| | 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 LoadBalancerBackendAddressPoolsRestOperations |
| | 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 LoadBalancerBackendAddressPoolsRestOperations. </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 |
| 8 | 32 | | public LoadBalancerBackendAddressPoolsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, |
| | 33 | | { |
| 8 | 34 | | if (subscriptionId == null) |
| | 35 | | { |
| 0 | 36 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 37 | | } |
| 8 | 38 | | endpoint ??= new Uri("https://management.azure.com"); |
| | 39 | |
|
| 8 | 40 | | this.subscriptionId = subscriptionId; |
| 8 | 41 | | this.endpoint = endpoint; |
| 8 | 42 | | _clientDiagnostics = clientDiagnostics; |
| 8 | 43 | | _pipeline = pipeline; |
| 8 | 44 | | } |
| | 45 | |
|
| | 46 | | internal HttpMessage CreateListRequest(string resourceGroupName, string loadBalancerName) |
| | 47 | | { |
| 4 | 48 | | var message = _pipeline.CreateMessage(); |
| 4 | 49 | | var request = message.Request; |
| 4 | 50 | | request.Method = RequestMethod.Get; |
| 4 | 51 | | var uri = new RawRequestUriBuilder(); |
| 4 | 52 | | uri.Reset(endpoint); |
| 4 | 53 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 54 | | uri.AppendPath(subscriptionId, true); |
| 4 | 55 | | uri.AppendPath("/resourceGroups/", false); |
| 4 | 56 | | uri.AppendPath(resourceGroupName, true); |
| 4 | 57 | | uri.AppendPath("/providers/Microsoft.Network/loadBalancers/", false); |
| 4 | 58 | | uri.AppendPath(loadBalancerName, true); |
| 4 | 59 | | uri.AppendPath("/backendAddressPools", false); |
| 4 | 60 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 4 | 61 | | request.Uri = uri; |
| 4 | 62 | | return message; |
| | 63 | | } |
| | 64 | |
|
| | 65 | | /// <summary> Gets all the load balancer backed address pools. </summary> |
| | 66 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 67 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 68 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 69 | | public async Task<Response<LoadBalancerBackendAddressPoolListResult>> ListAsync(string resourceGroupName, string |
| | 70 | | { |
| 2 | 71 | | if (resourceGroupName == null) |
| | 72 | | { |
| 0 | 73 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 74 | | } |
| 2 | 75 | | if (loadBalancerName == null) |
| | 76 | | { |
| 0 | 77 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 78 | | } |
| | 79 | |
|
| 2 | 80 | | using var message = CreateListRequest(resourceGroupName, loadBalancerName); |
| 2 | 81 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 82 | | switch (message.Response.Status) |
| | 83 | | { |
| | 84 | | case 200: |
| | 85 | | { |
| 2 | 86 | | LoadBalancerBackendAddressPoolListResult value = default; |
| 2 | 87 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 88 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 89 | | { |
| 0 | 90 | | value = null; |
| | 91 | | } |
| | 92 | | else |
| | 93 | | { |
| 2 | 94 | | value = LoadBalancerBackendAddressPoolListResult.DeserializeLoadBalancerBackendAddressPoolLi |
| | 95 | | } |
| 2 | 96 | | return Response.FromValue(value, message.Response); |
| | 97 | | } |
| | 98 | | default: |
| 0 | 99 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 100 | | } |
| 2 | 101 | | } |
| | 102 | |
|
| | 103 | | /// <summary> Gets all the load balancer backed address pools. </summary> |
| | 104 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 105 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 106 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 107 | | public Response<LoadBalancerBackendAddressPoolListResult> List(string resourceGroupName, string loadBalancerName |
| | 108 | | { |
| 2 | 109 | | if (resourceGroupName == null) |
| | 110 | | { |
| 0 | 111 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 112 | | } |
| 2 | 113 | | if (loadBalancerName == null) |
| | 114 | | { |
| 0 | 115 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 116 | | } |
| | 117 | |
|
| 2 | 118 | | using var message = CreateListRequest(resourceGroupName, loadBalancerName); |
| 2 | 119 | | _pipeline.Send(message, cancellationToken); |
| 2 | 120 | | switch (message.Response.Status) |
| | 121 | | { |
| | 122 | | case 200: |
| | 123 | | { |
| 2 | 124 | | LoadBalancerBackendAddressPoolListResult value = default; |
| 2 | 125 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 126 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 127 | | { |
| 0 | 128 | | value = null; |
| | 129 | | } |
| | 130 | | else |
| | 131 | | { |
| 2 | 132 | | value = LoadBalancerBackendAddressPoolListResult.DeserializeLoadBalancerBackendAddressPoolLi |
| | 133 | | } |
| 2 | 134 | | return Response.FromValue(value, message.Response); |
| | 135 | | } |
| | 136 | | default: |
| 0 | 137 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 138 | | } |
| 2 | 139 | | } |
| | 140 | |
|
| | 141 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string loadBalancerName, string backendAddressPo |
| | 142 | | { |
| 4 | 143 | | var message = _pipeline.CreateMessage(); |
| 4 | 144 | | var request = message.Request; |
| 4 | 145 | | request.Method = RequestMethod.Get; |
| 4 | 146 | | var uri = new RawRequestUriBuilder(); |
| 4 | 147 | | uri.Reset(endpoint); |
| 4 | 148 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 149 | | uri.AppendPath(subscriptionId, true); |
| 4 | 150 | | uri.AppendPath("/resourceGroups/", false); |
| 4 | 151 | | uri.AppendPath(resourceGroupName, true); |
| 4 | 152 | | uri.AppendPath("/providers/Microsoft.Network/loadBalancers/", false); |
| 4 | 153 | | uri.AppendPath(loadBalancerName, true); |
| 4 | 154 | | uri.AppendPath("/backendAddressPools/", false); |
| 4 | 155 | | uri.AppendPath(backendAddressPoolName, true); |
| 4 | 156 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 4 | 157 | | request.Uri = uri; |
| 4 | 158 | | return message; |
| | 159 | | } |
| | 160 | |
|
| | 161 | | /// <summary> Gets load balancer backend address pool. </summary> |
| | 162 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 163 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 164 | | /// <param name="backendAddressPoolName"> The name of the backend address pool. </param> |
| | 165 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 166 | | public async Task<Response<BackendAddressPool>> GetAsync(string resourceGroupName, string loadBalancerName, stri |
| | 167 | | { |
| 2 | 168 | | if (resourceGroupName == null) |
| | 169 | | { |
| 0 | 170 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 171 | | } |
| 2 | 172 | | if (loadBalancerName == null) |
| | 173 | | { |
| 0 | 174 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 175 | | } |
| 2 | 176 | | if (backendAddressPoolName == null) |
| | 177 | | { |
| 0 | 178 | | throw new ArgumentNullException(nameof(backendAddressPoolName)); |
| | 179 | | } |
| | 180 | |
|
| 2 | 181 | | using var message = CreateGetRequest(resourceGroupName, loadBalancerName, backendAddressPoolName); |
| 2 | 182 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 183 | | switch (message.Response.Status) |
| | 184 | | { |
| | 185 | | case 200: |
| | 186 | | { |
| 2 | 187 | | BackendAddressPool value = default; |
| 2 | 188 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 189 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 190 | | { |
| 0 | 191 | | value = null; |
| | 192 | | } |
| | 193 | | else |
| | 194 | | { |
| 2 | 195 | | value = BackendAddressPool.DeserializeBackendAddressPool(document.RootElement); |
| | 196 | | } |
| 2 | 197 | | return Response.FromValue(value, message.Response); |
| | 198 | | } |
| | 199 | | default: |
| 0 | 200 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 201 | | } |
| 2 | 202 | | } |
| | 203 | |
|
| | 204 | | /// <summary> Gets load balancer backend address pool. </summary> |
| | 205 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 206 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 207 | | /// <param name="backendAddressPoolName"> The name of the backend address pool. </param> |
| | 208 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 209 | | public Response<BackendAddressPool> Get(string resourceGroupName, string loadBalancerName, string backendAddress |
| | 210 | | { |
| 2 | 211 | | if (resourceGroupName == null) |
| | 212 | | { |
| 0 | 213 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 214 | | } |
| 2 | 215 | | if (loadBalancerName == null) |
| | 216 | | { |
| 0 | 217 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 218 | | } |
| 2 | 219 | | if (backendAddressPoolName == null) |
| | 220 | | { |
| 0 | 221 | | throw new ArgumentNullException(nameof(backendAddressPoolName)); |
| | 222 | | } |
| | 223 | |
|
| 2 | 224 | | using var message = CreateGetRequest(resourceGroupName, loadBalancerName, backendAddressPoolName); |
| 2 | 225 | | _pipeline.Send(message, cancellationToken); |
| 2 | 226 | | switch (message.Response.Status) |
| | 227 | | { |
| | 228 | | case 200: |
| | 229 | | { |
| 2 | 230 | | BackendAddressPool value = default; |
| 2 | 231 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 232 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 233 | | { |
| 0 | 234 | | value = null; |
| | 235 | | } |
| | 236 | | else |
| | 237 | | { |
| 2 | 238 | | value = BackendAddressPool.DeserializeBackendAddressPool(document.RootElement); |
| | 239 | | } |
| 2 | 240 | | return Response.FromValue(value, message.Response); |
| | 241 | | } |
| | 242 | | default: |
| 0 | 243 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 244 | | } |
| 2 | 245 | | } |
| | 246 | |
|
| | 247 | | internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string loadBalancerName, string backe |
| | 248 | | { |
| 0 | 249 | | var message = _pipeline.CreateMessage(); |
| 0 | 250 | | var request = message.Request; |
| 0 | 251 | | request.Method = RequestMethod.Put; |
| 0 | 252 | | var uri = new RawRequestUriBuilder(); |
| 0 | 253 | | uri.Reset(endpoint); |
| 0 | 254 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 255 | | uri.AppendPath(subscriptionId, true); |
| 0 | 256 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 257 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 258 | | uri.AppendPath("/providers/Microsoft.Network/loadBalancers/", false); |
| 0 | 259 | | uri.AppendPath(loadBalancerName, true); |
| 0 | 260 | | uri.AppendPath("/backendAddressPools/", false); |
| 0 | 261 | | uri.AppendPath(backendAddressPoolName, true); |
| 0 | 262 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 263 | | request.Uri = uri; |
| 0 | 264 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 265 | | var content = new Utf8JsonRequestContent(); |
| 0 | 266 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 267 | | request.Content = content; |
| 0 | 268 | | return message; |
| | 269 | | } |
| | 270 | |
|
| | 271 | | /// <summary> Creates or updates a load balancer backend address pool. </summary> |
| | 272 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 273 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 274 | | /// <param name="backendAddressPoolName"> The name of the backend address pool. </param> |
| | 275 | | /// <param name="parameters"> Parameters supplied to the create or update load balancer backend address pool ope |
| | 276 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 277 | | public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string loadBalancerName, string backen |
| | 278 | | { |
| 0 | 279 | | if (resourceGroupName == null) |
| | 280 | | { |
| 0 | 281 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 282 | | } |
| 0 | 283 | | if (loadBalancerName == null) |
| | 284 | | { |
| 0 | 285 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 286 | | } |
| 0 | 287 | | if (backendAddressPoolName == null) |
| | 288 | | { |
| 0 | 289 | | throw new ArgumentNullException(nameof(backendAddressPoolName)); |
| | 290 | | } |
| 0 | 291 | | if (parameters == null) |
| | 292 | | { |
| 0 | 293 | | throw new ArgumentNullException(nameof(parameters)); |
| | 294 | | } |
| | 295 | |
|
| 0 | 296 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, loadBalancerName, backendAddressPoolName, |
| 0 | 297 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 298 | | switch (message.Response.Status) |
| | 299 | | { |
| | 300 | | case 200: |
| | 301 | | case 201: |
| 0 | 302 | | return message.Response; |
| | 303 | | default: |
| 0 | 304 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 305 | | } |
| 0 | 306 | | } |
| | 307 | |
|
| | 308 | | /// <summary> Creates or updates a load balancer backend address pool. </summary> |
| | 309 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 310 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 311 | | /// <param name="backendAddressPoolName"> The name of the backend address pool. </param> |
| | 312 | | /// <param name="parameters"> Parameters supplied to the create or update load balancer backend address pool ope |
| | 313 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 314 | | public Response CreateOrUpdate(string resourceGroupName, string loadBalancerName, string backendAddressPoolName, |
| | 315 | | { |
| 0 | 316 | | if (resourceGroupName == null) |
| | 317 | | { |
| 0 | 318 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 319 | | } |
| 0 | 320 | | if (loadBalancerName == null) |
| | 321 | | { |
| 0 | 322 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 323 | | } |
| 0 | 324 | | if (backendAddressPoolName == null) |
| | 325 | | { |
| 0 | 326 | | throw new ArgumentNullException(nameof(backendAddressPoolName)); |
| | 327 | | } |
| 0 | 328 | | if (parameters == null) |
| | 329 | | { |
| 0 | 330 | | throw new ArgumentNullException(nameof(parameters)); |
| | 331 | | } |
| | 332 | |
|
| 0 | 333 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, loadBalancerName, backendAddressPoolName, |
| 0 | 334 | | _pipeline.Send(message, cancellationToken); |
| 0 | 335 | | switch (message.Response.Status) |
| | 336 | | { |
| | 337 | | case 200: |
| | 338 | | case 201: |
| 0 | 339 | | return message.Response; |
| | 340 | | default: |
| 0 | 341 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 342 | | } |
| 0 | 343 | | } |
| | 344 | |
|
| | 345 | | internal HttpMessage CreateDeleteRequest(string resourceGroupName, string loadBalancerName, string backendAddres |
| | 346 | | { |
| 0 | 347 | | var message = _pipeline.CreateMessage(); |
| 0 | 348 | | var request = message.Request; |
| 0 | 349 | | request.Method = RequestMethod.Delete; |
| 0 | 350 | | var uri = new RawRequestUriBuilder(); |
| 0 | 351 | | uri.Reset(endpoint); |
| 0 | 352 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 353 | | uri.AppendPath(subscriptionId, true); |
| 0 | 354 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 355 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 356 | | uri.AppendPath("/providers/Microsoft.Network/loadBalancers/", false); |
| 0 | 357 | | uri.AppendPath(loadBalancerName, true); |
| 0 | 358 | | uri.AppendPath("/backendAddressPools/", false); |
| 0 | 359 | | uri.AppendPath(backendAddressPoolName, true); |
| 0 | 360 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 361 | | request.Uri = uri; |
| 0 | 362 | | return message; |
| | 363 | | } |
| | 364 | |
|
| | 365 | | /// <summary> Deletes the specified load balancer backend address pool. </summary> |
| | 366 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 367 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 368 | | /// <param name="backendAddressPoolName"> The name of the backend address pool. </param> |
| | 369 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 370 | | public async Task<Response> DeleteAsync(string resourceGroupName, string loadBalancerName, string backendAddress |
| | 371 | | { |
| 0 | 372 | | if (resourceGroupName == null) |
| | 373 | | { |
| 0 | 374 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 375 | | } |
| 0 | 376 | | if (loadBalancerName == null) |
| | 377 | | { |
| 0 | 378 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 379 | | } |
| 0 | 380 | | if (backendAddressPoolName == null) |
| | 381 | | { |
| 0 | 382 | | throw new ArgumentNullException(nameof(backendAddressPoolName)); |
| | 383 | | } |
| | 384 | |
|
| 0 | 385 | | using var message = CreateDeleteRequest(resourceGroupName, loadBalancerName, backendAddressPoolName); |
| 0 | 386 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 387 | | switch (message.Response.Status) |
| | 388 | | { |
| | 389 | | case 200: |
| | 390 | | case 202: |
| | 391 | | case 204: |
| 0 | 392 | | return message.Response; |
| | 393 | | default: |
| 0 | 394 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 395 | | } |
| 0 | 396 | | } |
| | 397 | |
|
| | 398 | | /// <summary> Deletes the specified load balancer backend address pool. </summary> |
| | 399 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 400 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 401 | | /// <param name="backendAddressPoolName"> The name of the backend address pool. </param> |
| | 402 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 403 | | public Response Delete(string resourceGroupName, string loadBalancerName, string backendAddressPoolName, Cancell |
| | 404 | | { |
| 0 | 405 | | if (resourceGroupName == null) |
| | 406 | | { |
| 0 | 407 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 408 | | } |
| 0 | 409 | | if (loadBalancerName == null) |
| | 410 | | { |
| 0 | 411 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 412 | | } |
| 0 | 413 | | if (backendAddressPoolName == null) |
| | 414 | | { |
| 0 | 415 | | throw new ArgumentNullException(nameof(backendAddressPoolName)); |
| | 416 | | } |
| | 417 | |
|
| 0 | 418 | | using var message = CreateDeleteRequest(resourceGroupName, loadBalancerName, backendAddressPoolName); |
| 0 | 419 | | _pipeline.Send(message, cancellationToken); |
| 0 | 420 | | switch (message.Response.Status) |
| | 421 | | { |
| | 422 | | case 200: |
| | 423 | | case 202: |
| | 424 | | case 204: |
| 0 | 425 | | return message.Response; |
| | 426 | | default: |
| 0 | 427 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 428 | | } |
| 0 | 429 | | } |
| | 430 | |
|
| | 431 | | internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName, string loadBalancerNam |
| | 432 | | { |
| 0 | 433 | | var message = _pipeline.CreateMessage(); |
| 0 | 434 | | var request = message.Request; |
| 0 | 435 | | request.Method = RequestMethod.Get; |
| 0 | 436 | | var uri = new RawRequestUriBuilder(); |
| 0 | 437 | | uri.Reset(endpoint); |
| 0 | 438 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 439 | | request.Uri = uri; |
| 0 | 440 | | return message; |
| | 441 | | } |
| | 442 | |
|
| | 443 | | /// <summary> Gets all the load balancer backed address pools. </summary> |
| | 444 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 445 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 446 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 447 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 448 | | public async Task<Response<LoadBalancerBackendAddressPoolListResult>> ListNextPageAsync(string nextLink, string |
| | 449 | | { |
| 0 | 450 | | if (nextLink == null) |
| | 451 | | { |
| 0 | 452 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 453 | | } |
| 0 | 454 | | if (resourceGroupName == null) |
| | 455 | | { |
| 0 | 456 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 457 | | } |
| 0 | 458 | | if (loadBalancerName == null) |
| | 459 | | { |
| 0 | 460 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 461 | | } |
| | 462 | |
|
| 0 | 463 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName, loadBalancerName); |
| 0 | 464 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 465 | | switch (message.Response.Status) |
| | 466 | | { |
| | 467 | | case 200: |
| | 468 | | { |
| 0 | 469 | | LoadBalancerBackendAddressPoolListResult value = default; |
| 0 | 470 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 471 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 472 | | { |
| 0 | 473 | | value = null; |
| | 474 | | } |
| | 475 | | else |
| | 476 | | { |
| 0 | 477 | | value = LoadBalancerBackendAddressPoolListResult.DeserializeLoadBalancerBackendAddressPoolLi |
| | 478 | | } |
| 0 | 479 | | return Response.FromValue(value, message.Response); |
| | 480 | | } |
| | 481 | | default: |
| 0 | 482 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 483 | | } |
| 0 | 484 | | } |
| | 485 | |
|
| | 486 | | /// <summary> Gets all the load balancer backed address pools. </summary> |
| | 487 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 488 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 489 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | 490 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 491 | | public Response<LoadBalancerBackendAddressPoolListResult> ListNextPage(string nextLink, string resourceGroupName |
| | 492 | | { |
| 0 | 493 | | if (nextLink == null) |
| | 494 | | { |
| 0 | 495 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 496 | | } |
| 0 | 497 | | if (resourceGroupName == null) |
| | 498 | | { |
| 0 | 499 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 500 | | } |
| 0 | 501 | | if (loadBalancerName == null) |
| | 502 | | { |
| 0 | 503 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | 504 | | } |
| | 505 | |
|
| 0 | 506 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName, loadBalancerName); |
| 0 | 507 | | _pipeline.Send(message, cancellationToken); |
| 0 | 508 | | switch (message.Response.Status) |
| | 509 | | { |
| | 510 | | case 200: |
| | 511 | | { |
| 0 | 512 | | LoadBalancerBackendAddressPoolListResult value = default; |
| 0 | 513 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 514 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 515 | | { |
| 0 | 516 | | value = null; |
| | 517 | | } |
| | 518 | | else |
| | 519 | | { |
| 0 | 520 | | value = LoadBalancerBackendAddressPoolListResult.DeserializeLoadBalancerBackendAddressPoolLi |
| | 521 | | } |
| 0 | 522 | | return Response.FromValue(value, message.Response); |
| | 523 | | } |
| | 524 | | default: |
| 0 | 525 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 526 | | } |
| 0 | 527 | | } |
| | 528 | | } |
| | 529 | | } |