| | 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 ExpressRoutePortsLocations service client. </summary> |
| | 19 | | public partial class ExpressRoutePortsLocationsOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 0 | 23 | | internal ExpressRoutePortsLocationsRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of ExpressRoutePortsLocationsOperations for mocking. </summary> |
| 0 | 25 | | protected ExpressRoutePortsLocationsOperations() |
| | 26 | | { |
| 0 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of ExpressRoutePortsLocationsOperations. </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 ExpressRoutePortsLocationsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string |
| | 34 | | { |
| 0 | 35 | | RestClient = new ExpressRoutePortsLocationsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpo |
| 0 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 37 | | _pipeline = pipeline; |
| 0 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Retrieves a single ExpressRoutePort peering location, including the list of available bandwidths a |
| | 41 | | /// <param name="locationName"> Name of the requested ExpressRoutePort peering location. </param> |
| | 42 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 43 | | public virtual async Task<Response<ExpressRoutePortsLocation>> GetAsync(string locationName, CancellationToken c |
| | 44 | | { |
| 0 | 45 | | using var scope = _clientDiagnostics.CreateScope("ExpressRoutePortsLocationsOperations.Get"); |
| 0 | 46 | | scope.Start(); |
| | 47 | | try |
| | 48 | | { |
| 0 | 49 | | return await RestClient.GetAsync(locationName, cancellationToken).ConfigureAwait(false); |
| | 50 | | } |
| 0 | 51 | | catch (Exception e) |
| | 52 | | { |
| 0 | 53 | | scope.Failed(e); |
| 0 | 54 | | throw; |
| | 55 | | } |
| 0 | 56 | | } |
| | 57 | |
|
| | 58 | | /// <summary> Retrieves a single ExpressRoutePort peering location, including the list of available bandwidths a |
| | 59 | | /// <param name="locationName"> Name of the requested ExpressRoutePort peering location. </param> |
| | 60 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 61 | | public virtual Response<ExpressRoutePortsLocation> Get(string locationName, CancellationToken cancellationToken |
| | 62 | | { |
| 0 | 63 | | using var scope = _clientDiagnostics.CreateScope("ExpressRoutePortsLocationsOperations.Get"); |
| 0 | 64 | | scope.Start(); |
| | 65 | | try |
| | 66 | | { |
| 0 | 67 | | return RestClient.Get(locationName, cancellationToken); |
| | 68 | | } |
| 0 | 69 | | catch (Exception e) |
| | 70 | | { |
| 0 | 71 | | scope.Failed(e); |
| 0 | 72 | | throw; |
| | 73 | | } |
| 0 | 74 | | } |
| | 75 | |
|
| | 76 | | /// <summary> Retrieves all ExpressRoutePort peering locations. Does not return available bandwidths for each lo |
| | 77 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 78 | | public virtual AsyncPageable<ExpressRoutePortsLocation> ListAsync(CancellationToken cancellationToken = default) |
| | 79 | | { |
| | 80 | | async Task<Page<ExpressRoutePortsLocation>> FirstPageFunc(int? pageSizeHint) |
| | 81 | | { |
| 0 | 82 | | using var scope = _clientDiagnostics.CreateScope("ExpressRoutePortsLocationsOperations.List"); |
| 0 | 83 | | scope.Start(); |
| | 84 | | try |
| | 85 | | { |
| 0 | 86 | | var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false); |
| 0 | 87 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 88 | | } |
| 0 | 89 | | catch (Exception e) |
| | 90 | | { |
| 0 | 91 | | scope.Failed(e); |
| 0 | 92 | | throw; |
| | 93 | | } |
| 0 | 94 | | } |
| | 95 | | async Task<Page<ExpressRoutePortsLocation>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 96 | | { |
| 0 | 97 | | using var scope = _clientDiagnostics.CreateScope("ExpressRoutePortsLocationsOperations.List"); |
| 0 | 98 | | scope.Start(); |
| | 99 | | try |
| | 100 | | { |
| 0 | 101 | | var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false) |
| 0 | 102 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 103 | | } |
| 0 | 104 | | catch (Exception e) |
| | 105 | | { |
| 0 | 106 | | scope.Failed(e); |
| 0 | 107 | | throw; |
| | 108 | | } |
| 0 | 109 | | } |
| 0 | 110 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 111 | | } |
| | 112 | |
|
| | 113 | | /// <summary> Retrieves all ExpressRoutePort peering locations. Does not return available bandwidths for each lo |
| | 114 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 115 | | public virtual Pageable<ExpressRoutePortsLocation> List(CancellationToken cancellationToken = default) |
| | 116 | | { |
| | 117 | | Page<ExpressRoutePortsLocation> FirstPageFunc(int? pageSizeHint) |
| | 118 | | { |
| 0 | 119 | | using var scope = _clientDiagnostics.CreateScope("ExpressRoutePortsLocationsOperations.List"); |
| 0 | 120 | | scope.Start(); |
| | 121 | | try |
| | 122 | | { |
| 0 | 123 | | var response = RestClient.List(cancellationToken); |
| 0 | 124 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 125 | | } |
| 0 | 126 | | catch (Exception e) |
| | 127 | | { |
| 0 | 128 | | scope.Failed(e); |
| 0 | 129 | | throw; |
| | 130 | | } |
| 0 | 131 | | } |
| | 132 | | Page<ExpressRoutePortsLocation> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 133 | | { |
| 0 | 134 | | using var scope = _clientDiagnostics.CreateScope("ExpressRoutePortsLocationsOperations.List"); |
| 0 | 135 | | scope.Start(); |
| | 136 | | try |
| | 137 | | { |
| 0 | 138 | | var response = RestClient.ListNextPage(nextLink, cancellationToken); |
| 0 | 139 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 140 | | } |
| 0 | 141 | | catch (Exception e) |
| | 142 | | { |
| 0 | 143 | | scope.Failed(e); |
| 0 | 144 | | throw; |
| | 145 | | } |
| 0 | 146 | | } |
| 0 | 147 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 148 | | } |
| | 149 | | } |
| | 150 | | } |