| | 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 LoadBalancerNetworkInterfaces service client. </summary> |
| | 19 | | public partial class LoadBalancerNetworkInterfacesOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 8 | 23 | | internal LoadBalancerNetworkInterfacesRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of LoadBalancerNetworkInterfacesOperations for mocking. </summary> |
| 8 | 25 | | protected LoadBalancerNetworkInterfacesOperations() |
| | 26 | | { |
| 8 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of LoadBalancerNetworkInterfacesOperations. </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> |
| 8 | 33 | | internal LoadBalancerNetworkInterfacesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, str |
| | 34 | | { |
| 8 | 35 | | RestClient = new LoadBalancerNetworkInterfacesRestOperations(clientDiagnostics, pipeline, subscriptionId, en |
| 8 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 8 | 37 | | _pipeline = pipeline; |
| 8 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Gets associated load balancer network interfaces. </summary> |
| | 41 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 42 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 43 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 44 | | public virtual AsyncPageable<NetworkInterface> ListAsync(string resourceGroupName, string loadBalancerName, Canc |
| | 45 | | { |
| 4 | 46 | | if (resourceGroupName == null) |
| | 47 | | { |
| 0 | 48 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 49 | | } |
| 4 | 50 | | if (loadBalancerName == null) |
| | 51 | | { |
| 0 | 52 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 53 | | } |
| | 54 | |
|
| | 55 | | async Task<Page<NetworkInterface>> FirstPageFunc(int? pageSizeHint) |
| | 56 | | { |
| 4 | 57 | | using var scope = _clientDiagnostics.CreateScope("LoadBalancerNetworkInterfacesOperations.List"); |
| 4 | 58 | | scope.Start(); |
| | 59 | | try |
| | 60 | | { |
| 4 | 61 | | var response = await RestClient.ListAsync(resourceGroupName, loadBalancerName, cancellationToken).Co |
| 4 | 62 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 63 | | } |
| 0 | 64 | | catch (Exception e) |
| | 65 | | { |
| 0 | 66 | | scope.Failed(e); |
| 0 | 67 | | throw; |
| | 68 | | } |
| 4 | 69 | | } |
| | 70 | | async Task<Page<NetworkInterface>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 71 | | { |
| 0 | 72 | | using var scope = _clientDiagnostics.CreateScope("LoadBalancerNetworkInterfacesOperations.List"); |
| 0 | 73 | | scope.Start(); |
| | 74 | | try |
| | 75 | | { |
| 0 | 76 | | var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, loadBalancerName, can |
| 0 | 77 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 78 | | } |
| 0 | 79 | | catch (Exception e) |
| | 80 | | { |
| 0 | 81 | | scope.Failed(e); |
| 0 | 82 | | throw; |
| | 83 | | } |
| 0 | 84 | | } |
| 4 | 85 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 86 | | } |
| | 87 | |
|
| | 88 | | /// <summary> Gets associated load balancer network interfaces. </summary> |
| | 89 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 90 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 91 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 92 | | public virtual Pageable<NetworkInterface> List(string resourceGroupName, string loadBalancerName, CancellationTo |
| | 93 | | { |
| 4 | 94 | | if (resourceGroupName == null) |
| | 95 | | { |
| 0 | 96 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 97 | | } |
| 4 | 98 | | if (loadBalancerName == null) |
| | 99 | | { |
| 0 | 100 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 101 | | } |
| | 102 | |
|
| | 103 | | Page<NetworkInterface> FirstPageFunc(int? pageSizeHint) |
| | 104 | | { |
| 4 | 105 | | using var scope = _clientDiagnostics.CreateScope("LoadBalancerNetworkInterfacesOperations.List"); |
| 4 | 106 | | scope.Start(); |
| | 107 | | try |
| | 108 | | { |
| 4 | 109 | | var response = RestClient.List(resourceGroupName, loadBalancerName, cancellationToken); |
| 4 | 110 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 111 | | } |
| 0 | 112 | | catch (Exception e) |
| | 113 | | { |
| 0 | 114 | | scope.Failed(e); |
| 0 | 115 | | throw; |
| | 116 | | } |
| 4 | 117 | | } |
| | 118 | | Page<NetworkInterface> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 119 | | { |
| 0 | 120 | | using var scope = _clientDiagnostics.CreateScope("LoadBalancerNetworkInterfacesOperations.List"); |
| 0 | 121 | | scope.Start(); |
| | 122 | | try |
| | 123 | | { |
| 0 | 124 | | var response = RestClient.ListNextPage(nextLink, resourceGroupName, loadBalancerName, cancellationTo |
| 0 | 125 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 126 | | } |
| 0 | 127 | | catch (Exception e) |
| | 128 | | { |
| 0 | 129 | | scope.Failed(e); |
| 0 | 130 | | throw; |
| | 131 | | } |
| 0 | 132 | | } |
| 4 | 133 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 134 | | } |
| | 135 | | } |
| | 136 | | } |