1package batchai 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/batchai/mgmt/2018-03-01/batchai" 33 34// AllocationState enumerates the values for allocation state. 35type AllocationState string 36 37const ( 38 // Resizing ... 39 Resizing AllocationState = "resizing" 40 // Steady ... 41 Steady AllocationState = "steady" 42) 43 44// PossibleAllocationStateValues returns an array of possible values for the AllocationState const type. 45func PossibleAllocationStateValues() []AllocationState { 46 return []AllocationState{Resizing, Steady} 47} 48 49// CachingType enumerates the values for caching type. 50type CachingType string 51 52const ( 53 // None ... 54 None CachingType = "none" 55 // Readonly ... 56 Readonly CachingType = "readonly" 57 // Readwrite ... 58 Readwrite CachingType = "readwrite" 59) 60 61// PossibleCachingTypeValues returns an array of possible values for the CachingType const type. 62func PossibleCachingTypeValues() []CachingType { 63 return []CachingType{None, Readonly, Readwrite} 64} 65 66// DeallocationOption enumerates the values for deallocation option. 67type DeallocationOption string 68 69const ( 70 // Requeue ... 71 Requeue DeallocationOption = "requeue" 72 // Terminate ... 73 Terminate DeallocationOption = "terminate" 74 // Unknown ... 75 Unknown DeallocationOption = "unknown" 76 // Waitforjobcompletion ... 77 Waitforjobcompletion DeallocationOption = "waitforjobcompletion" 78) 79 80// PossibleDeallocationOptionValues returns an array of possible values for the DeallocationOption const type. 81func PossibleDeallocationOptionValues() []DeallocationOption { 82 return []DeallocationOption{Requeue, Terminate, Unknown, Waitforjobcompletion} 83} 84 85// ExecutionState enumerates the values for execution state. 86type ExecutionState string 87 88const ( 89 // Failed ... 90 Failed ExecutionState = "failed" 91 // Queued ... 92 Queued ExecutionState = "queued" 93 // Running ... 94 Running ExecutionState = "running" 95 // Succeeded ... 96 Succeeded ExecutionState = "succeeded" 97 // Terminating ... 98 Terminating ExecutionState = "terminating" 99) 100 101// PossibleExecutionStateValues returns an array of possible values for the ExecutionState const type. 102func PossibleExecutionStateValues() []ExecutionState { 103 return []ExecutionState{Failed, Queued, Running, Succeeded, Terminating} 104} 105 106// FileServerProvisioningState enumerates the values for file server provisioning state. 107type FileServerProvisioningState string 108 109const ( 110 // FileServerProvisioningStateCreating ... 111 FileServerProvisioningStateCreating FileServerProvisioningState = "creating" 112 // FileServerProvisioningStateDeleting ... 113 FileServerProvisioningStateDeleting FileServerProvisioningState = "deleting" 114 // FileServerProvisioningStateFailed ... 115 FileServerProvisioningStateFailed FileServerProvisioningState = "failed" 116 // FileServerProvisioningStateSucceeded ... 117 FileServerProvisioningStateSucceeded FileServerProvisioningState = "succeeded" 118 // FileServerProvisioningStateUpdating ... 119 FileServerProvisioningStateUpdating FileServerProvisioningState = "updating" 120) 121 122// PossibleFileServerProvisioningStateValues returns an array of possible values for the FileServerProvisioningState const type. 123func PossibleFileServerProvisioningStateValues() []FileServerProvisioningState { 124 return []FileServerProvisioningState{FileServerProvisioningStateCreating, FileServerProvisioningStateDeleting, FileServerProvisioningStateFailed, FileServerProvisioningStateSucceeded, FileServerProvisioningStateUpdating} 125} 126 127// FileServerType enumerates the values for file server type. 128type FileServerType string 129 130const ( 131 // Glusterfs ... 132 Glusterfs FileServerType = "glusterfs" 133 // Nfs ... 134 Nfs FileServerType = "nfs" 135) 136 137// PossibleFileServerTypeValues returns an array of possible values for the FileServerType const type. 138func PossibleFileServerTypeValues() []FileServerType { 139 return []FileServerType{Glusterfs, Nfs} 140} 141 142// OutputType enumerates the values for output type. 143type OutputType string 144 145const ( 146 // Custom ... 147 Custom OutputType = "custom" 148 // Logs ... 149 Logs OutputType = "logs" 150 // Model ... 151 Model OutputType = "model" 152 // Summary ... 153 Summary OutputType = "summary" 154) 155 156// PossibleOutputTypeValues returns an array of possible values for the OutputType const type. 157func PossibleOutputTypeValues() []OutputType { 158 return []OutputType{Custom, Logs, Model, Summary} 159} 160 161// ProvisioningState enumerates the values for provisioning state. 162type ProvisioningState string 163 164const ( 165 // ProvisioningStateCreating ... 166 ProvisioningStateCreating ProvisioningState = "creating" 167 // ProvisioningStateDeleting ... 168 ProvisioningStateDeleting ProvisioningState = "deleting" 169 // ProvisioningStateFailed ... 170 ProvisioningStateFailed ProvisioningState = "failed" 171 // ProvisioningStateSucceeded ... 172 ProvisioningStateSucceeded ProvisioningState = "succeeded" 173) 174 175// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. 176func PossibleProvisioningStateValues() []ProvisioningState { 177 return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded} 178} 179 180// StorageAccountType enumerates the values for storage account type. 181type StorageAccountType string 182 183const ( 184 // PremiumLRS ... 185 PremiumLRS StorageAccountType = "Premium_LRS" 186 // StandardLRS ... 187 StandardLRS StorageAccountType = "Standard_LRS" 188) 189 190// PossibleStorageAccountTypeValues returns an array of possible values for the StorageAccountType const type. 191func PossibleStorageAccountTypeValues() []StorageAccountType { 192 return []StorageAccountType{PremiumLRS, StandardLRS} 193} 194 195// ToolType enumerates the values for tool type. 196type ToolType string 197 198const ( 199 // ToolTypeCaffe ... 200 ToolTypeCaffe ToolType = "caffe" 201 // ToolTypeCaffe2 ... 202 ToolTypeCaffe2 ToolType = "caffe2" 203 // ToolTypeChainer ... 204 ToolTypeChainer ToolType = "chainer" 205 // ToolTypeCntk ... 206 ToolTypeCntk ToolType = "cntk" 207 // ToolTypeCustom ... 208 ToolTypeCustom ToolType = "custom" 209 // ToolTypeTensorflow ... 210 ToolTypeTensorflow ToolType = "tensorflow" 211) 212 213// PossibleToolTypeValues returns an array of possible values for the ToolType const type. 214func PossibleToolTypeValues() []ToolType { 215 return []ToolType{ToolTypeCaffe, ToolTypeCaffe2, ToolTypeChainer, ToolTypeCntk, ToolTypeCustom, ToolTypeTensorflow} 216} 217 218// VMPriority enumerates the values for vm priority. 219type VMPriority string 220 221const ( 222 // Dedicated ... 223 Dedicated VMPriority = "dedicated" 224 // Lowpriority ... 225 Lowpriority VMPriority = "lowpriority" 226) 227 228// PossibleVMPriorityValues returns an array of possible values for the VMPriority const type. 229func PossibleVMPriorityValues() []VMPriority { 230 return []VMPriority{Dedicated, Lowpriority} 231} 232 233// AppInsightsReference specifies Azure Application Insights information for performance counters 234// reporting. 235type AppInsightsReference struct { 236 Component *ResourceID `json:"component,omitempty"` 237 InstrumentationKey *string `json:"instrumentationKey,omitempty"` 238 // InstrumentationKeySecretReference - Specifies KeyVault Store and Secret which contains Azure Application Insights instrumentation key. One of instrumentationKey or instrumentationKeySecretReference must be specified. 239 InstrumentationKeySecretReference *KeyVaultSecretReference `json:"instrumentationKeySecretReference,omitempty"` 240} 241 242// AutoScaleSettings the system automatically scales the cluster up and down (within minimumNodeCount and 243// maximumNodeCount) based on the pending and running jobs on the cluster. 244type AutoScaleSettings struct { 245 MinimumNodeCount *int32 `json:"minimumNodeCount,omitempty"` 246 MaximumNodeCount *int32 `json:"maximumNodeCount,omitempty"` 247 InitialNodeCount *int32 `json:"initialNodeCount,omitempty"` 248} 249 250// AzureBlobFileSystemReference provides required information, for the service to be able to mount Azure 251// Blob Storage container on the cluster nodes. 252type AzureBlobFileSystemReference struct { 253 AccountName *string `json:"accountName,omitempty"` 254 ContainerName *string `json:"containerName,omitempty"` 255 Credentials *AzureStorageCredentialsInfo `json:"credentials,omitempty"` 256 // RelativeMountPath - Note that all cluster level blob file systems will be mounted under $AZ_BATCHAI_MOUNT_ROOT location and all job level blob file systems will be mounted under $AZ_BATCHAI_JOB_MOUNT_ROOT. 257 RelativeMountPath *string `json:"relativeMountPath,omitempty"` 258 MountOptions *string `json:"mountOptions,omitempty"` 259} 260 261// AzureFileShareReference details of the Azure File Share to mount on the cluster. 262type AzureFileShareReference struct { 263 AccountName *string `json:"accountName,omitempty"` 264 AzureFileURL *string `json:"azureFileUrl,omitempty"` 265 Credentials *AzureStorageCredentialsInfo `json:"credentials,omitempty"` 266 // RelativeMountPath - Note that all cluster level file shares will be mounted under $AZ_BATCHAI_MOUNT_ROOT location and all job level file shares will be mounted under $AZ_BATCHAI_JOB_MOUNT_ROOT. 267 RelativeMountPath *string `json:"relativeMountPath,omitempty"` 268 // FileMode - Default value is 0777. Valid only if OS is linux. 269 FileMode *string `json:"fileMode,omitempty"` 270 // DirectoryMode - Default value is 0777. Valid only if OS is linux. 271 DirectoryMode *string `json:"directoryMode,omitempty"` 272} 273 274// AzureStorageCredentialsInfo credentials to access Azure File Share. 275type AzureStorageCredentialsInfo struct { 276 // AccountKey - One of accountKey or accountKeySecretReference must be specified. 277 AccountKey *string `json:"accountKey,omitempty"` 278 // AccountKeySecretReference - Users can store their secrets in Azure KeyVault and pass it to the Batch AI Service to integrate with KeyVault. One of accountKey or accountKeySecretReference must be specified. 279 AccountKeySecretReference *KeyVaultSecretReference `json:"accountKeySecretReference,omitempty"` 280} 281 282// Caffe2Settings specifies the settings for Caffe2 job. 283type Caffe2Settings struct { 284 PythonScriptFilePath *string `json:"pythonScriptFilePath,omitempty"` 285 PythonInterpreterPath *string `json:"pythonInterpreterPath,omitempty"` 286 CommandLineArgs *string `json:"commandLineArgs,omitempty"` 287} 288 289// CaffeSettings specifies the settings for Caffe job. 290type CaffeSettings struct { 291 // ConfigFilePath - This property cannot be specified if pythonScriptFilePath is specified. 292 ConfigFilePath *string `json:"configFilePath,omitempty"` 293 // PythonScriptFilePath - This property cannot be specified if configFilePath is specified. 294 PythonScriptFilePath *string `json:"pythonScriptFilePath,omitempty"` 295 // PythonInterpreterPath - This property can be specified only if the pythonScriptFilePath is specified. 296 PythonInterpreterPath *string `json:"pythonInterpreterPath,omitempty"` 297 CommandLineArgs *string `json:"commandLineArgs,omitempty"` 298 // ProcessCount - The default value for this property is equal to nodeCount property 299 ProcessCount *int32 `json:"processCount,omitempty"` 300} 301 302// ChainerSettings specifies the settings for Chainer job. 303type ChainerSettings struct { 304 PythonScriptFilePath *string `json:"pythonScriptFilePath,omitempty"` 305 PythonInterpreterPath *string `json:"pythonInterpreterPath,omitempty"` 306 CommandLineArgs *string `json:"commandLineArgs,omitempty"` 307 // ProcessCount - The default value for this property is equal to nodeCount property 308 ProcessCount *int32 `json:"processCount,omitempty"` 309} 310 311// CloudError an error response from the Batch AI service. 312type CloudError struct { 313 // Error - An error response from the Batch AI service. 314 Error *CloudErrorBody `json:"error,omitempty"` 315} 316 317// CloudErrorBody an error response from the Batch AI service. 318type CloudErrorBody struct { 319 // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. 320 Code *string `json:"code,omitempty"` 321 // Message - A message describing the error, intended to be suitable for display in a user interface. 322 Message *string `json:"message,omitempty"` 323 // Target - The target of the particular error. For example, the name of the property in error. 324 Target *string `json:"target,omitempty"` 325 // Details - A list of additional details about the error. 326 Details *[]CloudErrorBody `json:"details,omitempty"` 327} 328 329// Cluster contains information about a Cluster. 330type Cluster struct { 331 autorest.Response `json:"-"` 332 // ClusterProperties - The properties associated with the Cluster. 333 *ClusterProperties `json:"properties,omitempty"` 334 // ID - READ-ONLY; The ID of the resource 335 ID *string `json:"id,omitempty"` 336 // Name - READ-ONLY; The name of the resource 337 Name *string `json:"name,omitempty"` 338 // Type - READ-ONLY; The type of the resource 339 Type *string `json:"type,omitempty"` 340 // Location - READ-ONLY; The location of the resource 341 Location *string `json:"location,omitempty"` 342 // Tags - READ-ONLY; The tags of the resource 343 Tags map[string]*string `json:"tags"` 344} 345 346// MarshalJSON is the custom marshaler for Cluster. 347func (c Cluster) MarshalJSON() ([]byte, error) { 348 objectMap := make(map[string]interface{}) 349 if c.ClusterProperties != nil { 350 objectMap["properties"] = c.ClusterProperties 351 } 352 return json.Marshal(objectMap) 353} 354 355// UnmarshalJSON is the custom unmarshaler for Cluster struct. 356func (c *Cluster) UnmarshalJSON(body []byte) error { 357 var m map[string]*json.RawMessage 358 err := json.Unmarshal(body, &m) 359 if err != nil { 360 return err 361 } 362 for k, v := range m { 363 switch k { 364 case "properties": 365 if v != nil { 366 var clusterProperties ClusterProperties 367 err = json.Unmarshal(*v, &clusterProperties) 368 if err != nil { 369 return err 370 } 371 c.ClusterProperties = &clusterProperties 372 } 373 case "id": 374 if v != nil { 375 var ID string 376 err = json.Unmarshal(*v, &ID) 377 if err != nil { 378 return err 379 } 380 c.ID = &ID 381 } 382 case "name": 383 if v != nil { 384 var name string 385 err = json.Unmarshal(*v, &name) 386 if err != nil { 387 return err 388 } 389 c.Name = &name 390 } 391 case "type": 392 if v != nil { 393 var typeVar string 394 err = json.Unmarshal(*v, &typeVar) 395 if err != nil { 396 return err 397 } 398 c.Type = &typeVar 399 } 400 case "location": 401 if v != nil { 402 var location string 403 err = json.Unmarshal(*v, &location) 404 if err != nil { 405 return err 406 } 407 c.Location = &location 408 } 409 case "tags": 410 if v != nil { 411 var tags map[string]*string 412 err = json.Unmarshal(*v, &tags) 413 if err != nil { 414 return err 415 } 416 c.Tags = tags 417 } 418 } 419 } 420 421 return nil 422} 423 424// ClusterBaseProperties the properties of a Cluster. 425type ClusterBaseProperties struct { 426 // VMSize - All virtual machines in a cluster are the same size. For information about available VM sizes for clusters using images from the Virtual Machines Marketplace (see Sizes for Virtual Machines (Linux) or Sizes for Virtual Machines (Windows). Batch AI service supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). 427 VMSize *string `json:"vmSize,omitempty"` 428 // VMPriority - Default is dedicated. Possible values include: 'Dedicated', 'Lowpriority' 429 VMPriority VMPriority `json:"vmPriority,omitempty"` 430 ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` 431 VirtualMachineConfiguration *VirtualMachineConfiguration `json:"virtualMachineConfiguration,omitempty"` 432 NodeSetup *NodeSetup `json:"nodeSetup,omitempty"` 433 UserAccountSettings *UserAccountSettings `json:"userAccountSettings,omitempty"` 434 Subnet *ResourceID `json:"subnet,omitempty"` 435} 436 437// ClusterCreateParameters parameters supplied to the Create operation. 438type ClusterCreateParameters struct { 439 // Location - The region in which to create the cluster. 440 Location *string `json:"location,omitempty"` 441 // Tags - The user specified tags associated with the Cluster. 442 Tags map[string]*string `json:"tags"` 443 // ClusterBaseProperties - The properties of the Cluster. 444 *ClusterBaseProperties `json:"properties,omitempty"` 445} 446 447// MarshalJSON is the custom marshaler for ClusterCreateParameters. 448func (ccp ClusterCreateParameters) MarshalJSON() ([]byte, error) { 449 objectMap := make(map[string]interface{}) 450 if ccp.Location != nil { 451 objectMap["location"] = ccp.Location 452 } 453 if ccp.Tags != nil { 454 objectMap["tags"] = ccp.Tags 455 } 456 if ccp.ClusterBaseProperties != nil { 457 objectMap["properties"] = ccp.ClusterBaseProperties 458 } 459 return json.Marshal(objectMap) 460} 461 462// UnmarshalJSON is the custom unmarshaler for ClusterCreateParameters struct. 463func (ccp *ClusterCreateParameters) UnmarshalJSON(body []byte) error { 464 var m map[string]*json.RawMessage 465 err := json.Unmarshal(body, &m) 466 if err != nil { 467 return err 468 } 469 for k, v := range m { 470 switch k { 471 case "location": 472 if v != nil { 473 var location string 474 err = json.Unmarshal(*v, &location) 475 if err != nil { 476 return err 477 } 478 ccp.Location = &location 479 } 480 case "tags": 481 if v != nil { 482 var tags map[string]*string 483 err = json.Unmarshal(*v, &tags) 484 if err != nil { 485 return err 486 } 487 ccp.Tags = tags 488 } 489 case "properties": 490 if v != nil { 491 var clusterBaseProperties ClusterBaseProperties 492 err = json.Unmarshal(*v, &clusterBaseProperties) 493 if err != nil { 494 return err 495 } 496 ccp.ClusterBaseProperties = &clusterBaseProperties 497 } 498 } 499 } 500 501 return nil 502} 503 504// ClusterListResult values returned by the List Clusters operation. 505type ClusterListResult struct { 506 autorest.Response `json:"-"` 507 // Value - The collection of returned Clusters. 508 Value *[]Cluster `json:"value,omitempty"` 509 // NextLink - The continuation token. 510 NextLink *string `json:"nextLink,omitempty"` 511} 512 513// ClusterListResultIterator provides access to a complete listing of Cluster values. 514type ClusterListResultIterator struct { 515 i int 516 page ClusterListResultPage 517} 518 519// NextWithContext advances to the next value. If there was an error making 520// the request the iterator does not advance and the error is returned. 521func (iter *ClusterListResultIterator) NextWithContext(ctx context.Context) (err error) { 522 if tracing.IsEnabled() { 523 ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListResultIterator.NextWithContext") 524 defer func() { 525 sc := -1 526 if iter.Response().Response.Response != nil { 527 sc = iter.Response().Response.Response.StatusCode 528 } 529 tracing.EndSpan(ctx, sc, err) 530 }() 531 } 532 iter.i++ 533 if iter.i < len(iter.page.Values()) { 534 return nil 535 } 536 err = iter.page.NextWithContext(ctx) 537 if err != nil { 538 iter.i-- 539 return err 540 } 541 iter.i = 0 542 return nil 543} 544 545// Next advances to the next value. If there was an error making 546// the request the iterator does not advance and the error is returned. 547// Deprecated: Use NextWithContext() instead. 548func (iter *ClusterListResultIterator) Next() error { 549 return iter.NextWithContext(context.Background()) 550} 551 552// NotDone returns true if the enumeration should be started or is not yet complete. 553func (iter ClusterListResultIterator) NotDone() bool { 554 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 555} 556 557// Response returns the raw server response from the last page request. 558func (iter ClusterListResultIterator) Response() ClusterListResult { 559 return iter.page.Response() 560} 561 562// Value returns the current value or a zero-initialized value if the 563// iterator has advanced beyond the end of the collection. 564func (iter ClusterListResultIterator) Value() Cluster { 565 if !iter.page.NotDone() { 566 return Cluster{} 567 } 568 return iter.page.Values()[iter.i] 569} 570 571// Creates a new instance of the ClusterListResultIterator type. 572func NewClusterListResultIterator(page ClusterListResultPage) ClusterListResultIterator { 573 return ClusterListResultIterator{page: page} 574} 575 576// IsEmpty returns true if the ListResult contains no values. 577func (clr ClusterListResult) IsEmpty() bool { 578 return clr.Value == nil || len(*clr.Value) == 0 579} 580 581// clusterListResultPreparer prepares a request to retrieve the next set of results. 582// It returns nil if no more results exist. 583func (clr ClusterListResult) clusterListResultPreparer(ctx context.Context) (*http.Request, error) { 584 if clr.NextLink == nil || len(to.String(clr.NextLink)) < 1 { 585 return nil, nil 586 } 587 return autorest.Prepare((&http.Request{}).WithContext(ctx), 588 autorest.AsJSON(), 589 autorest.AsGet(), 590 autorest.WithBaseURL(to.String(clr.NextLink))) 591} 592 593// ClusterListResultPage contains a page of Cluster values. 594type ClusterListResultPage struct { 595 fn func(context.Context, ClusterListResult) (ClusterListResult, error) 596 clr ClusterListResult 597} 598 599// NextWithContext advances to the next page of values. If there was an error making 600// the request the page does not advance and the error is returned. 601func (page *ClusterListResultPage) NextWithContext(ctx context.Context) (err error) { 602 if tracing.IsEnabled() { 603 ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListResultPage.NextWithContext") 604 defer func() { 605 sc := -1 606 if page.Response().Response.Response != nil { 607 sc = page.Response().Response.Response.StatusCode 608 } 609 tracing.EndSpan(ctx, sc, err) 610 }() 611 } 612 next, err := page.fn(ctx, page.clr) 613 if err != nil { 614 return err 615 } 616 page.clr = next 617 return nil 618} 619 620// Next advances to the next page of values. If there was an error making 621// the request the page does not advance and the error is returned. 622// Deprecated: Use NextWithContext() instead. 623func (page *ClusterListResultPage) Next() error { 624 return page.NextWithContext(context.Background()) 625} 626 627// NotDone returns true if the page enumeration should be started or is not yet complete. 628func (page ClusterListResultPage) NotDone() bool { 629 return !page.clr.IsEmpty() 630} 631 632// Response returns the raw server response from the last page request. 633func (page ClusterListResultPage) Response() ClusterListResult { 634 return page.clr 635} 636 637// Values returns the slice of values for the current page or nil if there are no values. 638func (page ClusterListResultPage) Values() []Cluster { 639 if page.clr.IsEmpty() { 640 return nil 641 } 642 return *page.clr.Value 643} 644 645// Creates a new instance of the ClusterListResultPage type. 646func NewClusterListResultPage(getNextPage func(context.Context, ClusterListResult) (ClusterListResult, error)) ClusterListResultPage { 647 return ClusterListResultPage{fn: getNextPage} 648} 649 650// ClusterProperties job specific properties. 651type ClusterProperties struct { 652 // VMSize - All virtual machines in a cluster are the same size. For information about available VM sizes for clusters using images from the Virtual Machines Marketplace (see Sizes for Virtual Machines (Linux) or Sizes for Virtual Machines (Windows). Batch AI service supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). 653 VMSize *string `json:"vmSize,omitempty"` 654 // VMPriority - The default value is dedicated. The node can get preempted while the task is running if lowpriority is chosen. This is best suited if the workload is checkpointing and can be restarted. Possible values include: 'Dedicated', 'Lowpriority' 655 VMPriority VMPriority `json:"vmPriority,omitempty"` 656 ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` 657 VirtualMachineConfiguration *VirtualMachineConfiguration `json:"virtualMachineConfiguration,omitempty"` 658 NodeSetup *NodeSetup `json:"nodeSetup,omitempty"` 659 UserAccountSettings *UserAccountSettings `json:"userAccountSettings,omitempty"` 660 Subnet *ResourceID `json:"subnet,omitempty"` 661 // CreationTime - READ-ONLY 662 CreationTime *date.Time `json:"creationTime,omitempty"` 663 // ProvisioningState - READ-ONLY; Possible value are: creating - Specifies that the cluster is being created. succeeded - Specifies that the cluster has been created successfully. failed - Specifies that the cluster creation has failed. deleting - Specifies that the cluster is being deleted. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateDeleting' 664 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 665 // ProvisioningStateTransitionTime - READ-ONLY 666 ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` 667 // AllocationState - READ-ONLY; Possible values are: steady and resizing. steady state indicates that the cluster is not resizing. There are no changes to the number of compute nodes in the cluster in progress. A cluster enters this state when it is created and when no operations are being performed on the cluster to change the number of compute nodes. resizing state indicates that the cluster is resizing; that is, compute nodes are being added to or removed from the cluster. Possible values include: 'Steady', 'Resizing' 668 AllocationState AllocationState `json:"allocationState,omitempty"` 669 // AllocationStateTransitionTime - READ-ONLY 670 AllocationStateTransitionTime *date.Time `json:"allocationStateTransitionTime,omitempty"` 671 // Errors - This element contains all the errors encountered by various compute nodes during node setup. 672 Errors *[]Error `json:"errors,omitempty"` 673 // CurrentNodeCount - READ-ONLY 674 CurrentNodeCount *int32 `json:"currentNodeCount,omitempty"` 675 // NodeStateCounts - READ-ONLY 676 NodeStateCounts *NodeStateCounts `json:"nodeStateCounts,omitempty"` 677} 678 679// ClustersCreateFuture an abstraction for monitoring and retrieving the results of a long-running 680// operation. 681type ClustersCreateFuture struct { 682 azure.Future 683} 684 685// Result returns the result of the asynchronous operation. 686// If the operation has not completed it will return an error. 687func (future *ClustersCreateFuture) Result(client ClustersClient) (c Cluster, err error) { 688 var done bool 689 done, err = future.DoneWithContext(context.Background(), client) 690 if err != nil { 691 err = autorest.NewErrorWithError(err, "batchai.ClustersCreateFuture", "Result", future.Response(), "Polling failure") 692 return 693 } 694 if !done { 695 err = azure.NewAsyncOpIncompleteError("batchai.ClustersCreateFuture") 696 return 697 } 698 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 699 if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { 700 c, err = client.CreateResponder(c.Response.Response) 701 if err != nil { 702 err = autorest.NewErrorWithError(err, "batchai.ClustersCreateFuture", "Result", c.Response.Response, "Failure responding to request") 703 } 704 } 705 return 706} 707 708// ClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 709// operation. 710type ClustersDeleteFuture struct { 711 azure.Future 712} 713 714// Result returns the result of the asynchronous operation. 715// If the operation has not completed it will return an error. 716func (future *ClustersDeleteFuture) Result(client ClustersClient) (ar autorest.Response, err error) { 717 var done bool 718 done, err = future.DoneWithContext(context.Background(), client) 719 if err != nil { 720 err = autorest.NewErrorWithError(err, "batchai.ClustersDeleteFuture", "Result", future.Response(), "Polling failure") 721 return 722 } 723 if !done { 724 err = azure.NewAsyncOpIncompleteError("batchai.ClustersDeleteFuture") 725 return 726 } 727 ar.Response = future.Response() 728 return 729} 730 731// ClusterUpdateParameters parameters supplied to the Update operation. 732type ClusterUpdateParameters struct { 733 // Tags - The user specified tags associated with the Cluster. 734 Tags map[string]*string `json:"tags"` 735 // ClusterUpdateProperties - The properties of the Cluster. 736 *ClusterUpdateProperties `json:"properties,omitempty"` 737} 738 739// MarshalJSON is the custom marshaler for ClusterUpdateParameters. 740func (cup ClusterUpdateParameters) MarshalJSON() ([]byte, error) { 741 objectMap := make(map[string]interface{}) 742 if cup.Tags != nil { 743 objectMap["tags"] = cup.Tags 744 } 745 if cup.ClusterUpdateProperties != nil { 746 objectMap["properties"] = cup.ClusterUpdateProperties 747 } 748 return json.Marshal(objectMap) 749} 750 751// UnmarshalJSON is the custom unmarshaler for ClusterUpdateParameters struct. 752func (cup *ClusterUpdateParameters) UnmarshalJSON(body []byte) error { 753 var m map[string]*json.RawMessage 754 err := json.Unmarshal(body, &m) 755 if err != nil { 756 return err 757 } 758 for k, v := range m { 759 switch k { 760 case "tags": 761 if v != nil { 762 var tags map[string]*string 763 err = json.Unmarshal(*v, &tags) 764 if err != nil { 765 return err 766 } 767 cup.Tags = tags 768 } 769 case "properties": 770 if v != nil { 771 var clusterUpdateProperties ClusterUpdateProperties 772 err = json.Unmarshal(*v, &clusterUpdateProperties) 773 if err != nil { 774 return err 775 } 776 cup.ClusterUpdateProperties = &clusterUpdateProperties 777 } 778 } 779 } 780 781 return nil 782} 783 784// ClusterUpdateProperties the properties of a Cluster that need to be updated. 785type ClusterUpdateProperties struct { 786 ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` 787} 788 789// CNTKsettings specifies the settings for CNTK (aka Microsoft Cognitive Toolkit) job. 790type CNTKsettings struct { 791 // LanguageType - Valid values are 'BrainScript' or 'Python'. 792 LanguageType *string `json:"languageType,omitempty"` 793 // ConfigFilePath - This property can be specified only if the languageType is 'BrainScript'. 794 ConfigFilePath *string `json:"configFilePath,omitempty"` 795 // PythonScriptFilePath - This property can be specified only if the languageType is 'Python'. 796 PythonScriptFilePath *string `json:"pythonScriptFilePath,omitempty"` 797 // PythonInterpreterPath - This property can be specified only if the languageType is 'Python'. 798 PythonInterpreterPath *string `json:"pythonInterpreterPath,omitempty"` 799 CommandLineArgs *string `json:"commandLineArgs,omitempty"` 800 // ProcessCount - The default value for this property is equal to nodeCount property 801 ProcessCount *int32 `json:"processCount,omitempty"` 802} 803 804// ContainerSettings settings for the container to be downloaded. 805type ContainerSettings struct { 806 ImageSourceRegistry *ImageSourceRegistry `json:"imageSourceRegistry,omitempty"` 807} 808 809// CustomToolkitSettings specifies the settings for a custom tool kit job. 810type CustomToolkitSettings struct { 811 CommandLine *string `json:"commandLine,omitempty"` 812} 813 814// DataDisks settings for the data disk which would be created for the File Server. 815type DataDisks struct { 816 DiskSizeInGB *int32 `json:"diskSizeInGB,omitempty"` 817 // CachingType - Possible values include: 'None', 'Readonly', 'Readwrite' 818 CachingType CachingType `json:"cachingType,omitempty"` 819 DiskCount *int32 `json:"diskCount,omitempty"` 820 // StorageAccountType - Possible values include: 'StandardLRS', 'PremiumLRS' 821 StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` 822} 823 824// EnvironmentVariable a collection of environment variables to set. 825type EnvironmentVariable struct { 826 Name *string `json:"name,omitempty"` 827 Value *string `json:"value,omitempty"` 828} 829 830// EnvironmentVariableWithSecretValue a collection of environment variables with secret values to set. 831type EnvironmentVariableWithSecretValue struct { 832 Name *string `json:"name,omitempty"` 833 Value *string `json:"value,omitempty"` 834 // ValueSecretReference - Specifies KeyVault Store and Secret which contains the value for the environment variable. One of value or valueSecretReference must be provided. 835 ValueSecretReference *KeyVaultSecretReference `json:"valueSecretReference,omitempty"` 836} 837 838// Error an error response from the Batch AI service. 839type Error struct { 840 // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. 841 Code *string `json:"code,omitempty"` 842 // Message - A message describing the error, intended to be suitable for display in a user interface. 843 Message *string `json:"message,omitempty"` 844 // Details - A list of additional details about the error. 845 Details *[]NameValuePair `json:"details,omitempty"` 846} 847 848// File properties of the file or directory. 849type File struct { 850 // Name - Name of the file. 851 Name *string `json:"name,omitempty"` 852 // IsDirectory - Indicates if the file is a directory. 853 IsDirectory *bool `json:"isDirectory,omitempty"` 854 DownloadURL *string `json:"downloadUrl,omitempty"` 855 // FileProperties - The properties associated with the file. The properties are not returned for directories. 856 *FileProperties `json:"properties,omitempty"` 857} 858 859// MarshalJSON is the custom marshaler for File. 860func (f File) MarshalJSON() ([]byte, error) { 861 objectMap := make(map[string]interface{}) 862 if f.Name != nil { 863 objectMap["name"] = f.Name 864 } 865 if f.IsDirectory != nil { 866 objectMap["isDirectory"] = f.IsDirectory 867 } 868 if f.DownloadURL != nil { 869 objectMap["downloadUrl"] = f.DownloadURL 870 } 871 if f.FileProperties != nil { 872 objectMap["properties"] = f.FileProperties 873 } 874 return json.Marshal(objectMap) 875} 876 877// UnmarshalJSON is the custom unmarshaler for File struct. 878func (f *File) UnmarshalJSON(body []byte) error { 879 var m map[string]*json.RawMessage 880 err := json.Unmarshal(body, &m) 881 if err != nil { 882 return err 883 } 884 for k, v := range m { 885 switch k { 886 case "name": 887 if v != nil { 888 var name string 889 err = json.Unmarshal(*v, &name) 890 if err != nil { 891 return err 892 } 893 f.Name = &name 894 } 895 case "isDirectory": 896 if v != nil { 897 var isDirectory bool 898 err = json.Unmarshal(*v, &isDirectory) 899 if err != nil { 900 return err 901 } 902 f.IsDirectory = &isDirectory 903 } 904 case "downloadUrl": 905 if v != nil { 906 var downloadURL string 907 err = json.Unmarshal(*v, &downloadURL) 908 if err != nil { 909 return err 910 } 911 f.DownloadURL = &downloadURL 912 } 913 case "properties": 914 if v != nil { 915 var fileProperties FileProperties 916 err = json.Unmarshal(*v, &fileProperties) 917 if err != nil { 918 return err 919 } 920 f.FileProperties = &fileProperties 921 } 922 } 923 } 924 925 return nil 926} 927 928// FileListResult values returned by the List operation. 929type FileListResult struct { 930 autorest.Response `json:"-"` 931 // Value - READ-ONLY; The collection of returned job directories and files. 932 Value *[]File `json:"value,omitempty"` 933 // NextLink - The continuation token. 934 NextLink *string `json:"nextLink,omitempty"` 935} 936 937// FileListResultIterator provides access to a complete listing of File values. 938type FileListResultIterator struct { 939 i int 940 page FileListResultPage 941} 942 943// NextWithContext advances to the next value. If there was an error making 944// the request the iterator does not advance and the error is returned. 945func (iter *FileListResultIterator) NextWithContext(ctx context.Context) (err error) { 946 if tracing.IsEnabled() { 947 ctx = tracing.StartSpan(ctx, fqdn+"/FileListResultIterator.NextWithContext") 948 defer func() { 949 sc := -1 950 if iter.Response().Response.Response != nil { 951 sc = iter.Response().Response.Response.StatusCode 952 } 953 tracing.EndSpan(ctx, sc, err) 954 }() 955 } 956 iter.i++ 957 if iter.i < len(iter.page.Values()) { 958 return nil 959 } 960 err = iter.page.NextWithContext(ctx) 961 if err != nil { 962 iter.i-- 963 return err 964 } 965 iter.i = 0 966 return nil 967} 968 969// Next advances to the next value. If there was an error making 970// the request the iterator does not advance and the error is returned. 971// Deprecated: Use NextWithContext() instead. 972func (iter *FileListResultIterator) Next() error { 973 return iter.NextWithContext(context.Background()) 974} 975 976// NotDone returns true if the enumeration should be started or is not yet complete. 977func (iter FileListResultIterator) NotDone() bool { 978 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 979} 980 981// Response returns the raw server response from the last page request. 982func (iter FileListResultIterator) Response() FileListResult { 983 return iter.page.Response() 984} 985 986// Value returns the current value or a zero-initialized value if the 987// iterator has advanced beyond the end of the collection. 988func (iter FileListResultIterator) Value() File { 989 if !iter.page.NotDone() { 990 return File{} 991 } 992 return iter.page.Values()[iter.i] 993} 994 995// Creates a new instance of the FileListResultIterator type. 996func NewFileListResultIterator(page FileListResultPage) FileListResultIterator { 997 return FileListResultIterator{page: page} 998} 999 1000// IsEmpty returns true if the ListResult contains no values. 1001func (flr FileListResult) IsEmpty() bool { 1002 return flr.Value == nil || len(*flr.Value) == 0 1003} 1004 1005// fileListResultPreparer prepares a request to retrieve the next set of results. 1006// It returns nil if no more results exist. 1007func (flr FileListResult) fileListResultPreparer(ctx context.Context) (*http.Request, error) { 1008 if flr.NextLink == nil || len(to.String(flr.NextLink)) < 1 { 1009 return nil, nil 1010 } 1011 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1012 autorest.AsJSON(), 1013 autorest.AsGet(), 1014 autorest.WithBaseURL(to.String(flr.NextLink))) 1015} 1016 1017// FileListResultPage contains a page of File values. 1018type FileListResultPage struct { 1019 fn func(context.Context, FileListResult) (FileListResult, error) 1020 flr FileListResult 1021} 1022 1023// NextWithContext advances to the next page of values. If there was an error making 1024// the request the page does not advance and the error is returned. 1025func (page *FileListResultPage) NextWithContext(ctx context.Context) (err error) { 1026 if tracing.IsEnabled() { 1027 ctx = tracing.StartSpan(ctx, fqdn+"/FileListResultPage.NextWithContext") 1028 defer func() { 1029 sc := -1 1030 if page.Response().Response.Response != nil { 1031 sc = page.Response().Response.Response.StatusCode 1032 } 1033 tracing.EndSpan(ctx, sc, err) 1034 }() 1035 } 1036 next, err := page.fn(ctx, page.flr) 1037 if err != nil { 1038 return err 1039 } 1040 page.flr = next 1041 return nil 1042} 1043 1044// Next advances to the next page of values. If there was an error making 1045// the request the page does not advance and the error is returned. 1046// Deprecated: Use NextWithContext() instead. 1047func (page *FileListResultPage) Next() error { 1048 return page.NextWithContext(context.Background()) 1049} 1050 1051// NotDone returns true if the page enumeration should be started or is not yet complete. 1052func (page FileListResultPage) NotDone() bool { 1053 return !page.flr.IsEmpty() 1054} 1055 1056// Response returns the raw server response from the last page request. 1057func (page FileListResultPage) Response() FileListResult { 1058 return page.flr 1059} 1060 1061// Values returns the slice of values for the current page or nil if there are no values. 1062func (page FileListResultPage) Values() []File { 1063 if page.flr.IsEmpty() { 1064 return nil 1065 } 1066 return *page.flr.Value 1067} 1068 1069// Creates a new instance of the FileListResultPage type. 1070func NewFileListResultPage(getNextPage func(context.Context, FileListResult) (FileListResult, error)) FileListResultPage { 1071 return FileListResultPage{fn: getNextPage} 1072} 1073 1074// FileProperties file specific properties. 1075type FileProperties struct { 1076 // LastModified - The time at which the file was last modified. 1077 LastModified *date.Time `json:"lastModified,omitempty"` 1078 // ContentLength - The file size. 1079 ContentLength *int64 `json:"contentLength,omitempty"` 1080} 1081 1082// FileServer contains information about the File Server. 1083type FileServer struct { 1084 autorest.Response `json:"-"` 1085 // FileServerProperties - The properties associated with the File Server. 1086 *FileServerProperties `json:"properties,omitempty"` 1087 // ID - READ-ONLY; The ID of the resource 1088 ID *string `json:"id,omitempty"` 1089 // Name - READ-ONLY; The name of the resource 1090 Name *string `json:"name,omitempty"` 1091 // Type - READ-ONLY; The type of the resource 1092 Type *string `json:"type,omitempty"` 1093 // Location - READ-ONLY; The location of the resource 1094 Location *string `json:"location,omitempty"` 1095 // Tags - READ-ONLY; The tags of the resource 1096 Tags map[string]*string `json:"tags"` 1097} 1098 1099// MarshalJSON is the custom marshaler for FileServer. 1100func (fs FileServer) MarshalJSON() ([]byte, error) { 1101 objectMap := make(map[string]interface{}) 1102 if fs.FileServerProperties != nil { 1103 objectMap["properties"] = fs.FileServerProperties 1104 } 1105 return json.Marshal(objectMap) 1106} 1107 1108// UnmarshalJSON is the custom unmarshaler for FileServer struct. 1109func (fs *FileServer) UnmarshalJSON(body []byte) error { 1110 var m map[string]*json.RawMessage 1111 err := json.Unmarshal(body, &m) 1112 if err != nil { 1113 return err 1114 } 1115 for k, v := range m { 1116 switch k { 1117 case "properties": 1118 if v != nil { 1119 var fileServerProperties FileServerProperties 1120 err = json.Unmarshal(*v, &fileServerProperties) 1121 if err != nil { 1122 return err 1123 } 1124 fs.FileServerProperties = &fileServerProperties 1125 } 1126 case "id": 1127 if v != nil { 1128 var ID string 1129 err = json.Unmarshal(*v, &ID) 1130 if err != nil { 1131 return err 1132 } 1133 fs.ID = &ID 1134 } 1135 case "name": 1136 if v != nil { 1137 var name string 1138 err = json.Unmarshal(*v, &name) 1139 if err != nil { 1140 return err 1141 } 1142 fs.Name = &name 1143 } 1144 case "type": 1145 if v != nil { 1146 var typeVar string 1147 err = json.Unmarshal(*v, &typeVar) 1148 if err != nil { 1149 return err 1150 } 1151 fs.Type = &typeVar 1152 } 1153 case "location": 1154 if v != nil { 1155 var location string 1156 err = json.Unmarshal(*v, &location) 1157 if err != nil { 1158 return err 1159 } 1160 fs.Location = &location 1161 } 1162 case "tags": 1163 if v != nil { 1164 var tags map[string]*string 1165 err = json.Unmarshal(*v, &tags) 1166 if err != nil { 1167 return err 1168 } 1169 fs.Tags = tags 1170 } 1171 } 1172 } 1173 1174 return nil 1175} 1176 1177// FileServerBaseProperties the properties of a file server. 1178type FileServerBaseProperties struct { 1179 // VMSize - For information about available VM sizes for fileservers from the Virtual Machines Marketplace, see Sizes for Virtual Machines (Linux). 1180 VMSize *string `json:"vmSize,omitempty"` 1181 SSHConfiguration *SSHConfiguration `json:"sshConfiguration,omitempty"` 1182 DataDisks *DataDisks `json:"dataDisks,omitempty"` 1183 Subnet *ResourceID `json:"subnet,omitempty"` 1184} 1185 1186// FileServerCreateParameters parameters supplied to the Create operation. 1187type FileServerCreateParameters struct { 1188 // Location - The region in which to create the File Server. 1189 Location *string `json:"location,omitempty"` 1190 // Tags - The user specified tags associated with the File Server. 1191 Tags map[string]*string `json:"tags"` 1192 // FileServerBaseProperties - The properties of the File Server. 1193 *FileServerBaseProperties `json:"properties,omitempty"` 1194} 1195 1196// MarshalJSON is the custom marshaler for FileServerCreateParameters. 1197func (fscp FileServerCreateParameters) MarshalJSON() ([]byte, error) { 1198 objectMap := make(map[string]interface{}) 1199 if fscp.Location != nil { 1200 objectMap["location"] = fscp.Location 1201 } 1202 if fscp.Tags != nil { 1203 objectMap["tags"] = fscp.Tags 1204 } 1205 if fscp.FileServerBaseProperties != nil { 1206 objectMap["properties"] = fscp.FileServerBaseProperties 1207 } 1208 return json.Marshal(objectMap) 1209} 1210 1211// UnmarshalJSON is the custom unmarshaler for FileServerCreateParameters struct. 1212func (fscp *FileServerCreateParameters) UnmarshalJSON(body []byte) error { 1213 var m map[string]*json.RawMessage 1214 err := json.Unmarshal(body, &m) 1215 if err != nil { 1216 return err 1217 } 1218 for k, v := range m { 1219 switch k { 1220 case "location": 1221 if v != nil { 1222 var location string 1223 err = json.Unmarshal(*v, &location) 1224 if err != nil { 1225 return err 1226 } 1227 fscp.Location = &location 1228 } 1229 case "tags": 1230 if v != nil { 1231 var tags map[string]*string 1232 err = json.Unmarshal(*v, &tags) 1233 if err != nil { 1234 return err 1235 } 1236 fscp.Tags = tags 1237 } 1238 case "properties": 1239 if v != nil { 1240 var fileServerBaseProperties FileServerBaseProperties 1241 err = json.Unmarshal(*v, &fileServerBaseProperties) 1242 if err != nil { 1243 return err 1244 } 1245 fscp.FileServerBaseProperties = &fileServerBaseProperties 1246 } 1247 } 1248 } 1249 1250 return nil 1251} 1252 1253// FileServerListResult values returned by the List operation. 1254type FileServerListResult struct { 1255 autorest.Response `json:"-"` 1256 // Value - The collection of File Servers. 1257 Value *[]FileServer `json:"value,omitempty"` 1258 // NextLink - The continuation token. 1259 NextLink *string `json:"nextLink,omitempty"` 1260} 1261 1262// FileServerListResultIterator provides access to a complete listing of FileServer values. 1263type FileServerListResultIterator struct { 1264 i int 1265 page FileServerListResultPage 1266} 1267 1268// NextWithContext advances to the next value. If there was an error making 1269// the request the iterator does not advance and the error is returned. 1270func (iter *FileServerListResultIterator) NextWithContext(ctx context.Context) (err error) { 1271 if tracing.IsEnabled() { 1272 ctx = tracing.StartSpan(ctx, fqdn+"/FileServerListResultIterator.NextWithContext") 1273 defer func() { 1274 sc := -1 1275 if iter.Response().Response.Response != nil { 1276 sc = iter.Response().Response.Response.StatusCode 1277 } 1278 tracing.EndSpan(ctx, sc, err) 1279 }() 1280 } 1281 iter.i++ 1282 if iter.i < len(iter.page.Values()) { 1283 return nil 1284 } 1285 err = iter.page.NextWithContext(ctx) 1286 if err != nil { 1287 iter.i-- 1288 return err 1289 } 1290 iter.i = 0 1291 return nil 1292} 1293 1294// Next advances to the next value. If there was an error making 1295// the request the iterator does not advance and the error is returned. 1296// Deprecated: Use NextWithContext() instead. 1297func (iter *FileServerListResultIterator) Next() error { 1298 return iter.NextWithContext(context.Background()) 1299} 1300 1301// NotDone returns true if the enumeration should be started or is not yet complete. 1302func (iter FileServerListResultIterator) NotDone() bool { 1303 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1304} 1305 1306// Response returns the raw server response from the last page request. 1307func (iter FileServerListResultIterator) Response() FileServerListResult { 1308 return iter.page.Response() 1309} 1310 1311// Value returns the current value or a zero-initialized value if the 1312// iterator has advanced beyond the end of the collection. 1313func (iter FileServerListResultIterator) Value() FileServer { 1314 if !iter.page.NotDone() { 1315 return FileServer{} 1316 } 1317 return iter.page.Values()[iter.i] 1318} 1319 1320// Creates a new instance of the FileServerListResultIterator type. 1321func NewFileServerListResultIterator(page FileServerListResultPage) FileServerListResultIterator { 1322 return FileServerListResultIterator{page: page} 1323} 1324 1325// IsEmpty returns true if the ListResult contains no values. 1326func (fslr FileServerListResult) IsEmpty() bool { 1327 return fslr.Value == nil || len(*fslr.Value) == 0 1328} 1329 1330// fileServerListResultPreparer prepares a request to retrieve the next set of results. 1331// It returns nil if no more results exist. 1332func (fslr FileServerListResult) fileServerListResultPreparer(ctx context.Context) (*http.Request, error) { 1333 if fslr.NextLink == nil || len(to.String(fslr.NextLink)) < 1 { 1334 return nil, nil 1335 } 1336 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1337 autorest.AsJSON(), 1338 autorest.AsGet(), 1339 autorest.WithBaseURL(to.String(fslr.NextLink))) 1340} 1341 1342// FileServerListResultPage contains a page of FileServer values. 1343type FileServerListResultPage struct { 1344 fn func(context.Context, FileServerListResult) (FileServerListResult, error) 1345 fslr FileServerListResult 1346} 1347 1348// NextWithContext advances to the next page of values. If there was an error making 1349// the request the page does not advance and the error is returned. 1350func (page *FileServerListResultPage) NextWithContext(ctx context.Context) (err error) { 1351 if tracing.IsEnabled() { 1352 ctx = tracing.StartSpan(ctx, fqdn+"/FileServerListResultPage.NextWithContext") 1353 defer func() { 1354 sc := -1 1355 if page.Response().Response.Response != nil { 1356 sc = page.Response().Response.Response.StatusCode 1357 } 1358 tracing.EndSpan(ctx, sc, err) 1359 }() 1360 } 1361 next, err := page.fn(ctx, page.fslr) 1362 if err != nil { 1363 return err 1364 } 1365 page.fslr = next 1366 return nil 1367} 1368 1369// Next advances to the next page of values. If there was an error making 1370// the request the page does not advance and the error is returned. 1371// Deprecated: Use NextWithContext() instead. 1372func (page *FileServerListResultPage) Next() error { 1373 return page.NextWithContext(context.Background()) 1374} 1375 1376// NotDone returns true if the page enumeration should be started or is not yet complete. 1377func (page FileServerListResultPage) NotDone() bool { 1378 return !page.fslr.IsEmpty() 1379} 1380 1381// Response returns the raw server response from the last page request. 1382func (page FileServerListResultPage) Response() FileServerListResult { 1383 return page.fslr 1384} 1385 1386// Values returns the slice of values for the current page or nil if there are no values. 1387func (page FileServerListResultPage) Values() []FileServer { 1388 if page.fslr.IsEmpty() { 1389 return nil 1390 } 1391 return *page.fslr.Value 1392} 1393 1394// Creates a new instance of the FileServerListResultPage type. 1395func NewFileServerListResultPage(getNextPage func(context.Context, FileServerListResult) (FileServerListResult, error)) FileServerListResultPage { 1396 return FileServerListResultPage{fn: getNextPage} 1397} 1398 1399// FileServerProperties file server specific properties. 1400type FileServerProperties struct { 1401 // VMSize - For information about available VM sizes for File Server from the Virtual Machines Marketplace, see Sizes for Virtual Machines (Linux). 1402 VMSize *string `json:"vmSize,omitempty"` 1403 SSHConfiguration *SSHConfiguration `json:"sshConfiguration,omitempty"` 1404 DataDisks *DataDisks `json:"dataDisks,omitempty"` 1405 Subnet *ResourceID `json:"subnet,omitempty"` 1406 // MountSettings - READ-ONLY 1407 MountSettings *MountSettings `json:"mountSettings,omitempty"` 1408 // ProvisioningStateTransitionTime - READ-ONLY 1409 ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` 1410 // CreationTime - READ-ONLY 1411 CreationTime *date.Time `json:"creationTime,omitempty"` 1412 // ProvisioningState - READ-ONLY; Possible values: creating - The File Server is getting created. updating - The File Server creation has been accepted and it is getting updated. deleting - The user has requested that the File Server be deleted, and it is in the process of being deleted. failed - The File Server creation has failed with the specified errorCode. Details about the error code are specified in the message field. succeeded - The File Server creation has succeeded. Possible values include: 'FileServerProvisioningStateCreating', 'FileServerProvisioningStateUpdating', 'FileServerProvisioningStateDeleting', 'FileServerProvisioningStateSucceeded', 'FileServerProvisioningStateFailed' 1413 ProvisioningState FileServerProvisioningState `json:"provisioningState,omitempty"` 1414} 1415 1416// FileServerReference provides required information, for the service to be able to mount Azure FileShare 1417// on the cluster nodes. 1418type FileServerReference struct { 1419 FileServer *ResourceID `json:"fileServer,omitempty"` 1420 // SourceDirectory - If this property is not specified, the entire File Server will be mounted. 1421 SourceDirectory *string `json:"sourceDirectory,omitempty"` 1422 // RelativeMountPath - Note that all cluster level file servers will be mounted under $AZ_BATCHAI_MOUNT_ROOT location and job level file servers will be mounted under $AZ_BATCHAI_JOB_MOUNT_ROOT. 1423 RelativeMountPath *string `json:"relativeMountPath,omitempty"` 1424 MountOptions *string `json:"mountOptions,omitempty"` 1425} 1426 1427// FileServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running 1428// operation. 1429type FileServersCreateFuture struct { 1430 azure.Future 1431} 1432 1433// Result returns the result of the asynchronous operation. 1434// If the operation has not completed it will return an error. 1435func (future *FileServersCreateFuture) Result(client FileServersClient) (fs FileServer, err error) { 1436 var done bool 1437 done, err = future.DoneWithContext(context.Background(), client) 1438 if err != nil { 1439 err = autorest.NewErrorWithError(err, "batchai.FileServersCreateFuture", "Result", future.Response(), "Polling failure") 1440 return 1441 } 1442 if !done { 1443 err = azure.NewAsyncOpIncompleteError("batchai.FileServersCreateFuture") 1444 return 1445 } 1446 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1447 if fs.Response.Response, err = future.GetResult(sender); err == nil && fs.Response.Response.StatusCode != http.StatusNoContent { 1448 fs, err = client.CreateResponder(fs.Response.Response) 1449 if err != nil { 1450 err = autorest.NewErrorWithError(err, "batchai.FileServersCreateFuture", "Result", fs.Response.Response, "Failure responding to request") 1451 } 1452 } 1453 return 1454} 1455 1456// FileServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 1457// operation. 1458type FileServersDeleteFuture struct { 1459 azure.Future 1460} 1461 1462// Result returns the result of the asynchronous operation. 1463// If the operation has not completed it will return an error. 1464func (future *FileServersDeleteFuture) Result(client FileServersClient) (ar autorest.Response, err error) { 1465 var done bool 1466 done, err = future.DoneWithContext(context.Background(), client) 1467 if err != nil { 1468 err = autorest.NewErrorWithError(err, "batchai.FileServersDeleteFuture", "Result", future.Response(), "Polling failure") 1469 return 1470 } 1471 if !done { 1472 err = azure.NewAsyncOpIncompleteError("batchai.FileServersDeleteFuture") 1473 return 1474 } 1475 ar.Response = future.Response() 1476 return 1477} 1478 1479// ImageReference the image reference. 1480type ImageReference struct { 1481 Publisher *string `json:"publisher,omitempty"` 1482 Offer *string `json:"offer,omitempty"` 1483 Sku *string `json:"sku,omitempty"` 1484 Version *string `json:"version,omitempty"` 1485 // VirtualMachineImageID - The virtual machine image must be in the same region and subscription as the cluster. For information about the firewall settings for the Batch node agent to communicate with the Batch service see https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. Note, you need to provide publisher, offer and sku of the base OS image of which the custom image has been derived from. 1486 VirtualMachineImageID *string `json:"virtualMachineImageId,omitempty"` 1487} 1488 1489// ImageSourceRegistry details of the container image such as name, URL and credentials. 1490type ImageSourceRegistry struct { 1491 ServerURL *string `json:"serverUrl,omitempty"` 1492 Image *string `json:"image,omitempty"` 1493 Credentials *PrivateRegistryCredentials `json:"credentials,omitempty"` 1494} 1495 1496// InputDirectory input directory for the job. 1497type InputDirectory struct { 1498 // ID - The path of the input directory will be available as a value of an environment variable with AZ_BATCHAI_INPUT_<id> name, where <id> is the value of id attribute. 1499 ID *string `json:"id,omitempty"` 1500 Path *string `json:"path,omitempty"` 1501} 1502 1503// Job contains information about the job. 1504type Job struct { 1505 autorest.Response `json:"-"` 1506 // JobProperties - The properties associated with the job. 1507 *JobProperties `json:"properties,omitempty"` 1508 // ID - READ-ONLY; The ID of the resource 1509 ID *string `json:"id,omitempty"` 1510 // Name - READ-ONLY; The name of the resource 1511 Name *string `json:"name,omitempty"` 1512 // Type - READ-ONLY; The type of the resource 1513 Type *string `json:"type,omitempty"` 1514 // Location - READ-ONLY; The location of the resource 1515 Location *string `json:"location,omitempty"` 1516 // Tags - READ-ONLY; The tags of the resource 1517 Tags map[string]*string `json:"tags"` 1518} 1519 1520// MarshalJSON is the custom marshaler for Job. 1521func (j Job) MarshalJSON() ([]byte, error) { 1522 objectMap := make(map[string]interface{}) 1523 if j.JobProperties != nil { 1524 objectMap["properties"] = j.JobProperties 1525 } 1526 return json.Marshal(objectMap) 1527} 1528 1529// UnmarshalJSON is the custom unmarshaler for Job struct. 1530func (j *Job) UnmarshalJSON(body []byte) error { 1531 var m map[string]*json.RawMessage 1532 err := json.Unmarshal(body, &m) 1533 if err != nil { 1534 return err 1535 } 1536 for k, v := range m { 1537 switch k { 1538 case "properties": 1539 if v != nil { 1540 var jobProperties JobProperties 1541 err = json.Unmarshal(*v, &jobProperties) 1542 if err != nil { 1543 return err 1544 } 1545 j.JobProperties = &jobProperties 1546 } 1547 case "id": 1548 if v != nil { 1549 var ID string 1550 err = json.Unmarshal(*v, &ID) 1551 if err != nil { 1552 return err 1553 } 1554 j.ID = &ID 1555 } 1556 case "name": 1557 if v != nil { 1558 var name string 1559 err = json.Unmarshal(*v, &name) 1560 if err != nil { 1561 return err 1562 } 1563 j.Name = &name 1564 } 1565 case "type": 1566 if v != nil { 1567 var typeVar string 1568 err = json.Unmarshal(*v, &typeVar) 1569 if err != nil { 1570 return err 1571 } 1572 j.Type = &typeVar 1573 } 1574 case "location": 1575 if v != nil { 1576 var location string 1577 err = json.Unmarshal(*v, &location) 1578 if err != nil { 1579 return err 1580 } 1581 j.Location = &location 1582 } 1583 case "tags": 1584 if v != nil { 1585 var tags map[string]*string 1586 err = json.Unmarshal(*v, &tags) 1587 if err != nil { 1588 return err 1589 } 1590 j.Tags = tags 1591 } 1592 } 1593 } 1594 1595 return nil 1596} 1597 1598// JobBaseProperties the properties of a Batch AI job. 1599type JobBaseProperties struct { 1600 // ExperimentName - Describe the experiment information of the job 1601 ExperimentName *string `json:"experimentName,omitempty"` 1602 // Priority - Priority associated with the job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0. 1603 Priority *int32 `json:"priority,omitempty"` 1604 Cluster *ResourceID `json:"cluster,omitempty"` 1605 // MountVolumes - These volumes will be mounted before the job execution and will be unmounted after the job completion. The volumes will be mounted at location specified by $AZ_BATCHAI_JOB_MOUNT_ROOT environment variable. 1606 MountVolumes *MountVolumes `json:"mountVolumes,omitempty"` 1607 // NodeCount - The job will be gang scheduled on that many compute nodes 1608 NodeCount *int32 `json:"nodeCount,omitempty"` 1609 // ContainerSettings - If the container was downloaded as part of cluster setup then the same container image will be used. If not provided, the job will run on the VM. 1610 ContainerSettings *ContainerSettings `json:"containerSettings,omitempty"` 1611 CntkSettings *CNTKsettings `json:"cntkSettings,omitempty"` 1612 PyTorchSettings *PyTorchSettings `json:"pyTorchSettings,omitempty"` 1613 TensorFlowSettings *TensorFlowSettings `json:"tensorFlowSettings,omitempty"` 1614 CaffeSettings *CaffeSettings `json:"caffeSettings,omitempty"` 1615 Caffe2Settings *Caffe2Settings `json:"caffe2Settings,omitempty"` 1616 ChainerSettings *ChainerSettings `json:"chainerSettings,omitempty"` 1617 CustomToolkitSettings *CustomToolkitSettings `json:"customToolkitSettings,omitempty"` 1618 // JobPreparation - The specified actions will run on all the nodes that are part of the job 1619 JobPreparation *JobPreparation `json:"jobPreparation,omitempty"` 1620 // StdOutErrPathPrefix - The path where the Batch AI service will upload stdout and stderror of the job. 1621 StdOutErrPathPrefix *string `json:"stdOutErrPathPrefix,omitempty"` 1622 InputDirectories *[]InputDirectory `json:"inputDirectories,omitempty"` 1623 OutputDirectories *[]OutputDirectory `json:"outputDirectories,omitempty"` 1624 // EnvironmentVariables - Batch AI will setup these additional environment variables for the job. 1625 EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` 1626 // Secrets - Batch AI will setup these additional environment variables for the job. Server will never report values of these variables back. 1627 Secrets *[]EnvironmentVariableWithSecretValue `json:"secrets,omitempty"` 1628 // Constraints - Constraints associated with the Job. 1629 Constraints *JobBasePropertiesConstraints `json:"constraints,omitempty"` 1630} 1631 1632// JobBasePropertiesConstraints constraints associated with the Job. 1633type JobBasePropertiesConstraints struct { 1634 // MaxWallClockTime - Default Value = 1 week. 1635 MaxWallClockTime *string `json:"maxWallClockTime,omitempty"` 1636} 1637 1638// JobCreateParameters parameters supplied to the Create operation. 1639type JobCreateParameters struct { 1640 // Location - The region in which to create the job. 1641 Location *string `json:"location,omitempty"` 1642 // Tags - The user specified tags associated with the job. 1643 Tags map[string]*string `json:"tags"` 1644 // JobBaseProperties - The properties of the Job. 1645 *JobBaseProperties `json:"properties,omitempty"` 1646} 1647 1648// MarshalJSON is the custom marshaler for JobCreateParameters. 1649func (jcp JobCreateParameters) MarshalJSON() ([]byte, error) { 1650 objectMap := make(map[string]interface{}) 1651 if jcp.Location != nil { 1652 objectMap["location"] = jcp.Location 1653 } 1654 if jcp.Tags != nil { 1655 objectMap["tags"] = jcp.Tags 1656 } 1657 if jcp.JobBaseProperties != nil { 1658 objectMap["properties"] = jcp.JobBaseProperties 1659 } 1660 return json.Marshal(objectMap) 1661} 1662 1663// UnmarshalJSON is the custom unmarshaler for JobCreateParameters struct. 1664func (jcp *JobCreateParameters) UnmarshalJSON(body []byte) error { 1665 var m map[string]*json.RawMessage 1666 err := json.Unmarshal(body, &m) 1667 if err != nil { 1668 return err 1669 } 1670 for k, v := range m { 1671 switch k { 1672 case "location": 1673 if v != nil { 1674 var location string 1675 err = json.Unmarshal(*v, &location) 1676 if err != nil { 1677 return err 1678 } 1679 jcp.Location = &location 1680 } 1681 case "tags": 1682 if v != nil { 1683 var tags map[string]*string 1684 err = json.Unmarshal(*v, &tags) 1685 if err != nil { 1686 return err 1687 } 1688 jcp.Tags = tags 1689 } 1690 case "properties": 1691 if v != nil { 1692 var jobBaseProperties JobBaseProperties 1693 err = json.Unmarshal(*v, &jobBaseProperties) 1694 if err != nil { 1695 return err 1696 } 1697 jcp.JobBaseProperties = &jobBaseProperties 1698 } 1699 } 1700 } 1701 1702 return nil 1703} 1704 1705// JobListResult values returned by the List operation. 1706type JobListResult struct { 1707 autorest.Response `json:"-"` 1708 // Value - The collection of jobs. 1709 Value *[]Job `json:"value,omitempty"` 1710 // NextLink - The continuation token. 1711 NextLink *string `json:"nextLink,omitempty"` 1712} 1713 1714// JobListResultIterator provides access to a complete listing of Job values. 1715type JobListResultIterator struct { 1716 i int 1717 page JobListResultPage 1718} 1719 1720// NextWithContext advances to the next value. If there was an error making 1721// the request the iterator does not advance and the error is returned. 1722func (iter *JobListResultIterator) NextWithContext(ctx context.Context) (err error) { 1723 if tracing.IsEnabled() { 1724 ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultIterator.NextWithContext") 1725 defer func() { 1726 sc := -1 1727 if iter.Response().Response.Response != nil { 1728 sc = iter.Response().Response.Response.StatusCode 1729 } 1730 tracing.EndSpan(ctx, sc, err) 1731 }() 1732 } 1733 iter.i++ 1734 if iter.i < len(iter.page.Values()) { 1735 return nil 1736 } 1737 err = iter.page.NextWithContext(ctx) 1738 if err != nil { 1739 iter.i-- 1740 return err 1741 } 1742 iter.i = 0 1743 return nil 1744} 1745 1746// Next advances to the next value. If there was an error making 1747// the request the iterator does not advance and the error is returned. 1748// Deprecated: Use NextWithContext() instead. 1749func (iter *JobListResultIterator) Next() error { 1750 return iter.NextWithContext(context.Background()) 1751} 1752 1753// NotDone returns true if the enumeration should be started or is not yet complete. 1754func (iter JobListResultIterator) NotDone() bool { 1755 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1756} 1757 1758// Response returns the raw server response from the last page request. 1759func (iter JobListResultIterator) Response() JobListResult { 1760 return iter.page.Response() 1761} 1762 1763// Value returns the current value or a zero-initialized value if the 1764// iterator has advanced beyond the end of the collection. 1765func (iter JobListResultIterator) Value() Job { 1766 if !iter.page.NotDone() { 1767 return Job{} 1768 } 1769 return iter.page.Values()[iter.i] 1770} 1771 1772// Creates a new instance of the JobListResultIterator type. 1773func NewJobListResultIterator(page JobListResultPage) JobListResultIterator { 1774 return JobListResultIterator{page: page} 1775} 1776 1777// IsEmpty returns true if the ListResult contains no values. 1778func (jlr JobListResult) IsEmpty() bool { 1779 return jlr.Value == nil || len(*jlr.Value) == 0 1780} 1781 1782// jobListResultPreparer prepares a request to retrieve the next set of results. 1783// It returns nil if no more results exist. 1784func (jlr JobListResult) jobListResultPreparer(ctx context.Context) (*http.Request, error) { 1785 if jlr.NextLink == nil || len(to.String(jlr.NextLink)) < 1 { 1786 return nil, nil 1787 } 1788 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1789 autorest.AsJSON(), 1790 autorest.AsGet(), 1791 autorest.WithBaseURL(to.String(jlr.NextLink))) 1792} 1793 1794// JobListResultPage contains a page of Job values. 1795type JobListResultPage struct { 1796 fn func(context.Context, JobListResult) (JobListResult, error) 1797 jlr JobListResult 1798} 1799 1800// NextWithContext advances to the next page of values. If there was an error making 1801// the request the page does not advance and the error is returned. 1802func (page *JobListResultPage) NextWithContext(ctx context.Context) (err error) { 1803 if tracing.IsEnabled() { 1804 ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultPage.NextWithContext") 1805 defer func() { 1806 sc := -1 1807 if page.Response().Response.Response != nil { 1808 sc = page.Response().Response.Response.StatusCode 1809 } 1810 tracing.EndSpan(ctx, sc, err) 1811 }() 1812 } 1813 next, err := page.fn(ctx, page.jlr) 1814 if err != nil { 1815 return err 1816 } 1817 page.jlr = next 1818 return nil 1819} 1820 1821// Next advances to the next page of values. If there was an error making 1822// the request the page does not advance and the error is returned. 1823// Deprecated: Use NextWithContext() instead. 1824func (page *JobListResultPage) Next() error { 1825 return page.NextWithContext(context.Background()) 1826} 1827 1828// NotDone returns true if the page enumeration should be started or is not yet complete. 1829func (page JobListResultPage) NotDone() bool { 1830 return !page.jlr.IsEmpty() 1831} 1832 1833// Response returns the raw server response from the last page request. 1834func (page JobListResultPage) Response() JobListResult { 1835 return page.jlr 1836} 1837 1838// Values returns the slice of values for the current page or nil if there are no values. 1839func (page JobListResultPage) Values() []Job { 1840 if page.jlr.IsEmpty() { 1841 return nil 1842 } 1843 return *page.jlr.Value 1844} 1845 1846// Creates a new instance of the JobListResultPage type. 1847func NewJobListResultPage(getNextPage func(context.Context, JobListResult) (JobListResult, error)) JobListResultPage { 1848 return JobListResultPage{fn: getNextPage} 1849} 1850 1851// JobPreparation specifies the settings for job preparation. 1852type JobPreparation struct { 1853 // CommandLine - If containerSettings is specified on the job, this commandLine will be executed in the same container as job. Otherwise it will be executed on the node. 1854 CommandLine *string `json:"commandLine,omitempty"` 1855} 1856 1857// JobProperties job specific properties. 1858type JobProperties struct { 1859 // ExperimentName - Describe the experiment information of the job 1860 ExperimentName *string `json:"experimentName,omitempty"` 1861 // Priority - Priority associated with the job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0. 1862 Priority *int32 `json:"priority,omitempty"` 1863 Cluster *ResourceID `json:"cluster,omitempty"` 1864 // MountVolumes - These volumes will be mounted before the job execution and will be unmounted after the job completion. The volumes will be mounted at location specified by $AZ_BATCHAI_JOB_MOUNT_ROOT environment variable. 1865 MountVolumes *MountVolumes `json:"mountVolumes,omitempty"` 1866 // JobOutputDirectoryPathSegment - Batch AI creates job's output directories under an unique path to avoid conflicts between jobs. This value contains a path segment generated by Batch AI to make the path unique and can be used to find the output directory on the node or mounted filesystem. 1867 JobOutputDirectoryPathSegment *string `json:"jobOutputDirectoryPathSegment,omitempty"` 1868 // NodeCount - The job will be gang scheduled on that many compute nodes 1869 NodeCount *int32 `json:"nodeCount,omitempty"` 1870 // ContainerSettings - If the container was downloaded as part of cluster setup then the same container image will be used. If not provided, the job will run on the VM. 1871 ContainerSettings *ContainerSettings `json:"containerSettings,omitempty"` 1872 // ToolType - Possible values are: cntk, tensorflow, caffe, caffe2, chainer, pytorch, custom. Possible values include: 'ToolTypeCntk', 'ToolTypeTensorflow', 'ToolTypeCaffe', 'ToolTypeCaffe2', 'ToolTypeChainer', 'ToolTypeCustom' 1873 ToolType ToolType `json:"toolType,omitempty"` 1874 CntkSettings *CNTKsettings `json:"cntkSettings,omitempty"` 1875 PyTorchSettings *PyTorchSettings `json:"pyTorchSettings,omitempty"` 1876 TensorFlowSettings *TensorFlowSettings `json:"tensorFlowSettings,omitempty"` 1877 CaffeSettings *CaffeSettings `json:"caffeSettings,omitempty"` 1878 ChainerSettings *ChainerSettings `json:"chainerSettings,omitempty"` 1879 CustomToolkitSettings *CustomToolkitSettings `json:"customToolkitSettings,omitempty"` 1880 // JobPreparation - The specified actions will run on all the nodes that are part of the job 1881 JobPreparation *JobPreparation `json:"jobPreparation,omitempty"` 1882 // StdOutErrPathPrefix - The path where the Batch AI service will upload stdout and stderror of the job. 1883 StdOutErrPathPrefix *string `json:"stdOutErrPathPrefix,omitempty"` 1884 InputDirectories *[]InputDirectory `json:"inputDirectories,omitempty"` 1885 OutputDirectories *[]OutputDirectory `json:"outputDirectories,omitempty"` 1886 // EnvironmentVariables - Batch AI will setup these additional environment variables for the job. 1887 EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` 1888 // Secrets - Batch AI will setup these additional environment variables for the job. Server will never report values of these variables back. 1889 Secrets *[]EnvironmentVariableWithSecretValue `json:"secrets,omitempty"` 1890 // Constraints - Constraints associated with the Job. 1891 Constraints *JobPropertiesConstraints `json:"constraints,omitempty"` 1892 // CreationTime - READ-ONLY; The creation time of the job. 1893 CreationTime *date.Time `json:"creationTime,omitempty"` 1894 // ProvisioningState - READ-ONLY; The provisioned state of the Batch AI job. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateDeleting' 1895 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 1896 // ProvisioningStateTransitionTime - READ-ONLY; The time at which the job entered its current provisioning state. 1897 ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` 1898 // ExecutionState - The current state of the job. Possible values are: queued - The job is queued and able to run. A job enters this state when it is created, or when it is awaiting a retry after a failed run. running - The job is running on a compute cluster. This includes job-level preparation such as downloading resource files or set up container specified on the job - it does not necessarily mean that the job command line has started executing. terminating - The job is terminated by the user, the terminate operation is in progress. succeeded - The job has completed running successfully and exited with exit code 0. failed - The job has finished unsuccessfully (failed with a non-zero exit code) and has exhausted its retry limit. A job is also marked as failed if an error occurred launching the job. Possible values include: 'Queued', 'Running', 'Terminating', 'Succeeded', 'Failed' 1899 ExecutionState ExecutionState `json:"executionState,omitempty"` 1900 // ExecutionStateTransitionTime - READ-ONLY; The time at which the job entered its current execution state. 1901 ExecutionStateTransitionTime *date.Time `json:"executionStateTransitionTime,omitempty"` 1902 // ExecutionInfo - Contains information about the execution of a job in the Azure Batch service. 1903 ExecutionInfo *JobPropertiesExecutionInfo `json:"executionInfo,omitempty"` 1904} 1905 1906// JobPropertiesConstraints constraints associated with the Job. 1907type JobPropertiesConstraints struct { 1908 // MaxWallClockTime - Default Value = 1 week. 1909 MaxWallClockTime *string `json:"maxWallClockTime,omitempty"` 1910} 1911 1912// JobPropertiesExecutionInfo contains information about the execution of a job in the Azure Batch service. 1913type JobPropertiesExecutionInfo struct { 1914 // StartTime - 'Running' corresponds to the running state. If the job has been restarted or retried, this is the most recent time at which the job started running. This property is present only for job that are in the running or completed state. 1915 StartTime *date.Time `json:"startTime,omitempty"` 1916 // EndTime - This property is only returned if the job is in completed state. 1917 EndTime *date.Time `json:"endTime,omitempty"` 1918 // ExitCode - This property is only returned if the job is in completed state. 1919 ExitCode *int32 `json:"exitCode,omitempty"` 1920 Errors *[]Error `json:"errors,omitempty"` 1921} 1922 1923// JobsCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 1924type JobsCreateFuture struct { 1925 azure.Future 1926} 1927 1928// Result returns the result of the asynchronous operation. 1929// If the operation has not completed it will return an error. 1930func (future *JobsCreateFuture) Result(client JobsClient) (j Job, err error) { 1931 var done bool 1932 done, err = future.DoneWithContext(context.Background(), client) 1933 if err != nil { 1934 err = autorest.NewErrorWithError(err, "batchai.JobsCreateFuture", "Result", future.Response(), "Polling failure") 1935 return 1936 } 1937 if !done { 1938 err = azure.NewAsyncOpIncompleteError("batchai.JobsCreateFuture") 1939 return 1940 } 1941 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1942 if j.Response.Response, err = future.GetResult(sender); err == nil && j.Response.Response.StatusCode != http.StatusNoContent { 1943 j, err = client.CreateResponder(j.Response.Response) 1944 if err != nil { 1945 err = autorest.NewErrorWithError(err, "batchai.JobsCreateFuture", "Result", j.Response.Response, "Failure responding to request") 1946 } 1947 } 1948 return 1949} 1950 1951// JobsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 1952type JobsDeleteFuture struct { 1953 azure.Future 1954} 1955 1956// Result returns the result of the asynchronous operation. 1957// If the operation has not completed it will return an error. 1958func (future *JobsDeleteFuture) Result(client JobsClient) (ar autorest.Response, err error) { 1959 var done bool 1960 done, err = future.DoneWithContext(context.Background(), client) 1961 if err != nil { 1962 err = autorest.NewErrorWithError(err, "batchai.JobsDeleteFuture", "Result", future.Response(), "Polling failure") 1963 return 1964 } 1965 if !done { 1966 err = azure.NewAsyncOpIncompleteError("batchai.JobsDeleteFuture") 1967 return 1968 } 1969 ar.Response = future.Response() 1970 return 1971} 1972 1973// JobsTerminateFuture an abstraction for monitoring and retrieving the results of a long-running 1974// operation. 1975type JobsTerminateFuture struct { 1976 azure.Future 1977} 1978 1979// Result returns the result of the asynchronous operation. 1980// If the operation has not completed it will return an error. 1981func (future *JobsTerminateFuture) Result(client JobsClient) (ar autorest.Response, err error) { 1982 var done bool 1983 done, err = future.DoneWithContext(context.Background(), client) 1984 if err != nil { 1985 err = autorest.NewErrorWithError(err, "batchai.JobsTerminateFuture", "Result", future.Response(), "Polling failure") 1986 return 1987 } 1988 if !done { 1989 err = azure.NewAsyncOpIncompleteError("batchai.JobsTerminateFuture") 1990 return 1991 } 1992 ar.Response = future.Response() 1993 return 1994} 1995 1996// KeyVaultKeyReference describes a reference to Key Vault Key. 1997type KeyVaultKeyReference struct { 1998 SourceVault *ResourceID `json:"sourceVault,omitempty"` 1999 KeyURL *string `json:"keyUrl,omitempty"` 2000} 2001 2002// KeyVaultSecretReference describes a reference to Key Vault Secret. 2003type KeyVaultSecretReference struct { 2004 SourceVault *ResourceID `json:"sourceVault,omitempty"` 2005 SecretURL *string `json:"secretUrl,omitempty"` 2006} 2007 2008// ListUsagesResult the List Usages operation response. 2009type ListUsagesResult struct { 2010 autorest.Response `json:"-"` 2011 // Value - The list of compute resource usages. 2012 Value *[]Usage `json:"value,omitempty"` 2013 // NextLink - The URI to fetch the next page of compute resource usage information. Call ListNext() with this to fetch the next page of compute resource usage information. 2014 NextLink *string `json:"nextLink,omitempty"` 2015} 2016 2017// ListUsagesResultIterator provides access to a complete listing of Usage values. 2018type ListUsagesResultIterator struct { 2019 i int 2020 page ListUsagesResultPage 2021} 2022 2023// NextWithContext advances to the next value. If there was an error making 2024// the request the iterator does not advance and the error is returned. 2025func (iter *ListUsagesResultIterator) NextWithContext(ctx context.Context) (err error) { 2026 if tracing.IsEnabled() { 2027 ctx = tracing.StartSpan(ctx, fqdn+"/ListUsagesResultIterator.NextWithContext") 2028 defer func() { 2029 sc := -1 2030 if iter.Response().Response.Response != nil { 2031 sc = iter.Response().Response.Response.StatusCode 2032 } 2033 tracing.EndSpan(ctx, sc, err) 2034 }() 2035 } 2036 iter.i++ 2037 if iter.i < len(iter.page.Values()) { 2038 return nil 2039 } 2040 err = iter.page.NextWithContext(ctx) 2041 if err != nil { 2042 iter.i-- 2043 return err 2044 } 2045 iter.i = 0 2046 return nil 2047} 2048 2049// Next advances to the next value. If there was an error making 2050// the request the iterator does not advance and the error is returned. 2051// Deprecated: Use NextWithContext() instead. 2052func (iter *ListUsagesResultIterator) Next() error { 2053 return iter.NextWithContext(context.Background()) 2054} 2055 2056// NotDone returns true if the enumeration should be started or is not yet complete. 2057func (iter ListUsagesResultIterator) NotDone() bool { 2058 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2059} 2060 2061// Response returns the raw server response from the last page request. 2062func (iter ListUsagesResultIterator) Response() ListUsagesResult { 2063 return iter.page.Response() 2064} 2065 2066// Value returns the current value or a zero-initialized value if the 2067// iterator has advanced beyond the end of the collection. 2068func (iter ListUsagesResultIterator) Value() Usage { 2069 if !iter.page.NotDone() { 2070 return Usage{} 2071 } 2072 return iter.page.Values()[iter.i] 2073} 2074 2075// Creates a new instance of the ListUsagesResultIterator type. 2076func NewListUsagesResultIterator(page ListUsagesResultPage) ListUsagesResultIterator { 2077 return ListUsagesResultIterator{page: page} 2078} 2079 2080// IsEmpty returns true if the ListResult contains no values. 2081func (lur ListUsagesResult) IsEmpty() bool { 2082 return lur.Value == nil || len(*lur.Value) == 0 2083} 2084 2085// listUsagesResultPreparer prepares a request to retrieve the next set of results. 2086// It returns nil if no more results exist. 2087func (lur ListUsagesResult) listUsagesResultPreparer(ctx context.Context) (*http.Request, error) { 2088 if lur.NextLink == nil || len(to.String(lur.NextLink)) < 1 { 2089 return nil, nil 2090 } 2091 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2092 autorest.AsJSON(), 2093 autorest.AsGet(), 2094 autorest.WithBaseURL(to.String(lur.NextLink))) 2095} 2096 2097// ListUsagesResultPage contains a page of Usage values. 2098type ListUsagesResultPage struct { 2099 fn func(context.Context, ListUsagesResult) (ListUsagesResult, error) 2100 lur ListUsagesResult 2101} 2102 2103// NextWithContext advances to the next page of values. If there was an error making 2104// the request the page does not advance and the error is returned. 2105func (page *ListUsagesResultPage) NextWithContext(ctx context.Context) (err error) { 2106 if tracing.IsEnabled() { 2107 ctx = tracing.StartSpan(ctx, fqdn+"/ListUsagesResultPage.NextWithContext") 2108 defer func() { 2109 sc := -1 2110 if page.Response().Response.Response != nil { 2111 sc = page.Response().Response.Response.StatusCode 2112 } 2113 tracing.EndSpan(ctx, sc, err) 2114 }() 2115 } 2116 next, err := page.fn(ctx, page.lur) 2117 if err != nil { 2118 return err 2119 } 2120 page.lur = next 2121 return nil 2122} 2123 2124// Next advances to the next page of values. If there was an error making 2125// the request the page does not advance and the error is returned. 2126// Deprecated: Use NextWithContext() instead. 2127func (page *ListUsagesResultPage) Next() error { 2128 return page.NextWithContext(context.Background()) 2129} 2130 2131// NotDone returns true if the page enumeration should be started or is not yet complete. 2132func (page ListUsagesResultPage) NotDone() bool { 2133 return !page.lur.IsEmpty() 2134} 2135 2136// Response returns the raw server response from the last page request. 2137func (page ListUsagesResultPage) Response() ListUsagesResult { 2138 return page.lur 2139} 2140 2141// Values returns the slice of values for the current page or nil if there are no values. 2142func (page ListUsagesResultPage) Values() []Usage { 2143 if page.lur.IsEmpty() { 2144 return nil 2145 } 2146 return *page.lur.Value 2147} 2148 2149// Creates a new instance of the ListUsagesResultPage type. 2150func NewListUsagesResultPage(getNextPage func(context.Context, ListUsagesResult) (ListUsagesResult, error)) ListUsagesResultPage { 2151 return ListUsagesResultPage{fn: getNextPage} 2152} 2153 2154// LocalDataVolume represents mapping of host directories to directories in the container. 2155type LocalDataVolume struct { 2156 HostPath *string `json:"hostPath,omitempty"` 2157 LocalPath *string `json:"localPath,omitempty"` 2158} 2159 2160// ManualScaleSettings manual scale settings for the cluster. 2161type ManualScaleSettings struct { 2162 // TargetNodeCount - Default is 0. If autoScaleSettings are not specified, then the Cluster starts with this target. 2163 TargetNodeCount *int32 `json:"targetNodeCount,omitempty"` 2164 // NodeDeallocationOption - The default value is requeue. Possible values include: 'Requeue', 'Terminate', 'Waitforjobcompletion', 'Unknown' 2165 NodeDeallocationOption DeallocationOption `json:"nodeDeallocationOption,omitempty"` 2166} 2167 2168// MountSettings details of the File Server. 2169type MountSettings struct { 2170 MountPoint *string `json:"mountPoint,omitempty"` 2171 FileServerPublicIP *string `json:"fileServerPublicIP,omitempty"` 2172 FileServerInternalIP *string `json:"fileServerInternalIP,omitempty"` 2173 // FileServerType - Possible values include: 'Nfs', 'Glusterfs' 2174 FileServerType FileServerType `json:"fileServerType,omitempty"` 2175} 2176 2177// MountVolumes details of volumes to mount on the cluster. 2178type MountVolumes struct { 2179 // AzureFileShares - References to Azure File Shares that are to be mounted to the cluster nodes. 2180 AzureFileShares *[]AzureFileShareReference `json:"azureFileShares,omitempty"` 2181 // AzureBlobFileSystems - References to Azure Blob FUSE that are to be mounted to the cluster nodes. 2182 AzureBlobFileSystems *[]AzureBlobFileSystemReference `json:"azureBlobFileSystems,omitempty"` 2183 FileServers *[]FileServerReference `json:"fileServers,omitempty"` 2184 UnmanagedFileSystems *[]UnmanagedFileSystemReference `json:"unmanagedFileSystems,omitempty"` 2185} 2186 2187// NameValuePair represents a name-value pair. 2188type NameValuePair struct { 2189 Name *string `json:"name,omitempty"` 2190 Value *string `json:"value,omitempty"` 2191} 2192 2193// NodeSetup use this to prepare the VM. NOTE: The volumes specified in mountVolumes are mounted first and 2194// then the setupTask is run. Therefore the setup task can use local mountPaths in its execution. 2195type NodeSetup struct { 2196 SetupTask *SetupTask `json:"setupTask,omitempty"` 2197 // MountVolumes - Specified mount volumes will be available to all jobs executing on the cluster. The volumes will be mounted at location specified by $AZ_BATCHAI_MOUNT_ROOT environment variable. 2198 MountVolumes *MountVolumes `json:"mountVolumes,omitempty"` 2199 PerformanceCountersSettings *PerformanceCountersSettings `json:"performanceCountersSettings,omitempty"` 2200} 2201 2202// NodeStateCounts counts of various compute node states on the cluster. 2203type NodeStateCounts struct { 2204 IdleNodeCount *int32 `json:"idleNodeCount,omitempty"` 2205 RunningNodeCount *int32 `json:"runningNodeCount,omitempty"` 2206 PreparingNodeCount *int32 `json:"preparingNodeCount,omitempty"` 2207 UnusableNodeCount *int32 `json:"unusableNodeCount,omitempty"` 2208 LeavingNodeCount *int32 `json:"leavingNodeCount,omitempty"` 2209} 2210 2211// Operation details of a REST API operation 2212type Operation struct { 2213 // Name - This is of the format {provider}/{resource}/{operation} 2214 Name *string `json:"name,omitempty"` 2215 // Display - The object that describes the operation. 2216 Display *OperationDisplay `json:"display,omitempty"` 2217 Origin *string `json:"origin,omitempty"` 2218 Properties interface{} `json:"properties,omitempty"` 2219} 2220 2221// OperationDisplay the object that describes the operation. 2222type OperationDisplay struct { 2223 Provider *string `json:"provider,omitempty"` 2224 // Operation - For example: read, write, delete, or listKeys/action 2225 Operation *string `json:"operation,omitempty"` 2226 Resource *string `json:"resource,omitempty"` 2227 Description *string `json:"description,omitempty"` 2228} 2229 2230// OperationListResult contains the list of all operations supported by BatchAI resource provider 2231type OperationListResult struct { 2232 autorest.Response `json:"-"` 2233 Value *[]Operation `json:"value,omitempty"` 2234 NextLink *string `json:"nextLink,omitempty"` 2235} 2236 2237// OperationListResultIterator provides access to a complete listing of Operation values. 2238type OperationListResultIterator struct { 2239 i int 2240 page OperationListResultPage 2241} 2242 2243// NextWithContext advances to the next value. If there was an error making 2244// the request the iterator does not advance and the error is returned. 2245func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 2246 if tracing.IsEnabled() { 2247 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 2248 defer func() { 2249 sc := -1 2250 if iter.Response().Response.Response != nil { 2251 sc = iter.Response().Response.Response.StatusCode 2252 } 2253 tracing.EndSpan(ctx, sc, err) 2254 }() 2255 } 2256 iter.i++ 2257 if iter.i < len(iter.page.Values()) { 2258 return nil 2259 } 2260 err = iter.page.NextWithContext(ctx) 2261 if err != nil { 2262 iter.i-- 2263 return err 2264 } 2265 iter.i = 0 2266 return nil 2267} 2268 2269// Next advances to the next value. If there was an error making 2270// the request the iterator does not advance and the error is returned. 2271// Deprecated: Use NextWithContext() instead. 2272func (iter *OperationListResultIterator) Next() error { 2273 return iter.NextWithContext(context.Background()) 2274} 2275 2276// NotDone returns true if the enumeration should be started or is not yet complete. 2277func (iter OperationListResultIterator) NotDone() bool { 2278 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2279} 2280 2281// Response returns the raw server response from the last page request. 2282func (iter OperationListResultIterator) Response() OperationListResult { 2283 return iter.page.Response() 2284} 2285 2286// Value returns the current value or a zero-initialized value if the 2287// iterator has advanced beyond the end of the collection. 2288func (iter OperationListResultIterator) Value() Operation { 2289 if !iter.page.NotDone() { 2290 return Operation{} 2291 } 2292 return iter.page.Values()[iter.i] 2293} 2294 2295// Creates a new instance of the OperationListResultIterator type. 2296func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 2297 return OperationListResultIterator{page: page} 2298} 2299 2300// IsEmpty returns true if the ListResult contains no values. 2301func (olr OperationListResult) IsEmpty() bool { 2302 return olr.Value == nil || len(*olr.Value) == 0 2303} 2304 2305// operationListResultPreparer prepares a request to retrieve the next set of results. 2306// It returns nil if no more results exist. 2307func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 2308 if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { 2309 return nil, nil 2310 } 2311 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2312 autorest.AsJSON(), 2313 autorest.AsGet(), 2314 autorest.WithBaseURL(to.String(olr.NextLink))) 2315} 2316 2317// OperationListResultPage contains a page of Operation values. 2318type OperationListResultPage struct { 2319 fn func(context.Context, OperationListResult) (OperationListResult, error) 2320 olr OperationListResult 2321} 2322 2323// NextWithContext advances to the next page of values. If there was an error making 2324// the request the page does not advance and the error is returned. 2325func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 2326 if tracing.IsEnabled() { 2327 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 2328 defer func() { 2329 sc := -1 2330 if page.Response().Response.Response != nil { 2331 sc = page.Response().Response.Response.StatusCode 2332 } 2333 tracing.EndSpan(ctx, sc, err) 2334 }() 2335 } 2336 next, err := page.fn(ctx, page.olr) 2337 if err != nil { 2338 return err 2339 } 2340 page.olr = next 2341 return nil 2342} 2343 2344// Next advances to the next page of values. If there was an error making 2345// the request the page does not advance and the error is returned. 2346// Deprecated: Use NextWithContext() instead. 2347func (page *OperationListResultPage) Next() error { 2348 return page.NextWithContext(context.Background()) 2349} 2350 2351// NotDone returns true if the page enumeration should be started or is not yet complete. 2352func (page OperationListResultPage) NotDone() bool { 2353 return !page.olr.IsEmpty() 2354} 2355 2356// Response returns the raw server response from the last page request. 2357func (page OperationListResultPage) Response() OperationListResult { 2358 return page.olr 2359} 2360 2361// Values returns the slice of values for the current page or nil if there are no values. 2362func (page OperationListResultPage) Values() []Operation { 2363 if page.olr.IsEmpty() { 2364 return nil 2365 } 2366 return *page.olr.Value 2367} 2368 2369// Creates a new instance of the OperationListResultPage type. 2370func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 2371 return OperationListResultPage{fn: getNextPage} 2372} 2373 2374// OutputDirectory output directory for the job. 2375type OutputDirectory struct { 2376 // ID - The path of the output directory will be available as a value of an environment variable with AZ_BATCHAI_OUTPUT_<id> name, where <id> is the value of id attribute. 2377 ID *string `json:"id,omitempty"` 2378 // PathPrefix - NOTE: This is an absolute path to prefix. E.g. $AZ_BATCHAI_MOUNT_ROOT/MyNFS/MyLogs. You can find the full path to the output directory by combining pathPrefix, jobOutputDirectoryPathSegment (reported by get job) and pathSuffix. 2379 PathPrefix *string `json:"pathPrefix,omitempty"` 2380 // PathSuffix - The suffix path where the output directory will be created. E.g. models. You can find the full path to the output directory by combining pathPrefix, jobOutputDirectoryPathSegment (reported by get job) and pathSuffix. 2381 PathSuffix *string `json:"pathSuffix,omitempty"` 2382 // Type - Default value is Custom. The possible values are Model, Logs, Summary, and Custom. Users can use multiple enums for a single directory. Eg. outPutType='Model,Logs, Summary'. Possible values include: 'Model', 'Logs', 'Summary', 'Custom' 2383 Type OutputType `json:"type,omitempty"` 2384 // CreateNew - Default is true. If false, then the directory is not created and can be any directory path that the user specifies. 2385 CreateNew *bool `json:"createNew,omitempty"` 2386} 2387 2388// PerformanceCountersSettings performance counters reporting settings. 2389type PerformanceCountersSettings struct { 2390 // AppInsightsReference - If provided, Batch AI will upload node performance counters to the corresponding Azure Application Insights account. 2391 AppInsightsReference *AppInsightsReference `json:"appInsightsReference,omitempty"` 2392} 2393 2394// PrivateRegistryCredentials credentials to access a container image in a private repository. 2395type PrivateRegistryCredentials struct { 2396 Username *string `json:"username,omitempty"` 2397 // Password - One of password or passwordSecretReference must be specified. 2398 Password *string `json:"password,omitempty"` 2399 // PasswordSecretReference - Users can store their secrets in Azure KeyVault and pass it to the Batch AI Service to integrate with KeyVault. One of password or passwordSecretReference must be specified. 2400 PasswordSecretReference *KeyVaultSecretReference `json:"passwordSecretReference,omitempty"` 2401} 2402 2403// PyTorchSettings specifies the settings for pyTorch job. 2404type PyTorchSettings struct { 2405 PythonScriptFilePath *string `json:"pythonScriptFilePath,omitempty"` 2406 PythonInterpreterPath *string `json:"pythonInterpreterPath,omitempty"` 2407 CommandLineArgs *string `json:"commandLineArgs,omitempty"` 2408 // ProcessCount - The default value for this property is equal to nodeCount property. 2409 ProcessCount *int32 `json:"processCount,omitempty"` 2410 // CommunicationBackend - Valid values are 'TCP', 'Gloo' or 'MPI'. Not required for non-distributed jobs. 2411 CommunicationBackend *string `json:"communicationBackend,omitempty"` 2412} 2413 2414// RemoteLoginInformation contains remote login details to SSH/RDP to a compute node in cluster. 2415type RemoteLoginInformation struct { 2416 // NodeID - Id of the compute node 2417 NodeID *string `json:"nodeId,omitempty"` 2418 // IPAddress - ip address 2419 IPAddress *string `json:"ipAddress,omitempty"` 2420 Port *float64 `json:"port,omitempty"` 2421} 2422 2423// RemoteLoginInformationListResult values returned by the List operation. 2424type RemoteLoginInformationListResult struct { 2425 autorest.Response `json:"-"` 2426 // Value - The collection of returned remote login details. 2427 Value *[]RemoteLoginInformation `json:"value,omitempty"` 2428 // NextLink - The continuation token. 2429 NextLink *string `json:"nextLink,omitempty"` 2430} 2431 2432// RemoteLoginInformationListResultIterator provides access to a complete listing of RemoteLoginInformation 2433// values. 2434type RemoteLoginInformationListResultIterator struct { 2435 i int 2436 page RemoteLoginInformationListResultPage 2437} 2438 2439// NextWithContext advances to the next value. If there was an error making 2440// the request the iterator does not advance and the error is returned. 2441func (iter *RemoteLoginInformationListResultIterator) NextWithContext(ctx context.Context) (err error) { 2442 if tracing.IsEnabled() { 2443 ctx = tracing.StartSpan(ctx, fqdn+"/RemoteLoginInformationListResultIterator.NextWithContext") 2444 defer func() { 2445 sc := -1 2446 if iter.Response().Response.Response != nil { 2447 sc = iter.Response().Response.Response.StatusCode 2448 } 2449 tracing.EndSpan(ctx, sc, err) 2450 }() 2451 } 2452 iter.i++ 2453 if iter.i < len(iter.page.Values()) { 2454 return nil 2455 } 2456 err = iter.page.NextWithContext(ctx) 2457 if err != nil { 2458 iter.i-- 2459 return err 2460 } 2461 iter.i = 0 2462 return nil 2463} 2464 2465// Next advances to the next value. If there was an error making 2466// the request the iterator does not advance and the error is returned. 2467// Deprecated: Use NextWithContext() instead. 2468func (iter *RemoteLoginInformationListResultIterator) Next() error { 2469 return iter.NextWithContext(context.Background()) 2470} 2471 2472// NotDone returns true if the enumeration should be started or is not yet complete. 2473func (iter RemoteLoginInformationListResultIterator) NotDone() bool { 2474 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2475} 2476 2477// Response returns the raw server response from the last page request. 2478func (iter RemoteLoginInformationListResultIterator) Response() RemoteLoginInformationListResult { 2479 return iter.page.Response() 2480} 2481 2482// Value returns the current value or a zero-initialized value if the 2483// iterator has advanced beyond the end of the collection. 2484func (iter RemoteLoginInformationListResultIterator) Value() RemoteLoginInformation { 2485 if !iter.page.NotDone() { 2486 return RemoteLoginInformation{} 2487 } 2488 return iter.page.Values()[iter.i] 2489} 2490 2491// Creates a new instance of the RemoteLoginInformationListResultIterator type. 2492func NewRemoteLoginInformationListResultIterator(page RemoteLoginInformationListResultPage) RemoteLoginInformationListResultIterator { 2493 return RemoteLoginInformationListResultIterator{page: page} 2494} 2495 2496// IsEmpty returns true if the ListResult contains no values. 2497func (rlilr RemoteLoginInformationListResult) IsEmpty() bool { 2498 return rlilr.Value == nil || len(*rlilr.Value) == 0 2499} 2500 2501// remoteLoginInformationListResultPreparer prepares a request to retrieve the next set of results. 2502// It returns nil if no more results exist. 2503func (rlilr RemoteLoginInformationListResult) remoteLoginInformationListResultPreparer(ctx context.Context) (*http.Request, error) { 2504 if rlilr.NextLink == nil || len(to.String(rlilr.NextLink)) < 1 { 2505 return nil, nil 2506 } 2507 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2508 autorest.AsJSON(), 2509 autorest.AsGet(), 2510 autorest.WithBaseURL(to.String(rlilr.NextLink))) 2511} 2512 2513// RemoteLoginInformationListResultPage contains a page of RemoteLoginInformation values. 2514type RemoteLoginInformationListResultPage struct { 2515 fn func(context.Context, RemoteLoginInformationListResult) (RemoteLoginInformationListResult, error) 2516 rlilr RemoteLoginInformationListResult 2517} 2518 2519// NextWithContext advances to the next page of values. If there was an error making 2520// the request the page does not advance and the error is returned. 2521func (page *RemoteLoginInformationListResultPage) NextWithContext(ctx context.Context) (err error) { 2522 if tracing.IsEnabled() { 2523 ctx = tracing.StartSpan(ctx, fqdn+"/RemoteLoginInformationListResultPage.NextWithContext") 2524 defer func() { 2525 sc := -1 2526 if page.Response().Response.Response != nil { 2527 sc = page.Response().Response.Response.StatusCode 2528 } 2529 tracing.EndSpan(ctx, sc, err) 2530 }() 2531 } 2532 next, err := page.fn(ctx, page.rlilr) 2533 if err != nil { 2534 return err 2535 } 2536 page.rlilr = next 2537 return nil 2538} 2539 2540// Next advances to the next page of values. If there was an error making 2541// the request the page does not advance and the error is returned. 2542// Deprecated: Use NextWithContext() instead. 2543func (page *RemoteLoginInformationListResultPage) Next() error { 2544 return page.NextWithContext(context.Background()) 2545} 2546 2547// NotDone returns true if the page enumeration should be started or is not yet complete. 2548func (page RemoteLoginInformationListResultPage) NotDone() bool { 2549 return !page.rlilr.IsEmpty() 2550} 2551 2552// Response returns the raw server response from the last page request. 2553func (page RemoteLoginInformationListResultPage) Response() RemoteLoginInformationListResult { 2554 return page.rlilr 2555} 2556 2557// Values returns the slice of values for the current page or nil if there are no values. 2558func (page RemoteLoginInformationListResultPage) Values() []RemoteLoginInformation { 2559 if page.rlilr.IsEmpty() { 2560 return nil 2561 } 2562 return *page.rlilr.Value 2563} 2564 2565// Creates a new instance of the RemoteLoginInformationListResultPage type. 2566func NewRemoteLoginInformationListResultPage(getNextPage func(context.Context, RemoteLoginInformationListResult) (RemoteLoginInformationListResult, error)) RemoteLoginInformationListResultPage { 2567 return RemoteLoginInformationListResultPage{fn: getNextPage} 2568} 2569 2570// Resource a definition of an Azure resource. 2571type Resource struct { 2572 // ID - READ-ONLY; The ID of the resource 2573 ID *string `json:"id,omitempty"` 2574 // Name - READ-ONLY; The name of the resource 2575 Name *string `json:"name,omitempty"` 2576 // Type - READ-ONLY; The type of the resource 2577 Type *string `json:"type,omitempty"` 2578 // Location - READ-ONLY; The location of the resource 2579 Location *string `json:"location,omitempty"` 2580 // Tags - READ-ONLY; The tags of the resource 2581 Tags map[string]*string `json:"tags"` 2582} 2583 2584// MarshalJSON is the custom marshaler for Resource. 2585func (r Resource) MarshalJSON() ([]byte, error) { 2586 objectMap := make(map[string]interface{}) 2587 return json.Marshal(objectMap) 2588} 2589 2590// ResourceID represents a resource ID. For example, for a subnet, it is the resource URL for the subnet. 2591type ResourceID struct { 2592 // ID - The ID of the resource 2593 ID *string `json:"id,omitempty"` 2594} 2595 2596// ScaleSettings at least one of manual or autoScale settings must be specified. Only one of manual or 2597// autoScale settings can be specified. If autoScale settings are specified, the system automatically 2598// scales the cluster up and down (within the supplied limits) based on the pending jobs on the cluster. 2599type ScaleSettings struct { 2600 Manual *ManualScaleSettings `json:"manual,omitempty"` 2601 AutoScale *AutoScaleSettings `json:"autoScale,omitempty"` 2602} 2603 2604// SetupTask specifies a setup task which can be used to customize the compute nodes of the cluster. 2605type SetupTask struct { 2606 CommandLine *string `json:"commandLine,omitempty"` 2607 EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` 2608 // Secrets - Server will never report values of these variables back. 2609 Secrets *[]EnvironmentVariableWithSecretValue `json:"secrets,omitempty"` 2610 // RunElevated - Note. Non-elevated tasks are run under an account added into sudoer list and can perform sudo when required. 2611 RunElevated *bool `json:"runElevated,omitempty"` 2612 // StdOutErrPathPrefix - The prefix of a path where the Batch AI service will upload the stdout and stderr of the setup task. 2613 StdOutErrPathPrefix *string `json:"stdOutErrPathPrefix,omitempty"` 2614 // StdOutErrPathSuffix - READ-ONLY; Batch AI creates the setup task output directories under an unique path to avoid conflicts between different clusters. You can concatenate stdOutErrPathPrefix and stdOutErrPathSuffix to get the full path to the output directory. 2615 StdOutErrPathSuffix *string `json:"stdOutErrPathSuffix,omitempty"` 2616} 2617 2618// SSHConfiguration SSH configuration settings for the VM 2619type SSHConfiguration struct { 2620 // PublicIPsToAllow - Default value is '*' can be used to match all source IPs. Maximum number of IP ranges that can be specified are 400. 2621 PublicIPsToAllow *[]string `json:"publicIPsToAllow,omitempty"` 2622 UserAccountSettings *UserAccountSettings `json:"userAccountSettings,omitempty"` 2623} 2624 2625// TensorFlowSettings specifies the settings for TensorFlow job. 2626type TensorFlowSettings struct { 2627 PythonScriptFilePath *string `json:"pythonScriptFilePath,omitempty"` 2628 PythonInterpreterPath *string `json:"pythonInterpreterPath,omitempty"` 2629 MasterCommandLineArgs *string `json:"masterCommandLineArgs,omitempty"` 2630 // WorkerCommandLineArgs - This property is optional for single machine training. 2631 WorkerCommandLineArgs *string `json:"workerCommandLineArgs,omitempty"` 2632 // ParameterServerCommandLineArgs - This property is optional for single machine training. 2633 ParameterServerCommandLineArgs *string `json:"parameterServerCommandLineArgs,omitempty"` 2634 // WorkerCount - If specified, the value must be less than or equal to (nodeCount * numberOfGPUs per VM). If not specified, the default value is equal to nodeCount. This property can be specified only for distributed TensorFlow training 2635 WorkerCount *int32 `json:"workerCount,omitempty"` 2636 // ParameterServerCount - If specified, the value must be less than or equal to nodeCount. If not specified, the default value is equal to 1 for distributed TensorFlow training (This property is not applicable for single machine training). This property can be specified only for distributed TensorFlow training. 2637 ParameterServerCount *int32 `json:"parameterServerCount,omitempty"` 2638} 2639 2640// UnmanagedFileSystemReference details of the file system to mount on the compute cluster nodes. 2641type UnmanagedFileSystemReference struct { 2642 MountCommand *string `json:"mountCommand,omitempty"` 2643 // RelativeMountPath - Note that all cluster level unmanaged file system will be mounted under $AZ_BATCHAI_MOUNT_ROOT location and job level unmanaged file system will be mounted under $AZ_BATCHAI_JOB_MOUNT_ROOT. 2644 RelativeMountPath *string `json:"relativeMountPath,omitempty"` 2645} 2646 2647// Usage describes Batch AI Resource Usage. 2648type Usage struct { 2649 // Unit - An enum describing the unit of usage measurement. 2650 Unit *string `json:"unit,omitempty"` 2651 // CurrentValue - The current usage of the resource. 2652 CurrentValue *int32 `json:"currentValue,omitempty"` 2653 // Limit - The maximum permitted usage of the resource. 2654 Limit *int64 `json:"limit,omitempty"` 2655 // Name - The name of the type of usage. 2656 Name *UsageName `json:"name,omitempty"` 2657} 2658 2659// UsageName the Usage Names. 2660type UsageName struct { 2661 // Value - The name of the resource. 2662 Value *string `json:"value,omitempty"` 2663 // LocalizedValue - The localized name of the resource. 2664 LocalizedValue *string `json:"localizedValue,omitempty"` 2665} 2666 2667// UserAccountSettings settings for user account that gets created on each on the nodes of a cluster. 2668type UserAccountSettings struct { 2669 AdminUserName *string `json:"adminUserName,omitempty"` 2670 AdminUserSSHPublicKey *string `json:"adminUserSshPublicKey,omitempty"` 2671 AdminUserPassword *string `json:"adminUserPassword,omitempty"` 2672} 2673 2674// VirtualMachineConfiguration settings for OS image. 2675type VirtualMachineConfiguration struct { 2676 ImageReference *ImageReference `json:"imageReference,omitempty"` 2677} 2678