| | 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 NetworkVirtualAppliances service client. </summary> |
| | 19 | | public partial class NetworkVirtualAppliancesOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 0 | 23 | | internal NetworkVirtualAppliancesRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of NetworkVirtualAppliancesOperations for mocking. </summary> |
| 0 | 25 | | protected NetworkVirtualAppliancesOperations() |
| | 26 | | { |
| 0 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of NetworkVirtualAppliancesOperations. </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> |
| 0 | 33 | | internal NetworkVirtualAppliancesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string s |
| | 34 | | { |
| 0 | 35 | | RestClient = new NetworkVirtualAppliancesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoin |
| 0 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 37 | | _pipeline = pipeline; |
| 0 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Gets the specified Network Virtual Appliance. </summary> |
| | 41 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 42 | | /// <param name="networkVirtualApplianceName"> The name of Network Virtual Appliance. </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<NetworkVirtualAppliance>> GetAsync(string resourceGroupName, string networkVi |
| | 46 | | { |
| 0 | 47 | | using var scope = _clientDiagnostics.CreateScope("NetworkVirtualAppliancesOperations.Get"); |
| 0 | 48 | | scope.Start(); |
| | 49 | | try |
| | 50 | | { |
| 0 | 51 | | return await RestClient.GetAsync(resourceGroupName, networkVirtualApplianceName, expand, cancellationTok |
| | 52 | | } |
| 0 | 53 | | catch (Exception e) |
| | 54 | | { |
| 0 | 55 | | scope.Failed(e); |
| 0 | 56 | | throw; |
| | 57 | | } |
| 0 | 58 | | } |
| | 59 | |
|
| | 60 | | /// <summary> Gets the specified Network Virtual Appliance. </summary> |
| | 61 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 62 | | /// <param name="networkVirtualApplianceName"> The name of Network Virtual Appliance. </param> |
| | 63 | | /// <param name="expand"> Expands referenced resources. </param> |
| | 64 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 65 | | public virtual Response<NetworkVirtualAppliance> Get(string resourceGroupName, string networkVirtualApplianceNam |
| | 66 | | { |
| 0 | 67 | | using var scope = _clientDiagnostics.CreateScope("NetworkVirtualAppliancesOperations.Get"); |
| 0 | 68 | | scope.Start(); |
| | 69 | | try |
| | 70 | | { |
| 0 | 71 | | return RestClient.Get(resourceGroupName, networkVirtualApplianceName, expand, cancellationToken); |
| | 72 | | } |
| 0 | 73 | | catch (Exception e) |
| | 74 | | { |
| 0 | 75 | | scope.Failed(e); |
| 0 | 76 | | throw; |
| | 77 | | } |
| 0 | 78 | | } |
| | 79 | |
|
| | 80 | | /// <summary> Updates a Network Virtual Appliance. </summary> |
| | 81 | | /// <param name="resourceGroupName"> The resource group name of Network Virtual Appliance. </param> |
| | 82 | | /// <param name="networkVirtualApplianceName"> The name of Network Virtual Appliance being updated. </param> |
| | 83 | | /// <param name="parameters"> Parameters supplied to Update Network Virtual Appliance Tags. </param> |
| | 84 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 85 | | public virtual async Task<Response<NetworkVirtualAppliance>> UpdateTagsAsync(string resourceGroupName, string ne |
| | 86 | | { |
| 0 | 87 | | using var scope = _clientDiagnostics.CreateScope("NetworkVirtualAppliancesOperations.UpdateTags"); |
| 0 | 88 | | scope.Start(); |
| | 89 | | try |
| | 90 | | { |
| 0 | 91 | | return await RestClient.UpdateTagsAsync(resourceGroupName, networkVirtualApplianceName, parameters, canc |
| | 92 | | } |
| 0 | 93 | | catch (Exception e) |
| | 94 | | { |
| 0 | 95 | | scope.Failed(e); |
| 0 | 96 | | throw; |
| | 97 | | } |
| 0 | 98 | | } |
| | 99 | |
|
| | 100 | | /// <summary> Updates a Network Virtual Appliance. </summary> |
| | 101 | | /// <param name="resourceGroupName"> The resource group name of Network Virtual Appliance. </param> |
| | 102 | | /// <param name="networkVirtualApplianceName"> The name of Network Virtual Appliance being updated. </param> |
| | 103 | | /// <param name="parameters"> Parameters supplied to Update Network Virtual Appliance Tags. </param> |
| | 104 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 105 | | public virtual Response<NetworkVirtualAppliance> UpdateTags(string resourceGroupName, string networkVirtualAppli |
| | 106 | | { |
| 0 | 107 | | using var scope = _clientDiagnostics.CreateScope("NetworkVirtualAppliancesOperations.UpdateTags"); |
| 0 | 108 | | scope.Start(); |
| | 109 | | try |
| | 110 | | { |
| 0 | 111 | | return RestClient.UpdateTags(resourceGroupName, networkVirtualApplianceName, parameters, cancellationTok |
| | 112 | | } |
| 0 | 113 | | catch (Exception e) |
| | 114 | | { |
| 0 | 115 | | scope.Failed(e); |
| 0 | 116 | | throw; |
| | 117 | | } |
| 0 | 118 | | } |
| | 119 | |
|
| | 120 | | /// <summary> Lists all Network Virtual Appliances 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<NetworkVirtualAppliance> ListByResourceGroupAsync(string resourceGroupName, Cancell |
| | 124 | | { |
| 0 | 125 | | if (resourceGroupName == null) |
| | 126 | | { |
| 0 | 127 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 128 | | } |
| | 129 | |
|
| | 130 | | async Task<Page<NetworkVirtualAppliance>> FirstPageFunc(int? pageSizeHint) |
| | 131 | | { |
| 0 | 132 | | using var scope = _clientDiagnostics.CreateScope("NetworkVirtualAppliancesOperations.ListByResourceGroup |
| 0 | 133 | | scope.Start(); |
| | 134 | | try |
| | 135 | | { |
| 0 | 136 | | var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi |
| 0 | 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 | | } |
| 0 | 144 | | } |
| | 145 | | async Task<Page<NetworkVirtualAppliance>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 146 | | { |
| 0 | 147 | | using var scope = _clientDiagnostics.CreateScope("NetworkVirtualAppliancesOperations.ListByResourceGroup |
| 0 | 148 | | scope.Start(); |
| | 149 | | try |
| | 150 | | { |
| 0 | 151 | | var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancel |
| 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 | | } |
| 0 | 160 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 161 | | } |
| | 162 | |
|
| | 163 | | /// <summary> Lists all Network Virtual Appliances 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<NetworkVirtualAppliance> ListByResourceGroup(string resourceGroupName, CancellationToken |
| | 167 | | { |
| 0 | 168 | | if (resourceGroupName == null) |
| | 169 | | { |
| 0 | 170 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 171 | | } |
| | 172 | |
|
| | 173 | | Page<NetworkVirtualAppliance> FirstPageFunc(int? pageSizeHint) |
| | 174 | | { |
| 0 | 175 | | using var scope = _clientDiagnostics.CreateScope("NetworkVirtualAppliancesOperations.ListByResourceGroup |
| 0 | 176 | | scope.Start(); |
| | 177 | | try |
| | 178 | | { |
| 0 | 179 | | var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken); |
| 0 | 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 | | } |
| 0 | 187 | | } |
| | 188 | | Page<NetworkVirtualAppliance> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 189 | | { |
| 0 | 190 | | using var scope = _clientDiagnostics.CreateScope("NetworkVirtualAppliancesOperations.ListByResourceGroup |
| 0 | 191 | | scope.Start(); |
| | 192 | | try |
| | 193 | | { |
| 0 | 194 | | var response = RestClient.ListByResourceGroupNextPage(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 | | } |
| 0 | 203 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 204 | | } |
| | 205 | |
|
| | 206 | | /// <summary> Gets all Network Virtual Appliances in a subscription. </summary> |
| | 207 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 208 | | public virtual AsyncPageable<NetworkVirtualAppliance> ListAsync(CancellationToken cancellationToken = default) |
| | 209 | | { |
| | 210 | | async Task<Page<NetworkVirtualAppliance>> FirstPageFunc(int? pageSizeHint) |
| | 211 | | { |
| 0 | 212 | | using var scope = _clientDiagnostics.CreateScope("NetworkVirtualAppliancesOperations.List"); |
| 0 | 213 | | scope.Start(); |
| | 214 | | try |
| | 215 | | { |
| 0 | 216 | | var response = await RestClient.ListAsync(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<NetworkVirtualAppliance>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 226 | | { |
| 0 | 227 | | using var scope = _clientDiagnostics.CreateScope("NetworkVirtualAppliancesOperations.List"); |
| 0 | 228 | | scope.Start(); |
| | 229 | | try |
| | 230 | | { |
| 0 | 231 | | var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false) |
| 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 Network Virtual Appliances in a subscription. </summary> |
| | 244 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 245 | | public virtual Pageable<NetworkVirtualAppliance> List(CancellationToken cancellationToken = default) |
| | 246 | | { |
| | 247 | | Page<NetworkVirtualAppliance> FirstPageFunc(int? pageSizeHint) |
| | 248 | | { |
| 0 | 249 | | using var scope = _clientDiagnostics.CreateScope("NetworkVirtualAppliancesOperations.List"); |
| 0 | 250 | | scope.Start(); |
| | 251 | | try |
| | 252 | | { |
| 0 | 253 | | var response = RestClient.List(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<NetworkVirtualAppliance> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 263 | | { |
| 0 | 264 | | using var scope = _clientDiagnostics.CreateScope("NetworkVirtualAppliancesOperations.List"); |
| 0 | 265 | | scope.Start(); |
| | 266 | | try |
| | 267 | | { |
| 0 | 268 | | var response = RestClient.ListNextPage(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 Network Virtual Appliance. </summary> |
| | 281 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 282 | | /// <param name="networkVirtualApplianceName"> The name of Network Virtual Appliance. </param> |
| | 283 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 284 | | public virtual async Task<NetworkVirtualAppliancesDeleteOperation> StartDeleteAsync(string resourceGroupName, st |
| | 285 | | { |
| 0 | 286 | | if (resourceGroupName == null) |
| | 287 | | { |
| 0 | 288 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 289 | | } |
| 0 | 290 | | if (networkVirtualApplianceName == null) |
| | 291 | | { |
| 0 | 292 | | throw new ArgumentNullException(nameof(networkVirtualApplianceName)); |
| | 293 | | } |
| | 294 | |
|
| 0 | 295 | | using var scope = _clientDiagnostics.CreateScope("NetworkVirtualAppliancesOperations.StartDelete"); |
| 0 | 296 | | scope.Start(); |
| | 297 | | try |
| | 298 | | { |
| 0 | 299 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, networkVirtualApplianceName, canc |
| 0 | 300 | | return new NetworkVirtualAppliancesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDelet |
| | 301 | | } |
| 0 | 302 | | catch (Exception e) |
| | 303 | | { |
| 0 | 304 | | scope.Failed(e); |
| 0 | 305 | | throw; |
| | 306 | | } |
| 0 | 307 | | } |
| | 308 | |
|
| | 309 | | /// <summary> Deletes the specified Network Virtual Appliance. </summary> |
| | 310 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 311 | | /// <param name="networkVirtualApplianceName"> The name of Network Virtual Appliance. </param> |
| | 312 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 313 | | public virtual NetworkVirtualAppliancesDeleteOperation StartDelete(string resourceGroupName, string networkVirtu |
| | 314 | | { |
| 0 | 315 | | if (resourceGroupName == null) |
| | 316 | | { |
| 0 | 317 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 318 | | } |
| 0 | 319 | | if (networkVirtualApplianceName == null) |
| | 320 | | { |
| 0 | 321 | | throw new ArgumentNullException(nameof(networkVirtualApplianceName)); |
| | 322 | | } |
| | 323 | |
|
| 0 | 324 | | using var scope = _clientDiagnostics.CreateScope("NetworkVirtualAppliancesOperations.StartDelete"); |
| 0 | 325 | | scope.Start(); |
| | 326 | | try |
| | 327 | | { |
| 0 | 328 | | var originalResponse = RestClient.Delete(resourceGroupName, networkVirtualApplianceName, cancellationTok |
| 0 | 329 | | return new NetworkVirtualAppliancesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDelet |
| | 330 | | } |
| 0 | 331 | | catch (Exception e) |
| | 332 | | { |
| 0 | 333 | | scope.Failed(e); |
| 0 | 334 | | throw; |
| | 335 | | } |
| 0 | 336 | | } |
| | 337 | |
|
| | 338 | | /// <summary> Creates or updates the specified Network Virtual Appliance. </summary> |
| | 339 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 340 | | /// <param name="networkVirtualApplianceName"> The name of Network Virtual Appliance. </param> |
| | 341 | | /// <param name="parameters"> Parameters supplied to the create or update Network Virtual Appliance. </param> |
| | 342 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 343 | | public virtual async Task<NetworkVirtualAppliancesCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resou |
| | 344 | | { |
| 0 | 345 | | if (resourceGroupName == null) |
| | 346 | | { |
| 0 | 347 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 348 | | } |
| 0 | 349 | | if (networkVirtualApplianceName == null) |
| | 350 | | { |
| 0 | 351 | | throw new ArgumentNullException(nameof(networkVirtualApplianceName)); |
| | 352 | | } |
| 0 | 353 | | if (parameters == null) |
| | 354 | | { |
| 0 | 355 | | throw new ArgumentNullException(nameof(parameters)); |
| | 356 | | } |
| | 357 | |
|
| 0 | 358 | | using var scope = _clientDiagnostics.CreateScope("NetworkVirtualAppliancesOperations.StartCreateOrUpdate"); |
| 0 | 359 | | scope.Start(); |
| | 360 | | try |
| | 361 | | { |
| 0 | 362 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, networkVirtualApplianceNa |
| 0 | 363 | | return new NetworkVirtualAppliancesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.Cre |
| | 364 | | } |
| 0 | 365 | | catch (Exception e) |
| | 366 | | { |
| 0 | 367 | | scope.Failed(e); |
| 0 | 368 | | throw; |
| | 369 | | } |
| 0 | 370 | | } |
| | 371 | |
|
| | 372 | | /// <summary> Creates or updates the specified Network Virtual Appliance. </summary> |
| | 373 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 374 | | /// <param name="networkVirtualApplianceName"> The name of Network Virtual Appliance. </param> |
| | 375 | | /// <param name="parameters"> Parameters supplied to the create or update Network Virtual Appliance. </param> |
| | 376 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 377 | | public virtual NetworkVirtualAppliancesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, str |
| | 378 | | { |
| 0 | 379 | | if (resourceGroupName == null) |
| | 380 | | { |
| 0 | 381 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 382 | | } |
| 0 | 383 | | if (networkVirtualApplianceName == null) |
| | 384 | | { |
| 0 | 385 | | throw new ArgumentNullException(nameof(networkVirtualApplianceName)); |
| | 386 | | } |
| 0 | 387 | | if (parameters == null) |
| | 388 | | { |
| 0 | 389 | | throw new ArgumentNullException(nameof(parameters)); |
| | 390 | | } |
| | 391 | |
|
| 0 | 392 | | using var scope = _clientDiagnostics.CreateScope("NetworkVirtualAppliancesOperations.StartCreateOrUpdate"); |
| 0 | 393 | | scope.Start(); |
| | 394 | | try |
| | 395 | | { |
| 0 | 396 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, networkVirtualApplianceName, paramet |
| 0 | 397 | | return new NetworkVirtualAppliancesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.Cre |
| | 398 | | } |
| 0 | 399 | | catch (Exception e) |
| | 400 | | { |
| 0 | 401 | | scope.Failed(e); |
| 0 | 402 | | throw; |
| | 403 | | } |
| 0 | 404 | | } |
| | 405 | | } |
| | 406 | | } |