| | 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 LocalNetworkGateways service client. </summary> |
| | 19 | | public partial class LocalNetworkGatewaysOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 76 | 23 | | internal LocalNetworkGatewaysRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of LocalNetworkGatewaysOperations for mocking. </summary> |
| 52 | 25 | | protected LocalNetworkGatewaysOperations() |
| | 26 | | { |
| 52 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of LocalNetworkGatewaysOperations. </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> |
| 52 | 33 | | internal LocalNetworkGatewaysOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subsc |
| | 34 | | { |
| 52 | 35 | | RestClient = new LocalNetworkGatewaysRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 52 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 52 | 37 | | _pipeline = pipeline; |
| 52 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Gets the specified local network gateway in a resource group. </summary> |
| | 41 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 42 | | /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param> |
| | 43 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 44 | | public virtual async Task<Response<LocalNetworkGateway>> GetAsync(string resourceGroupName, string localNetworkG |
| | 45 | | { |
| 10 | 46 | | using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.Get"); |
| 10 | 47 | | scope.Start(); |
| | 48 | | try |
| | 49 | | { |
| 10 | 50 | | return await RestClient.GetAsync(resourceGroupName, localNetworkGatewayName, cancellationToken).Configur |
| | 51 | | } |
| 0 | 52 | | catch (Exception e) |
| | 53 | | { |
| 0 | 54 | | scope.Failed(e); |
| 0 | 55 | | throw; |
| | 56 | | } |
| 10 | 57 | | } |
| | 58 | |
|
| | 59 | | /// <summary> Gets the specified local network gateway in a resource group. </summary> |
| | 60 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 61 | | /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param> |
| | 62 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 63 | | public virtual Response<LocalNetworkGateway> Get(string resourceGroupName, string localNetworkGatewayName, Cance |
| | 64 | | { |
| 10 | 65 | | using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.Get"); |
| 10 | 66 | | scope.Start(); |
| | 67 | | try |
| | 68 | | { |
| 10 | 69 | | return RestClient.Get(resourceGroupName, localNetworkGatewayName, cancellationToken); |
| | 70 | | } |
| 0 | 71 | | catch (Exception e) |
| | 72 | | { |
| 0 | 73 | | scope.Failed(e); |
| 0 | 74 | | throw; |
| | 75 | | } |
| 10 | 76 | | } |
| | 77 | |
|
| | 78 | | /// <summary> Updates a local network gateway tags. </summary> |
| | 79 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 80 | | /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param> |
| | 81 | | /// <param name="parameters"> Parameters supplied to update local network gateway tags. </param> |
| | 82 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 83 | | public virtual async Task<Response<LocalNetworkGateway>> UpdateTagsAsync(string resourceGroupName, string localN |
| | 84 | | { |
| 0 | 85 | | using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.UpdateTags"); |
| 0 | 86 | | scope.Start(); |
| | 87 | | try |
| | 88 | | { |
| 0 | 89 | | return await RestClient.UpdateTagsAsync(resourceGroupName, localNetworkGatewayName, parameters, cancella |
| | 90 | | } |
| 0 | 91 | | catch (Exception e) |
| | 92 | | { |
| 0 | 93 | | scope.Failed(e); |
| 0 | 94 | | throw; |
| | 95 | | } |
| 0 | 96 | | } |
| | 97 | |
|
| | 98 | | /// <summary> Updates a local network gateway tags. </summary> |
| | 99 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 100 | | /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param> |
| | 101 | | /// <param name="parameters"> Parameters supplied to update local network gateway tags. </param> |
| | 102 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 103 | | public virtual Response<LocalNetworkGateway> UpdateTags(string resourceGroupName, string localNetworkGatewayName |
| | 104 | | { |
| 0 | 105 | | using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.UpdateTags"); |
| 0 | 106 | | scope.Start(); |
| | 107 | | try |
| | 108 | | { |
| 0 | 109 | | return RestClient.UpdateTags(resourceGroupName, localNetworkGatewayName, parameters, cancellationToken); |
| | 110 | | } |
| 0 | 111 | | catch (Exception e) |
| | 112 | | { |
| 0 | 113 | | scope.Failed(e); |
| 0 | 114 | | throw; |
| | 115 | | } |
| 0 | 116 | | } |
| | 117 | |
|
| | 118 | | /// <summary> Gets all the local network gateways in a resource group. </summary> |
| | 119 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 120 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 121 | | public virtual AsyncPageable<LocalNetworkGateway> ListAsync(string resourceGroupName, CancellationToken cancella |
| | 122 | | { |
| 4 | 123 | | if (resourceGroupName == null) |
| | 124 | | { |
| 0 | 125 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 126 | | } |
| | 127 | |
|
| | 128 | | async Task<Page<LocalNetworkGateway>> FirstPageFunc(int? pageSizeHint) |
| | 129 | | { |
| 4 | 130 | | using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.List"); |
| 4 | 131 | | scope.Start(); |
| | 132 | | try |
| | 133 | | { |
| 4 | 134 | | var response = await RestClient.ListAsync(resourceGroupName, cancellationToken).ConfigureAwait(false |
| 4 | 135 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 136 | | } |
| 0 | 137 | | catch (Exception e) |
| | 138 | | { |
| 0 | 139 | | scope.Failed(e); |
| 0 | 140 | | throw; |
| | 141 | | } |
| 4 | 142 | | } |
| | 143 | | async Task<Page<LocalNetworkGateway>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 144 | | { |
| 0 | 145 | | using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.List"); |
| 0 | 146 | | scope.Start(); |
| | 147 | | try |
| | 148 | | { |
| 0 | 149 | | var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, cancellationToken).Co |
| 0 | 150 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 151 | | } |
| 0 | 152 | | catch (Exception e) |
| | 153 | | { |
| 0 | 154 | | scope.Failed(e); |
| 0 | 155 | | throw; |
| | 156 | | } |
| 0 | 157 | | } |
| 4 | 158 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 159 | | } |
| | 160 | |
|
| | 161 | | /// <summary> Gets all the local network gateways in a resource group. </summary> |
| | 162 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 163 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 164 | | public virtual Pageable<LocalNetworkGateway> List(string resourceGroupName, CancellationToken cancellationToken |
| | 165 | | { |
| 4 | 166 | | if (resourceGroupName == null) |
| | 167 | | { |
| 0 | 168 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 169 | | } |
| | 170 | |
|
| | 171 | | Page<LocalNetworkGateway> FirstPageFunc(int? pageSizeHint) |
| | 172 | | { |
| 4 | 173 | | using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.List"); |
| 4 | 174 | | scope.Start(); |
| | 175 | | try |
| | 176 | | { |
| 4 | 177 | | var response = RestClient.List(resourceGroupName, cancellationToken); |
| 4 | 178 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 179 | | } |
| 0 | 180 | | catch (Exception e) |
| | 181 | | { |
| 0 | 182 | | scope.Failed(e); |
| 0 | 183 | | throw; |
| | 184 | | } |
| 4 | 185 | | } |
| | 186 | | Page<LocalNetworkGateway> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 187 | | { |
| 0 | 188 | | using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.List"); |
| 0 | 189 | | scope.Start(); |
| | 190 | | try |
| | 191 | | { |
| 0 | 192 | | var response = RestClient.ListNextPage(nextLink, resourceGroupName, cancellationToken); |
| 0 | 193 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 194 | | } |
| 0 | 195 | | catch (Exception e) |
| | 196 | | { |
| 0 | 197 | | scope.Failed(e); |
| 0 | 198 | | throw; |
| | 199 | | } |
| 0 | 200 | | } |
| 4 | 201 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 202 | | } |
| | 203 | |
|
| | 204 | | /// <summary> Creates or updates a local network gateway in the specified resource group. </summary> |
| | 205 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 206 | | /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param> |
| | 207 | | /// <param name="parameters"> Parameters supplied to the create or update local network gateway operation. </par |
| | 208 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 209 | | public virtual async Task<LocalNetworkGatewaysCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceG |
| | 210 | | { |
| 10 | 211 | | if (resourceGroupName == null) |
| | 212 | | { |
| 0 | 213 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 214 | | } |
| 10 | 215 | | if (localNetworkGatewayName == null) |
| | 216 | | { |
| 0 | 217 | | throw new ArgumentNullException(nameof(localNetworkGatewayName)); |
| | 218 | | } |
| 10 | 219 | | if (parameters == null) |
| | 220 | | { |
| 0 | 221 | | throw new ArgumentNullException(nameof(parameters)); |
| | 222 | | } |
| | 223 | |
|
| 10 | 224 | | using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.StartCreateOrUpdate"); |
| 10 | 225 | | scope.Start(); |
| | 226 | | try |
| | 227 | | { |
| 10 | 228 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, localNetworkGatewayName, |
| 10 | 229 | | return new LocalNetworkGatewaysCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateC |
| | 230 | | } |
| 0 | 231 | | catch (Exception e) |
| | 232 | | { |
| 0 | 233 | | scope.Failed(e); |
| 0 | 234 | | throw; |
| | 235 | | } |
| 10 | 236 | | } |
| | 237 | |
|
| | 238 | | /// <summary> Creates or updates a local network gateway in the specified resource group. </summary> |
| | 239 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 240 | | /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param> |
| | 241 | | /// <param name="parameters"> Parameters supplied to the create or update local network gateway operation. </par |
| | 242 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 243 | | public virtual LocalNetworkGatewaysCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string |
| | 244 | | { |
| 10 | 245 | | if (resourceGroupName == null) |
| | 246 | | { |
| 0 | 247 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 248 | | } |
| 10 | 249 | | if (localNetworkGatewayName == null) |
| | 250 | | { |
| 0 | 251 | | throw new ArgumentNullException(nameof(localNetworkGatewayName)); |
| | 252 | | } |
| 10 | 253 | | if (parameters == null) |
| | 254 | | { |
| 0 | 255 | | throw new ArgumentNullException(nameof(parameters)); |
| | 256 | | } |
| | 257 | |
|
| 10 | 258 | | using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.StartCreateOrUpdate"); |
| 10 | 259 | | scope.Start(); |
| | 260 | | try |
| | 261 | | { |
| 10 | 262 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, localNetworkGatewayName, parameters, |
| 10 | 263 | | return new LocalNetworkGatewaysCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateC |
| | 264 | | } |
| 0 | 265 | | catch (Exception e) |
| | 266 | | { |
| 0 | 267 | | scope.Failed(e); |
| 0 | 268 | | throw; |
| | 269 | | } |
| 10 | 270 | | } |
| | 271 | |
|
| | 272 | | /// <summary> Deletes the specified local network gateway. </summary> |
| | 273 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 274 | | /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param> |
| | 275 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 276 | | public virtual async Task<LocalNetworkGatewaysDeleteOperation> StartDeleteAsync(string resourceGroupName, string |
| | 277 | | { |
| 2 | 278 | | if (resourceGroupName == null) |
| | 279 | | { |
| 0 | 280 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 281 | | } |
| 2 | 282 | | if (localNetworkGatewayName == null) |
| | 283 | | { |
| 0 | 284 | | throw new ArgumentNullException(nameof(localNetworkGatewayName)); |
| | 285 | | } |
| | 286 | |
|
| 2 | 287 | | using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.StartDelete"); |
| 2 | 288 | | scope.Start(); |
| | 289 | | try |
| | 290 | | { |
| 2 | 291 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, localNetworkGatewayName, cancella |
| 2 | 292 | | return new LocalNetworkGatewaysDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteReq |
| | 293 | | } |
| 0 | 294 | | catch (Exception e) |
| | 295 | | { |
| 0 | 296 | | scope.Failed(e); |
| 0 | 297 | | throw; |
| | 298 | | } |
| 2 | 299 | | } |
| | 300 | |
|
| | 301 | | /// <summary> Deletes the specified local network gateway. </summary> |
| | 302 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 303 | | /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param> |
| | 304 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 305 | | public virtual LocalNetworkGatewaysDeleteOperation StartDelete(string resourceGroupName, string localNetworkGate |
| | 306 | | { |
| 2 | 307 | | if (resourceGroupName == null) |
| | 308 | | { |
| 0 | 309 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 310 | | } |
| 2 | 311 | | if (localNetworkGatewayName == null) |
| | 312 | | { |
| 0 | 313 | | throw new ArgumentNullException(nameof(localNetworkGatewayName)); |
| | 314 | | } |
| | 315 | |
|
| 2 | 316 | | using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewaysOperations.StartDelete"); |
| 2 | 317 | | scope.Start(); |
| | 318 | | try |
| | 319 | | { |
| 2 | 320 | | var originalResponse = RestClient.Delete(resourceGroupName, localNetworkGatewayName, cancellationToken); |
| 2 | 321 | | return new LocalNetworkGatewaysDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteReq |
| | 322 | | } |
| 0 | 323 | | catch (Exception e) |
| | 324 | | { |
| 0 | 325 | | scope.Failed(e); |
| 0 | 326 | | throw; |
| | 327 | | } |
| 2 | 328 | | } |
| | 329 | | } |
| | 330 | | } |