1package batch 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 "encoding/json" 23 "github.com/Azure/go-autorest/autorest" 24 "github.com/Azure/go-autorest/autorest/azure" 25 "github.com/Azure/go-autorest/autorest/date" 26 "github.com/Azure/go-autorest/autorest/to" 27 "github.com/Azure/go-autorest/tracing" 28 "net/http" 29) 30 31// The package's fully qualified name. 32const fqdn = "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2015-12-01/batch" 33 34// AccountKeyType enumerates the values for account key type. 35type AccountKeyType string 36 37const ( 38 // Primary ... 39 Primary AccountKeyType = "Primary" 40 // Secondary ... 41 Secondary AccountKeyType = "Secondary" 42) 43 44// PossibleAccountKeyTypeValues returns an array of possible values for the AccountKeyType const type. 45func PossibleAccountKeyTypeValues() []AccountKeyType { 46 return []AccountKeyType{Primary, Secondary} 47} 48 49// PackageState enumerates the values for package state. 50type PackageState string 51 52const ( 53 // Active ... 54 Active PackageState = "active" 55 // Pending ... 56 Pending PackageState = "pending" 57 // Unmapped ... 58 Unmapped PackageState = "unmapped" 59) 60 61// PossiblePackageStateValues returns an array of possible values for the PackageState const type. 62func PossiblePackageStateValues() []PackageState { 63 return []PackageState{Active, Pending, Unmapped} 64} 65 66// ProvisioningState enumerates the values for provisioning state. 67type ProvisioningState string 68 69const ( 70 // Cancelled ... 71 Cancelled ProvisioningState = "Cancelled" 72 // Creating ... 73 Creating ProvisioningState = "Creating" 74 // Deleting ... 75 Deleting ProvisioningState = "Deleting" 76 // Failed ... 77 Failed ProvisioningState = "Failed" 78 // Invalid ... 79 Invalid ProvisioningState = "Invalid" 80 // Succeeded ... 81 Succeeded ProvisioningState = "Succeeded" 82) 83 84// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. 85func PossibleProvisioningStateValues() []ProvisioningState { 86 return []ProvisioningState{Cancelled, Creating, Deleting, Failed, Invalid, Succeeded} 87} 88 89// Account contains information about an Azure Batch account. 90type Account struct { 91 autorest.Response `json:"-"` 92 // AccountProperties - The properties associated with the account. 93 *AccountProperties `json:"properties,omitempty"` 94 // ID - READ-ONLY; The ID of the resource 95 ID *string `json:"id,omitempty"` 96 // Name - READ-ONLY; The name of the resource 97 Name *string `json:"name,omitempty"` 98 // Type - READ-ONLY; The type of the resource 99 Type *string `json:"type,omitempty"` 100 // Location - The location of the resource 101 Location *string `json:"location,omitempty"` 102 // Tags - The tags of the resource 103 Tags map[string]*string `json:"tags"` 104} 105 106// MarshalJSON is the custom marshaler for Account. 107func (a Account) MarshalJSON() ([]byte, error) { 108 objectMap := make(map[string]interface{}) 109 if a.AccountProperties != nil { 110 objectMap["properties"] = a.AccountProperties 111 } 112 if a.Location != nil { 113 objectMap["location"] = a.Location 114 } 115 if a.Tags != nil { 116 objectMap["tags"] = a.Tags 117 } 118 return json.Marshal(objectMap) 119} 120 121// UnmarshalJSON is the custom unmarshaler for Account struct. 122func (a *Account) UnmarshalJSON(body []byte) error { 123 var m map[string]*json.RawMessage 124 err := json.Unmarshal(body, &m) 125 if err != nil { 126 return err 127 } 128 for k, v := range m { 129 switch k { 130 case "properties": 131 if v != nil { 132 var accountProperties AccountProperties 133 err = json.Unmarshal(*v, &accountProperties) 134 if err != nil { 135 return err 136 } 137 a.AccountProperties = &accountProperties 138 } 139 case "id": 140 if v != nil { 141 var ID string 142 err = json.Unmarshal(*v, &ID) 143 if err != nil { 144 return err 145 } 146 a.ID = &ID 147 } 148 case "name": 149 if v != nil { 150 var name string 151 err = json.Unmarshal(*v, &name) 152 if err != nil { 153 return err 154 } 155 a.Name = &name 156 } 157 case "type": 158 if v != nil { 159 var typeVar string 160 err = json.Unmarshal(*v, &typeVar) 161 if err != nil { 162 return err 163 } 164 a.Type = &typeVar 165 } 166 case "location": 167 if v != nil { 168 var location string 169 err = json.Unmarshal(*v, &location) 170 if err != nil { 171 return err 172 } 173 a.Location = &location 174 } 175 case "tags": 176 if v != nil { 177 var tags map[string]*string 178 err = json.Unmarshal(*v, &tags) 179 if err != nil { 180 return err 181 } 182 a.Tags = tags 183 } 184 } 185 } 186 187 return nil 188} 189 190// AccountBaseProperties the properties of a Batch account. 191type AccountBaseProperties struct { 192 // AutoStorage - The properties related to auto storage account. 193 AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` 194} 195 196// AccountCreateFuture an abstraction for monitoring and retrieving the results of a long-running 197// operation. 198type AccountCreateFuture struct { 199 azure.Future 200} 201 202// Result returns the result of the asynchronous operation. 203// If the operation has not completed it will return an error. 204func (future *AccountCreateFuture) Result(client AccountClient) (a Account, err error) { 205 var done bool 206 done, err = future.DoneWithContext(context.Background(), client) 207 if err != nil { 208 err = autorest.NewErrorWithError(err, "batch.AccountCreateFuture", "Result", future.Response(), "Polling failure") 209 return 210 } 211 if !done { 212 err = azure.NewAsyncOpIncompleteError("batch.AccountCreateFuture") 213 return 214 } 215 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 216 if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { 217 a, err = client.CreateResponder(a.Response.Response) 218 if err != nil { 219 err = autorest.NewErrorWithError(err, "batch.AccountCreateFuture", "Result", a.Response.Response, "Failure responding to request") 220 } 221 } 222 return 223} 224 225// AccountCreateParameters parameters supplied to the Create operation. 226type AccountCreateParameters struct { 227 // Location - The region in which to create the account. 228 Location *string `json:"location,omitempty"` 229 // Tags - The user specified tags associated with the account. 230 Tags map[string]*string `json:"tags"` 231 // AccountBaseProperties - The properties of the account. 232 *AccountBaseProperties `json:"properties,omitempty"` 233} 234 235// MarshalJSON is the custom marshaler for AccountCreateParameters. 236func (acp AccountCreateParameters) MarshalJSON() ([]byte, error) { 237 objectMap := make(map[string]interface{}) 238 if acp.Location != nil { 239 objectMap["location"] = acp.Location 240 } 241 if acp.Tags != nil { 242 objectMap["tags"] = acp.Tags 243 } 244 if acp.AccountBaseProperties != nil { 245 objectMap["properties"] = acp.AccountBaseProperties 246 } 247 return json.Marshal(objectMap) 248} 249 250// UnmarshalJSON is the custom unmarshaler for AccountCreateParameters struct. 251func (acp *AccountCreateParameters) UnmarshalJSON(body []byte) error { 252 var m map[string]*json.RawMessage 253 err := json.Unmarshal(body, &m) 254 if err != nil { 255 return err 256 } 257 for k, v := range m { 258 switch k { 259 case "location": 260 if v != nil { 261 var location string 262 err = json.Unmarshal(*v, &location) 263 if err != nil { 264 return err 265 } 266 acp.Location = &location 267 } 268 case "tags": 269 if v != nil { 270 var tags map[string]*string 271 err = json.Unmarshal(*v, &tags) 272 if err != nil { 273 return err 274 } 275 acp.Tags = tags 276 } 277 case "properties": 278 if v != nil { 279 var accountBaseProperties AccountBaseProperties 280 err = json.Unmarshal(*v, &accountBaseProperties) 281 if err != nil { 282 return err 283 } 284 acp.AccountBaseProperties = &accountBaseProperties 285 } 286 } 287 } 288 289 return nil 290} 291 292// AccountDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 293// operation. 294type AccountDeleteFuture struct { 295 azure.Future 296} 297 298// Result returns the result of the asynchronous operation. 299// If the operation has not completed it will return an error. 300func (future *AccountDeleteFuture) Result(client AccountClient) (ar autorest.Response, err error) { 301 var done bool 302 done, err = future.DoneWithContext(context.Background(), client) 303 if err != nil { 304 err = autorest.NewErrorWithError(err, "batch.AccountDeleteFuture", "Result", future.Response(), "Polling failure") 305 return 306 } 307 if !done { 308 err = azure.NewAsyncOpIncompleteError("batch.AccountDeleteFuture") 309 return 310 } 311 ar.Response = future.Response() 312 return 313} 314 315// AccountKeys a set of Azure Batch account keys. 316type AccountKeys struct { 317 autorest.Response `json:"-"` 318 // Primary - The primary key associated with the account. 319 Primary *string `json:"primary,omitempty"` 320 // Secondary - The secondary key associated with the account. 321 Secondary *string `json:"secondary,omitempty"` 322} 323 324// AccountListResult values returned by the List operation. 325type AccountListResult struct { 326 autorest.Response `json:"-"` 327 // Value - The collection of returned Batch accounts. 328 Value *[]Account `json:"value,omitempty"` 329 // NextLink - The continuation token. 330 NextLink *string `json:"nextLink,omitempty"` 331} 332 333// AccountListResultIterator provides access to a complete listing of Account values. 334type AccountListResultIterator struct { 335 i int 336 page AccountListResultPage 337} 338 339// NextWithContext advances to the next value. If there was an error making 340// the request the iterator does not advance and the error is returned. 341func (iter *AccountListResultIterator) NextWithContext(ctx context.Context) (err error) { 342 if tracing.IsEnabled() { 343 ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultIterator.NextWithContext") 344 defer func() { 345 sc := -1 346 if iter.Response().Response.Response != nil { 347 sc = iter.Response().Response.Response.StatusCode 348 } 349 tracing.EndSpan(ctx, sc, err) 350 }() 351 } 352 iter.i++ 353 if iter.i < len(iter.page.Values()) { 354 return nil 355 } 356 err = iter.page.NextWithContext(ctx) 357 if err != nil { 358 iter.i-- 359 return err 360 } 361 iter.i = 0 362 return nil 363} 364 365// Next advances to the next value. If there was an error making 366// the request the iterator does not advance and the error is returned. 367// Deprecated: Use NextWithContext() instead. 368func (iter *AccountListResultIterator) Next() error { 369 return iter.NextWithContext(context.Background()) 370} 371 372// NotDone returns true if the enumeration should be started or is not yet complete. 373func (iter AccountListResultIterator) NotDone() bool { 374 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 375} 376 377// Response returns the raw server response from the last page request. 378func (iter AccountListResultIterator) Response() AccountListResult { 379 return iter.page.Response() 380} 381 382// Value returns the current value or a zero-initialized value if the 383// iterator has advanced beyond the end of the collection. 384func (iter AccountListResultIterator) Value() Account { 385 if !iter.page.NotDone() { 386 return Account{} 387 } 388 return iter.page.Values()[iter.i] 389} 390 391// Creates a new instance of the AccountListResultIterator type. 392func NewAccountListResultIterator(page AccountListResultPage) AccountListResultIterator { 393 return AccountListResultIterator{page: page} 394} 395 396// IsEmpty returns true if the ListResult contains no values. 397func (alr AccountListResult) IsEmpty() bool { 398 return alr.Value == nil || len(*alr.Value) == 0 399} 400 401// accountListResultPreparer prepares a request to retrieve the next set of results. 402// It returns nil if no more results exist. 403func (alr AccountListResult) accountListResultPreparer(ctx context.Context) (*http.Request, error) { 404 if alr.NextLink == nil || len(to.String(alr.NextLink)) < 1 { 405 return nil, nil 406 } 407 return autorest.Prepare((&http.Request{}).WithContext(ctx), 408 autorest.AsJSON(), 409 autorest.AsGet(), 410 autorest.WithBaseURL(to.String(alr.NextLink))) 411} 412 413// AccountListResultPage contains a page of Account values. 414type AccountListResultPage struct { 415 fn func(context.Context, AccountListResult) (AccountListResult, error) 416 alr AccountListResult 417} 418 419// NextWithContext advances to the next page of values. If there was an error making 420// the request the page does not advance and the error is returned. 421func (page *AccountListResultPage) NextWithContext(ctx context.Context) (err error) { 422 if tracing.IsEnabled() { 423 ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultPage.NextWithContext") 424 defer func() { 425 sc := -1 426 if page.Response().Response.Response != nil { 427 sc = page.Response().Response.Response.StatusCode 428 } 429 tracing.EndSpan(ctx, sc, err) 430 }() 431 } 432 next, err := page.fn(ctx, page.alr) 433 if err != nil { 434 return err 435 } 436 page.alr = next 437 return nil 438} 439 440// Next advances to the next page of values. If there was an error making 441// the request the page does not advance and the error is returned. 442// Deprecated: Use NextWithContext() instead. 443func (page *AccountListResultPage) Next() error { 444 return page.NextWithContext(context.Background()) 445} 446 447// NotDone returns true if the page enumeration should be started or is not yet complete. 448func (page AccountListResultPage) NotDone() bool { 449 return !page.alr.IsEmpty() 450} 451 452// Response returns the raw server response from the last page request. 453func (page AccountListResultPage) Response() AccountListResult { 454 return page.alr 455} 456 457// Values returns the slice of values for the current page or nil if there are no values. 458func (page AccountListResultPage) Values() []Account { 459 if page.alr.IsEmpty() { 460 return nil 461 } 462 return *page.alr.Value 463} 464 465// Creates a new instance of the AccountListResultPage type. 466func NewAccountListResultPage(getNextPage func(context.Context, AccountListResult) (AccountListResult, error)) AccountListResultPage { 467 return AccountListResultPage{fn: getNextPage} 468} 469 470// AccountProperties account specific properties. 471type AccountProperties struct { 472 // AccountEndpoint - READ-ONLY; The endpoint used by this account to interact with the Batch services. 473 AccountEndpoint *string `json:"accountEndpoint,omitempty"` 474 // ProvisioningState - The provisioned state of the resource. Possible values include: 'Invalid', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Cancelled' 475 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 476 // AutoStorage - The properties and status of any auto storage account associated with the account. 477 AutoStorage *AutoStorageProperties `json:"autoStorage,omitempty"` 478 // CoreQuota - The core quota for this Batch account. 479 CoreQuota *int32 `json:"coreQuota,omitempty"` 480 // PoolQuota - The pool quota for this Batch account. 481 PoolQuota *int32 `json:"poolQuota,omitempty"` 482 // ActiveJobAndJobScheduleQuota - The active job and job schedule quota for this Batch account. 483 ActiveJobAndJobScheduleQuota *int32 `json:"activeJobAndJobScheduleQuota,omitempty"` 484} 485 486// AccountRegenerateKeyParameters parameters supplied to the RegenerateKey operation. 487type AccountRegenerateKeyParameters struct { 488 // KeyName - The type of account key to regenerate. Possible values include: 'Primary', 'Secondary' 489 KeyName AccountKeyType `json:"keyName,omitempty"` 490} 491 492// AccountUpdateParameters parameters supplied to the Update operation. 493type AccountUpdateParameters struct { 494 // Tags - The user specified tags associated with the account. 495 Tags map[string]*string `json:"tags"` 496 // AccountBaseProperties - The properties of the account. 497 *AccountBaseProperties `json:"properties,omitempty"` 498} 499 500// MarshalJSON is the custom marshaler for AccountUpdateParameters. 501func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) { 502 objectMap := make(map[string]interface{}) 503 if aup.Tags != nil { 504 objectMap["tags"] = aup.Tags 505 } 506 if aup.AccountBaseProperties != nil { 507 objectMap["properties"] = aup.AccountBaseProperties 508 } 509 return json.Marshal(objectMap) 510} 511 512// UnmarshalJSON is the custom unmarshaler for AccountUpdateParameters struct. 513func (aup *AccountUpdateParameters) UnmarshalJSON(body []byte) error { 514 var m map[string]*json.RawMessage 515 err := json.Unmarshal(body, &m) 516 if err != nil { 517 return err 518 } 519 for k, v := range m { 520 switch k { 521 case "tags": 522 if v != nil { 523 var tags map[string]*string 524 err = json.Unmarshal(*v, &tags) 525 if err != nil { 526 return err 527 } 528 aup.Tags = tags 529 } 530 case "properties": 531 if v != nil { 532 var accountBaseProperties AccountBaseProperties 533 err = json.Unmarshal(*v, &accountBaseProperties) 534 if err != nil { 535 return err 536 } 537 aup.AccountBaseProperties = &accountBaseProperties 538 } 539 } 540 } 541 542 return nil 543} 544 545// ActivateApplicationPackageParameters parameters for an ApplicationOperations.ActivateApplicationPackage 546// request. 547type ActivateApplicationPackageParameters struct { 548 // Format - The format of the application package binary file. 549 Format *string `json:"format,omitempty"` 550} 551 552// AddApplicationParameters parameters for an ApplicationOperations.AddApplication request. 553type AddApplicationParameters struct { 554 // AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string. 555 AllowUpdates *bool `json:"allowUpdates,omitempty"` 556 // DisplayName - The display name for the application. 557 DisplayName *string `json:"displayName,omitempty"` 558} 559 560// Application contains information about an application in a Batch account. 561type Application struct { 562 autorest.Response `json:"-"` 563 // ID - A string that uniquely identifies the application within the account. 564 ID *string `json:"id,omitempty"` 565 // DisplayName - The display name for the application. 566 DisplayName *string `json:"displayName,omitempty"` 567 // Packages - The list of packages under this application. 568 Packages *[]ApplicationPackage `json:"packages,omitempty"` 569 // AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string. 570 AllowUpdates *bool `json:"allowUpdates,omitempty"` 571 // DefaultVersion - The package to use if a client requests the application but does not specify a version. 572 DefaultVersion *string `json:"defaultVersion,omitempty"` 573} 574 575// ApplicationPackage an application package which represents a particular version of an application. 576type ApplicationPackage struct { 577 autorest.Response `json:"-"` 578 // ID - The ID of the application. 579 ID *string `json:"id,omitempty"` 580 // Version - The version of the application package. 581 Version *string `json:"version,omitempty"` 582 // State - The current state of the application package. Possible values include: 'Pending', 'Active', 'Unmapped' 583 State PackageState `json:"state,omitempty"` 584 // Format - The format of the application package, if the package is active. 585 Format *string `json:"format,omitempty"` 586 // StorageURL - The storage URL at which the application package is stored. 587 StorageURL *string `json:"storageUrl,omitempty"` 588 // StorageURLExpiry - The UTC time at which the storage URL will expire. 589 StorageURLExpiry *date.Time `json:"storageUrlExpiry,omitempty"` 590 // LastActivationTime - The time at which the package was last activated, if the package is active. 591 LastActivationTime *date.Time `json:"lastActivationTime,omitempty"` 592} 593 594// AutoStorageBaseProperties the properties related to auto storage account. 595type AutoStorageBaseProperties struct { 596 // StorageAccountID - The resource ID of the storage account to be used for auto storage account. 597 StorageAccountID *string `json:"storageAccountId,omitempty"` 598} 599 600// AutoStorageProperties contains information about the auto storage account associated with a Batch 601// account. 602type AutoStorageProperties struct { 603 // StorageAccountID - The resource ID of the storage account to be used for auto storage account. 604 StorageAccountID *string `json:"storageAccountId,omitempty"` 605 // LastKeySync - The UTC time at which storage keys were last synchronized with the Batch account. 606 LastKeySync *date.Time `json:"lastKeySync,omitempty"` 607} 608 609// CloudError an error response from the Batch service. 610type CloudError struct { 611 // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. 612 Code *string `json:"code,omitempty"` 613 // Message - A message describing the error, intended to be suitable for display in a user interface. 614 Message *string `json:"message,omitempty"` 615 // Target - The target of the particular error. For example, the name of the property in error. 616 Target *string `json:"target,omitempty"` 617 // Details - A list of additional details about the error. 618 Details *[]CloudError `json:"details,omitempty"` 619} 620 621// ListApplicationsResult response to an ApplicationOperations.ListApplications request. 622type ListApplicationsResult struct { 623 autorest.Response `json:"-"` 624 // Value - The list of applications. 625 Value *[]Application `json:"value,omitempty"` 626 // NextLink - The URL to get the next set of results. 627 NextLink *string `json:"nextLink,omitempty"` 628} 629 630// ListApplicationsResultIterator provides access to a complete listing of Application values. 631type ListApplicationsResultIterator struct { 632 i int 633 page ListApplicationsResultPage 634} 635 636// NextWithContext advances to the next value. If there was an error making 637// the request the iterator does not advance and the error is returned. 638func (iter *ListApplicationsResultIterator) NextWithContext(ctx context.Context) (err error) { 639 if tracing.IsEnabled() { 640 ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationsResultIterator.NextWithContext") 641 defer func() { 642 sc := -1 643 if iter.Response().Response.Response != nil { 644 sc = iter.Response().Response.Response.StatusCode 645 } 646 tracing.EndSpan(ctx, sc, err) 647 }() 648 } 649 iter.i++ 650 if iter.i < len(iter.page.Values()) { 651 return nil 652 } 653 err = iter.page.NextWithContext(ctx) 654 if err != nil { 655 iter.i-- 656 return err 657 } 658 iter.i = 0 659 return nil 660} 661 662// Next advances to the next value. If there was an error making 663// the request the iterator does not advance and the error is returned. 664// Deprecated: Use NextWithContext() instead. 665func (iter *ListApplicationsResultIterator) Next() error { 666 return iter.NextWithContext(context.Background()) 667} 668 669// NotDone returns true if the enumeration should be started or is not yet complete. 670func (iter ListApplicationsResultIterator) NotDone() bool { 671 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 672} 673 674// Response returns the raw server response from the last page request. 675func (iter ListApplicationsResultIterator) Response() ListApplicationsResult { 676 return iter.page.Response() 677} 678 679// Value returns the current value or a zero-initialized value if the 680// iterator has advanced beyond the end of the collection. 681func (iter ListApplicationsResultIterator) Value() Application { 682 if !iter.page.NotDone() { 683 return Application{} 684 } 685 return iter.page.Values()[iter.i] 686} 687 688// Creates a new instance of the ListApplicationsResultIterator type. 689func NewListApplicationsResultIterator(page ListApplicationsResultPage) ListApplicationsResultIterator { 690 return ListApplicationsResultIterator{page: page} 691} 692 693// IsEmpty returns true if the ListResult contains no values. 694func (lar ListApplicationsResult) IsEmpty() bool { 695 return lar.Value == nil || len(*lar.Value) == 0 696} 697 698// listApplicationsResultPreparer prepares a request to retrieve the next set of results. 699// It returns nil if no more results exist. 700func (lar ListApplicationsResult) listApplicationsResultPreparer(ctx context.Context) (*http.Request, error) { 701 if lar.NextLink == nil || len(to.String(lar.NextLink)) < 1 { 702 return nil, nil 703 } 704 return autorest.Prepare((&http.Request{}).WithContext(ctx), 705 autorest.AsJSON(), 706 autorest.AsGet(), 707 autorest.WithBaseURL(to.String(lar.NextLink))) 708} 709 710// ListApplicationsResultPage contains a page of Application values. 711type ListApplicationsResultPage struct { 712 fn func(context.Context, ListApplicationsResult) (ListApplicationsResult, error) 713 lar ListApplicationsResult 714} 715 716// NextWithContext advances to the next page of values. If there was an error making 717// the request the page does not advance and the error is returned. 718func (page *ListApplicationsResultPage) NextWithContext(ctx context.Context) (err error) { 719 if tracing.IsEnabled() { 720 ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationsResultPage.NextWithContext") 721 defer func() { 722 sc := -1 723 if page.Response().Response.Response != nil { 724 sc = page.Response().Response.Response.StatusCode 725 } 726 tracing.EndSpan(ctx, sc, err) 727 }() 728 } 729 next, err := page.fn(ctx, page.lar) 730 if err != nil { 731 return err 732 } 733 page.lar = next 734 return nil 735} 736 737// Next advances to the next page of values. If there was an error making 738// the request the page does not advance and the error is returned. 739// Deprecated: Use NextWithContext() instead. 740func (page *ListApplicationsResultPage) Next() error { 741 return page.NextWithContext(context.Background()) 742} 743 744// NotDone returns true if the page enumeration should be started or is not yet complete. 745func (page ListApplicationsResultPage) NotDone() bool { 746 return !page.lar.IsEmpty() 747} 748 749// Response returns the raw server response from the last page request. 750func (page ListApplicationsResultPage) Response() ListApplicationsResult { 751 return page.lar 752} 753 754// Values returns the slice of values for the current page or nil if there are no values. 755func (page ListApplicationsResultPage) Values() []Application { 756 if page.lar.IsEmpty() { 757 return nil 758 } 759 return *page.lar.Value 760} 761 762// Creates a new instance of the ListApplicationsResultPage type. 763func NewListApplicationsResultPage(getNextPage func(context.Context, ListApplicationsResult) (ListApplicationsResult, error)) ListApplicationsResultPage { 764 return ListApplicationsResultPage{fn: getNextPage} 765} 766 767// LocationQuota quotas associated with a Batch region for a particular subscription. 768type LocationQuota struct { 769 autorest.Response `json:"-"` 770 // AccountQuota - The number of Batch accounts that may be created under the subscription in the specified region. 771 AccountQuota *int32 `json:"accountQuota,omitempty"` 772} 773 774// Resource a definition of an Azure resource. 775type Resource struct { 776 // ID - READ-ONLY; The ID of the resource 777 ID *string `json:"id,omitempty"` 778 // Name - READ-ONLY; The name of the resource 779 Name *string `json:"name,omitempty"` 780 // Type - READ-ONLY; The type of the resource 781 Type *string `json:"type,omitempty"` 782 // Location - The location of the resource 783 Location *string `json:"location,omitempty"` 784 // Tags - The tags of the resource 785 Tags map[string]*string `json:"tags"` 786} 787 788// MarshalJSON is the custom marshaler for Resource. 789func (r Resource) MarshalJSON() ([]byte, error) { 790 objectMap := make(map[string]interface{}) 791 if r.Location != nil { 792 objectMap["location"] = r.Location 793 } 794 if r.Tags != nil { 795 objectMap["tags"] = r.Tags 796 } 797 return json.Marshal(objectMap) 798} 799 800// UpdateApplicationParameters parameters for an ApplicationOperations.UpdateApplication request. 801type UpdateApplicationParameters struct { 802 // AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string. 803 AllowUpdates *bool `json:"allowUpdates,omitempty"` 804 // DefaultVersion - The package to use if a client requests the application but does not specify a version. 805 DefaultVersion *string `json:"defaultVersion,omitempty"` 806 // DisplayName - The display name for the application. 807 DisplayName *string `json:"displayName,omitempty"` 808} 809