| | 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 VirtualNetworks service client. </summary> |
| | 19 | | public partial class VirtualNetworksOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 464 | 23 | | internal VirtualNetworksRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of VirtualNetworksOperations for mocking. </summary> |
| 280 | 25 | | protected VirtualNetworksOperations() |
| | 26 | | { |
| 280 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of VirtualNetworksOperations. </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> |
| 280 | 33 | | internal VirtualNetworksOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscripti |
| | 34 | | { |
| 280 | 35 | | RestClient = new VirtualNetworksRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 280 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 280 | 37 | | _pipeline = pipeline; |
| 280 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Gets the specified virtual network by resource group. </summary> |
| | 41 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 42 | | /// <param name="virtualNetworkName"> The name of the virtual network. </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<VirtualNetwork>> GetAsync(string resourceGroupName, string virtualNetworkName |
| | 46 | | { |
| 30 | 47 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.Get"); |
| 30 | 48 | | scope.Start(); |
| | 49 | | try |
| | 50 | | { |
| 30 | 51 | | return await RestClient.GetAsync(resourceGroupName, virtualNetworkName, expand, cancellationToken).Confi |
| | 52 | | } |
| 0 | 53 | | catch (Exception e) |
| | 54 | | { |
| 0 | 55 | | scope.Failed(e); |
| 0 | 56 | | throw; |
| | 57 | | } |
| 30 | 58 | | } |
| | 59 | |
|
| | 60 | | /// <summary> Gets the specified virtual network by resource group. </summary> |
| | 61 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 62 | | /// <param name="virtualNetworkName"> The name of the virtual network. </param> |
| | 63 | | /// <param name="expand"> Expands referenced resources. </param> |
| | 64 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 65 | | public virtual Response<VirtualNetwork> Get(string resourceGroupName, string virtualNetworkName, string expand = |
| | 66 | | { |
| 30 | 67 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.Get"); |
| 30 | 68 | | scope.Start(); |
| | 69 | | try |
| | 70 | | { |
| 30 | 71 | | return RestClient.Get(resourceGroupName, virtualNetworkName, expand, cancellationToken); |
| | 72 | | } |
| 0 | 73 | | catch (Exception e) |
| | 74 | | { |
| 0 | 75 | | scope.Failed(e); |
| 0 | 76 | | throw; |
| | 77 | | } |
| 30 | 78 | | } |
| | 79 | |
|
| | 80 | | /// <summary> Updates a virtual network tags. </summary> |
| | 81 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 82 | | /// <param name="virtualNetworkName"> The name of the virtual network. </param> |
| | 83 | | /// <param name="parameters"> Parameters supplied to update virtual network tags. </param> |
| | 84 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 85 | | public virtual async Task<Response<VirtualNetwork>> UpdateTagsAsync(string resourceGroupName, string virtualNetw |
| | 86 | | { |
| 0 | 87 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.UpdateTags"); |
| 0 | 88 | | scope.Start(); |
| | 89 | | try |
| | 90 | | { |
| 0 | 91 | | return await RestClient.UpdateTagsAsync(resourceGroupName, virtualNetworkName, parameters, cancellationT |
| | 92 | | } |
| 0 | 93 | | catch (Exception e) |
| | 94 | | { |
| 0 | 95 | | scope.Failed(e); |
| 0 | 96 | | throw; |
| | 97 | | } |
| 0 | 98 | | } |
| | 99 | |
|
| | 100 | | /// <summary> Updates a virtual network tags. </summary> |
| | 101 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 102 | | /// <param name="virtualNetworkName"> The name of the virtual network. </param> |
| | 103 | | /// <param name="parameters"> Parameters supplied to update virtual network tags. </param> |
| | 104 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 105 | | public virtual Response<VirtualNetwork> UpdateTags(string resourceGroupName, string virtualNetworkName, TagsObje |
| | 106 | | { |
| 0 | 107 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.UpdateTags"); |
| 0 | 108 | | scope.Start(); |
| | 109 | | try |
| | 110 | | { |
| 0 | 111 | | return RestClient.UpdateTags(resourceGroupName, virtualNetworkName, parameters, cancellationToken); |
| | 112 | | } |
| 0 | 113 | | catch (Exception e) |
| | 114 | | { |
| 0 | 115 | | scope.Failed(e); |
| 0 | 116 | | throw; |
| | 117 | | } |
| 0 | 118 | | } |
| | 119 | |
|
| | 120 | | /// <summary> Checks whether a private IP address is available for use. </summary> |
| | 121 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 122 | | /// <param name="virtualNetworkName"> The name of the virtual network. </param> |
| | 123 | | /// <param name="ipAddress"> The private IP address to be verified. </param> |
| | 124 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 125 | | public virtual async Task<Response<IPAddressAvailabilityResult>> CheckIPAddressAvailabilityAsync(string resource |
| | 126 | | { |
| 4 | 127 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.CheckIPAddressAvailability"); |
| 4 | 128 | | scope.Start(); |
| | 129 | | try |
| | 130 | | { |
| 4 | 131 | | return await RestClient.CheckIPAddressAvailabilityAsync(resourceGroupName, virtualNetworkName, ipAddress |
| | 132 | | } |
| 0 | 133 | | catch (Exception e) |
| | 134 | | { |
| 0 | 135 | | scope.Failed(e); |
| 0 | 136 | | throw; |
| | 137 | | } |
| 4 | 138 | | } |
| | 139 | |
|
| | 140 | | /// <summary> Checks whether a private IP address is available for use. </summary> |
| | 141 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 142 | | /// <param name="virtualNetworkName"> The name of the virtual network. </param> |
| | 143 | | /// <param name="ipAddress"> The private IP address to be verified. </param> |
| | 144 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 145 | | public virtual Response<IPAddressAvailabilityResult> CheckIPAddressAvailability(string resourceGroupName, string |
| | 146 | | { |
| 4 | 147 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.CheckIPAddressAvailability"); |
| 4 | 148 | | scope.Start(); |
| | 149 | | try |
| | 150 | | { |
| 4 | 151 | | return RestClient.CheckIPAddressAvailability(resourceGroupName, virtualNetworkName, ipAddress, cancellat |
| | 152 | | } |
| 0 | 153 | | catch (Exception e) |
| | 154 | | { |
| 0 | 155 | | scope.Failed(e); |
| 0 | 156 | | throw; |
| | 157 | | } |
| 4 | 158 | | } |
| | 159 | |
|
| | 160 | | /// <summary> Gets all virtual networks in a subscription. </summary> |
| | 161 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 162 | | public virtual AsyncPageable<VirtualNetwork> ListAllAsync(CancellationToken cancellationToken = default) |
| | 163 | | { |
| | 164 | | async Task<Page<VirtualNetwork>> FirstPageFunc(int? pageSizeHint) |
| | 165 | | { |
| 2 | 166 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.ListAll"); |
| 2 | 167 | | scope.Start(); |
| | 168 | | try |
| | 169 | | { |
| 2 | 170 | | var response = await RestClient.ListAllAsync(cancellationToken).ConfigureAwait(false); |
| 2 | 171 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 172 | | } |
| 0 | 173 | | catch (Exception e) |
| | 174 | | { |
| 0 | 175 | | scope.Failed(e); |
| 0 | 176 | | throw; |
| | 177 | | } |
| 2 | 178 | | } |
| | 179 | | async Task<Page<VirtualNetwork>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 180 | | { |
| 0 | 181 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.ListAll"); |
| 0 | 182 | | scope.Start(); |
| | 183 | | try |
| | 184 | | { |
| 0 | 185 | | var response = await RestClient.ListAllNextPageAsync(nextLink, cancellationToken).ConfigureAwait(fal |
| 0 | 186 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 187 | | } |
| 0 | 188 | | catch (Exception e) |
| | 189 | | { |
| 0 | 190 | | scope.Failed(e); |
| 0 | 191 | | throw; |
| | 192 | | } |
| 0 | 193 | | } |
| 2 | 194 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 195 | | } |
| | 196 | |
|
| | 197 | | /// <summary> Gets all virtual networks in a subscription. </summary> |
| | 198 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 199 | | public virtual Pageable<VirtualNetwork> ListAll(CancellationToken cancellationToken = default) |
| | 200 | | { |
| | 201 | | Page<VirtualNetwork> FirstPageFunc(int? pageSizeHint) |
| | 202 | | { |
| 2 | 203 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.ListAll"); |
| 2 | 204 | | scope.Start(); |
| | 205 | | try |
| | 206 | | { |
| 2 | 207 | | var response = RestClient.ListAll(cancellationToken); |
| 2 | 208 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 209 | | } |
| 0 | 210 | | catch (Exception e) |
| | 211 | | { |
| 0 | 212 | | scope.Failed(e); |
| 0 | 213 | | throw; |
| | 214 | | } |
| 2 | 215 | | } |
| | 216 | | Page<VirtualNetwork> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 217 | | { |
| 0 | 218 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.ListAll"); |
| 0 | 219 | | scope.Start(); |
| | 220 | | try |
| | 221 | | { |
| 0 | 222 | | var response = RestClient.ListAllNextPage(nextLink, cancellationToken); |
| 0 | 223 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 224 | | } |
| 0 | 225 | | catch (Exception e) |
| | 226 | | { |
| 0 | 227 | | scope.Failed(e); |
| 0 | 228 | | throw; |
| | 229 | | } |
| 0 | 230 | | } |
| 2 | 231 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 232 | | } |
| | 233 | |
|
| | 234 | | /// <summary> Gets all virtual networks in a resource group. </summary> |
| | 235 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 236 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 237 | | public virtual AsyncPageable<VirtualNetwork> ListAsync(string resourceGroupName, CancellationToken cancellationT |
| | 238 | | { |
| 8 | 239 | | if (resourceGroupName == null) |
| | 240 | | { |
| 0 | 241 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 242 | | } |
| | 243 | |
|
| | 244 | | async Task<Page<VirtualNetwork>> FirstPageFunc(int? pageSizeHint) |
| | 245 | | { |
| 8 | 246 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.List"); |
| 8 | 247 | | scope.Start(); |
| | 248 | | try |
| | 249 | | { |
| 8 | 250 | | var response = await RestClient.ListAsync(resourceGroupName, cancellationToken).ConfigureAwait(false |
| 8 | 251 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 252 | | } |
| 0 | 253 | | catch (Exception e) |
| | 254 | | { |
| 0 | 255 | | scope.Failed(e); |
| 0 | 256 | | throw; |
| | 257 | | } |
| 8 | 258 | | } |
| | 259 | | async Task<Page<VirtualNetwork>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 260 | | { |
| 0 | 261 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.List"); |
| 0 | 262 | | scope.Start(); |
| | 263 | | try |
| | 264 | | { |
| 0 | 265 | | var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, cancellationToken).Co |
| 0 | 266 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 267 | | } |
| 0 | 268 | | catch (Exception e) |
| | 269 | | { |
| 0 | 270 | | scope.Failed(e); |
| 0 | 271 | | throw; |
| | 272 | | } |
| 0 | 273 | | } |
| 8 | 274 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 275 | | } |
| | 276 | |
|
| | 277 | | /// <summary> Gets all virtual networks in a resource group. </summary> |
| | 278 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 279 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 280 | | public virtual Pageable<VirtualNetwork> List(string resourceGroupName, CancellationToken cancellationToken = def |
| | 281 | | { |
| 8 | 282 | | if (resourceGroupName == null) |
| | 283 | | { |
| 0 | 284 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 285 | | } |
| | 286 | |
|
| | 287 | | Page<VirtualNetwork> FirstPageFunc(int? pageSizeHint) |
| | 288 | | { |
| 8 | 289 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.List"); |
| 8 | 290 | | scope.Start(); |
| | 291 | | try |
| | 292 | | { |
| 8 | 293 | | var response = RestClient.List(resourceGroupName, cancellationToken); |
| 8 | 294 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 295 | | } |
| 0 | 296 | | catch (Exception e) |
| | 297 | | { |
| 0 | 298 | | scope.Failed(e); |
| 0 | 299 | | throw; |
| | 300 | | } |
| 8 | 301 | | } |
| | 302 | | Page<VirtualNetwork> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 303 | | { |
| 0 | 304 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.List"); |
| 0 | 305 | | scope.Start(); |
| | 306 | | try |
| | 307 | | { |
| 0 | 308 | | var response = RestClient.ListNextPage(nextLink, resourceGroupName, cancellationToken); |
| 0 | 309 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 310 | | } |
| 0 | 311 | | catch (Exception e) |
| | 312 | | { |
| 0 | 313 | | scope.Failed(e); |
| 0 | 314 | | throw; |
| | 315 | | } |
| 0 | 316 | | } |
| 8 | 317 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 318 | | } |
| | 319 | |
|
| | 320 | | /// <summary> Lists usage stats. </summary> |
| | 321 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 322 | | /// <param name="virtualNetworkName"> The name of the virtual network. </param> |
| | 323 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 324 | | public virtual AsyncPageable<VirtualNetworkUsage> ListUsageAsync(string resourceGroupName, string virtualNetwork |
| | 325 | | { |
| 4 | 326 | | if (resourceGroupName == null) |
| | 327 | | { |
| 0 | 328 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 329 | | } |
| 4 | 330 | | if (virtualNetworkName == null) |
| | 331 | | { |
| 0 | 332 | | throw new ArgumentNullException(nameof(virtualNetworkName)); |
| | 333 | | } |
| | 334 | |
|
| | 335 | | async Task<Page<VirtualNetworkUsage>> FirstPageFunc(int? pageSizeHint) |
| | 336 | | { |
| 4 | 337 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.ListUsage"); |
| 4 | 338 | | scope.Start(); |
| | 339 | | try |
| | 340 | | { |
| 4 | 341 | | var response = await RestClient.ListUsageAsync(resourceGroupName, virtualNetworkName, cancellationTo |
| 4 | 342 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 343 | | } |
| 0 | 344 | | catch (Exception e) |
| | 345 | | { |
| 0 | 346 | | scope.Failed(e); |
| 0 | 347 | | throw; |
| | 348 | | } |
| 4 | 349 | | } |
| | 350 | | async Task<Page<VirtualNetworkUsage>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 351 | | { |
| 0 | 352 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.ListUsage"); |
| 0 | 353 | | scope.Start(); |
| | 354 | | try |
| | 355 | | { |
| 0 | 356 | | var response = await RestClient.ListUsageNextPageAsync(nextLink, resourceGroupName, virtualNetworkNa |
| 0 | 357 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 358 | | } |
| 0 | 359 | | catch (Exception e) |
| | 360 | | { |
| 0 | 361 | | scope.Failed(e); |
| 0 | 362 | | throw; |
| | 363 | | } |
| 0 | 364 | | } |
| 4 | 365 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 366 | | } |
| | 367 | |
|
| | 368 | | /// <summary> Lists usage stats. </summary> |
| | 369 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 370 | | /// <param name="virtualNetworkName"> The name of the virtual network. </param> |
| | 371 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 372 | | public virtual Pageable<VirtualNetworkUsage> ListUsage(string resourceGroupName, string virtualNetworkName, Canc |
| | 373 | | { |
| 4 | 374 | | if (resourceGroupName == null) |
| | 375 | | { |
| 0 | 376 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 377 | | } |
| 4 | 378 | | if (virtualNetworkName == null) |
| | 379 | | { |
| 0 | 380 | | throw new ArgumentNullException(nameof(virtualNetworkName)); |
| | 381 | | } |
| | 382 | |
|
| | 383 | | Page<VirtualNetworkUsage> FirstPageFunc(int? pageSizeHint) |
| | 384 | | { |
| 4 | 385 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.ListUsage"); |
| 4 | 386 | | scope.Start(); |
| | 387 | | try |
| | 388 | | { |
| 4 | 389 | | var response = RestClient.ListUsage(resourceGroupName, virtualNetworkName, cancellationToken); |
| 4 | 390 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 391 | | } |
| 0 | 392 | | catch (Exception e) |
| | 393 | | { |
| 0 | 394 | | scope.Failed(e); |
| 0 | 395 | | throw; |
| | 396 | | } |
| 4 | 397 | | } |
| | 398 | | Page<VirtualNetworkUsage> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 399 | | { |
| 0 | 400 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.ListUsage"); |
| 0 | 401 | | scope.Start(); |
| | 402 | | try |
| | 403 | | { |
| 0 | 404 | | var response = RestClient.ListUsageNextPage(nextLink, resourceGroupName, virtualNetworkName, cancell |
| 0 | 405 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 406 | | } |
| 0 | 407 | | catch (Exception e) |
| | 408 | | { |
| 0 | 409 | | scope.Failed(e); |
| 0 | 410 | | throw; |
| | 411 | | } |
| 0 | 412 | | } |
| 4 | 413 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 414 | | } |
| | 415 | |
|
| | 416 | | /// <summary> Deletes the specified virtual network. </summary> |
| | 417 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 418 | | /// <param name="virtualNetworkName"> The name of the virtual network. </param> |
| | 419 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 420 | | public virtual async Task<VirtualNetworksDeleteOperation> StartDeleteAsync(string resourceGroupName, string virt |
| | 421 | | { |
| 38 | 422 | | if (resourceGroupName == null) |
| | 423 | | { |
| 0 | 424 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 425 | | } |
| 38 | 426 | | if (virtualNetworkName == null) |
| | 427 | | { |
| 0 | 428 | | throw new ArgumentNullException(nameof(virtualNetworkName)); |
| | 429 | | } |
| | 430 | |
|
| 38 | 431 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.StartDelete"); |
| 38 | 432 | | scope.Start(); |
| | 433 | | try |
| | 434 | | { |
| 38 | 435 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, virtualNetworkName, cancellationT |
| 38 | 436 | | return new VirtualNetworksDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest( |
| | 437 | | } |
| 0 | 438 | | catch (Exception e) |
| | 439 | | { |
| 0 | 440 | | scope.Failed(e); |
| 0 | 441 | | throw; |
| | 442 | | } |
| 38 | 443 | | } |
| | 444 | |
|
| | 445 | | /// <summary> Deletes the specified virtual network. </summary> |
| | 446 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 447 | | /// <param name="virtualNetworkName"> The name of the virtual network. </param> |
| | 448 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 449 | | public virtual VirtualNetworksDeleteOperation StartDelete(string resourceGroupName, string virtualNetworkName, C |
| | 450 | | { |
| 38 | 451 | | if (resourceGroupName == null) |
| | 452 | | { |
| 0 | 453 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 454 | | } |
| 38 | 455 | | if (virtualNetworkName == null) |
| | 456 | | { |
| 0 | 457 | | throw new ArgumentNullException(nameof(virtualNetworkName)); |
| | 458 | | } |
| | 459 | |
|
| 38 | 460 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.StartDelete"); |
| 38 | 461 | | scope.Start(); |
| | 462 | | try |
| | 463 | | { |
| 38 | 464 | | var originalResponse = RestClient.Delete(resourceGroupName, virtualNetworkName, cancellationToken); |
| 38 | 465 | | return new VirtualNetworksDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest( |
| | 466 | | } |
| 0 | 467 | | catch (Exception e) |
| | 468 | | { |
| 0 | 469 | | scope.Failed(e); |
| 0 | 470 | | throw; |
| | 471 | | } |
| 38 | 472 | | } |
| | 473 | |
|
| | 474 | | /// <summary> Creates or updates a virtual network in the specified resource group. </summary> |
| | 475 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 476 | | /// <param name="virtualNetworkName"> The name of the virtual network. </param> |
| | 477 | | /// <param name="parameters"> Parameters supplied to the create or update virtual network operation. </param> |
| | 478 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 479 | | public virtual async Task<VirtualNetworksCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroupN |
| | 480 | | { |
| 54 | 481 | | if (resourceGroupName == null) |
| | 482 | | { |
| 0 | 483 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 484 | | } |
| 54 | 485 | | if (virtualNetworkName == null) |
| | 486 | | { |
| 0 | 487 | | throw new ArgumentNullException(nameof(virtualNetworkName)); |
| | 488 | | } |
| 54 | 489 | | if (parameters == null) |
| | 490 | | { |
| 0 | 491 | | throw new ArgumentNullException(nameof(parameters)); |
| | 492 | | } |
| | 493 | |
|
| 54 | 494 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.StartCreateOrUpdate"); |
| 54 | 495 | | scope.Start(); |
| | 496 | | try |
| | 497 | | { |
| 54 | 498 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, virtualNetworkName, param |
| 54 | 499 | | return new VirtualNetworksCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreate |
| | 500 | | } |
| 0 | 501 | | catch (Exception e) |
| | 502 | | { |
| 0 | 503 | | scope.Failed(e); |
| 0 | 504 | | throw; |
| | 505 | | } |
| 54 | 506 | | } |
| | 507 | |
|
| | 508 | | /// <summary> Creates or updates a virtual network in the specified resource group. </summary> |
| | 509 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 510 | | /// <param name="virtualNetworkName"> The name of the virtual network. </param> |
| | 511 | | /// <param name="parameters"> Parameters supplied to the create or update virtual network operation. </param> |
| | 512 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 513 | | public virtual VirtualNetworksCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string virtu |
| | 514 | | { |
| 54 | 515 | | if (resourceGroupName == null) |
| | 516 | | { |
| 0 | 517 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 518 | | } |
| 54 | 519 | | if (virtualNetworkName == null) |
| | 520 | | { |
| 0 | 521 | | throw new ArgumentNullException(nameof(virtualNetworkName)); |
| | 522 | | } |
| 54 | 523 | | if (parameters == null) |
| | 524 | | { |
| 0 | 525 | | throw new ArgumentNullException(nameof(parameters)); |
| | 526 | | } |
| | 527 | |
|
| 54 | 528 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworksOperations.StartCreateOrUpdate"); |
| 54 | 529 | | scope.Start(); |
| | 530 | | try |
| | 531 | | { |
| 54 | 532 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, virtualNetworkName, parameters, canc |
| 54 | 533 | | return new VirtualNetworksCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreate |
| | 534 | | } |
| 0 | 535 | | catch (Exception e) |
| | 536 | | { |
| 0 | 537 | | scope.Failed(e); |
| 0 | 538 | | throw; |
| | 539 | | } |
| 54 | 540 | | } |
| | 541 | | } |
| | 542 | | } |