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