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/2017-09-01/batch" 33 34// Account contains information about an Azure Batch account. 35type Account struct { 36 autorest.Response `json:"-"` 37 // AccountProperties - The properties associated with the account. 38 *AccountProperties `json:"properties,omitempty"` 39 // ID - READ-ONLY; The ID of the resource. 40 ID *string `json:"id,omitempty"` 41 // Name - READ-ONLY; The name of the resource. 42 Name *string `json:"name,omitempty"` 43 // Type - READ-ONLY; The type of the resource. 44 Type *string `json:"type,omitempty"` 45 // Location - READ-ONLY; The location of the resource. 46 Location *string `json:"location,omitempty"` 47 // Tags - READ-ONLY; The tags of the resource. 48 Tags map[string]*string `json:"tags"` 49} 50 51// MarshalJSON is the custom marshaler for Account. 52func (a Account) MarshalJSON() ([]byte, error) { 53 objectMap := make(map[string]interface{}) 54 if a.AccountProperties != nil { 55 objectMap["properties"] = a.AccountProperties 56 } 57 return json.Marshal(objectMap) 58} 59 60// UnmarshalJSON is the custom unmarshaler for Account struct. 61func (a *Account) UnmarshalJSON(body []byte) error { 62 var m map[string]*json.RawMessage 63 err := json.Unmarshal(body, &m) 64 if err != nil { 65 return err 66 } 67 for k, v := range m { 68 switch k { 69 case "properties": 70 if v != nil { 71 var accountProperties AccountProperties 72 err = json.Unmarshal(*v, &accountProperties) 73 if err != nil { 74 return err 75 } 76 a.AccountProperties = &accountProperties 77 } 78 case "id": 79 if v != nil { 80 var ID string 81 err = json.Unmarshal(*v, &ID) 82 if err != nil { 83 return err 84 } 85 a.ID = &ID 86 } 87 case "name": 88 if v != nil { 89 var name string 90 err = json.Unmarshal(*v, &name) 91 if err != nil { 92 return err 93 } 94 a.Name = &name 95 } 96 case "type": 97 if v != nil { 98 var typeVar string 99 err = json.Unmarshal(*v, &typeVar) 100 if err != nil { 101 return err 102 } 103 a.Type = &typeVar 104 } 105 case "location": 106 if v != nil { 107 var location string 108 err = json.Unmarshal(*v, &location) 109 if err != nil { 110 return err 111 } 112 a.Location = &location 113 } 114 case "tags": 115 if v != nil { 116 var tags map[string]*string 117 err = json.Unmarshal(*v, &tags) 118 if err != nil { 119 return err 120 } 121 a.Tags = tags 122 } 123 } 124 } 125 126 return nil 127} 128 129// AccountCreateFuture an abstraction for monitoring and retrieving the results of a long-running 130// operation. 131type AccountCreateFuture struct { 132 azure.FutureAPI 133 // Result returns the result of the asynchronous operation. 134 // If the operation has not completed it will return an error. 135 Result func(AccountClient) (Account, error) 136} 137 138// AccountCreateParameters parameters supplied to the Create operation. 139type AccountCreateParameters struct { 140 // Location - The region in which to create the account. 141 Location *string `json:"location,omitempty"` 142 // Tags - The user-specified tags associated with the account. 143 Tags map[string]*string `json:"tags"` 144 // AccountCreateProperties - The properties of the Batch account. 145 *AccountCreateProperties `json:"properties,omitempty"` 146} 147 148// MarshalJSON is the custom marshaler for AccountCreateParameters. 149func (acp AccountCreateParameters) MarshalJSON() ([]byte, error) { 150 objectMap := make(map[string]interface{}) 151 if acp.Location != nil { 152 objectMap["location"] = acp.Location 153 } 154 if acp.Tags != nil { 155 objectMap["tags"] = acp.Tags 156 } 157 if acp.AccountCreateProperties != nil { 158 objectMap["properties"] = acp.AccountCreateProperties 159 } 160 return json.Marshal(objectMap) 161} 162 163// UnmarshalJSON is the custom unmarshaler for AccountCreateParameters struct. 164func (acp *AccountCreateParameters) UnmarshalJSON(body []byte) error { 165 var m map[string]*json.RawMessage 166 err := json.Unmarshal(body, &m) 167 if err != nil { 168 return err 169 } 170 for k, v := range m { 171 switch k { 172 case "location": 173 if v != nil { 174 var location string 175 err = json.Unmarshal(*v, &location) 176 if err != nil { 177 return err 178 } 179 acp.Location = &location 180 } 181 case "tags": 182 if v != nil { 183 var tags map[string]*string 184 err = json.Unmarshal(*v, &tags) 185 if err != nil { 186 return err 187 } 188 acp.Tags = tags 189 } 190 case "properties": 191 if v != nil { 192 var accountCreateProperties AccountCreateProperties 193 err = json.Unmarshal(*v, &accountCreateProperties) 194 if err != nil { 195 return err 196 } 197 acp.AccountCreateProperties = &accountCreateProperties 198 } 199 } 200 } 201 202 return nil 203} 204 205// AccountCreateProperties the properties of a Batch account. 206type AccountCreateProperties struct { 207 // AutoStorage - The properties related to the auto-storage account. 208 AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` 209 // PoolAllocationMode - The pool allocation mode also affects how clients may authenticate to the Batch Service API. If the mode is BatchService, clients may authenticate using access keys or Azure Active Directory. If the mode is UserSubscription, clients must use Azure Active Directory. The default is BatchService. Possible values include: 'BatchService', 'UserSubscription' 210 PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"` 211 // KeyVaultReference - A reference to the Azure key vault associated with the Batch account. 212 KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` 213} 214 215// AccountDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 216// operation. 217type AccountDeleteFuture struct { 218 azure.FutureAPI 219 // Result returns the result of the asynchronous operation. 220 // If the operation has not completed it will return an error. 221 Result func(AccountClient) (autorest.Response, error) 222} 223 224// AccountKeys a set of Azure Batch account keys. 225type AccountKeys struct { 226 autorest.Response `json:"-"` 227 // AccountName - READ-ONLY; The Batch account name. 228 AccountName *string `json:"accountName,omitempty"` 229 // Primary - READ-ONLY; The primary key associated with the account. 230 Primary *string `json:"primary,omitempty"` 231 // Secondary - READ-ONLY; The secondary key associated with the account. 232 Secondary *string `json:"secondary,omitempty"` 233} 234 235// AccountListResult values returned by the List operation. 236type AccountListResult struct { 237 autorest.Response `json:"-"` 238 // Value - The collection of Batch accounts returned by the listing operation. 239 Value *[]Account `json:"value,omitempty"` 240 // NextLink - The continuation token. 241 NextLink *string `json:"nextLink,omitempty"` 242} 243 244// AccountListResultIterator provides access to a complete listing of Account values. 245type AccountListResultIterator struct { 246 i int 247 page AccountListResultPage 248} 249 250// NextWithContext advances to the next value. If there was an error making 251// the request the iterator does not advance and the error is returned. 252func (iter *AccountListResultIterator) NextWithContext(ctx context.Context) (err error) { 253 if tracing.IsEnabled() { 254 ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultIterator.NextWithContext") 255 defer func() { 256 sc := -1 257 if iter.Response().Response.Response != nil { 258 sc = iter.Response().Response.Response.StatusCode 259 } 260 tracing.EndSpan(ctx, sc, err) 261 }() 262 } 263 iter.i++ 264 if iter.i < len(iter.page.Values()) { 265 return nil 266 } 267 err = iter.page.NextWithContext(ctx) 268 if err != nil { 269 iter.i-- 270 return err 271 } 272 iter.i = 0 273 return nil 274} 275 276// Next advances to the next value. If there was an error making 277// the request the iterator does not advance and the error is returned. 278// Deprecated: Use NextWithContext() instead. 279func (iter *AccountListResultIterator) Next() error { 280 return iter.NextWithContext(context.Background()) 281} 282 283// NotDone returns true if the enumeration should be started or is not yet complete. 284func (iter AccountListResultIterator) NotDone() bool { 285 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 286} 287 288// Response returns the raw server response from the last page request. 289func (iter AccountListResultIterator) Response() AccountListResult { 290 return iter.page.Response() 291} 292 293// Value returns the current value or a zero-initialized value if the 294// iterator has advanced beyond the end of the collection. 295func (iter AccountListResultIterator) Value() Account { 296 if !iter.page.NotDone() { 297 return Account{} 298 } 299 return iter.page.Values()[iter.i] 300} 301 302// Creates a new instance of the AccountListResultIterator type. 303func NewAccountListResultIterator(page AccountListResultPage) AccountListResultIterator { 304 return AccountListResultIterator{page: page} 305} 306 307// IsEmpty returns true if the ListResult contains no values. 308func (alr AccountListResult) IsEmpty() bool { 309 return alr.Value == nil || len(*alr.Value) == 0 310} 311 312// hasNextLink returns true if the NextLink is not empty. 313func (alr AccountListResult) hasNextLink() bool { 314 return alr.NextLink != nil && len(*alr.NextLink) != 0 315} 316 317// accountListResultPreparer prepares a request to retrieve the next set of results. 318// It returns nil if no more results exist. 319func (alr AccountListResult) accountListResultPreparer(ctx context.Context) (*http.Request, error) { 320 if !alr.hasNextLink() { 321 return nil, nil 322 } 323 return autorest.Prepare((&http.Request{}).WithContext(ctx), 324 autorest.AsJSON(), 325 autorest.AsGet(), 326 autorest.WithBaseURL(to.String(alr.NextLink))) 327} 328 329// AccountListResultPage contains a page of Account values. 330type AccountListResultPage struct { 331 fn func(context.Context, AccountListResult) (AccountListResult, error) 332 alr AccountListResult 333} 334 335// NextWithContext advances to the next page of values. If there was an error making 336// the request the page does not advance and the error is returned. 337func (page *AccountListResultPage) NextWithContext(ctx context.Context) (err error) { 338 if tracing.IsEnabled() { 339 ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultPage.NextWithContext") 340 defer func() { 341 sc := -1 342 if page.Response().Response.Response != nil { 343 sc = page.Response().Response.Response.StatusCode 344 } 345 tracing.EndSpan(ctx, sc, err) 346 }() 347 } 348 for { 349 next, err := page.fn(ctx, page.alr) 350 if err != nil { 351 return err 352 } 353 page.alr = next 354 if !next.hasNextLink() || !next.IsEmpty() { 355 break 356 } 357 } 358 return nil 359} 360 361// Next advances to the next page of values. If there was an error making 362// the request the page does not advance and the error is returned. 363// Deprecated: Use NextWithContext() instead. 364func (page *AccountListResultPage) Next() error { 365 return page.NextWithContext(context.Background()) 366} 367 368// NotDone returns true if the page enumeration should be started or is not yet complete. 369func (page AccountListResultPage) NotDone() bool { 370 return !page.alr.IsEmpty() 371} 372 373// Response returns the raw server response from the last page request. 374func (page AccountListResultPage) Response() AccountListResult { 375 return page.alr 376} 377 378// Values returns the slice of values for the current page or nil if there are no values. 379func (page AccountListResultPage) Values() []Account { 380 if page.alr.IsEmpty() { 381 return nil 382 } 383 return *page.alr.Value 384} 385 386// Creates a new instance of the AccountListResultPage type. 387func NewAccountListResultPage(cur AccountListResult, getNextPage func(context.Context, AccountListResult) (AccountListResult, error)) AccountListResultPage { 388 return AccountListResultPage{ 389 fn: getNextPage, 390 alr: cur, 391 } 392} 393 394// AccountProperties account specific properties. 395type AccountProperties struct { 396 // AccountEndpoint - READ-ONLY; The account endpoint used to interact with the Batch service. 397 AccountEndpoint *string `json:"accountEndpoint,omitempty"` 398 // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateInvalid', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCancelled' 399 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 400 // PoolAllocationMode - READ-ONLY; Possible values include: 'BatchService', 'UserSubscription' 401 PoolAllocationMode PoolAllocationMode `json:"poolAllocationMode,omitempty"` 402 // KeyVaultReference - READ-ONLY 403 KeyVaultReference *KeyVaultReference `json:"keyVaultReference,omitempty"` 404 // AutoStorage - READ-ONLY 405 AutoStorage *AutoStorageProperties `json:"autoStorage,omitempty"` 406 // DedicatedCoreQuota - READ-ONLY 407 DedicatedCoreQuota *int32 `json:"dedicatedCoreQuota,omitempty"` 408 // LowPriorityCoreQuota - READ-ONLY 409 LowPriorityCoreQuota *int32 `json:"lowPriorityCoreQuota,omitempty"` 410 // PoolQuota - READ-ONLY 411 PoolQuota *int32 `json:"poolQuota,omitempty"` 412 // ActiveJobAndJobScheduleQuota - READ-ONLY 413 ActiveJobAndJobScheduleQuota *int32 `json:"activeJobAndJobScheduleQuota,omitempty"` 414} 415 416// AccountRegenerateKeyParameters parameters supplied to the RegenerateKey operation. 417type AccountRegenerateKeyParameters struct { 418 // KeyName - The type of account key to regenerate. Possible values include: 'Primary', 'Secondary' 419 KeyName AccountKeyType `json:"keyName,omitempty"` 420} 421 422// AccountUpdateParameters parameters for updating an Azure Batch account. 423type AccountUpdateParameters struct { 424 // Tags - The user-specified tags associated with the account. 425 Tags map[string]*string `json:"tags"` 426 // AccountUpdateProperties - The properties of the account. 427 *AccountUpdateProperties `json:"properties,omitempty"` 428} 429 430// MarshalJSON is the custom marshaler for AccountUpdateParameters. 431func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) { 432 objectMap := make(map[string]interface{}) 433 if aup.Tags != nil { 434 objectMap["tags"] = aup.Tags 435 } 436 if aup.AccountUpdateProperties != nil { 437 objectMap["properties"] = aup.AccountUpdateProperties 438 } 439 return json.Marshal(objectMap) 440} 441 442// UnmarshalJSON is the custom unmarshaler for AccountUpdateParameters struct. 443func (aup *AccountUpdateParameters) UnmarshalJSON(body []byte) error { 444 var m map[string]*json.RawMessage 445 err := json.Unmarshal(body, &m) 446 if err != nil { 447 return err 448 } 449 for k, v := range m { 450 switch k { 451 case "tags": 452 if v != nil { 453 var tags map[string]*string 454 err = json.Unmarshal(*v, &tags) 455 if err != nil { 456 return err 457 } 458 aup.Tags = tags 459 } 460 case "properties": 461 if v != nil { 462 var accountUpdateProperties AccountUpdateProperties 463 err = json.Unmarshal(*v, &accountUpdateProperties) 464 if err != nil { 465 return err 466 } 467 aup.AccountUpdateProperties = &accountUpdateProperties 468 } 469 } 470 } 471 472 return nil 473} 474 475// AccountUpdateProperties the properties of a Batch account. 476type AccountUpdateProperties struct { 477 // AutoStorage - The properties related to the auto-storage account. 478 AutoStorage *AutoStorageBaseProperties `json:"autoStorage,omitempty"` 479} 480 481// ActivateApplicationPackageParameters parameters for an activating an application package. 482type ActivateApplicationPackageParameters struct { 483 // Format - The format of the application package binary file. 484 Format *string `json:"format,omitempty"` 485} 486 487// Application contains information about an application in a Batch account. 488type Application struct { 489 autorest.Response `json:"-"` 490 // ID - A string that uniquely identifies the application within the account. 491 ID *string `json:"id,omitempty"` 492 // DisplayName - The display name for the application. 493 DisplayName *string `json:"displayName,omitempty"` 494 // Packages - The list of packages under this application. 495 Packages *[]ApplicationPackage `json:"packages,omitempty"` 496 // AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string. 497 AllowUpdates *bool `json:"allowUpdates,omitempty"` 498 // DefaultVersion - The package to use if a client requests the application but does not specify a version. 499 DefaultVersion *string `json:"defaultVersion,omitempty"` 500} 501 502// ApplicationCreateParameters parameters for adding an Application. 503type ApplicationCreateParameters struct { 504 // AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string. 505 AllowUpdates *bool `json:"allowUpdates,omitempty"` 506 // DisplayName - The display name for the application. 507 DisplayName *string `json:"displayName,omitempty"` 508} 509 510// ApplicationPackage an application package which represents a particular version of an application. 511type ApplicationPackage struct { 512 autorest.Response `json:"-"` 513 // ID - READ-ONLY; The ID of the application. 514 ID *string `json:"id,omitempty"` 515 // Version - READ-ONLY; The version of the application package. 516 Version *string `json:"version,omitempty"` 517 // State - READ-ONLY; The current state of the application package. Possible values include: 'Pending', 'Active', 'Unmapped' 518 State PackageState `json:"state,omitempty"` 519 // Format - READ-ONLY; The format of the application package, if the package is active. 520 Format *string `json:"format,omitempty"` 521 // StorageURL - READ-ONLY; The URL for the application package in Azure Storage. 522 StorageURL *string `json:"storageUrl,omitempty"` 523 // StorageURLExpiry - READ-ONLY; The UTC time at which the Azure Storage URL will expire. 524 StorageURLExpiry *date.Time `json:"storageUrlExpiry,omitempty"` 525 // LastActivationTime - READ-ONLY; The time at which the package was last activated, if the package is active. 526 LastActivationTime *date.Time `json:"lastActivationTime,omitempty"` 527} 528 529// ApplicationPackageReference ... 530type ApplicationPackageReference struct { 531 ID *string `json:"id,omitempty"` 532 // Version - If this is omitted, and no default version is specified for this application, the request fails with the error code InvalidApplicationPackageReferences. If you are calling the REST API directly, the HTTP status code is 409. 533 Version *string `json:"version,omitempty"` 534} 535 536// ApplicationUpdateParameters parameters for an update application request. 537type ApplicationUpdateParameters struct { 538 // AllowUpdates - A value indicating whether packages within the application may be overwritten using the same version string. 539 AllowUpdates *bool `json:"allowUpdates,omitempty"` 540 // DefaultVersion - The package to use if a client requests the application but does not specify a version. 541 DefaultVersion *string `json:"defaultVersion,omitempty"` 542 // DisplayName - The display name for the application. 543 DisplayName *string `json:"displayName,omitempty"` 544} 545 546// AutoScaleRun ... 547type AutoScaleRun struct { 548 EvaluationTime *date.Time `json:"evaluationTime,omitempty"` 549 // Results - Each variable value is returned in the form $variable=value, and variables are separated by semicolons. 550 Results *string `json:"results,omitempty"` 551 Error *AutoScaleRunError `json:"error,omitempty"` 552} 553 554// AutoScaleRunError ... 555type AutoScaleRunError struct { 556 // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. 557 Code *string `json:"code,omitempty"` 558 // Message - A message describing the error, intended to be suitable for display in a user interface. 559 Message *string `json:"message,omitempty"` 560 Details *[]AutoScaleRunError `json:"details,omitempty"` 561} 562 563// AutoScaleSettings ... 564type AutoScaleSettings struct { 565 Formula *string `json:"formula,omitempty"` 566 // EvaluationInterval - If omitted, the default value is 15 minutes (PT15M). 567 EvaluationInterval *string `json:"evaluationInterval,omitempty"` 568} 569 570// AutoStorageBaseProperties the properties related to the auto-storage account. 571type AutoStorageBaseProperties struct { 572 // StorageAccountID - The resource ID of the storage account to be used for auto-storage account. 573 StorageAccountID *string `json:"storageAccountId,omitempty"` 574} 575 576// AutoStorageProperties contains information about the auto-storage account associated with a Batch 577// account. 578type AutoStorageProperties struct { 579 // LastKeySync - The UTC time at which storage keys were last synchronized with the Batch account. 580 LastKeySync *date.Time `json:"lastKeySync,omitempty"` 581 // StorageAccountID - The resource ID of the storage account to be used for auto-storage account. 582 StorageAccountID *string `json:"storageAccountId,omitempty"` 583} 584 585// AutoUserSpecification ... 586type AutoUserSpecification struct { 587 // Scope - pool - specifies that the task runs as the common auto user account which is created on every node in a pool. task - specifies that the service should create a new user for the task. The default value is task. Possible values include: 'AutoUserScopeTask', 'AutoUserScopePool' 588 Scope AutoUserScope `json:"scope,omitempty"` 589 // ElevationLevel - nonAdmin - The auto user is a standard user without elevated access. admin - The auto user is a user with elevated access and operates with full Administrator permissions. The default value is nonAdmin. Possible values include: 'NonAdmin', 'Admin' 590 ElevationLevel ElevationLevel `json:"elevationLevel,omitempty"` 591} 592 593// Certificate contains information about a certificate. 594type Certificate struct { 595 autorest.Response `json:"-"` 596 // CertificateProperties - The properties associated with the certificate. 597 *CertificateProperties `json:"properties,omitempty"` 598 // ID - READ-ONLY; The ID of the resource. 599 ID *string `json:"id,omitempty"` 600 // Name - READ-ONLY; The name of the resource. 601 Name *string `json:"name,omitempty"` 602 // Type - READ-ONLY; The type of the resource. 603 Type *string `json:"type,omitempty"` 604 // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. 605 Etag *string `json:"etag,omitempty"` 606} 607 608// MarshalJSON is the custom marshaler for Certificate. 609func (c Certificate) MarshalJSON() ([]byte, error) { 610 objectMap := make(map[string]interface{}) 611 if c.CertificateProperties != nil { 612 objectMap["properties"] = c.CertificateProperties 613 } 614 return json.Marshal(objectMap) 615} 616 617// UnmarshalJSON is the custom unmarshaler for Certificate struct. 618func (c *Certificate) UnmarshalJSON(body []byte) error { 619 var m map[string]*json.RawMessage 620 err := json.Unmarshal(body, &m) 621 if err != nil { 622 return err 623 } 624 for k, v := range m { 625 switch k { 626 case "properties": 627 if v != nil { 628 var certificateProperties CertificateProperties 629 err = json.Unmarshal(*v, &certificateProperties) 630 if err != nil { 631 return err 632 } 633 c.CertificateProperties = &certificateProperties 634 } 635 case "id": 636 if v != nil { 637 var ID string 638 err = json.Unmarshal(*v, &ID) 639 if err != nil { 640 return err 641 } 642 c.ID = &ID 643 } 644 case "name": 645 if v != nil { 646 var name string 647 err = json.Unmarshal(*v, &name) 648 if err != nil { 649 return err 650 } 651 c.Name = &name 652 } 653 case "type": 654 if v != nil { 655 var typeVar string 656 err = json.Unmarshal(*v, &typeVar) 657 if err != nil { 658 return err 659 } 660 c.Type = &typeVar 661 } 662 case "etag": 663 if v != nil { 664 var etag string 665 err = json.Unmarshal(*v, &etag) 666 if err != nil { 667 return err 668 } 669 c.Etag = &etag 670 } 671 } 672 } 673 674 return nil 675} 676 677// CertificateBaseProperties ... 678type CertificateBaseProperties struct { 679 // ThumbprintAlgorithm - This must match the first portion of the certificate name. Currently required to be 'SHA1'. 680 ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` 681 // Thumbprint - This must match the thumbprint from the name. 682 Thumbprint *string `json:"thumbprint,omitempty"` 683 // Format - The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: 'Pfx', 'Cer' 684 Format CertificateFormat `json:"format,omitempty"` 685} 686 687// CertificateCreateFuture an abstraction for monitoring and retrieving the results of a long-running 688// operation. 689type CertificateCreateFuture struct { 690 azure.FutureAPI 691 // Result returns the result of the asynchronous operation. 692 // If the operation has not completed it will return an error. 693 Result func(CertificateClient) (Certificate, error) 694} 695 696// CertificateCreateOrUpdateParameters contains information about a certificate. 697type CertificateCreateOrUpdateParameters struct { 698 // CertificateCreateOrUpdateProperties - The properties associated with the certificate. 699 *CertificateCreateOrUpdateProperties `json:"properties,omitempty"` 700 // ID - READ-ONLY; The ID of the resource. 701 ID *string `json:"id,omitempty"` 702 // Name - READ-ONLY; The name of the resource. 703 Name *string `json:"name,omitempty"` 704 // Type - READ-ONLY; The type of the resource. 705 Type *string `json:"type,omitempty"` 706 // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. 707 Etag *string `json:"etag,omitempty"` 708} 709 710// MarshalJSON is the custom marshaler for CertificateCreateOrUpdateParameters. 711func (ccoup CertificateCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { 712 objectMap := make(map[string]interface{}) 713 if ccoup.CertificateCreateOrUpdateProperties != nil { 714 objectMap["properties"] = ccoup.CertificateCreateOrUpdateProperties 715 } 716 return json.Marshal(objectMap) 717} 718 719// UnmarshalJSON is the custom unmarshaler for CertificateCreateOrUpdateParameters struct. 720func (ccoup *CertificateCreateOrUpdateParameters) UnmarshalJSON(body []byte) error { 721 var m map[string]*json.RawMessage 722 err := json.Unmarshal(body, &m) 723 if err != nil { 724 return err 725 } 726 for k, v := range m { 727 switch k { 728 case "properties": 729 if v != nil { 730 var certificateCreateOrUpdateProperties CertificateCreateOrUpdateProperties 731 err = json.Unmarshal(*v, &certificateCreateOrUpdateProperties) 732 if err != nil { 733 return err 734 } 735 ccoup.CertificateCreateOrUpdateProperties = &certificateCreateOrUpdateProperties 736 } 737 case "id": 738 if v != nil { 739 var ID string 740 err = json.Unmarshal(*v, &ID) 741 if err != nil { 742 return err 743 } 744 ccoup.ID = &ID 745 } 746 case "name": 747 if v != nil { 748 var name string 749 err = json.Unmarshal(*v, &name) 750 if err != nil { 751 return err 752 } 753 ccoup.Name = &name 754 } 755 case "type": 756 if v != nil { 757 var typeVar string 758 err = json.Unmarshal(*v, &typeVar) 759 if err != nil { 760 return err 761 } 762 ccoup.Type = &typeVar 763 } 764 case "etag": 765 if v != nil { 766 var etag string 767 err = json.Unmarshal(*v, &etag) 768 if err != nil { 769 return err 770 } 771 ccoup.Etag = &etag 772 } 773 } 774 } 775 776 return nil 777} 778 779// CertificateCreateOrUpdateProperties certificate properties for create operations 780type CertificateCreateOrUpdateProperties struct { 781 // Data - The maximum size is 10KB. 782 Data *string `json:"data,omitempty"` 783 // Password - This is required if the certificate format is pfx and must be omitted if the certificate format is cer. 784 Password *string `json:"password,omitempty"` 785 // ThumbprintAlgorithm - This must match the first portion of the certificate name. Currently required to be 'SHA1'. 786 ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` 787 // Thumbprint - This must match the thumbprint from the name. 788 Thumbprint *string `json:"thumbprint,omitempty"` 789 // Format - The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: 'Pfx', 'Cer' 790 Format CertificateFormat `json:"format,omitempty"` 791} 792 793// CertificateDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 794// operation. 795type CertificateDeleteFuture struct { 796 azure.FutureAPI 797 // Result returns the result of the asynchronous operation. 798 // If the operation has not completed it will return an error. 799 Result func(CertificateClient) (autorest.Response, error) 800} 801 802// CertificateProperties certificate properties. 803type CertificateProperties struct { 804 // ProvisioningState - READ-ONLY; Values are: 805 // Succeeded - The certificate is available for use in pools. 806 // Deleting - The user has requested that the certificate be deleted, but the delete operation has not yet completed. You may not reference the certificate when creating or updating pools. 807 // Failed - The user requested that the certificate be deleted, but there are pools that still have references to the certificate, or it is still installed on one or more compute nodes. (The latter can occur if the certificate has been removed from the pool, but the node has not yet restarted. Nodes refresh their certificates only when they restart.) You may use the cancel certificate delete operation to cancel the delete, or the delete certificate operation to retry the delete. Possible values include: 'Succeeded', 'Deleting', 'Failed' 808 ProvisioningState CertificateProvisioningState `json:"provisioningState,omitempty"` 809 // ProvisioningStateTransitionTime - READ-ONLY 810 ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` 811 // PreviousProvisioningState - READ-ONLY; The previous provisioned state of the resource. Possible values include: 'Succeeded', 'Deleting', 'Failed' 812 PreviousProvisioningState CertificateProvisioningState `json:"previousProvisioningState,omitempty"` 813 // PreviousProvisioningStateTransitionTime - READ-ONLY 814 PreviousProvisioningStateTransitionTime *date.Time `json:"previousProvisioningStateTransitionTime,omitempty"` 815 // PublicData - READ-ONLY; The public key of the certificate. 816 PublicData *string `json:"publicData,omitempty"` 817 // DeleteCertificateError - READ-ONLY; This is only returned when the certificate provisioningState is 'Failed'. 818 DeleteCertificateError *DeleteCertificateError `json:"deleteCertificateError,omitempty"` 819 // ThumbprintAlgorithm - This must match the first portion of the certificate name. Currently required to be 'SHA1'. 820 ThumbprintAlgorithm *string `json:"thumbprintAlgorithm,omitempty"` 821 // Thumbprint - This must match the thumbprint from the name. 822 Thumbprint *string `json:"thumbprint,omitempty"` 823 // Format - The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. Possible values include: 'Pfx', 'Cer' 824 Format CertificateFormat `json:"format,omitempty"` 825} 826 827// MarshalJSON is the custom marshaler for CertificateProperties. 828func (cp CertificateProperties) MarshalJSON() ([]byte, error) { 829 objectMap := make(map[string]interface{}) 830 if cp.ThumbprintAlgorithm != nil { 831 objectMap["thumbprintAlgorithm"] = cp.ThumbprintAlgorithm 832 } 833 if cp.Thumbprint != nil { 834 objectMap["thumbprint"] = cp.Thumbprint 835 } 836 if cp.Format != "" { 837 objectMap["format"] = cp.Format 838 } 839 return json.Marshal(objectMap) 840} 841 842// CertificateReference ... 843type CertificateReference struct { 844 ID *string `json:"id,omitempty"` 845 // StoreLocation - The default value is currentUser. This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. Possible values include: 'CurrentUser', 'LocalMachine' 846 StoreLocation CertificateStoreLocation `json:"storeLocation,omitempty"` 847 // StoreName - This property is applicable only for pools configured with Windows nodes (that is, created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). Common store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, but any custom store name can also be used. The default value is My. 848 StoreName *string `json:"storeName,omitempty"` 849 // Visibility - Values are: 850 // starttask - The user account under which the start task is run. 851 // task - The accounts under which job tasks are run. 852 // remoteuser - The accounts under which users remotely access the node. 853 // You can specify more than one visibility in this collection. The default is all accounts. 854 Visibility *[]CertificateVisibility `json:"visibility,omitempty"` 855} 856 857// CheckNameAvailabilityParameters parameters for a check name availability request. 858type CheckNameAvailabilityParameters struct { 859 // Name - The name to check for availability 860 Name *string `json:"name,omitempty"` 861 // Type - The resource type. Must be set to Microsoft.Batch/batchAccounts 862 Type *string `json:"type,omitempty"` 863} 864 865// CheckNameAvailabilityResult the CheckNameAvailability operation response. 866type CheckNameAvailabilityResult struct { 867 autorest.Response `json:"-"` 868 // NameAvailable - READ-ONLY; Gets a boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or invalid and cannot be used. 869 NameAvailable *bool `json:"nameAvailable,omitempty"` 870 // Reason - READ-ONLY; Gets the reason that a Batch account name could not be used. The Reason element is only returned if NameAvailable is false. Possible values include: 'Invalid', 'AlreadyExists' 871 Reason NameAvailabilityReason `json:"reason,omitempty"` 872 // Message - READ-ONLY; Gets an error message explaining the Reason value in more detail. 873 Message *string `json:"message,omitempty"` 874} 875 876// CloudError an error response from the Batch service. 877type CloudError struct { 878 Error *CloudErrorBody `json:"error,omitempty"` 879} 880 881// CloudErrorBody an error response from the Batch service. 882type CloudErrorBody struct { 883 // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. 884 Code *string `json:"code,omitempty"` 885 // Message - A message describing the error, intended to be suitable for display in a user interface. 886 Message *string `json:"message,omitempty"` 887 // Target - The target of the particular error. For example, the name of the property in error. 888 Target *string `json:"target,omitempty"` 889 // Details - A list of additional details about the error. 890 Details *[]CloudErrorBody `json:"details,omitempty"` 891} 892 893// CloudServiceConfiguration ... 894type CloudServiceConfiguration struct { 895 // OsFamily - Possible values are: 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. 3 - OS Family 3, equivalent to Windows Server 2012. 4 - OS Family 4, equivalent to Windows Server 2012 R2. 5 - OS Family 5, equivalent to Windows Server 2016. For more information, see Azure Guest OS Releases (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). 896 OsFamily *string `json:"osFamily,omitempty"` 897 // TargetOSVersion - The default value is * which specifies the latest operating system version for the specified OS family. 898 TargetOSVersion *string `json:"targetOSVersion,omitempty"` 899 // CurrentOSVersion - This may differ from targetOSVersion if the pool state is Upgrading. In this case some virtual machines may be on the targetOSVersion and some may be on the currentOSVersion during the upgrade process. Once all virtual machines have upgraded, currentOSVersion is updated to be the same as targetOSVersion. 900 CurrentOSVersion *string `json:"currentOSVersion,omitempty"` 901} 902 903// DataDisk data Disk settings which will be used by the data disks associated to Compute Nodes in the 904// pool. 905type DataDisk struct { 906 // Lun - The lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinct lun. 907 Lun *int32 `json:"lun,omitempty"` 908 // Caching - Values are: 909 // none - The caching mode for the disk is not enabled. 910 // readOnly - The caching mode for the disk is read only. 911 // readWrite - The caching mode for the disk is read and write. 912 // The default value for caching is none. For information about the caching options see: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. Possible values include: 'None', 'ReadOnly', 'ReadWrite' 913 Caching CachingType `json:"caching,omitempty"` 914 DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` 915 // StorageAccountType - If omitted, the default is "Standard_LRS". Values are: 916 // Standard_LRS - The data disk should use standard locally redundant storage. 917 // Premium_LRS - The data disk should use premium locally redundant storage. Possible values include: 'StandardLRS', 'PremiumLRS' 918 StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` 919} 920 921// DeleteCertificateError an error response from the Batch service. 922type DeleteCertificateError struct { 923 // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. 924 Code *string `json:"code,omitempty"` 925 // Message - A message describing the error, intended to be suitable for display in a user interface. 926 Message *string `json:"message,omitempty"` 927 // Target - The target of the particular error. For example, the name of the property in error. 928 Target *string `json:"target,omitempty"` 929 // Details - A list of additional details about the error. 930 Details *[]DeleteCertificateError `json:"details,omitempty"` 931} 932 933// DeploymentConfiguration ... 934type DeploymentConfiguration struct { 935 // CloudServiceConfiguration - This property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified. This property cannot be specified if the Batch account was created with its poolAllocationMode property set to 'UserSubscription'. 936 CloudServiceConfiguration *CloudServiceConfiguration `json:"cloudServiceConfiguration,omitempty"` 937 // VirtualMachineConfiguration - This property and cloudServiceConfiguration are mutually exclusive and one of the properties must be specified. 938 VirtualMachineConfiguration *VirtualMachineConfiguration `json:"virtualMachineConfiguration,omitempty"` 939} 940 941// EnvironmentSetting ... 942type EnvironmentSetting struct { 943 Name *string `json:"name,omitempty"` 944 Value *string `json:"value,omitempty"` 945} 946 947// FixedScaleSettings ... 948type FixedScaleSettings struct { 949 // ResizeTimeout - The default value is 15 minutes. Timeout values use ISO 8601 format. For example, use PT10M for 10 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service rejects the request with an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). 950 ResizeTimeout *string `json:"resizeTimeout,omitempty"` 951 // TargetDedicatedNodes - At least one of targetDedicatedNodes, targetLowPriority nodes must be set. 952 TargetDedicatedNodes *int32 `json:"targetDedicatedNodes,omitempty"` 953 // TargetLowPriorityNodes - At least one of targetDedicatedNodes, targetLowPriority nodes must be set. 954 TargetLowPriorityNodes *int32 `json:"targetLowPriorityNodes,omitempty"` 955 // NodeDeallocationOption - If omitted, the default value is Requeue. Possible values include: 'Requeue', 'Terminate', 'TaskCompletion', 'RetainedData' 956 NodeDeallocationOption ComputeNodeDeallocationOption `json:"nodeDeallocationOption,omitempty"` 957} 958 959// ImageReference ... 960type ImageReference struct { 961 // Publisher - For example, Canonical or MicrosoftWindowsServer. 962 Publisher *string `json:"publisher,omitempty"` 963 // Offer - For example, UbuntuServer or WindowsServer. 964 Offer *string `json:"offer,omitempty"` 965 // Sku - For example, 14.04.0-LTS or 2012-R2-Datacenter. 966 Sku *string `json:"sku,omitempty"` 967 // Version - A value of 'latest' can be specified to select the latest version of an image. If omitted, the default is 'latest'. 968 Version *string `json:"version,omitempty"` 969 // ID - This property is mutually exclusive with other properties. The virtual machine image must be in the same region and subscription as the Azure Batch account. For information about the firewall settings for Batch node agent to communicate with Batch service see https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration . 970 ID *string `json:"id,omitempty"` 971} 972 973// InboundNatPool ... 974type InboundNatPool struct { 975 // Name - The name must be unique within a Batch pool, can contain letters, numbers, underscores, periods, and hyphens. Names must start with a letter or number, must end with a letter, number, or underscore, and cannot exceed 77 characters. If any invalid values are provided the request fails with HTTP status code 400. 976 Name *string `json:"name,omitempty"` 977 // Protocol - Possible values include: 'TCP', 'UDP' 978 Protocol InboundEndpointProtocol `json:"protocol,omitempty"` 979 // BackendPort - This must be unique within a Batch pool. Acceptable values are between 1 and 65535 except for 22, 3389, 29876 and 29877 as these are reserved. If any reserved values are provided the request fails with HTTP status code 400. 980 BackendPort *int32 `json:"backendPort,omitempty"` 981 // FrontendPortRangeStart - Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved. All ranges within a pool must be distinct and cannot overlap. If any reserved or overlapping values are provided the request fails with HTTP status code 400. 982 FrontendPortRangeStart *int32 `json:"frontendPortRangeStart,omitempty"` 983 // FrontendPortRangeEnd - Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved by the Batch service. All ranges within a pool must be distinct and cannot overlap. If any reserved or overlapping values are provided the request fails with HTTP status code 400. 984 FrontendPortRangeEnd *int32 `json:"frontendPortRangeEnd,omitempty"` 985 // NetworkSecurityGroupRules - The maximum number of rules that can be specified across all the endpoints on a Batch pool is 25. If no network security group rules are specified, a default rule will be created to allow inbound access to the specified backendPort. If the maximum number of network security group rules is exceeded the request fails with HTTP status code 400. 986 NetworkSecurityGroupRules *[]NetworkSecurityGroupRule `json:"networkSecurityGroupRules,omitempty"` 987} 988 989// KeyVaultReference identifies the Azure key vault associated with a Batch account. 990type KeyVaultReference struct { 991 // ID - The resource ID of the Azure key vault associated with the Batch account. 992 ID *string `json:"id,omitempty"` 993 // URL - The URL of the Azure key vault associated with the Batch account. 994 URL *string `json:"url,omitempty"` 995} 996 997// LinuxUserConfiguration ... 998type LinuxUserConfiguration struct { 999 // UID - The uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the uid. 1000 UID *int32 `json:"uid,omitempty"` 1001 // Gid - The uid and gid properties must be specified together or not at all. If not specified the underlying operating system picks the gid. 1002 Gid *int32 `json:"gid,omitempty"` 1003 // SSHPrivateKey - The private key must not be password protected. The private key is used to automatically configure asymmetric-key based authentication for SSH between nodes in a Linux pool when the pool's enableInterNodeCommunication property is true (it is ignored if enableInterNodeCommunication is false). It does this by placing the key pair into the user's .ssh directory. If not specified, password-less SSH is not configured between nodes (no modification of the user's .ssh directory is done). 1004 SSHPrivateKey *string `json:"sshPrivateKey,omitempty"` 1005} 1006 1007// ListApplicationsResult the result of performing list applications. 1008type ListApplicationsResult struct { 1009 autorest.Response `json:"-"` 1010 // Value - The list of applications. 1011 Value *[]Application `json:"value,omitempty"` 1012 // NextLink - The URL to get the next set of results. 1013 NextLink *string `json:"nextLink,omitempty"` 1014} 1015 1016// ListApplicationsResultIterator provides access to a complete listing of Application values. 1017type ListApplicationsResultIterator struct { 1018 i int 1019 page ListApplicationsResultPage 1020} 1021 1022// NextWithContext advances to the next value. If there was an error making 1023// the request the iterator does not advance and the error is returned. 1024func (iter *ListApplicationsResultIterator) NextWithContext(ctx context.Context) (err error) { 1025 if tracing.IsEnabled() { 1026 ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationsResultIterator.NextWithContext") 1027 defer func() { 1028 sc := -1 1029 if iter.Response().Response.Response != nil { 1030 sc = iter.Response().Response.Response.StatusCode 1031 } 1032 tracing.EndSpan(ctx, sc, err) 1033 }() 1034 } 1035 iter.i++ 1036 if iter.i < len(iter.page.Values()) { 1037 return nil 1038 } 1039 err = iter.page.NextWithContext(ctx) 1040 if err != nil { 1041 iter.i-- 1042 return err 1043 } 1044 iter.i = 0 1045 return nil 1046} 1047 1048// Next advances to the next value. If there was an error making 1049// the request the iterator does not advance and the error is returned. 1050// Deprecated: Use NextWithContext() instead. 1051func (iter *ListApplicationsResultIterator) Next() error { 1052 return iter.NextWithContext(context.Background()) 1053} 1054 1055// NotDone returns true if the enumeration should be started or is not yet complete. 1056func (iter ListApplicationsResultIterator) NotDone() bool { 1057 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1058} 1059 1060// Response returns the raw server response from the last page request. 1061func (iter ListApplicationsResultIterator) Response() ListApplicationsResult { 1062 return iter.page.Response() 1063} 1064 1065// Value returns the current value or a zero-initialized value if the 1066// iterator has advanced beyond the end of the collection. 1067func (iter ListApplicationsResultIterator) Value() Application { 1068 if !iter.page.NotDone() { 1069 return Application{} 1070 } 1071 return iter.page.Values()[iter.i] 1072} 1073 1074// Creates a new instance of the ListApplicationsResultIterator type. 1075func NewListApplicationsResultIterator(page ListApplicationsResultPage) ListApplicationsResultIterator { 1076 return ListApplicationsResultIterator{page: page} 1077} 1078 1079// IsEmpty returns true if the ListResult contains no values. 1080func (lar ListApplicationsResult) IsEmpty() bool { 1081 return lar.Value == nil || len(*lar.Value) == 0 1082} 1083 1084// hasNextLink returns true if the NextLink is not empty. 1085func (lar ListApplicationsResult) hasNextLink() bool { 1086 return lar.NextLink != nil && len(*lar.NextLink) != 0 1087} 1088 1089// listApplicationsResultPreparer prepares a request to retrieve the next set of results. 1090// It returns nil if no more results exist. 1091func (lar ListApplicationsResult) listApplicationsResultPreparer(ctx context.Context) (*http.Request, error) { 1092 if !lar.hasNextLink() { 1093 return nil, nil 1094 } 1095 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1096 autorest.AsJSON(), 1097 autorest.AsGet(), 1098 autorest.WithBaseURL(to.String(lar.NextLink))) 1099} 1100 1101// ListApplicationsResultPage contains a page of Application values. 1102type ListApplicationsResultPage struct { 1103 fn func(context.Context, ListApplicationsResult) (ListApplicationsResult, error) 1104 lar ListApplicationsResult 1105} 1106 1107// NextWithContext advances to the next page of values. If there was an error making 1108// the request the page does not advance and the error is returned. 1109func (page *ListApplicationsResultPage) NextWithContext(ctx context.Context) (err error) { 1110 if tracing.IsEnabled() { 1111 ctx = tracing.StartSpan(ctx, fqdn+"/ListApplicationsResultPage.NextWithContext") 1112 defer func() { 1113 sc := -1 1114 if page.Response().Response.Response != nil { 1115 sc = page.Response().Response.Response.StatusCode 1116 } 1117 tracing.EndSpan(ctx, sc, err) 1118 }() 1119 } 1120 for { 1121 next, err := page.fn(ctx, page.lar) 1122 if err != nil { 1123 return err 1124 } 1125 page.lar = next 1126 if !next.hasNextLink() || !next.IsEmpty() { 1127 break 1128 } 1129 } 1130 return nil 1131} 1132 1133// Next advances to the next page of values. If there was an error making 1134// the request the page does not advance and the error is returned. 1135// Deprecated: Use NextWithContext() instead. 1136func (page *ListApplicationsResultPage) Next() error { 1137 return page.NextWithContext(context.Background()) 1138} 1139 1140// NotDone returns true if the page enumeration should be started or is not yet complete. 1141func (page ListApplicationsResultPage) NotDone() bool { 1142 return !page.lar.IsEmpty() 1143} 1144 1145// Response returns the raw server response from the last page request. 1146func (page ListApplicationsResultPage) Response() ListApplicationsResult { 1147 return page.lar 1148} 1149 1150// Values returns the slice of values for the current page or nil if there are no values. 1151func (page ListApplicationsResultPage) Values() []Application { 1152 if page.lar.IsEmpty() { 1153 return nil 1154 } 1155 return *page.lar.Value 1156} 1157 1158// Creates a new instance of the ListApplicationsResultPage type. 1159func NewListApplicationsResultPage(cur ListApplicationsResult, getNextPage func(context.Context, ListApplicationsResult) (ListApplicationsResult, error)) ListApplicationsResultPage { 1160 return ListApplicationsResultPage{ 1161 fn: getNextPage, 1162 lar: cur, 1163 } 1164} 1165 1166// ListCertificatesResult values returned by the List operation. 1167type ListCertificatesResult struct { 1168 autorest.Response `json:"-"` 1169 // Value - The collection of returned certificates. 1170 Value *[]Certificate `json:"value,omitempty"` 1171 // NextLink - The continuation token. 1172 NextLink *string `json:"nextLink,omitempty"` 1173} 1174 1175// ListCertificatesResultIterator provides access to a complete listing of Certificate values. 1176type ListCertificatesResultIterator struct { 1177 i int 1178 page ListCertificatesResultPage 1179} 1180 1181// NextWithContext advances to the next value. If there was an error making 1182// the request the iterator does not advance and the error is returned. 1183func (iter *ListCertificatesResultIterator) NextWithContext(ctx context.Context) (err error) { 1184 if tracing.IsEnabled() { 1185 ctx = tracing.StartSpan(ctx, fqdn+"/ListCertificatesResultIterator.NextWithContext") 1186 defer func() { 1187 sc := -1 1188 if iter.Response().Response.Response != nil { 1189 sc = iter.Response().Response.Response.StatusCode 1190 } 1191 tracing.EndSpan(ctx, sc, err) 1192 }() 1193 } 1194 iter.i++ 1195 if iter.i < len(iter.page.Values()) { 1196 return nil 1197 } 1198 err = iter.page.NextWithContext(ctx) 1199 if err != nil { 1200 iter.i-- 1201 return err 1202 } 1203 iter.i = 0 1204 return nil 1205} 1206 1207// Next advances to the next value. If there was an error making 1208// the request the iterator does not advance and the error is returned. 1209// Deprecated: Use NextWithContext() instead. 1210func (iter *ListCertificatesResultIterator) Next() error { 1211 return iter.NextWithContext(context.Background()) 1212} 1213 1214// NotDone returns true if the enumeration should be started or is not yet complete. 1215func (iter ListCertificatesResultIterator) NotDone() bool { 1216 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1217} 1218 1219// Response returns the raw server response from the last page request. 1220func (iter ListCertificatesResultIterator) Response() ListCertificatesResult { 1221 return iter.page.Response() 1222} 1223 1224// Value returns the current value or a zero-initialized value if the 1225// iterator has advanced beyond the end of the collection. 1226func (iter ListCertificatesResultIterator) Value() Certificate { 1227 if !iter.page.NotDone() { 1228 return Certificate{} 1229 } 1230 return iter.page.Values()[iter.i] 1231} 1232 1233// Creates a new instance of the ListCertificatesResultIterator type. 1234func NewListCertificatesResultIterator(page ListCertificatesResultPage) ListCertificatesResultIterator { 1235 return ListCertificatesResultIterator{page: page} 1236} 1237 1238// IsEmpty returns true if the ListResult contains no values. 1239func (lcr ListCertificatesResult) IsEmpty() bool { 1240 return lcr.Value == nil || len(*lcr.Value) == 0 1241} 1242 1243// hasNextLink returns true if the NextLink is not empty. 1244func (lcr ListCertificatesResult) hasNextLink() bool { 1245 return lcr.NextLink != nil && len(*lcr.NextLink) != 0 1246} 1247 1248// listCertificatesResultPreparer prepares a request to retrieve the next set of results. 1249// It returns nil if no more results exist. 1250func (lcr ListCertificatesResult) listCertificatesResultPreparer(ctx context.Context) (*http.Request, error) { 1251 if !lcr.hasNextLink() { 1252 return nil, nil 1253 } 1254 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1255 autorest.AsJSON(), 1256 autorest.AsGet(), 1257 autorest.WithBaseURL(to.String(lcr.NextLink))) 1258} 1259 1260// ListCertificatesResultPage contains a page of Certificate values. 1261type ListCertificatesResultPage struct { 1262 fn func(context.Context, ListCertificatesResult) (ListCertificatesResult, error) 1263 lcr ListCertificatesResult 1264} 1265 1266// NextWithContext advances to the next page of values. If there was an error making 1267// the request the page does not advance and the error is returned. 1268func (page *ListCertificatesResultPage) NextWithContext(ctx context.Context) (err error) { 1269 if tracing.IsEnabled() { 1270 ctx = tracing.StartSpan(ctx, fqdn+"/ListCertificatesResultPage.NextWithContext") 1271 defer func() { 1272 sc := -1 1273 if page.Response().Response.Response != nil { 1274 sc = page.Response().Response.Response.StatusCode 1275 } 1276 tracing.EndSpan(ctx, sc, err) 1277 }() 1278 } 1279 for { 1280 next, err := page.fn(ctx, page.lcr) 1281 if err != nil { 1282 return err 1283 } 1284 page.lcr = next 1285 if !next.hasNextLink() || !next.IsEmpty() { 1286 break 1287 } 1288 } 1289 return nil 1290} 1291 1292// Next advances to the next page of values. If there was an error making 1293// the request the page does not advance and the error is returned. 1294// Deprecated: Use NextWithContext() instead. 1295func (page *ListCertificatesResultPage) Next() error { 1296 return page.NextWithContext(context.Background()) 1297} 1298 1299// NotDone returns true if the page enumeration should be started or is not yet complete. 1300func (page ListCertificatesResultPage) NotDone() bool { 1301 return !page.lcr.IsEmpty() 1302} 1303 1304// Response returns the raw server response from the last page request. 1305func (page ListCertificatesResultPage) Response() ListCertificatesResult { 1306 return page.lcr 1307} 1308 1309// Values returns the slice of values for the current page or nil if there are no values. 1310func (page ListCertificatesResultPage) Values() []Certificate { 1311 if page.lcr.IsEmpty() { 1312 return nil 1313 } 1314 return *page.lcr.Value 1315} 1316 1317// Creates a new instance of the ListCertificatesResultPage type. 1318func NewListCertificatesResultPage(cur ListCertificatesResult, getNextPage func(context.Context, ListCertificatesResult) (ListCertificatesResult, error)) ListCertificatesResultPage { 1319 return ListCertificatesResultPage{ 1320 fn: getNextPage, 1321 lcr: cur, 1322 } 1323} 1324 1325// ListPoolsResult values returned by the List operation. 1326type ListPoolsResult struct { 1327 autorest.Response `json:"-"` 1328 // Value - The collection of returned pools. 1329 Value *[]Pool `json:"value,omitempty"` 1330 // NextLink - The continuation token. 1331 NextLink *string `json:"nextLink,omitempty"` 1332} 1333 1334// ListPoolsResultIterator provides access to a complete listing of Pool values. 1335type ListPoolsResultIterator struct { 1336 i int 1337 page ListPoolsResultPage 1338} 1339 1340// NextWithContext advances to the next value. If there was an error making 1341// the request the iterator does not advance and the error is returned. 1342func (iter *ListPoolsResultIterator) NextWithContext(ctx context.Context) (err error) { 1343 if tracing.IsEnabled() { 1344 ctx = tracing.StartSpan(ctx, fqdn+"/ListPoolsResultIterator.NextWithContext") 1345 defer func() { 1346 sc := -1 1347 if iter.Response().Response.Response != nil { 1348 sc = iter.Response().Response.Response.StatusCode 1349 } 1350 tracing.EndSpan(ctx, sc, err) 1351 }() 1352 } 1353 iter.i++ 1354 if iter.i < len(iter.page.Values()) { 1355 return nil 1356 } 1357 err = iter.page.NextWithContext(ctx) 1358 if err != nil { 1359 iter.i-- 1360 return err 1361 } 1362 iter.i = 0 1363 return nil 1364} 1365 1366// Next advances to the next value. If there was an error making 1367// the request the iterator does not advance and the error is returned. 1368// Deprecated: Use NextWithContext() instead. 1369func (iter *ListPoolsResultIterator) Next() error { 1370 return iter.NextWithContext(context.Background()) 1371} 1372 1373// NotDone returns true if the enumeration should be started or is not yet complete. 1374func (iter ListPoolsResultIterator) NotDone() bool { 1375 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1376} 1377 1378// Response returns the raw server response from the last page request. 1379func (iter ListPoolsResultIterator) Response() ListPoolsResult { 1380 return iter.page.Response() 1381} 1382 1383// Value returns the current value or a zero-initialized value if the 1384// iterator has advanced beyond the end of the collection. 1385func (iter ListPoolsResultIterator) Value() Pool { 1386 if !iter.page.NotDone() { 1387 return Pool{} 1388 } 1389 return iter.page.Values()[iter.i] 1390} 1391 1392// Creates a new instance of the ListPoolsResultIterator type. 1393func NewListPoolsResultIterator(page ListPoolsResultPage) ListPoolsResultIterator { 1394 return ListPoolsResultIterator{page: page} 1395} 1396 1397// IsEmpty returns true if the ListResult contains no values. 1398func (lpr ListPoolsResult) IsEmpty() bool { 1399 return lpr.Value == nil || len(*lpr.Value) == 0 1400} 1401 1402// hasNextLink returns true if the NextLink is not empty. 1403func (lpr ListPoolsResult) hasNextLink() bool { 1404 return lpr.NextLink != nil && len(*lpr.NextLink) != 0 1405} 1406 1407// listPoolsResultPreparer prepares a request to retrieve the next set of results. 1408// It returns nil if no more results exist. 1409func (lpr ListPoolsResult) listPoolsResultPreparer(ctx context.Context) (*http.Request, error) { 1410 if !lpr.hasNextLink() { 1411 return nil, nil 1412 } 1413 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1414 autorest.AsJSON(), 1415 autorest.AsGet(), 1416 autorest.WithBaseURL(to.String(lpr.NextLink))) 1417} 1418 1419// ListPoolsResultPage contains a page of Pool values. 1420type ListPoolsResultPage struct { 1421 fn func(context.Context, ListPoolsResult) (ListPoolsResult, error) 1422 lpr ListPoolsResult 1423} 1424 1425// NextWithContext advances to the next page of values. If there was an error making 1426// the request the page does not advance and the error is returned. 1427func (page *ListPoolsResultPage) NextWithContext(ctx context.Context) (err error) { 1428 if tracing.IsEnabled() { 1429 ctx = tracing.StartSpan(ctx, fqdn+"/ListPoolsResultPage.NextWithContext") 1430 defer func() { 1431 sc := -1 1432 if page.Response().Response.Response != nil { 1433 sc = page.Response().Response.Response.StatusCode 1434 } 1435 tracing.EndSpan(ctx, sc, err) 1436 }() 1437 } 1438 for { 1439 next, err := page.fn(ctx, page.lpr) 1440 if err != nil { 1441 return err 1442 } 1443 page.lpr = next 1444 if !next.hasNextLink() || !next.IsEmpty() { 1445 break 1446 } 1447 } 1448 return nil 1449} 1450 1451// Next advances to the next page of values. If there was an error making 1452// the request the page does not advance and the error is returned. 1453// Deprecated: Use NextWithContext() instead. 1454func (page *ListPoolsResultPage) Next() error { 1455 return page.NextWithContext(context.Background()) 1456} 1457 1458// NotDone returns true if the page enumeration should be started or is not yet complete. 1459func (page ListPoolsResultPage) NotDone() bool { 1460 return !page.lpr.IsEmpty() 1461} 1462 1463// Response returns the raw server response from the last page request. 1464func (page ListPoolsResultPage) Response() ListPoolsResult { 1465 return page.lpr 1466} 1467 1468// Values returns the slice of values for the current page or nil if there are no values. 1469func (page ListPoolsResultPage) Values() []Pool { 1470 if page.lpr.IsEmpty() { 1471 return nil 1472 } 1473 return *page.lpr.Value 1474} 1475 1476// Creates a new instance of the ListPoolsResultPage type. 1477func NewListPoolsResultPage(cur ListPoolsResult, getNextPage func(context.Context, ListPoolsResult) (ListPoolsResult, error)) ListPoolsResultPage { 1478 return ListPoolsResultPage{ 1479 fn: getNextPage, 1480 lpr: cur, 1481 } 1482} 1483 1484// LocationQuota quotas associated with a Batch region for a particular subscription. 1485type LocationQuota struct { 1486 autorest.Response `json:"-"` 1487 // AccountQuota - READ-ONLY; The number of Batch accounts that may be created under the subscription in the specified region. 1488 AccountQuota *int32 `json:"accountQuota,omitempty"` 1489} 1490 1491// MetadataItem the Batch service does not assign any meaning to this metadata; it is solely for the use of 1492// user code. 1493type MetadataItem struct { 1494 Name *string `json:"name,omitempty"` 1495 Value *string `json:"value,omitempty"` 1496} 1497 1498// NetworkConfiguration the network configuration for a pool. 1499type NetworkConfiguration struct { 1500 // SubnetID - The virtual network must be in the same region and subscription as the Azure Batch account. The specified subnet should have enough free IP addresses to accommodate the number of nodes in the pool. If the subnet doesn't have enough free IP addresses, the pool will partially allocate compute nodes, and a resize error will occur. The 'MicrosoftAzureBatch' service principal must have the 'Classic Virtual Machine Contributor' Role-Based Access Control (RBAC) role for the specified VNet. The specified subnet must allow communication from the Azure Batch service to be able to schedule tasks on the compute nodes. This can be verified by checking if the specified VNet has any associated Network Security Groups (NSG). If communication to the compute nodes in the specified subnet is denied by an NSG, then the Batch service will set the state of the compute nodes to unusable. For pools created via virtualMachineConfiguration the Batch account must have poolAllocationMode userSubscription in order to use a VNet. If the specified VNet has any associated Network Security Groups (NSG), then a few reserved system ports must be enabled for inbound communication. For pools created with a virtual machine configuration, enable ports 29876 and 29877, as well as port 22 for Linux and port 3389 for Windows. For pools created with a cloud service configuration, enable ports 10100, 20100, and 30100. Also enable outbound connections to Azure Storage on port 443. For more details see: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration 1501 SubnetID *string `json:"subnetId,omitempty"` 1502 // EndpointConfiguration - Pool endpoint configuration is only supported on pools with the virtualMachineConfiguration property. 1503 EndpointConfiguration *PoolEndpointConfiguration `json:"endpointConfiguration,omitempty"` 1504} 1505 1506// NetworkSecurityGroupRule ... 1507type NetworkSecurityGroupRule struct { 1508 // Priority - Priorities within a pool must be unique and are evaluated in order of priority. The lower the number the higher the priority. For example, rules could be specified with order numbers of 150, 250, and 350. The rule with the order number of 150 takes precedence over the rule that has an order of 250. Allowed priorities are 150 to 3500. If any reserved or duplicate values are provided the request fails with HTTP status code 400. 1509 Priority *int32 `json:"priority,omitempty"` 1510 // Access - Possible values include: 'Allow', 'Deny' 1511 Access NetworkSecurityGroupRuleAccess `json:"access,omitempty"` 1512 // SourceAddressPrefix - Valid values are a single IP address (i.e. 10.10.10.10), IP subnet (i.e. 192.168.1.0/24), default tag, or * (for all addresses). If any other values are provided the request fails with HTTP status code 400. 1513 SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` 1514} 1515 1516// Operation ... 1517type Operation struct { 1518 // Name - This is of the format {provider}/{resource}/{operation} 1519 Name *string `json:"name,omitempty"` 1520 Display *OperationDisplay `json:"display,omitempty"` 1521 Origin *string `json:"origin,omitempty"` 1522 Properties interface{} `json:"properties,omitempty"` 1523} 1524 1525// OperationDisplay ... 1526type OperationDisplay struct { 1527 Provider *string `json:"provider,omitempty"` 1528 // Operation - For example: read, write, delete, or listKeys/action 1529 Operation *string `json:"operation,omitempty"` 1530 Resource *string `json:"resource,omitempty"` 1531 Description *string `json:"description,omitempty"` 1532} 1533 1534// OperationListResult ... 1535type OperationListResult struct { 1536 autorest.Response `json:"-"` 1537 Value *[]Operation `json:"value,omitempty"` 1538 NextLink *string `json:"nextLink,omitempty"` 1539} 1540 1541// OperationListResultIterator provides access to a complete listing of Operation values. 1542type OperationListResultIterator struct { 1543 i int 1544 page OperationListResultPage 1545} 1546 1547// NextWithContext advances to the next value. If there was an error making 1548// the request the iterator does not advance and the error is returned. 1549func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 1550 if tracing.IsEnabled() { 1551 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 1552 defer func() { 1553 sc := -1 1554 if iter.Response().Response.Response != nil { 1555 sc = iter.Response().Response.Response.StatusCode 1556 } 1557 tracing.EndSpan(ctx, sc, err) 1558 }() 1559 } 1560 iter.i++ 1561 if iter.i < len(iter.page.Values()) { 1562 return nil 1563 } 1564 err = iter.page.NextWithContext(ctx) 1565 if err != nil { 1566 iter.i-- 1567 return err 1568 } 1569 iter.i = 0 1570 return nil 1571} 1572 1573// Next advances to the next value. If there was an error making 1574// the request the iterator does not advance and the error is returned. 1575// Deprecated: Use NextWithContext() instead. 1576func (iter *OperationListResultIterator) Next() error { 1577 return iter.NextWithContext(context.Background()) 1578} 1579 1580// NotDone returns true if the enumeration should be started or is not yet complete. 1581func (iter OperationListResultIterator) NotDone() bool { 1582 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1583} 1584 1585// Response returns the raw server response from the last page request. 1586func (iter OperationListResultIterator) Response() OperationListResult { 1587 return iter.page.Response() 1588} 1589 1590// Value returns the current value or a zero-initialized value if the 1591// iterator has advanced beyond the end of the collection. 1592func (iter OperationListResultIterator) Value() Operation { 1593 if !iter.page.NotDone() { 1594 return Operation{} 1595 } 1596 return iter.page.Values()[iter.i] 1597} 1598 1599// Creates a new instance of the OperationListResultIterator type. 1600func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 1601 return OperationListResultIterator{page: page} 1602} 1603 1604// IsEmpty returns true if the ListResult contains no values. 1605func (olr OperationListResult) IsEmpty() bool { 1606 return olr.Value == nil || len(*olr.Value) == 0 1607} 1608 1609// hasNextLink returns true if the NextLink is not empty. 1610func (olr OperationListResult) hasNextLink() bool { 1611 return olr.NextLink != nil && len(*olr.NextLink) != 0 1612} 1613 1614// operationListResultPreparer prepares a request to retrieve the next set of results. 1615// It returns nil if no more results exist. 1616func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 1617 if !olr.hasNextLink() { 1618 return nil, nil 1619 } 1620 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1621 autorest.AsJSON(), 1622 autorest.AsGet(), 1623 autorest.WithBaseURL(to.String(olr.NextLink))) 1624} 1625 1626// OperationListResultPage contains a page of Operation values. 1627type OperationListResultPage struct { 1628 fn func(context.Context, OperationListResult) (OperationListResult, error) 1629 olr OperationListResult 1630} 1631 1632// NextWithContext advances to the next page of values. If there was an error making 1633// the request the page does not advance and the error is returned. 1634func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 1635 if tracing.IsEnabled() { 1636 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 1637 defer func() { 1638 sc := -1 1639 if page.Response().Response.Response != nil { 1640 sc = page.Response().Response.Response.StatusCode 1641 } 1642 tracing.EndSpan(ctx, sc, err) 1643 }() 1644 } 1645 for { 1646 next, err := page.fn(ctx, page.olr) 1647 if err != nil { 1648 return err 1649 } 1650 page.olr = next 1651 if !next.hasNextLink() || !next.IsEmpty() { 1652 break 1653 } 1654 } 1655 return nil 1656} 1657 1658// Next advances to the next page of values. If there was an error making 1659// the request the page does not advance and the error is returned. 1660// Deprecated: Use NextWithContext() instead. 1661func (page *OperationListResultPage) Next() error { 1662 return page.NextWithContext(context.Background()) 1663} 1664 1665// NotDone returns true if the page enumeration should be started or is not yet complete. 1666func (page OperationListResultPage) NotDone() bool { 1667 return !page.olr.IsEmpty() 1668} 1669 1670// Response returns the raw server response from the last page request. 1671func (page OperationListResultPage) Response() OperationListResult { 1672 return page.olr 1673} 1674 1675// Values returns the slice of values for the current page or nil if there are no values. 1676func (page OperationListResultPage) Values() []Operation { 1677 if page.olr.IsEmpty() { 1678 return nil 1679 } 1680 return *page.olr.Value 1681} 1682 1683// Creates a new instance of the OperationListResultPage type. 1684func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 1685 return OperationListResultPage{ 1686 fn: getNextPage, 1687 olr: cur, 1688 } 1689} 1690 1691// OSDisk ... 1692type OSDisk struct { 1693 // Caching - Default value is none. Possible values include: 'None', 'ReadOnly', 'ReadWrite' 1694 Caching CachingType `json:"caching,omitempty"` 1695} 1696 1697// Pool contains information about a pool. 1698type Pool struct { 1699 autorest.Response `json:"-"` 1700 // PoolProperties - The properties associated with the pool. 1701 *PoolProperties `json:"properties,omitempty"` 1702 // ID - READ-ONLY; The ID of the resource. 1703 ID *string `json:"id,omitempty"` 1704 // Name - READ-ONLY; The name of the resource. 1705 Name *string `json:"name,omitempty"` 1706 // Type - READ-ONLY; The type of the resource. 1707 Type *string `json:"type,omitempty"` 1708 // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. 1709 Etag *string `json:"etag,omitempty"` 1710} 1711 1712// MarshalJSON is the custom marshaler for Pool. 1713func (p Pool) MarshalJSON() ([]byte, error) { 1714 objectMap := make(map[string]interface{}) 1715 if p.PoolProperties != nil { 1716 objectMap["properties"] = p.PoolProperties 1717 } 1718 return json.Marshal(objectMap) 1719} 1720 1721// UnmarshalJSON is the custom unmarshaler for Pool struct. 1722func (p *Pool) UnmarshalJSON(body []byte) error { 1723 var m map[string]*json.RawMessage 1724 err := json.Unmarshal(body, &m) 1725 if err != nil { 1726 return err 1727 } 1728 for k, v := range m { 1729 switch k { 1730 case "properties": 1731 if v != nil { 1732 var poolProperties PoolProperties 1733 err = json.Unmarshal(*v, &poolProperties) 1734 if err != nil { 1735 return err 1736 } 1737 p.PoolProperties = &poolProperties 1738 } 1739 case "id": 1740 if v != nil { 1741 var ID string 1742 err = json.Unmarshal(*v, &ID) 1743 if err != nil { 1744 return err 1745 } 1746 p.ID = &ID 1747 } 1748 case "name": 1749 if v != nil { 1750 var name string 1751 err = json.Unmarshal(*v, &name) 1752 if err != nil { 1753 return err 1754 } 1755 p.Name = &name 1756 } 1757 case "type": 1758 if v != nil { 1759 var typeVar string 1760 err = json.Unmarshal(*v, &typeVar) 1761 if err != nil { 1762 return err 1763 } 1764 p.Type = &typeVar 1765 } 1766 case "etag": 1767 if v != nil { 1768 var etag string 1769 err = json.Unmarshal(*v, &etag) 1770 if err != nil { 1771 return err 1772 } 1773 p.Etag = &etag 1774 } 1775 } 1776 } 1777 1778 return nil 1779} 1780 1781// PoolCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 1782type PoolCreateFuture struct { 1783 azure.FutureAPI 1784 // Result returns the result of the asynchronous operation. 1785 // If the operation has not completed it will return an error. 1786 Result func(PoolClient) (Pool, error) 1787} 1788 1789// PoolDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 1790type PoolDeleteFuture struct { 1791 azure.FutureAPI 1792 // Result returns the result of the asynchronous operation. 1793 // If the operation has not completed it will return an error. 1794 Result func(PoolClient) (autorest.Response, error) 1795} 1796 1797// PoolEndpointConfiguration ... 1798type PoolEndpointConfiguration struct { 1799 // InboundNatPools - The maximum number of inbound NAT pools per Batch pool is 5. If the maximum number of inbound NAT pools is exceeded the request fails with HTTP status code 400. 1800 InboundNatPools *[]InboundNatPool `json:"inboundNatPools,omitempty"` 1801} 1802 1803// PoolProperties pool properties. 1804type PoolProperties struct { 1805 // DisplayName - The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024. 1806 DisplayName *string `json:"displayName,omitempty"` 1807 // LastModified - READ-ONLY; This is the last time at which the pool level data, such as the targetDedicatedNodes or autoScaleSettings, changed. It does not factor in node-level changes such as a compute node changing state. 1808 LastModified *date.Time `json:"lastModified,omitempty"` 1809 // CreationTime - READ-ONLY 1810 CreationTime *date.Time `json:"creationTime,omitempty"` 1811 // ProvisioningState - READ-ONLY; Values are: 1812 // Succeeded - The pool is available to run tasks subject to the availability of compute nodes. 1813 // Deleting - The user has requested that the pool be deleted, but the delete operation has not yet completed. Possible values include: 'PoolProvisioningStateSucceeded', 'PoolProvisioningStateDeleting' 1814 ProvisioningState PoolProvisioningState `json:"provisioningState,omitempty"` 1815 // ProvisioningStateTransitionTime - READ-ONLY 1816 ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` 1817 // AllocationState - READ-ONLY; Values are: 1818 // Steady - The pool is not resizing. There are no changes to the number of nodes in the pool in progress. A pool enters this state when it is created and when no operations are being performed on the pool to change the number of dedicated nodes. 1819 // Resizing - The pool is resizing; that is, compute nodes are being added to or removed from the pool. 1820 // Stopping - The pool was resizing, but the user has requested that the resize be stopped, but the stop request has not yet been completed. Possible values include: 'Steady', 'Resizing', 'Stopping' 1821 AllocationState AllocationState `json:"allocationState,omitempty"` 1822 // AllocationStateTransitionTime - READ-ONLY 1823 AllocationStateTransitionTime *date.Time `json:"allocationStateTransitionTime,omitempty"` 1824 // VMSize - For information about available sizes of virtual machines for Cloud Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all Cloud Services VM sizes except ExtraSmall. For information about available VM sizes for pools using images from the Virtual Machines Marketplace (pools created with virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for Virtual Machines (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). 1825 VMSize *string `json:"vmSize,omitempty"` 1826 // DeploymentConfiguration - Using CloudServiceConfiguration specifies that the nodes should be creating using Azure Cloud Services (PaaS), while VirtualMachineConfiguration uses Azure Virtual Machines (IaaS). 1827 DeploymentConfiguration *DeploymentConfiguration `json:"deploymentConfiguration,omitempty"` 1828 // CurrentDedicatedNodes - READ-ONLY 1829 CurrentDedicatedNodes *int32 `json:"currentDedicatedNodes,omitempty"` 1830 // CurrentLowPriorityNodes - READ-ONLY 1831 CurrentLowPriorityNodes *int32 `json:"currentLowPriorityNodes,omitempty"` 1832 ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` 1833 // AutoScaleRun - READ-ONLY; This property is set only if the pool automatically scales, i.e. autoScaleSettings are used. 1834 AutoScaleRun *AutoScaleRun `json:"autoScaleRun,omitempty"` 1835 // InterNodeCommunication - This imposes restrictions on which nodes can be assigned to the pool. Enabling this value can reduce the chance of the requested number of nodes to be allocated in the pool. If not specified, this value defaults to 'Disabled'. Possible values include: 'Enabled', 'Disabled' 1836 InterNodeCommunication InterNodeCommunicationState `json:"interNodeCommunication,omitempty"` 1837 NetworkConfiguration *NetworkConfiguration `json:"networkConfiguration,omitempty"` 1838 MaxTasksPerNode *int32 `json:"maxTasksPerNode,omitempty"` 1839 TaskSchedulingPolicy *TaskSchedulingPolicy `json:"taskSchedulingPolicy,omitempty"` 1840 UserAccounts *[]UserAccount `json:"userAccounts,omitempty"` 1841 // Metadata - The Batch service does not assign any meaning to metadata; it is solely for the use of user code. 1842 Metadata *[]MetadataItem `json:"metadata,omitempty"` 1843 // StartTask - In an PATCH (update) operation, this property can be set to an empty object to remove the start task from the pool. 1844 StartTask *StartTask `json:"startTask,omitempty"` 1845 // Certificates - For Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. 1846 Certificates *[]CertificateReference `json:"certificates,omitempty"` 1847 // ApplicationPackages - Changes to application packages affect all new compute nodes joining the pool, but do not affect compute nodes that are already in the pool until they are rebooted or reimaged. 1848 ApplicationPackages *[]ApplicationPackageReference `json:"applicationPackages,omitempty"` 1849 // ApplicationLicenses - The list of application licenses must be a subset of available Batch service application licenses. If a license is requested which is not supported, pool creation will fail. 1850 ApplicationLicenses *[]string `json:"applicationLicenses,omitempty"` 1851 // ResizeOperationStatus - READ-ONLY 1852 ResizeOperationStatus *ResizeOperationStatus `json:"resizeOperationStatus,omitempty"` 1853} 1854 1855// MarshalJSON is the custom marshaler for PoolProperties. 1856func (pp PoolProperties) MarshalJSON() ([]byte, error) { 1857 objectMap := make(map[string]interface{}) 1858 if pp.DisplayName != nil { 1859 objectMap["displayName"] = pp.DisplayName 1860 } 1861 if pp.VMSize != nil { 1862 objectMap["vmSize"] = pp.VMSize 1863 } 1864 if pp.DeploymentConfiguration != nil { 1865 objectMap["deploymentConfiguration"] = pp.DeploymentConfiguration 1866 } 1867 if pp.ScaleSettings != nil { 1868 objectMap["scaleSettings"] = pp.ScaleSettings 1869 } 1870 if pp.InterNodeCommunication != "" { 1871 objectMap["interNodeCommunication"] = pp.InterNodeCommunication 1872 } 1873 if pp.NetworkConfiguration != nil { 1874 objectMap["networkConfiguration"] = pp.NetworkConfiguration 1875 } 1876 if pp.MaxTasksPerNode != nil { 1877 objectMap["maxTasksPerNode"] = pp.MaxTasksPerNode 1878 } 1879 if pp.TaskSchedulingPolicy != nil { 1880 objectMap["taskSchedulingPolicy"] = pp.TaskSchedulingPolicy 1881 } 1882 if pp.UserAccounts != nil { 1883 objectMap["userAccounts"] = pp.UserAccounts 1884 } 1885 if pp.Metadata != nil { 1886 objectMap["metadata"] = pp.Metadata 1887 } 1888 if pp.StartTask != nil { 1889 objectMap["startTask"] = pp.StartTask 1890 } 1891 if pp.Certificates != nil { 1892 objectMap["certificates"] = pp.Certificates 1893 } 1894 if pp.ApplicationPackages != nil { 1895 objectMap["applicationPackages"] = pp.ApplicationPackages 1896 } 1897 if pp.ApplicationLicenses != nil { 1898 objectMap["applicationLicenses"] = pp.ApplicationLicenses 1899 } 1900 return json.Marshal(objectMap) 1901} 1902 1903// ProxyResource a definition of an Azure resource. 1904type ProxyResource struct { 1905 // ID - READ-ONLY; The ID of the resource. 1906 ID *string `json:"id,omitempty"` 1907 // Name - READ-ONLY; The name of the resource. 1908 Name *string `json:"name,omitempty"` 1909 // Type - READ-ONLY; The type of the resource. 1910 Type *string `json:"type,omitempty"` 1911 // Etag - READ-ONLY; The ETag of the resource, used for concurrency statements. 1912 Etag *string `json:"etag,omitempty"` 1913} 1914 1915// ResizeError ... 1916type ResizeError struct { 1917 // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. 1918 Code *string `json:"code,omitempty"` 1919 // Message - A message describing the error, intended to be suitable for display in a user interface. 1920 Message *string `json:"message,omitempty"` 1921 Details *[]ResizeError `json:"details,omitempty"` 1922} 1923 1924// ResizeOperationStatus describes either the current operation (if the pool AllocationState is Resizing) 1925// or the previously completed operation (if the AllocationState is Steady). 1926type ResizeOperationStatus struct { 1927 TargetDedicatedNodes *int32 `json:"targetDedicatedNodes,omitempty"` 1928 TargetLowPriorityNodes *int32 `json:"targetLowPriorityNodes,omitempty"` 1929 // ResizeTimeout - The default value is 15 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP status code is 400 (Bad Request). 1930 ResizeTimeout *string `json:"resizeTimeout,omitempty"` 1931 // NodeDeallocationOption - The default value is requeue. Possible values include: 'Requeue', 'Terminate', 'TaskCompletion', 'RetainedData' 1932 NodeDeallocationOption ComputeNodeDeallocationOption `json:"nodeDeallocationOption,omitempty"` 1933 StartTime *date.Time `json:"startTime,omitempty"` 1934 // Errors - This property is set only if an error occurred during the last pool resize, and only when the pool allocationState is Steady. 1935 Errors *[]ResizeError `json:"errors,omitempty"` 1936} 1937 1938// Resource a definition of an Azure resource. 1939type Resource struct { 1940 // ID - READ-ONLY; The ID of the resource. 1941 ID *string `json:"id,omitempty"` 1942 // Name - READ-ONLY; The name of the resource. 1943 Name *string `json:"name,omitempty"` 1944 // Type - READ-ONLY; The type of the resource. 1945 Type *string `json:"type,omitempty"` 1946 // Location - READ-ONLY; The location of the resource. 1947 Location *string `json:"location,omitempty"` 1948 // Tags - READ-ONLY; The tags of the resource. 1949 Tags map[string]*string `json:"tags"` 1950} 1951 1952// MarshalJSON is the custom marshaler for Resource. 1953func (r Resource) MarshalJSON() ([]byte, error) { 1954 objectMap := make(map[string]interface{}) 1955 return json.Marshal(objectMap) 1956} 1957 1958// ResourceFile ... 1959type ResourceFile struct { 1960 // BlobSource - This URL must be readable using anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read permissions on the blob, or set the ACL for the blob or its container to allow public access. 1961 BlobSource *string `json:"blobSource,omitempty"` 1962 FilePath *string `json:"filePath,omitempty"` 1963 // FileMode - This property applies only to files being downloaded to Linux compute nodes. It will be ignored if it is specified for a resourceFile which will be downloaded to a Windows node. If this property is not specified for a Linux node, then a default value of 0770 is applied to the file. 1964 FileMode *string `json:"fileMode,omitempty"` 1965} 1966 1967// ScaleSettings defines the desired size of the pool. This can either be 'fixedScale' where the requested 1968// targetDedicatedNodes is specified, or 'autoScale' which defines a formula which is periodically 1969// reevaluated. If this property is not specified, the pool will have a fixed scale with 0 1970// targetDedicatedNodes. 1971type ScaleSettings struct { 1972 // FixedScale - This property and autoScale are mutually exclusive and one of the properties must be specified. 1973 FixedScale *FixedScaleSettings `json:"fixedScale,omitempty"` 1974 // AutoScale - This property and fixedScale are mutually exclusive and one of the properties must be specified. 1975 AutoScale *AutoScaleSettings `json:"autoScale,omitempty"` 1976} 1977 1978// StartTask ... 1979type StartTask struct { 1980 // CommandLine - The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. Required if any other properties of the startTask are specified. 1981 CommandLine *string `json:"commandLine,omitempty"` 1982 ResourceFiles *[]ResourceFile `json:"resourceFiles,omitempty"` 1983 EnvironmentSettings *[]EnvironmentSetting `json:"environmentSettings,omitempty"` 1984 // UserIdentity - If omitted, the task runs as a non-administrative user unique to the task. 1985 UserIdentity *UserIdentity `json:"userIdentity,omitempty"` 1986 // MaxTaskRetryCount - The Batch service retries a task if its exit code is nonzero. Note that this value specifically controls the number of retries. The Batch service will try the task once, and may then retry up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task. If the maximum retry count is -1, the Batch service retries the task without limit. 1987 MaxTaskRetryCount *int32 `json:"maxTaskRetryCount,omitempty"` 1988 // WaitForSuccess - If true and the start task fails on a compute node, the Batch service retries the start task up to its maximum retry count (maxTaskRetryCount). If the task has still not completed successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule tasks to it. This condition can be detected via the node state and scheduling error detail. If false, the Batch service will not wait for the start task to complete. In this case, other tasks can start executing on the compute node while the start task is still running; and even if the start task fails, new tasks will continue to be scheduled on the node. The default is false. 1989 WaitForSuccess *bool `json:"waitForSuccess,omitempty"` 1990} 1991 1992// TaskSchedulingPolicy ... 1993type TaskSchedulingPolicy struct { 1994 // NodeFillType - Possible values include: 'Spread', 'Pack' 1995 NodeFillType ComputeNodeFillType `json:"nodeFillType,omitempty"` 1996} 1997 1998// UserAccount ... 1999type UserAccount struct { 2000 Name *string `json:"name,omitempty"` 2001 Password *string `json:"password,omitempty"` 2002 // ElevationLevel - nonAdmin - The auto user is a standard user without elevated access. admin - The auto user is a user with elevated access and operates with full Administrator permissions. The default value is nonAdmin. Possible values include: 'NonAdmin', 'Admin' 2003 ElevationLevel ElevationLevel `json:"elevationLevel,omitempty"` 2004 // LinuxUserConfiguration - This property is ignored if specified on a Windows pool. If not specified, the user is created with the default options. 2005 LinuxUserConfiguration *LinuxUserConfiguration `json:"linuxUserConfiguration,omitempty"` 2006} 2007 2008// UserIdentity specify either the userName or autoUser property, but not both. 2009type UserIdentity struct { 2010 // UserName - The userName and autoUser properties are mutually exclusive; you must specify one but not both. 2011 UserName *string `json:"userName,omitempty"` 2012 // AutoUser - The userName and autoUser properties are mutually exclusive; you must specify one but not both. 2013 AutoUser *AutoUserSpecification `json:"autoUser,omitempty"` 2014} 2015 2016// VirtualMachineConfiguration ... 2017type VirtualMachineConfiguration struct { 2018 ImageReference *ImageReference `json:"imageReference,omitempty"` 2019 OsDisk *OSDisk `json:"osDisk,omitempty"` 2020 // NodeAgentSkuID - The Batch node agent is a program that runs on each node in the pool, and provides the command-and-control interface between the node and the Batch service. There are different implementations of the node agent, known as SKUs, for different operating systems. You must specify a node agent SKU which matches the selected image reference. To get the list of supported node agent SKUs along with their list of verified image references, see the 'List supported node agent SKUs' operation. 2021 NodeAgentSkuID *string `json:"nodeAgentSkuId,omitempty"` 2022 // WindowsConfiguration - This property must not be specified if the imageReference specifies a Linux OS image. 2023 WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` 2024 // DataDisks - This property must be specified if the compute nodes in the pool need to have empty data disks attached to them. 2025 DataDisks *[]DataDisk `json:"dataDisks,omitempty"` 2026 // LicenseType - This only applies to images that contain the Windows operating system, and should only be used when you hold valid on-premises licenses for the nodes which will be deployed. If omitted, no on-premises licensing discount is applied. Values are: 2027 // Windows_Server - The on-premises license is for Windows Server. 2028 // Windows_Client - The on-premises license is for Windows Client. 2029 LicenseType *string `json:"licenseType,omitempty"` 2030} 2031 2032// WindowsConfiguration ... 2033type WindowsConfiguration struct { 2034 // EnableAutomaticUpdates - If omitted, the default value is true. 2035 EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` 2036} 2037