1package containerservice 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "github.com/Azure/go-autorest/autorest/validation" 25 "github.com/Azure/go-autorest/tracing" 26 "net/http" 27) 28 29// ContainerServicesClient is the compute Client 30type ContainerServicesClient struct { 31 BaseClient 32} 33 34// NewContainerServicesClient creates an instance of the ContainerServicesClient client. 35func NewContainerServicesClient(subscriptionID string) ContainerServicesClient { 36 return NewContainerServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) 37} 38 39// NewContainerServicesClientWithBaseURI creates an instance of the ContainerServicesClient client using a custom 40// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure 41// stack). 42func NewContainerServicesClientWithBaseURI(baseURI string, subscriptionID string) ContainerServicesClient { 43 return ContainerServicesClient{NewWithBaseURI(baseURI, subscriptionID)} 44} 45 46// CreateOrUpdate creates or updates a container service with the specified configuration of orchestrator, masters, and 47// agents. 48// Parameters: 49// resourceGroupName - the name of the resource group. 50// containerServiceName - the name of the container service in the specified subscription and resource group. 51// parameters - parameters supplied to the Create or Update a Container Service operation. 52func (client ContainerServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, containerServiceName string, parameters ContainerService) (result ContainerServicesCreateOrUpdateFutureType, err error) { 53 if tracing.IsEnabled() { 54 ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.CreateOrUpdate") 55 defer func() { 56 sc := -1 57 if result.Response() != nil { 58 sc = result.Response().StatusCode 59 } 60 tracing.EndSpan(ctx, sc, err) 61 }() 62 } 63 if err := validation.Validate([]validation.Validation{ 64 {TargetValue: parameters, 65 Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: false, 66 Chain: []validation.Constraint{{Target: "parameters.Properties.CustomProfile", Name: validation.Null, Rule: false, 67 Chain: []validation.Constraint{{Target: "parameters.Properties.CustomProfile.Orchestrator", Name: validation.Null, Rule: true, Chain: nil}}}, 68 {Target: "parameters.Properties.ServicePrincipalProfile", Name: validation.Null, Rule: false, 69 Chain: []validation.Constraint{{Target: "parameters.Properties.ServicePrincipalProfile.ClientID", Name: validation.Null, Rule: true, Chain: nil}, 70 {Target: "parameters.Properties.ServicePrincipalProfile.Secret", Name: validation.Null, Rule: true, Chain: nil}, 71 }}, 72 {Target: "parameters.Properties.MasterProfile", Name: validation.Null, Rule: true, 73 Chain: []validation.Constraint{{Target: "parameters.Properties.MasterProfile.DNSPrefix", Name: validation.Null, Rule: true, Chain: nil}}}, 74 {Target: "parameters.Properties.AgentPoolProfiles", Name: validation.Null, Rule: true, Chain: nil}, 75 {Target: "parameters.Properties.WindowsProfile", Name: validation.Null, Rule: false, 76 Chain: []validation.Constraint{{Target: "parameters.Properties.WindowsProfile.AdminUsername", Name: validation.Null, Rule: true, 77 Chain: []validation.Constraint{{Target: "parameters.Properties.WindowsProfile.AdminUsername", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$`, Chain: nil}}}, 78 {Target: "parameters.Properties.WindowsProfile.AdminPassword", Name: validation.Null, Rule: true, Chain: nil}, 79 }}, 80 {Target: "parameters.Properties.LinuxProfile", Name: validation.Null, Rule: true, 81 Chain: []validation.Constraint{{Target: "parameters.Properties.LinuxProfile.AdminUsername", Name: validation.Null, Rule: true, 82 Chain: []validation.Constraint{{Target: "parameters.Properties.LinuxProfile.AdminUsername", Name: validation.Pattern, Rule: `^[a-z][a-z0-9_-]*$`, Chain: nil}}}, 83 {Target: "parameters.Properties.LinuxProfile.SSH", Name: validation.Null, Rule: true, 84 Chain: []validation.Constraint{{Target: "parameters.Properties.LinuxProfile.SSH.PublicKeys", Name: validation.Null, Rule: true, Chain: nil}}}, 85 }}, 86 {Target: "parameters.Properties.DiagnosticsProfile", Name: validation.Null, Rule: false, 87 Chain: []validation.Constraint{{Target: "parameters.Properties.DiagnosticsProfile.VMDiagnostics", Name: validation.Null, Rule: true, 88 Chain: []validation.Constraint{{Target: "parameters.Properties.DiagnosticsProfile.VMDiagnostics.Enabled", Name: validation.Null, Rule: true, Chain: nil}}}, 89 }}, 90 }}}}}); err != nil { 91 return result, validation.NewError("containerservice.ContainerServicesClient", "CreateOrUpdate", err.Error()) 92 } 93 94 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, containerServiceName, parameters) 95 if err != nil { 96 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "CreateOrUpdate", nil, "Failure preparing request") 97 return 98 } 99 100 result, err = client.CreateOrUpdateSender(req) 101 if err != nil { 102 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "CreateOrUpdate", nil, "Failure sending request") 103 return 104 } 105 106 return 107} 108 109// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 110func (client ContainerServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, containerServiceName string, parameters ContainerService) (*http.Request, error) { 111 pathParameters := map[string]interface{}{ 112 "containerServiceName": autorest.Encode("path", containerServiceName), 113 "resourceGroupName": autorest.Encode("path", resourceGroupName), 114 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 115 } 116 117 const APIVersion = "2016-09-30" 118 queryParameters := map[string]interface{}{ 119 "api-version": APIVersion, 120 } 121 122 preparer := autorest.CreatePreparer( 123 autorest.AsContentType("application/json; charset=utf-8"), 124 autorest.AsPut(), 125 autorest.WithBaseURL(client.BaseURI), 126 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters), 127 autorest.WithJSON(parameters), 128 autorest.WithQueryParameters(queryParameters)) 129 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 130} 131 132// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 133// http.Response Body if it receives an error. 134func (client ContainerServicesClient) CreateOrUpdateSender(req *http.Request) (future ContainerServicesCreateOrUpdateFutureType, err error) { 135 var resp *http.Response 136 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 137 if err != nil { 138 return 139 } 140 var azf azure.Future 141 azf, err = azure.NewFutureFromResponse(resp) 142 future.FutureAPI = &azf 143 future.Result = func(client ContainerServicesClient) (cs ContainerService, err error) { 144 var done bool 145 done, err = future.DoneWithContext(context.Background(), client) 146 if err != nil { 147 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesCreateOrUpdateFutureType", "Result", future.Response(), "Polling failure") 148 return 149 } 150 if !done { 151 err = azure.NewAsyncOpIncompleteError("containerservice.ContainerServicesCreateOrUpdateFutureType") 152 return 153 } 154 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 155 if cs.Response.Response, err = future.GetResult(sender); err == nil && cs.Response.Response.StatusCode != http.StatusNoContent { 156 cs, err = client.CreateOrUpdateResponder(cs.Response.Response) 157 if err != nil { 158 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesCreateOrUpdateFutureType", "Result", cs.Response.Response, "Failure responding to request") 159 } 160 } 161 return 162 } 163 return 164} 165 166// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 167// closes the http.Response Body. 168func (client ContainerServicesClient) CreateOrUpdateResponder(resp *http.Response) (result ContainerService, err error) { 169 err = autorest.Respond( 170 resp, 171 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), 172 autorest.ByUnmarshallingJSON(&result), 173 autorest.ByClosing()) 174 result.Response = autorest.Response{Response: resp} 175 return 176} 177 178// Delete deletes the specified container service in the specified subscription and resource group. The operation does 179// not delete other resources created as part of creating a container service, including storage accounts, VMs, and 180// availability sets. All the other resources created with the container service are part of the same resource group 181// and can be deleted individually. 182// Parameters: 183// resourceGroupName - the name of the resource group. 184// containerServiceName - the name of the container service in the specified subscription and resource group. 185func (client ContainerServicesClient) Delete(ctx context.Context, resourceGroupName string, containerServiceName string) (result ContainerServicesDeleteFutureType, err error) { 186 if tracing.IsEnabled() { 187 ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.Delete") 188 defer func() { 189 sc := -1 190 if result.Response() != nil { 191 sc = result.Response().StatusCode 192 } 193 tracing.EndSpan(ctx, sc, err) 194 }() 195 } 196 req, err := client.DeletePreparer(ctx, resourceGroupName, containerServiceName) 197 if err != nil { 198 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Delete", nil, "Failure preparing request") 199 return 200 } 201 202 result, err = client.DeleteSender(req) 203 if err != nil { 204 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Delete", nil, "Failure sending request") 205 return 206 } 207 208 return 209} 210 211// DeletePreparer prepares the Delete request. 212func (client ContainerServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, containerServiceName string) (*http.Request, error) { 213 pathParameters := map[string]interface{}{ 214 "containerServiceName": autorest.Encode("path", containerServiceName), 215 "resourceGroupName": autorest.Encode("path", resourceGroupName), 216 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 217 } 218 219 const APIVersion = "2016-09-30" 220 queryParameters := map[string]interface{}{ 221 "api-version": APIVersion, 222 } 223 224 preparer := autorest.CreatePreparer( 225 autorest.AsDelete(), 226 autorest.WithBaseURL(client.BaseURI), 227 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters), 228 autorest.WithQueryParameters(queryParameters)) 229 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 230} 231 232// DeleteSender sends the Delete request. The method will close the 233// http.Response Body if it receives an error. 234func (client ContainerServicesClient) DeleteSender(req *http.Request) (future ContainerServicesDeleteFutureType, err error) { 235 var resp *http.Response 236 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 237 if err != nil { 238 return 239 } 240 var azf azure.Future 241 azf, err = azure.NewFutureFromResponse(resp) 242 future.FutureAPI = &azf 243 future.Result = func(client ContainerServicesClient) (ar autorest.Response, err error) { 244 var done bool 245 done, err = future.DoneWithContext(context.Background(), client) 246 if err != nil { 247 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesDeleteFutureType", "Result", future.Response(), "Polling failure") 248 return 249 } 250 if !done { 251 err = azure.NewAsyncOpIncompleteError("containerservice.ContainerServicesDeleteFutureType") 252 return 253 } 254 ar.Response = future.Response() 255 return 256 } 257 return 258} 259 260// DeleteResponder handles the response to the Delete request. The method always 261// closes the http.Response Body. 262func (client ContainerServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { 263 err = autorest.Respond( 264 resp, 265 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), 266 autorest.ByClosing()) 267 result.Response = resp 268 return 269} 270 271// Get gets the properties of the specified container service in the specified subscription and resource group. The 272// operation returns the properties including state, orchestrator, number of masters and agents, and FQDNs of masters 273// and agents. 274// Parameters: 275// resourceGroupName - the name of the resource group. 276// containerServiceName - the name of the container service in the specified subscription and resource group. 277func (client ContainerServicesClient) Get(ctx context.Context, resourceGroupName string, containerServiceName string) (result ContainerService, err error) { 278 if tracing.IsEnabled() { 279 ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.Get") 280 defer func() { 281 sc := -1 282 if result.Response.Response != nil { 283 sc = result.Response.Response.StatusCode 284 } 285 tracing.EndSpan(ctx, sc, err) 286 }() 287 } 288 req, err := client.GetPreparer(ctx, resourceGroupName, containerServiceName) 289 if err != nil { 290 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Get", nil, "Failure preparing request") 291 return 292 } 293 294 resp, err := client.GetSender(req) 295 if err != nil { 296 result.Response = autorest.Response{Response: resp} 297 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Get", resp, "Failure sending request") 298 return 299 } 300 301 result, err = client.GetResponder(resp) 302 if err != nil { 303 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "Get", resp, "Failure responding to request") 304 return 305 } 306 307 return 308} 309 310// GetPreparer prepares the Get request. 311func (client ContainerServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, containerServiceName string) (*http.Request, error) { 312 pathParameters := map[string]interface{}{ 313 "containerServiceName": autorest.Encode("path", containerServiceName), 314 "resourceGroupName": autorest.Encode("path", resourceGroupName), 315 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 316 } 317 318 const APIVersion = "2016-09-30" 319 queryParameters := map[string]interface{}{ 320 "api-version": APIVersion, 321 } 322 323 preparer := autorest.CreatePreparer( 324 autorest.AsGet(), 325 autorest.WithBaseURL(client.BaseURI), 326 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", pathParameters), 327 autorest.WithQueryParameters(queryParameters)) 328 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 329} 330 331// GetSender sends the Get request. The method will close the 332// http.Response Body if it receives an error. 333func (client ContainerServicesClient) GetSender(req *http.Request) (*http.Response, error) { 334 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 335} 336 337// GetResponder handles the response to the Get request. The method always 338// closes the http.Response Body. 339func (client ContainerServicesClient) GetResponder(resp *http.Response) (result ContainerService, err error) { 340 err = autorest.Respond( 341 resp, 342 azure.WithErrorUnlessStatusCode(http.StatusOK), 343 autorest.ByUnmarshallingJSON(&result), 344 autorest.ByClosing()) 345 result.Response = autorest.Response{Response: resp} 346 return 347} 348 349// List gets a list of container services in the specified subscription. The operation returns properties of each 350// container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. 351func (client ContainerServicesClient) List(ctx context.Context) (result ListResultPage, err error) { 352 if tracing.IsEnabled() { 353 ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.List") 354 defer func() { 355 sc := -1 356 if result.lr.Response.Response != nil { 357 sc = result.lr.Response.Response.StatusCode 358 } 359 tracing.EndSpan(ctx, sc, err) 360 }() 361 } 362 result.fn = client.listNextResults 363 req, err := client.ListPreparer(ctx) 364 if err != nil { 365 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "List", nil, "Failure preparing request") 366 return 367 } 368 369 resp, err := client.ListSender(req) 370 if err != nil { 371 result.lr.Response = autorest.Response{Response: resp} 372 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "List", resp, "Failure sending request") 373 return 374 } 375 376 result.lr, err = client.ListResponder(resp) 377 if err != nil { 378 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "List", resp, "Failure responding to request") 379 return 380 } 381 if result.lr.hasNextLink() && result.lr.IsEmpty() { 382 err = result.NextWithContext(ctx) 383 return 384 } 385 386 return 387} 388 389// ListPreparer prepares the List request. 390func (client ContainerServicesClient) ListPreparer(ctx context.Context) (*http.Request, error) { 391 pathParameters := map[string]interface{}{ 392 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 393 } 394 395 const APIVersion = "2016-09-30" 396 queryParameters := map[string]interface{}{ 397 "api-version": APIVersion, 398 } 399 400 preparer := autorest.CreatePreparer( 401 autorest.AsGet(), 402 autorest.WithBaseURL(client.BaseURI), 403 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/containerServices", pathParameters), 404 autorest.WithQueryParameters(queryParameters)) 405 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 406} 407 408// ListSender sends the List request. The method will close the 409// http.Response Body if it receives an error. 410func (client ContainerServicesClient) ListSender(req *http.Request) (*http.Response, error) { 411 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 412} 413 414// ListResponder handles the response to the List request. The method always 415// closes the http.Response Body. 416func (client ContainerServicesClient) ListResponder(resp *http.Response) (result ListResult, err error) { 417 err = autorest.Respond( 418 resp, 419 azure.WithErrorUnlessStatusCode(http.StatusOK), 420 autorest.ByUnmarshallingJSON(&result), 421 autorest.ByClosing()) 422 result.Response = autorest.Response{Response: resp} 423 return 424} 425 426// listNextResults retrieves the next set of results, if any. 427func (client ContainerServicesClient) listNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { 428 req, err := lastResults.listResultPreparer(ctx) 429 if err != nil { 430 return result, autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "listNextResults", nil, "Failure preparing next results request") 431 } 432 if req == nil { 433 return 434 } 435 resp, err := client.ListSender(req) 436 if err != nil { 437 result.Response = autorest.Response{Response: resp} 438 return result, autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "listNextResults", resp, "Failure sending next results request") 439 } 440 result, err = client.ListResponder(resp) 441 if err != nil { 442 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "listNextResults", resp, "Failure responding to next results request") 443 } 444 return 445} 446 447// ListComplete enumerates all values, automatically crossing page boundaries as required. 448func (client ContainerServicesClient) ListComplete(ctx context.Context) (result ListResultIterator, err error) { 449 if tracing.IsEnabled() { 450 ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.List") 451 defer func() { 452 sc := -1 453 if result.Response().Response.Response != nil { 454 sc = result.page.Response().Response.Response.StatusCode 455 } 456 tracing.EndSpan(ctx, sc, err) 457 }() 458 } 459 result.page, err = client.List(ctx) 460 return 461} 462 463// ListByResourceGroup gets a list of container services in the specified subscription and resource group. The 464// operation returns properties of each container service including state, orchestrator, number of masters and agents, 465// and FQDNs of masters and agents. 466// Parameters: 467// resourceGroupName - the name of the resource group. 468func (client ContainerServicesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ListResultPage, err error) { 469 if tracing.IsEnabled() { 470 ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.ListByResourceGroup") 471 defer func() { 472 sc := -1 473 if result.lr.Response.Response != nil { 474 sc = result.lr.Response.Response.StatusCode 475 } 476 tracing.EndSpan(ctx, sc, err) 477 }() 478 } 479 result.fn = client.listByResourceGroupNextResults 480 req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) 481 if err != nil { 482 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListByResourceGroup", nil, "Failure preparing request") 483 return 484 } 485 486 resp, err := client.ListByResourceGroupSender(req) 487 if err != nil { 488 result.lr.Response = autorest.Response{Response: resp} 489 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListByResourceGroup", resp, "Failure sending request") 490 return 491 } 492 493 result.lr, err = client.ListByResourceGroupResponder(resp) 494 if err != nil { 495 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "ListByResourceGroup", resp, "Failure responding to request") 496 return 497 } 498 if result.lr.hasNextLink() && result.lr.IsEmpty() { 499 err = result.NextWithContext(ctx) 500 return 501 } 502 503 return 504} 505 506// ListByResourceGroupPreparer prepares the ListByResourceGroup request. 507func (client ContainerServicesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { 508 pathParameters := map[string]interface{}{ 509 "resourceGroupName": autorest.Encode("path", resourceGroupName), 510 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 511 } 512 513 const APIVersion = "2016-09-30" 514 queryParameters := map[string]interface{}{ 515 "api-version": APIVersion, 516 } 517 518 preparer := autorest.CreatePreparer( 519 autorest.AsGet(), 520 autorest.WithBaseURL(client.BaseURI), 521 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices", pathParameters), 522 autorest.WithQueryParameters(queryParameters)) 523 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 524} 525 526// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the 527// http.Response Body if it receives an error. 528func (client ContainerServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { 529 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 530} 531 532// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always 533// closes the http.Response Body. 534func (client ContainerServicesClient) ListByResourceGroupResponder(resp *http.Response) (result ListResult, err error) { 535 err = autorest.Respond( 536 resp, 537 azure.WithErrorUnlessStatusCode(http.StatusOK), 538 autorest.ByUnmarshallingJSON(&result), 539 autorest.ByClosing()) 540 result.Response = autorest.Response{Response: resp} 541 return 542} 543 544// listByResourceGroupNextResults retrieves the next set of results, if any. 545func (client ContainerServicesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { 546 req, err := lastResults.listResultPreparer(ctx) 547 if err != nil { 548 return result, autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") 549 } 550 if req == nil { 551 return 552 } 553 resp, err := client.ListByResourceGroupSender(req) 554 if err != nil { 555 result.Response = autorest.Response{Response: resp} 556 return result, autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") 557 } 558 result, err = client.ListByResourceGroupResponder(resp) 559 if err != nil { 560 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") 561 } 562 return 563} 564 565// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. 566func (client ContainerServicesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ListResultIterator, err error) { 567 if tracing.IsEnabled() { 568 ctx = tracing.StartSpan(ctx, fqdn+"/ContainerServicesClient.ListByResourceGroup") 569 defer func() { 570 sc := -1 571 if result.Response().Response.Response != nil { 572 sc = result.page.Response().Response.Response.StatusCode 573 } 574 tracing.EndSpan(ctx, sc, err) 575 }() 576 } 577 result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) 578 return 579} 580