| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System; |
| | 9 | | using System.Threading; |
| | 10 | | using System.Threading.Tasks; |
| | 11 | | using Azure; |
| | 12 | | using Azure.Core; |
| | 13 | | using Azure.Core.Pipeline; |
| | 14 | | using Azure.ResourceManager.Network.Models; |
| | 15 | |
|
| | 16 | | namespace Azure.ResourceManager.Network |
| | 17 | | { |
| | 18 | | /// <summary> The RouteTables service client. </summary> |
| | 19 | | public partial class RouteTablesOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 152 | 23 | | internal RouteTablesRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of RouteTablesOperations for mocking. </summary> |
| 108 | 25 | | protected RouteTablesOperations() |
| | 26 | | { |
| 108 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of RouteTablesOperations. </summary> |
| | 29 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 30 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 31 | | /// <param name="subscriptionId"> The subscription credentials which uniquely identify the Microsoft Azure subsc |
| | 32 | | /// <param name="endpoint"> server parameter. </param> |
| 108 | 33 | | internal RouteTablesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId |
| | 34 | | { |
| 108 | 35 | | RestClient = new RouteTablesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 108 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 108 | 37 | | _pipeline = pipeline; |
| 108 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Gets the specified route table. </summary> |
| | 41 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 42 | | /// <param name="routeTableName"> The name of the route table. </param> |
| | 43 | | /// <param name="expand"> Expands referenced resources. </param> |
| | 44 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 45 | | public virtual async Task<Response<RouteTable>> GetAsync(string resourceGroupName, string routeTableName, string |
| | 46 | | { |
| 22 | 47 | | using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.Get"); |
| 22 | 48 | | scope.Start(); |
| | 49 | | try |
| | 50 | | { |
| 22 | 51 | | return await RestClient.GetAsync(resourceGroupName, routeTableName, expand, cancellationToken).Configure |
| | 52 | | } |
| 0 | 53 | | catch (Exception e) |
| | 54 | | { |
| 0 | 55 | | scope.Failed(e); |
| 0 | 56 | | throw; |
| | 57 | | } |
| 22 | 58 | | } |
| | 59 | |
|
| | 60 | | /// <summary> Gets the specified route table. </summary> |
| | 61 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 62 | | /// <param name="routeTableName"> The name of the route table. </param> |
| | 63 | | /// <param name="expand"> Expands referenced resources. </param> |
| | 64 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 65 | | public virtual Response<RouteTable> Get(string resourceGroupName, string routeTableName, string expand = null, C |
| | 66 | | { |
| 22 | 67 | | using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.Get"); |
| 22 | 68 | | scope.Start(); |
| | 69 | | try |
| | 70 | | { |
| 22 | 71 | | return RestClient.Get(resourceGroupName, routeTableName, expand, cancellationToken); |
| | 72 | | } |
| 0 | 73 | | catch (Exception e) |
| | 74 | | { |
| 0 | 75 | | scope.Failed(e); |
| 0 | 76 | | throw; |
| | 77 | | } |
| 22 | 78 | | } |
| | 79 | |
|
| | 80 | | /// <summary> Updates a route table tags. </summary> |
| | 81 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 82 | | /// <param name="routeTableName"> The name of the route table. </param> |
| | 83 | | /// <param name="parameters"> Parameters supplied to update route table tags. </param> |
| | 84 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 85 | | public virtual async Task<Response<RouteTable>> UpdateTagsAsync(string resourceGroupName, string routeTableName, |
| | 86 | | { |
| 0 | 87 | | using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.UpdateTags"); |
| 0 | 88 | | scope.Start(); |
| | 89 | | try |
| | 90 | | { |
| 0 | 91 | | return await RestClient.UpdateTagsAsync(resourceGroupName, routeTableName, parameters, cancellationToken |
| | 92 | | } |
| 0 | 93 | | catch (Exception e) |
| | 94 | | { |
| 0 | 95 | | scope.Failed(e); |
| 0 | 96 | | throw; |
| | 97 | | } |
| 0 | 98 | | } |
| | 99 | |
|
| | 100 | | /// <summary> Updates a route table tags. </summary> |
| | 101 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 102 | | /// <param name="routeTableName"> The name of the route table. </param> |
| | 103 | | /// <param name="parameters"> Parameters supplied to update route table tags. </param> |
| | 104 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 105 | | public virtual Response<RouteTable> UpdateTags(string resourceGroupName, string routeTableName, TagsObject param |
| | 106 | | { |
| 0 | 107 | | using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.UpdateTags"); |
| 0 | 108 | | scope.Start(); |
| | 109 | | try |
| | 110 | | { |
| 0 | 111 | | return RestClient.UpdateTags(resourceGroupName, routeTableName, parameters, cancellationToken); |
| | 112 | | } |
| 0 | 113 | | catch (Exception e) |
| | 114 | | { |
| 0 | 115 | | scope.Failed(e); |
| 0 | 116 | | throw; |
| | 117 | | } |
| 0 | 118 | | } |
| | 119 | |
|
| | 120 | | /// <summary> Gets all route tables in a resource group. </summary> |
| | 121 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 122 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 123 | | public virtual AsyncPageable<RouteTable> ListAsync(string resourceGroupName, CancellationToken cancellationToken |
| | 124 | | { |
| 10 | 125 | | if (resourceGroupName == null) |
| | 126 | | { |
| 0 | 127 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 128 | | } |
| | 129 | |
|
| | 130 | | async Task<Page<RouteTable>> FirstPageFunc(int? pageSizeHint) |
| | 131 | | { |
| 10 | 132 | | using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.List"); |
| 10 | 133 | | scope.Start(); |
| | 134 | | try |
| | 135 | | { |
| 10 | 136 | | var response = await RestClient.ListAsync(resourceGroupName, cancellationToken).ConfigureAwait(false |
| 10 | 137 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 138 | | } |
| 0 | 139 | | catch (Exception e) |
| | 140 | | { |
| 0 | 141 | | scope.Failed(e); |
| 0 | 142 | | throw; |
| | 143 | | } |
| 10 | 144 | | } |
| | 145 | | async Task<Page<RouteTable>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 146 | | { |
| 0 | 147 | | using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.List"); |
| 0 | 148 | | scope.Start(); |
| | 149 | | try |
| | 150 | | { |
| 0 | 151 | | var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, cancellationToken).Co |
| 0 | 152 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 153 | | } |
| 0 | 154 | | catch (Exception e) |
| | 155 | | { |
| 0 | 156 | | scope.Failed(e); |
| 0 | 157 | | throw; |
| | 158 | | } |
| 0 | 159 | | } |
| 10 | 160 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 161 | | } |
| | 162 | |
|
| | 163 | | /// <summary> Gets all route tables in a resource group. </summary> |
| | 164 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 165 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 166 | | public virtual Pageable<RouteTable> List(string resourceGroupName, CancellationToken cancellationToken = default |
| | 167 | | { |
| 10 | 168 | | if (resourceGroupName == null) |
| | 169 | | { |
| 0 | 170 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 171 | | } |
| | 172 | |
|
| | 173 | | Page<RouteTable> FirstPageFunc(int? pageSizeHint) |
| | 174 | | { |
| 10 | 175 | | using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.List"); |
| 10 | 176 | | scope.Start(); |
| | 177 | | try |
| | 178 | | { |
| 10 | 179 | | var response = RestClient.List(resourceGroupName, cancellationToken); |
| 10 | 180 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 181 | | } |
| 0 | 182 | | catch (Exception e) |
| | 183 | | { |
| 0 | 184 | | scope.Failed(e); |
| 0 | 185 | | throw; |
| | 186 | | } |
| 10 | 187 | | } |
| | 188 | | Page<RouteTable> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 189 | | { |
| 0 | 190 | | using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.List"); |
| 0 | 191 | | scope.Start(); |
| | 192 | | try |
| | 193 | | { |
| 0 | 194 | | var response = RestClient.ListNextPage(nextLink, resourceGroupName, cancellationToken); |
| 0 | 195 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 196 | | } |
| 0 | 197 | | catch (Exception e) |
| | 198 | | { |
| 0 | 199 | | scope.Failed(e); |
| 0 | 200 | | throw; |
| | 201 | | } |
| 0 | 202 | | } |
| 10 | 203 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 204 | | } |
| | 205 | |
|
| | 206 | | /// <summary> Gets all route tables in a subscription. </summary> |
| | 207 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 208 | | public virtual AsyncPageable<RouteTable> ListAllAsync(CancellationToken cancellationToken = default) |
| | 209 | | { |
| | 210 | | async Task<Page<RouteTable>> FirstPageFunc(int? pageSizeHint) |
| | 211 | | { |
| 0 | 212 | | using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.ListAll"); |
| 0 | 213 | | scope.Start(); |
| | 214 | | try |
| | 215 | | { |
| 0 | 216 | | var response = await RestClient.ListAllAsync(cancellationToken).ConfigureAwait(false); |
| 0 | 217 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 218 | | } |
| 0 | 219 | | catch (Exception e) |
| | 220 | | { |
| 0 | 221 | | scope.Failed(e); |
| 0 | 222 | | throw; |
| | 223 | | } |
| 0 | 224 | | } |
| | 225 | | async Task<Page<RouteTable>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 226 | | { |
| 0 | 227 | | using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.ListAll"); |
| 0 | 228 | | scope.Start(); |
| | 229 | | try |
| | 230 | | { |
| 0 | 231 | | var response = await RestClient.ListAllNextPageAsync(nextLink, cancellationToken).ConfigureAwait(fal |
| 0 | 232 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 233 | | } |
| 0 | 234 | | catch (Exception e) |
| | 235 | | { |
| 0 | 236 | | scope.Failed(e); |
| 0 | 237 | | throw; |
| | 238 | | } |
| 0 | 239 | | } |
| 0 | 240 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 241 | | } |
| | 242 | |
|
| | 243 | | /// <summary> Gets all route tables in a subscription. </summary> |
| | 244 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 245 | | public virtual Pageable<RouteTable> ListAll(CancellationToken cancellationToken = default) |
| | 246 | | { |
| | 247 | | Page<RouteTable> FirstPageFunc(int? pageSizeHint) |
| | 248 | | { |
| 0 | 249 | | using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.ListAll"); |
| 0 | 250 | | scope.Start(); |
| | 251 | | try |
| | 252 | | { |
| 0 | 253 | | var response = RestClient.ListAll(cancellationToken); |
| 0 | 254 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 255 | | } |
| 0 | 256 | | catch (Exception e) |
| | 257 | | { |
| 0 | 258 | | scope.Failed(e); |
| 0 | 259 | | throw; |
| | 260 | | } |
| 0 | 261 | | } |
| | 262 | | Page<RouteTable> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 263 | | { |
| 0 | 264 | | using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.ListAll"); |
| 0 | 265 | | scope.Start(); |
| | 266 | | try |
| | 267 | | { |
| 0 | 268 | | var response = RestClient.ListAllNextPage(nextLink, cancellationToken); |
| 0 | 269 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 270 | | } |
| 0 | 271 | | catch (Exception e) |
| | 272 | | { |
| 0 | 273 | | scope.Failed(e); |
| 0 | 274 | | throw; |
| | 275 | | } |
| 0 | 276 | | } |
| 0 | 277 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 278 | | } |
| | 279 | |
|
| | 280 | | /// <summary> Deletes the specified route table. </summary> |
| | 281 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 282 | | /// <param name="routeTableName"> The name of the route table. </param> |
| | 283 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 284 | | public virtual async Task<RouteTablesDeleteOperation> StartDeleteAsync(string resourceGroupName, string routeTab |
| | 285 | | { |
| 8 | 286 | | if (resourceGroupName == null) |
| | 287 | | { |
| 0 | 288 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 289 | | } |
| 8 | 290 | | if (routeTableName == null) |
| | 291 | | { |
| 0 | 292 | | throw new ArgumentNullException(nameof(routeTableName)); |
| | 293 | | } |
| | 294 | |
|
| 8 | 295 | | using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.StartDelete"); |
| 8 | 296 | | scope.Start(); |
| | 297 | | try |
| | 298 | | { |
| 8 | 299 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, routeTableName, cancellationToken |
| 8 | 300 | | return new RouteTablesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(reso |
| | 301 | | } |
| 0 | 302 | | catch (Exception e) |
| | 303 | | { |
| 0 | 304 | | scope.Failed(e); |
| 0 | 305 | | throw; |
| | 306 | | } |
| 8 | 307 | | } |
| | 308 | |
|
| | 309 | | /// <summary> Deletes the specified route table. </summary> |
| | 310 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 311 | | /// <param name="routeTableName"> The name of the route table. </param> |
| | 312 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 313 | | public virtual RouteTablesDeleteOperation StartDelete(string resourceGroupName, string routeTableName, Cancellat |
| | 314 | | { |
| 8 | 315 | | if (resourceGroupName == null) |
| | 316 | | { |
| 0 | 317 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 318 | | } |
| 8 | 319 | | if (routeTableName == null) |
| | 320 | | { |
| 0 | 321 | | throw new ArgumentNullException(nameof(routeTableName)); |
| | 322 | | } |
| | 323 | |
|
| 8 | 324 | | using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.StartDelete"); |
| 8 | 325 | | scope.Start(); |
| | 326 | | try |
| | 327 | | { |
| 8 | 328 | | var originalResponse = RestClient.Delete(resourceGroupName, routeTableName, cancellationToken); |
| 8 | 329 | | return new RouteTablesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(reso |
| | 330 | | } |
| 0 | 331 | | catch (Exception e) |
| | 332 | | { |
| 0 | 333 | | scope.Failed(e); |
| 0 | 334 | | throw; |
| | 335 | | } |
| 8 | 336 | | } |
| | 337 | |
|
| | 338 | | /// <summary> Create or updates a route table in a specified resource group. </summary> |
| | 339 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 340 | | /// <param name="routeTableName"> The name of the route table. </param> |
| | 341 | | /// <param name="parameters"> Parameters supplied to the create or update route table operation. </param> |
| | 342 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 343 | | public virtual async Task<RouteTablesCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroupName, |
| | 344 | | { |
| 14 | 345 | | if (resourceGroupName == null) |
| | 346 | | { |
| 0 | 347 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 348 | | } |
| 14 | 349 | | if (routeTableName == null) |
| | 350 | | { |
| 0 | 351 | | throw new ArgumentNullException(nameof(routeTableName)); |
| | 352 | | } |
| 14 | 353 | | if (parameters == null) |
| | 354 | | { |
| 0 | 355 | | throw new ArgumentNullException(nameof(parameters)); |
| | 356 | | } |
| | 357 | |
|
| 14 | 358 | | using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.StartCreateOrUpdate"); |
| 14 | 359 | | scope.Start(); |
| | 360 | | try |
| | 361 | | { |
| 14 | 362 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, routeTableName, parameter |
| 14 | 363 | | return new RouteTablesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUp |
| | 364 | | } |
| 0 | 365 | | catch (Exception e) |
| | 366 | | { |
| 0 | 367 | | scope.Failed(e); |
| 0 | 368 | | throw; |
| | 369 | | } |
| 14 | 370 | | } |
| | 371 | |
|
| | 372 | | /// <summary> Create or updates a route table in a specified resource group. </summary> |
| | 373 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 374 | | /// <param name="routeTableName"> The name of the route table. </param> |
| | 375 | | /// <param name="parameters"> Parameters supplied to the create or update route table operation. </param> |
| | 376 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 377 | | public virtual RouteTablesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string routeTabl |
| | 378 | | { |
| 14 | 379 | | if (resourceGroupName == null) |
| | 380 | | { |
| 0 | 381 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 382 | | } |
| 14 | 383 | | if (routeTableName == null) |
| | 384 | | { |
| 0 | 385 | | throw new ArgumentNullException(nameof(routeTableName)); |
| | 386 | | } |
| 14 | 387 | | if (parameters == null) |
| | 388 | | { |
| 0 | 389 | | throw new ArgumentNullException(nameof(parameters)); |
| | 390 | | } |
| | 391 | |
|
| 14 | 392 | | using var scope = _clientDiagnostics.CreateScope("RouteTablesOperations.StartCreateOrUpdate"); |
| 14 | 393 | | scope.Start(); |
| | 394 | | try |
| | 395 | | { |
| 14 | 396 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, routeTableName, parameters, cancella |
| 14 | 397 | | return new RouteTablesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUp |
| | 398 | | } |
| 0 | 399 | | catch (Exception e) |
| | 400 | | { |
| 0 | 401 | | scope.Failed(e); |
| 0 | 402 | | throw; |
| | 403 | | } |
| 14 | 404 | | } |
| | 405 | | } |
| | 406 | | } |