| | 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.Text.Json; |
| | 10 | | using System.Threading; |
| | 11 | | using System.Threading.Tasks; |
| | 12 | | using Azure; |
| | 13 | | using Azure.Core; |
| | 14 | | using Azure.Core.Pipeline; |
| | 15 | | using Azure.ResourceManager.Network.Models; |
| | 16 | |
|
| | 17 | | namespace Azure.ResourceManager.Network |
| | 18 | | { |
| | 19 | | internal partial class LocalNetworkGatewaysRestOperations |
| | 20 | | { |
| | 21 | | private string subscriptionId; |
| | 22 | | private Uri endpoint; |
| | 23 | | private ClientDiagnostics _clientDiagnostics; |
| | 24 | | private HttpPipeline _pipeline; |
| | 25 | |
|
| | 26 | | /// <summary> Initializes a new instance of LocalNetworkGatewaysRestOperations. </summary> |
| | 27 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 28 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 29 | | /// <param name="subscriptionId"> The subscription credentials which uniquely identify the Microsoft Azure subsc |
| | 30 | | /// <param name="endpoint"> server parameter. </param> |
| | 31 | | /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception |
| 52 | 32 | | public LocalNetworkGatewaysRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string sub |
| | 33 | | { |
| 52 | 34 | | if (subscriptionId == null) |
| | 35 | | { |
| 0 | 36 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 37 | | } |
| 52 | 38 | | endpoint ??= new Uri("https://management.azure.com"); |
| | 39 | |
|
| 52 | 40 | | this.subscriptionId = subscriptionId; |
| 52 | 41 | | this.endpoint = endpoint; |
| 52 | 42 | | _clientDiagnostics = clientDiagnostics; |
| 52 | 43 | | _pipeline = pipeline; |
| 52 | 44 | | } |
| | 45 | |
|
| | 46 | | internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string localNetworkGatewayName, Local |
| | 47 | | { |
| 40 | 48 | | var message = _pipeline.CreateMessage(); |
| 40 | 49 | | var request = message.Request; |
| 40 | 50 | | request.Method = RequestMethod.Put; |
| 40 | 51 | | var uri = new RawRequestUriBuilder(); |
| 40 | 52 | | uri.Reset(endpoint); |
| 40 | 53 | | uri.AppendPath("/subscriptions/", false); |
| 40 | 54 | | uri.AppendPath(subscriptionId, true); |
| 40 | 55 | | uri.AppendPath("/resourceGroups/", false); |
| 40 | 56 | | uri.AppendPath(resourceGroupName, true); |
| 40 | 57 | | uri.AppendPath("/providers/Microsoft.Network/localNetworkGateways/", false); |
| 40 | 58 | | uri.AppendPath(localNetworkGatewayName, true); |
| 40 | 59 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 40 | 60 | | request.Uri = uri; |
| 40 | 61 | | request.Headers.Add("Content-Type", "application/json"); |
| 40 | 62 | | var content = new Utf8JsonRequestContent(); |
| 40 | 63 | | content.JsonWriter.WriteObjectValue(parameters); |
| 40 | 64 | | request.Content = content; |
| 40 | 65 | | return message; |
| | 66 | | } |
| | 67 | |
|
| | 68 | | /// <summary> Creates or updates a local network gateway in the specified resource group. </summary> |
| | 69 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 70 | | /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param> |
| | 71 | | /// <param name="parameters"> Parameters supplied to the create or update local network gateway operation. </par |
| | 72 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 73 | | public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string localNetworkGatewayName, LocalN |
| | 74 | | { |
| 10 | 75 | | if (resourceGroupName == null) |
| | 76 | | { |
| 0 | 77 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 78 | | } |
| 10 | 79 | | if (localNetworkGatewayName == null) |
| | 80 | | { |
| 0 | 81 | | throw new ArgumentNullException(nameof(localNetworkGatewayName)); |
| | 82 | | } |
| 10 | 83 | | if (parameters == null) |
| | 84 | | { |
| 0 | 85 | | throw new ArgumentNullException(nameof(parameters)); |
| | 86 | | } |
| | 87 | |
|
| 10 | 88 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, localNetworkGatewayName, parameters); |
| 10 | 89 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 10 | 90 | | switch (message.Response.Status) |
| | 91 | | { |
| | 92 | | case 200: |
| | 93 | | case 201: |
| 10 | 94 | | return message.Response; |
| | 95 | | default: |
| 0 | 96 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 97 | | } |
| 10 | 98 | | } |
| | 99 | |
|
| | 100 | | /// <summary> Creates or updates a local network gateway in the specified resource group. </summary> |
| | 101 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 102 | | /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param> |
| | 103 | | /// <param name="parameters"> Parameters supplied to the create or update local network gateway operation. </par |
| | 104 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 105 | | public Response CreateOrUpdate(string resourceGroupName, string localNetworkGatewayName, LocalNetworkGateway par |
| | 106 | | { |
| 10 | 107 | | if (resourceGroupName == null) |
| | 108 | | { |
| 0 | 109 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 110 | | } |
| 10 | 111 | | if (localNetworkGatewayName == null) |
| | 112 | | { |
| 0 | 113 | | throw new ArgumentNullException(nameof(localNetworkGatewayName)); |
| | 114 | | } |
| 10 | 115 | | if (parameters == null) |
| | 116 | | { |
| 0 | 117 | | throw new ArgumentNullException(nameof(parameters)); |
| | 118 | | } |
| | 119 | |
|
| 10 | 120 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, localNetworkGatewayName, parameters); |
| 10 | 121 | | _pipeline.Send(message, cancellationToken); |
| 10 | 122 | | switch (message.Response.Status) |
| | 123 | | { |
| | 124 | | case 200: |
| | 125 | | case 201: |
| 10 | 126 | | return message.Response; |
| | 127 | | default: |
| 0 | 128 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 129 | | } |
| 10 | 130 | | } |
| | 131 | |
|
| | 132 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string localNetworkGatewayName) |
| | 133 | | { |
| 20 | 134 | | var message = _pipeline.CreateMessage(); |
| 20 | 135 | | var request = message.Request; |
| 20 | 136 | | request.Method = RequestMethod.Get; |
| 20 | 137 | | var uri = new RawRequestUriBuilder(); |
| 20 | 138 | | uri.Reset(endpoint); |
| 20 | 139 | | uri.AppendPath("/subscriptions/", false); |
| 20 | 140 | | uri.AppendPath(subscriptionId, true); |
| 20 | 141 | | uri.AppendPath("/resourceGroups/", false); |
| 20 | 142 | | uri.AppendPath(resourceGroupName, true); |
| 20 | 143 | | uri.AppendPath("/providers/Microsoft.Network/localNetworkGateways/", false); |
| 20 | 144 | | uri.AppendPath(localNetworkGatewayName, true); |
| 20 | 145 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 20 | 146 | | request.Uri = uri; |
| 20 | 147 | | return message; |
| | 148 | | } |
| | 149 | |
|
| | 150 | | /// <summary> Gets the specified local network gateway in a resource group. </summary> |
| | 151 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 152 | | /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param> |
| | 153 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 154 | | public async Task<Response<LocalNetworkGateway>> GetAsync(string resourceGroupName, string localNetworkGatewayNa |
| | 155 | | { |
| 10 | 156 | | if (resourceGroupName == null) |
| | 157 | | { |
| 0 | 158 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 159 | | } |
| 10 | 160 | | if (localNetworkGatewayName == null) |
| | 161 | | { |
| 0 | 162 | | throw new ArgumentNullException(nameof(localNetworkGatewayName)); |
| | 163 | | } |
| | 164 | |
|
| 10 | 165 | | using var message = CreateGetRequest(resourceGroupName, localNetworkGatewayName); |
| 10 | 166 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 10 | 167 | | switch (message.Response.Status) |
| | 168 | | { |
| | 169 | | case 200: |
| | 170 | | { |
| 10 | 171 | | LocalNetworkGateway value = default; |
| 10 | 172 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 10 | 173 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 174 | | { |
| 0 | 175 | | value = null; |
| | 176 | | } |
| | 177 | | else |
| | 178 | | { |
| 10 | 179 | | value = LocalNetworkGateway.DeserializeLocalNetworkGateway(document.RootElement); |
| | 180 | | } |
| 10 | 181 | | return Response.FromValue(value, message.Response); |
| | 182 | | } |
| | 183 | | default: |
| 0 | 184 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 185 | | } |
| 10 | 186 | | } |
| | 187 | |
|
| | 188 | | /// <summary> Gets the specified local network gateway in a resource group. </summary> |
| | 189 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 190 | | /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param> |
| | 191 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 192 | | public Response<LocalNetworkGateway> Get(string resourceGroupName, string localNetworkGatewayName, CancellationT |
| | 193 | | { |
| 10 | 194 | | if (resourceGroupName == null) |
| | 195 | | { |
| 0 | 196 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 197 | | } |
| 10 | 198 | | if (localNetworkGatewayName == null) |
| | 199 | | { |
| 0 | 200 | | throw new ArgumentNullException(nameof(localNetworkGatewayName)); |
| | 201 | | } |
| | 202 | |
|
| 10 | 203 | | using var message = CreateGetRequest(resourceGroupName, localNetworkGatewayName); |
| 10 | 204 | | _pipeline.Send(message, cancellationToken); |
| 10 | 205 | | switch (message.Response.Status) |
| | 206 | | { |
| | 207 | | case 200: |
| | 208 | | { |
| 10 | 209 | | LocalNetworkGateway value = default; |
| 10 | 210 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 10 | 211 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 212 | | { |
| 0 | 213 | | value = null; |
| | 214 | | } |
| | 215 | | else |
| | 216 | | { |
| 10 | 217 | | value = LocalNetworkGateway.DeserializeLocalNetworkGateway(document.RootElement); |
| | 218 | | } |
| 10 | 219 | | return Response.FromValue(value, message.Response); |
| | 220 | | } |
| | 221 | | default: |
| 0 | 222 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 223 | | } |
| 10 | 224 | | } |
| | 225 | |
|
| | 226 | | internal HttpMessage CreateDeleteRequest(string resourceGroupName, string localNetworkGatewayName) |
| | 227 | | { |
| 8 | 228 | | var message = _pipeline.CreateMessage(); |
| 8 | 229 | | var request = message.Request; |
| 8 | 230 | | request.Method = RequestMethod.Delete; |
| 8 | 231 | | var uri = new RawRequestUriBuilder(); |
| 8 | 232 | | uri.Reset(endpoint); |
| 8 | 233 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 234 | | uri.AppendPath(subscriptionId, true); |
| 8 | 235 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 236 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 237 | | uri.AppendPath("/providers/Microsoft.Network/localNetworkGateways/", false); |
| 8 | 238 | | uri.AppendPath(localNetworkGatewayName, true); |
| 8 | 239 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 8 | 240 | | request.Uri = uri; |
| 8 | 241 | | return message; |
| | 242 | | } |
| | 243 | |
|
| | 244 | | /// <summary> Deletes the specified local network gateway. </summary> |
| | 245 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 246 | | /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param> |
| | 247 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 248 | | public async Task<Response> DeleteAsync(string resourceGroupName, string localNetworkGatewayName, CancellationTo |
| | 249 | | { |
| 2 | 250 | | if (resourceGroupName == null) |
| | 251 | | { |
| 0 | 252 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 253 | | } |
| 2 | 254 | | if (localNetworkGatewayName == null) |
| | 255 | | { |
| 0 | 256 | | throw new ArgumentNullException(nameof(localNetworkGatewayName)); |
| | 257 | | } |
| | 258 | |
|
| 2 | 259 | | using var message = CreateDeleteRequest(resourceGroupName, localNetworkGatewayName); |
| 2 | 260 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 261 | | switch (message.Response.Status) |
| | 262 | | { |
| | 263 | | case 200: |
| | 264 | | case 202: |
| | 265 | | case 204: |
| 2 | 266 | | return message.Response; |
| | 267 | | default: |
| 0 | 268 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 269 | | } |
| 2 | 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 Response Delete(string resourceGroupName, string localNetworkGatewayName, CancellationToken cancellationT |
| | 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 message = CreateDeleteRequest(resourceGroupName, localNetworkGatewayName); |
| 2 | 288 | | _pipeline.Send(message, cancellationToken); |
| 2 | 289 | | switch (message.Response.Status) |
| | 290 | | { |
| | 291 | | case 200: |
| | 292 | | case 202: |
| | 293 | | case 204: |
| 2 | 294 | | return message.Response; |
| | 295 | | default: |
| 0 | 296 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 297 | | } |
| 2 | 298 | | } |
| | 299 | |
|
| | 300 | | internal HttpMessage CreateUpdateTagsRequest(string resourceGroupName, string localNetworkGatewayName, TagsObjec |
| | 301 | | { |
| 0 | 302 | | var message = _pipeline.CreateMessage(); |
| 0 | 303 | | var request = message.Request; |
| 0 | 304 | | request.Method = RequestMethod.Patch; |
| 0 | 305 | | var uri = new RawRequestUriBuilder(); |
| 0 | 306 | | uri.Reset(endpoint); |
| 0 | 307 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 308 | | uri.AppendPath(subscriptionId, true); |
| 0 | 309 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 310 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 311 | | uri.AppendPath("/providers/Microsoft.Network/localNetworkGateways/", false); |
| 0 | 312 | | uri.AppendPath(localNetworkGatewayName, true); |
| 0 | 313 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 314 | | request.Uri = uri; |
| 0 | 315 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 316 | | var content = new Utf8JsonRequestContent(); |
| 0 | 317 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 318 | | request.Content = content; |
| 0 | 319 | | return message; |
| | 320 | | } |
| | 321 | |
|
| | 322 | | /// <summary> Updates a local network gateway tags. </summary> |
| | 323 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 324 | | /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param> |
| | 325 | | /// <param name="parameters"> Parameters supplied to update local network gateway tags. </param> |
| | 326 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 327 | | public async Task<Response<LocalNetworkGateway>> UpdateTagsAsync(string resourceGroupName, string localNetworkGa |
| | 328 | | { |
| 0 | 329 | | if (resourceGroupName == null) |
| | 330 | | { |
| 0 | 331 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 332 | | } |
| 0 | 333 | | if (localNetworkGatewayName == null) |
| | 334 | | { |
| 0 | 335 | | throw new ArgumentNullException(nameof(localNetworkGatewayName)); |
| | 336 | | } |
| 0 | 337 | | if (parameters == null) |
| | 338 | | { |
| 0 | 339 | | throw new ArgumentNullException(nameof(parameters)); |
| | 340 | | } |
| | 341 | |
|
| 0 | 342 | | using var message = CreateUpdateTagsRequest(resourceGroupName, localNetworkGatewayName, parameters); |
| 0 | 343 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 344 | | switch (message.Response.Status) |
| | 345 | | { |
| | 346 | | case 200: |
| | 347 | | { |
| 0 | 348 | | LocalNetworkGateway value = default; |
| 0 | 349 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 350 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 351 | | { |
| 0 | 352 | | value = null; |
| | 353 | | } |
| | 354 | | else |
| | 355 | | { |
| 0 | 356 | | value = LocalNetworkGateway.DeserializeLocalNetworkGateway(document.RootElement); |
| | 357 | | } |
| 0 | 358 | | return Response.FromValue(value, message.Response); |
| | 359 | | } |
| | 360 | | default: |
| 0 | 361 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 362 | | } |
| 0 | 363 | | } |
| | 364 | |
|
| | 365 | | /// <summary> Updates a local network gateway tags. </summary> |
| | 366 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 367 | | /// <param name="localNetworkGatewayName"> The name of the local network gateway. </param> |
| | 368 | | /// <param name="parameters"> Parameters supplied to update local network gateway tags. </param> |
| | 369 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 370 | | public Response<LocalNetworkGateway> UpdateTags(string resourceGroupName, string localNetworkGatewayName, TagsOb |
| | 371 | | { |
| 0 | 372 | | if (resourceGroupName == null) |
| | 373 | | { |
| 0 | 374 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 375 | | } |
| 0 | 376 | | if (localNetworkGatewayName == null) |
| | 377 | | { |
| 0 | 378 | | throw new ArgumentNullException(nameof(localNetworkGatewayName)); |
| | 379 | | } |
| 0 | 380 | | if (parameters == null) |
| | 381 | | { |
| 0 | 382 | | throw new ArgumentNullException(nameof(parameters)); |
| | 383 | | } |
| | 384 | |
|
| 0 | 385 | | using var message = CreateUpdateTagsRequest(resourceGroupName, localNetworkGatewayName, parameters); |
| 0 | 386 | | _pipeline.Send(message, cancellationToken); |
| 0 | 387 | | switch (message.Response.Status) |
| | 388 | | { |
| | 389 | | case 200: |
| | 390 | | { |
| 0 | 391 | | LocalNetworkGateway value = default; |
| 0 | 392 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 393 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 394 | | { |
| 0 | 395 | | value = null; |
| | 396 | | } |
| | 397 | | else |
| | 398 | | { |
| 0 | 399 | | value = LocalNetworkGateway.DeserializeLocalNetworkGateway(document.RootElement); |
| | 400 | | } |
| 0 | 401 | | return Response.FromValue(value, message.Response); |
| | 402 | | } |
| | 403 | | default: |
| 0 | 404 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 405 | | } |
| 0 | 406 | | } |
| | 407 | |
|
| | 408 | | internal HttpMessage CreateListRequest(string resourceGroupName) |
| | 409 | | { |
| 8 | 410 | | var message = _pipeline.CreateMessage(); |
| 8 | 411 | | var request = message.Request; |
| 8 | 412 | | request.Method = RequestMethod.Get; |
| 8 | 413 | | var uri = new RawRequestUriBuilder(); |
| 8 | 414 | | uri.Reset(endpoint); |
| 8 | 415 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 416 | | uri.AppendPath(subscriptionId, true); |
| 8 | 417 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 418 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 419 | | uri.AppendPath("/providers/Microsoft.Network/localNetworkGateways", false); |
| 8 | 420 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 8 | 421 | | request.Uri = uri; |
| 8 | 422 | | return message; |
| | 423 | | } |
| | 424 | |
|
| | 425 | | /// <summary> Gets all the local network gateways in a resource group. </summary> |
| | 426 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 427 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 428 | | public async Task<Response<LocalNetworkGatewayListResult>> ListAsync(string resourceGroupName, CancellationToken |
| | 429 | | { |
| 4 | 430 | | if (resourceGroupName == null) |
| | 431 | | { |
| 0 | 432 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 433 | | } |
| | 434 | |
|
| 4 | 435 | | using var message = CreateListRequest(resourceGroupName); |
| 4 | 436 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 4 | 437 | | switch (message.Response.Status) |
| | 438 | | { |
| | 439 | | case 200: |
| | 440 | | { |
| 4 | 441 | | LocalNetworkGatewayListResult value = default; |
| 4 | 442 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 4 | 443 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 444 | | { |
| 0 | 445 | | value = null; |
| | 446 | | } |
| | 447 | | else |
| | 448 | | { |
| 4 | 449 | | value = LocalNetworkGatewayListResult.DeserializeLocalNetworkGatewayListResult(document.Root |
| | 450 | | } |
| 4 | 451 | | return Response.FromValue(value, message.Response); |
| | 452 | | } |
| | 453 | | default: |
| 0 | 454 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 455 | | } |
| 4 | 456 | | } |
| | 457 | |
|
| | 458 | | /// <summary> Gets all the local network gateways in a resource group. </summary> |
| | 459 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 460 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 461 | | public Response<LocalNetworkGatewayListResult> List(string resourceGroupName, CancellationToken cancellationToke |
| | 462 | | { |
| 4 | 463 | | if (resourceGroupName == null) |
| | 464 | | { |
| 0 | 465 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 466 | | } |
| | 467 | |
|
| 4 | 468 | | using var message = CreateListRequest(resourceGroupName); |
| 4 | 469 | | _pipeline.Send(message, cancellationToken); |
| 4 | 470 | | switch (message.Response.Status) |
| | 471 | | { |
| | 472 | | case 200: |
| | 473 | | { |
| 4 | 474 | | LocalNetworkGatewayListResult value = default; |
| 4 | 475 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 4 | 476 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 477 | | { |
| 0 | 478 | | value = null; |
| | 479 | | } |
| | 480 | | else |
| | 481 | | { |
| 4 | 482 | | value = LocalNetworkGatewayListResult.DeserializeLocalNetworkGatewayListResult(document.Root |
| | 483 | | } |
| 4 | 484 | | return Response.FromValue(value, message.Response); |
| | 485 | | } |
| | 486 | | default: |
| 0 | 487 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 488 | | } |
| 4 | 489 | | } |
| | 490 | |
|
| | 491 | | internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName) |
| | 492 | | { |
| 0 | 493 | | var message = _pipeline.CreateMessage(); |
| 0 | 494 | | var request = message.Request; |
| 0 | 495 | | request.Method = RequestMethod.Get; |
| 0 | 496 | | var uri = new RawRequestUriBuilder(); |
| 0 | 497 | | uri.Reset(endpoint); |
| 0 | 498 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 499 | | request.Uri = uri; |
| 0 | 500 | | return message; |
| | 501 | | } |
| | 502 | |
|
| | 503 | | /// <summary> Gets all the local network gateways in a resource group. </summary> |
| | 504 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 505 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 506 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 507 | | public async Task<Response<LocalNetworkGatewayListResult>> ListNextPageAsync(string nextLink, string resourceGro |
| | 508 | | { |
| 0 | 509 | | if (nextLink == null) |
| | 510 | | { |
| 0 | 511 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 512 | | } |
| 0 | 513 | | if (resourceGroupName == null) |
| | 514 | | { |
| 0 | 515 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 516 | | } |
| | 517 | |
|
| 0 | 518 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName); |
| 0 | 519 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 520 | | switch (message.Response.Status) |
| | 521 | | { |
| | 522 | | case 200: |
| | 523 | | { |
| 0 | 524 | | LocalNetworkGatewayListResult value = default; |
| 0 | 525 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 526 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 527 | | { |
| 0 | 528 | | value = null; |
| | 529 | | } |
| | 530 | | else |
| | 531 | | { |
| 0 | 532 | | value = LocalNetworkGatewayListResult.DeserializeLocalNetworkGatewayListResult(document.Root |
| | 533 | | } |
| 0 | 534 | | return Response.FromValue(value, message.Response); |
| | 535 | | } |
| | 536 | | default: |
| 0 | 537 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 538 | | } |
| 0 | 539 | | } |
| | 540 | |
|
| | 541 | | /// <summary> Gets all the local network gateways in a resource group. </summary> |
| | 542 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 543 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 544 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 545 | | public Response<LocalNetworkGatewayListResult> ListNextPage(string nextLink, string resourceGroupName, Cancellat |
| | 546 | | { |
| 0 | 547 | | if (nextLink == null) |
| | 548 | | { |
| 0 | 549 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 550 | | } |
| 0 | 551 | | if (resourceGroupName == null) |
| | 552 | | { |
| 0 | 553 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 554 | | } |
| | 555 | |
|
| 0 | 556 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName); |
| 0 | 557 | | _pipeline.Send(message, cancellationToken); |
| 0 | 558 | | switch (message.Response.Status) |
| | 559 | | { |
| | 560 | | case 200: |
| | 561 | | { |
| 0 | 562 | | LocalNetworkGatewayListResult value = default; |
| 0 | 563 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 564 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 565 | | { |
| 0 | 566 | | value = null; |
| | 567 | | } |
| | 568 | | else |
| | 569 | | { |
| 0 | 570 | | value = LocalNetworkGatewayListResult.DeserializeLocalNetworkGatewayListResult(document.Root |
| | 571 | | } |
| 0 | 572 | | return Response.FromValue(value, message.Response); |
| | 573 | | } |
| | 574 | | default: |
| 0 | 575 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 576 | | } |
| 0 | 577 | | } |
| | 578 | | } |
| | 579 | | } |