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-05-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 // Waitforjobcompletion ... 75 Waitforjobcompletion DeallocationOption = "waitforjobcompletion" 76) 77 78// PossibleDeallocationOptionValues returns an array of possible values for the DeallocationOption const type. 79func PossibleDeallocationOptionValues() []DeallocationOption { 80 return []DeallocationOption{Requeue, Terminate, Waitforjobcompletion} 81} 82 83// ExecutionState enumerates the values for execution state. 84type ExecutionState string 85 86const ( 87 // Failed ... 88 Failed ExecutionState = "failed" 89 // Queued ... 90 Queued ExecutionState = "queued" 91 // Running ... 92 Running ExecutionState = "running" 93 // Succeeded ... 94 Succeeded ExecutionState = "succeeded" 95 // Terminating ... 96 Terminating ExecutionState = "terminating" 97) 98 99// PossibleExecutionStateValues returns an array of possible values for the ExecutionState const type. 100func PossibleExecutionStateValues() []ExecutionState { 101 return []ExecutionState{Failed, Queued, Running, Succeeded, Terminating} 102} 103 104// FileServerProvisioningState enumerates the values for file server provisioning state. 105type FileServerProvisioningState string 106 107const ( 108 // FileServerProvisioningStateCreating ... 109 FileServerProvisioningStateCreating FileServerProvisioningState = "creating" 110 // FileServerProvisioningStateDeleting ... 111 FileServerProvisioningStateDeleting FileServerProvisioningState = "deleting" 112 // FileServerProvisioningStateFailed ... 113 FileServerProvisioningStateFailed FileServerProvisioningState = "failed" 114 // FileServerProvisioningStateSucceeded ... 115 FileServerProvisioningStateSucceeded FileServerProvisioningState = "succeeded" 116 // FileServerProvisioningStateUpdating ... 117 FileServerProvisioningStateUpdating FileServerProvisioningState = "updating" 118) 119 120// PossibleFileServerProvisioningStateValues returns an array of possible values for the FileServerProvisioningState const type. 121func PossibleFileServerProvisioningStateValues() []FileServerProvisioningState { 122 return []FileServerProvisioningState{FileServerProvisioningStateCreating, FileServerProvisioningStateDeleting, FileServerProvisioningStateFailed, FileServerProvisioningStateSucceeded, FileServerProvisioningStateUpdating} 123} 124 125// FileType enumerates the values for file type. 126type FileType string 127 128const ( 129 // FileTypeDirectory ... 130 FileTypeDirectory FileType = "directory" 131 // FileTypeFile ... 132 FileTypeFile FileType = "file" 133) 134 135// PossibleFileTypeValues returns an array of possible values for the FileType const type. 136func PossibleFileTypeValues() []FileType { 137 return []FileType{FileTypeDirectory, FileTypeFile} 138} 139 140// JobPriority enumerates the values for job priority. 141type JobPriority string 142 143const ( 144 // High ... 145 High JobPriority = "high" 146 // Low ... 147 Low JobPriority = "low" 148 // Normal ... 149 Normal JobPriority = "normal" 150) 151 152// PossibleJobPriorityValues returns an array of possible values for the JobPriority const type. 153func PossibleJobPriorityValues() []JobPriority { 154 return []JobPriority{High, Low, Normal} 155} 156 157// ProvisioningState enumerates the values for provisioning state. 158type ProvisioningState string 159 160const ( 161 // ProvisioningStateCreating ... 162 ProvisioningStateCreating ProvisioningState = "creating" 163 // ProvisioningStateDeleting ... 164 ProvisioningStateDeleting ProvisioningState = "deleting" 165 // ProvisioningStateFailed ... 166 ProvisioningStateFailed ProvisioningState = "failed" 167 // ProvisioningStateSucceeded ... 168 ProvisioningStateSucceeded ProvisioningState = "succeeded" 169) 170 171// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. 172func PossibleProvisioningStateValues() []ProvisioningState { 173 return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded} 174} 175 176// StorageAccountType enumerates the values for storage account type. 177type StorageAccountType string 178 179const ( 180 // PremiumLRS ... 181 PremiumLRS StorageAccountType = "Premium_LRS" 182 // StandardLRS ... 183 StandardLRS StorageAccountType = "Standard_LRS" 184) 185 186// PossibleStorageAccountTypeValues returns an array of possible values for the StorageAccountType const type. 187func PossibleStorageAccountTypeValues() []StorageAccountType { 188 return []StorageAccountType{PremiumLRS, StandardLRS} 189} 190 191// ToolType enumerates the values for tool type. 192type ToolType string 193 194const ( 195 // Caffe ... 196 Caffe ToolType = "caffe" 197 // Caffe2 ... 198 Caffe2 ToolType = "caffe2" 199 // Chainer ... 200 Chainer ToolType = "chainer" 201 // Cntk ... 202 Cntk ToolType = "cntk" 203 // Custom ... 204 Custom ToolType = "custom" 205 // Custommpi ... 206 Custommpi ToolType = "custommpi" 207 // Horovod ... 208 Horovod ToolType = "horovod" 209 // Tensorflow ... 210 Tensorflow ToolType = "tensorflow" 211) 212 213// PossibleToolTypeValues returns an array of possible values for the ToolType const type. 214func PossibleToolTypeValues() []ToolType { 215 return []ToolType{Caffe, Caffe2, Chainer, Cntk, Custom, Custommpi, Horovod, Tensorflow} 216} 217 218// UsageUnit enumerates the values for usage unit. 219type UsageUnit string 220 221const ( 222 // Count ... 223 Count UsageUnit = "Count" 224) 225 226// PossibleUsageUnitValues returns an array of possible values for the UsageUnit const type. 227func PossibleUsageUnitValues() []UsageUnit { 228 return []UsageUnit{Count} 229} 230 231// VMPriority enumerates the values for vm priority. 232type VMPriority string 233 234const ( 235 // Dedicated ... 236 Dedicated VMPriority = "dedicated" 237 // Lowpriority ... 238 Lowpriority VMPriority = "lowpriority" 239) 240 241// PossibleVMPriorityValues returns an array of possible values for the VMPriority const type. 242func PossibleVMPriorityValues() []VMPriority { 243 return []VMPriority{Dedicated, Lowpriority} 244} 245 246// AppInsightsReference azure Application Insights information for performance counters reporting. 247type AppInsightsReference struct { 248 // Component - Azure Application Insights component resource ID. 249 Component *ResourceID `json:"component,omitempty"` 250 // InstrumentationKey - Value of the Azure Application Insights instrumentation key. 251 InstrumentationKey *string `json:"instrumentationKey,omitempty"` 252 // InstrumentationKeySecretReference - KeyVault Store and Secret which contains Azure Application Insights instrumentation key. One of instrumentationKey or instrumentationKeySecretReference must be specified. 253 InstrumentationKeySecretReference *KeyVaultSecretReference `json:"instrumentationKeySecretReference,omitempty"` 254} 255 256// AutoScaleSettings auto-scale settings for the cluster. The system automatically scales the cluster up 257// and down (within minimumNodeCount and maximumNodeCount) based on the number of queued and running jobs 258// assigned to the cluster. 259type AutoScaleSettings struct { 260 // MinimumNodeCount - The minimum number of compute nodes the Batch AI service will try to allocate for the cluster. Note, the actual number of nodes can be less than the specified value if the subscription has not enough quota to fulfill the request. 261 MinimumNodeCount *int32 `json:"minimumNodeCount,omitempty"` 262 // MaximumNodeCount - The maximum number of compute nodes the cluster can have. 263 MaximumNodeCount *int32 `json:"maximumNodeCount,omitempty"` 264 // InitialNodeCount - The number of compute nodes to allocate on cluster creation. Note that this value is used only during cluster creation. Default: 0. 265 InitialNodeCount *int32 `json:"initialNodeCount,omitempty"` 266} 267 268// AzureBlobFileSystemReference azure Blob Storage Container mounting configuration. 269type AzureBlobFileSystemReference struct { 270 // AccountName - Name of the Azure storage account. 271 AccountName *string `json:"accountName,omitempty"` 272 // ContainerName - Name of the Azure Blob Storage container to mount on the cluster. 273 ContainerName *string `json:"containerName,omitempty"` 274 // Credentials - Information about the Azure storage credentials. 275 Credentials *AzureStorageCredentialsInfo `json:"credentials,omitempty"` 276 // RelativeMountPath - The relative path on the compute node where the Azure File container will be mounted. Note that all cluster level containers will be mounted under $AZ_BATCHAI_MOUNT_ROOT location and all job level containers will be mounted under $AZ_BATCHAI_JOB_MOUNT_ROOT. 277 RelativeMountPath *string `json:"relativeMountPath,omitempty"` 278 // MountOptions - Mount options for mounting blobfuse file system. 279 MountOptions *string `json:"mountOptions,omitempty"` 280} 281 282// AzureFileShareReference azure File Share mounting configuration. 283type AzureFileShareReference struct { 284 // AccountName - Name of the Azure storage account. 285 AccountName *string `json:"accountName,omitempty"` 286 // AzureFileURL - URL to access the Azure File. 287 AzureFileURL *string `json:"azureFileUrl,omitempty"` 288 // Credentials - Information about the Azure storage credentials. 289 Credentials *AzureStorageCredentialsInfo `json:"credentials,omitempty"` 290 // RelativeMountPath - The relative path on the compute node where the Azure File share will be mounted. 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. 291 RelativeMountPath *string `json:"relativeMountPath,omitempty"` 292 // FileMode - File mode for files on the mounted file share. Default value: 0777. 293 FileMode *string `json:"fileMode,omitempty"` 294 // DirectoryMode - File mode for directories on the mounted file share. Default value: 0777. 295 DirectoryMode *string `json:"directoryMode,omitempty"` 296} 297 298// AzureStorageCredentialsInfo azure storage account credentials. 299type AzureStorageCredentialsInfo struct { 300 // AccountKey - Storage account key. One of accountKey or accountKeySecretReference must be specified. 301 AccountKey *string `json:"accountKey,omitempty"` 302 // AccountKeySecretReference - Information about KeyVault secret storing the storage account key. One of accountKey or accountKeySecretReference must be specified. 303 AccountKeySecretReference *KeyVaultSecretReference `json:"accountKeySecretReference,omitempty"` 304} 305 306// Caffe2Settings caffe2 job settings. 307type Caffe2Settings struct { 308 // PythonScriptFilePath - The python script to execute. 309 PythonScriptFilePath *string `json:"pythonScriptFilePath,omitempty"` 310 // PythonInterpreterPath - The path to the Python interpreter. 311 PythonInterpreterPath *string `json:"pythonInterpreterPath,omitempty"` 312 // CommandLineArgs - Command line arguments that need to be passed to the python script. 313 CommandLineArgs *string `json:"commandLineArgs,omitempty"` 314} 315 316// CaffeSettings caffe job settings. 317type CaffeSettings struct { 318 // ConfigFilePath - Path of the config file for the job. This property cannot be specified if pythonScriptFilePath is specified. 319 ConfigFilePath *string `json:"configFilePath,omitempty"` 320 // PythonScriptFilePath - Python script to execute. This property cannot be specified if configFilePath is specified. 321 PythonScriptFilePath *string `json:"pythonScriptFilePath,omitempty"` 322 // PythonInterpreterPath - The path to the Python interpreter. The property can be specified only if the pythonScriptFilePath is specified. 323 PythonInterpreterPath *string `json:"pythonInterpreterPath,omitempty"` 324 // CommandLineArgs - Command line arguments that need to be passed to the Caffe job. 325 CommandLineArgs *string `json:"commandLineArgs,omitempty"` 326 // ProcessCount - Number of processes to launch for the job execution. The default value for this property is equal to nodeCount property 327 ProcessCount *int32 `json:"processCount,omitempty"` 328} 329 330// ChainerSettings chainer job settings. 331type ChainerSettings struct { 332 // PythonScriptFilePath - The python script to execute. 333 PythonScriptFilePath *string `json:"pythonScriptFilePath,omitempty"` 334 // PythonInterpreterPath - The path to the Python interpreter. 335 PythonInterpreterPath *string `json:"pythonInterpreterPath,omitempty"` 336 // CommandLineArgs - Command line arguments that need to be passed to the python script. 337 CommandLineArgs *string `json:"commandLineArgs,omitempty"` 338 // ProcessCount - Number of processes to launch for the job execution. The default value for this property is equal to nodeCount property 339 ProcessCount *int32 `json:"processCount,omitempty"` 340} 341 342// CloudError an error response from the Batch AI service. 343type CloudError struct { 344 // Error - READ-ONLY; An error response from the Batch AI service. 345 Error *CloudErrorBody `json:"error,omitempty"` 346} 347 348// CloudErrorBody an error response from the Batch AI service. 349type CloudErrorBody struct { 350 // Code - READ-ONLY; An identifier for the error. Codes are invariant and are intended to be consumed programmatically. 351 Code *string `json:"code,omitempty"` 352 // Message - READ-ONLY; A message describing the error, intended to be suitable for display in a user interface. 353 Message *string `json:"message,omitempty"` 354 // Target - READ-ONLY; The target of the particular error. For example, the name of the property in error. 355 Target *string `json:"target,omitempty"` 356 // Details - READ-ONLY; A list of additional details about the error. 357 Details *[]CloudErrorBody `json:"details,omitempty"` 358} 359 360// Cluster information about a Cluster. 361type Cluster struct { 362 autorest.Response `json:"-"` 363 // ClusterProperties - The properties associated with the Cluster. 364 *ClusterProperties `json:"properties,omitempty"` 365 // ID - READ-ONLY; The ID of the resource. 366 ID *string `json:"id,omitempty"` 367 // Name - READ-ONLY; The name of the resource. 368 Name *string `json:"name,omitempty"` 369 // Type - READ-ONLY; The type of the resource. 370 Type *string `json:"type,omitempty"` 371} 372 373// MarshalJSON is the custom marshaler for Cluster. 374func (c Cluster) MarshalJSON() ([]byte, error) { 375 objectMap := make(map[string]interface{}) 376 if c.ClusterProperties != nil { 377 objectMap["properties"] = c.ClusterProperties 378 } 379 return json.Marshal(objectMap) 380} 381 382// UnmarshalJSON is the custom unmarshaler for Cluster struct. 383func (c *Cluster) UnmarshalJSON(body []byte) error { 384 var m map[string]*json.RawMessage 385 err := json.Unmarshal(body, &m) 386 if err != nil { 387 return err 388 } 389 for k, v := range m { 390 switch k { 391 case "properties": 392 if v != nil { 393 var clusterProperties ClusterProperties 394 err = json.Unmarshal(*v, &clusterProperties) 395 if err != nil { 396 return err 397 } 398 c.ClusterProperties = &clusterProperties 399 } 400 case "id": 401 if v != nil { 402 var ID string 403 err = json.Unmarshal(*v, &ID) 404 if err != nil { 405 return err 406 } 407 c.ID = &ID 408 } 409 case "name": 410 if v != nil { 411 var name string 412 err = json.Unmarshal(*v, &name) 413 if err != nil { 414 return err 415 } 416 c.Name = &name 417 } 418 case "type": 419 if v != nil { 420 var typeVar string 421 err = json.Unmarshal(*v, &typeVar) 422 if err != nil { 423 return err 424 } 425 c.Type = &typeVar 426 } 427 } 428 } 429 430 return nil 431} 432 433// ClusterBaseProperties the properties of a Cluster. 434type ClusterBaseProperties struct { 435 // VMSize - The size of the virtual machines in the cluster. All nodes in a cluster have the same VM size. For information about available VM sizes for clusters using images from the Virtual Machines Marketplace see Sizes for Virtual Machines (Linux). Batch AI service supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). 436 VMSize *string `json:"vmSize,omitempty"` 437 // VMPriority - VM priority. Allowed values are: dedicated (default) and lowpriority. Possible values include: 'Dedicated', 'Lowpriority' 438 VMPriority VMPriority `json:"vmPriority,omitempty"` 439 // ScaleSettings - Scale settings for the cluster. Batch AI service supports manual and auto scale clusters. 440 ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` 441 // VirtualMachineConfiguration - OS image configuration for cluster nodes. All nodes in a cluster have the same OS image. 442 VirtualMachineConfiguration *VirtualMachineConfiguration `json:"virtualMachineConfiguration,omitempty"` 443 // NodeSetup - Setup to be performed on each compute node in the cluster. 444 NodeSetup *NodeSetup `json:"nodeSetup,omitempty"` 445 // UserAccountSettings - Settings for an administrator user account that will be created on each compute node in the cluster. 446 UserAccountSettings *UserAccountSettings `json:"userAccountSettings,omitempty"` 447 // Subnet - Existing virtual network subnet to put the cluster nodes in. Note, if a File Server mount configured in node setup, the File Server's subnet will be used automatically. 448 Subnet *ResourceID `json:"subnet,omitempty"` 449} 450 451// ClusterCreateParameters cluster creation operation. 452type ClusterCreateParameters struct { 453 // ClusterBaseProperties - The properties of the Cluster. 454 *ClusterBaseProperties `json:"properties,omitempty"` 455} 456 457// MarshalJSON is the custom marshaler for ClusterCreateParameters. 458func (ccp ClusterCreateParameters) MarshalJSON() ([]byte, error) { 459 objectMap := make(map[string]interface{}) 460 if ccp.ClusterBaseProperties != nil { 461 objectMap["properties"] = ccp.ClusterBaseProperties 462 } 463 return json.Marshal(objectMap) 464} 465 466// UnmarshalJSON is the custom unmarshaler for ClusterCreateParameters struct. 467func (ccp *ClusterCreateParameters) UnmarshalJSON(body []byte) error { 468 var m map[string]*json.RawMessage 469 err := json.Unmarshal(body, &m) 470 if err != nil { 471 return err 472 } 473 for k, v := range m { 474 switch k { 475 case "properties": 476 if v != nil { 477 var clusterBaseProperties ClusterBaseProperties 478 err = json.Unmarshal(*v, &clusterBaseProperties) 479 if err != nil { 480 return err 481 } 482 ccp.ClusterBaseProperties = &clusterBaseProperties 483 } 484 } 485 } 486 487 return nil 488} 489 490// ClusterListResult values returned by the List Clusters operation. 491type ClusterListResult struct { 492 autorest.Response `json:"-"` 493 // Value - READ-ONLY; The collection of returned Clusters. 494 Value *[]Cluster `json:"value,omitempty"` 495 // NextLink - READ-ONLY; The continuation token. 496 NextLink *string `json:"nextLink,omitempty"` 497} 498 499// ClusterListResultIterator provides access to a complete listing of Cluster values. 500type ClusterListResultIterator struct { 501 i int 502 page ClusterListResultPage 503} 504 505// NextWithContext advances to the next value. If there was an error making 506// the request the iterator does not advance and the error is returned. 507func (iter *ClusterListResultIterator) NextWithContext(ctx context.Context) (err error) { 508 if tracing.IsEnabled() { 509 ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListResultIterator.NextWithContext") 510 defer func() { 511 sc := -1 512 if iter.Response().Response.Response != nil { 513 sc = iter.Response().Response.Response.StatusCode 514 } 515 tracing.EndSpan(ctx, sc, err) 516 }() 517 } 518 iter.i++ 519 if iter.i < len(iter.page.Values()) { 520 return nil 521 } 522 err = iter.page.NextWithContext(ctx) 523 if err != nil { 524 iter.i-- 525 return err 526 } 527 iter.i = 0 528 return nil 529} 530 531// Next advances to the next value. If there was an error making 532// the request the iterator does not advance and the error is returned. 533// Deprecated: Use NextWithContext() instead. 534func (iter *ClusterListResultIterator) Next() error { 535 return iter.NextWithContext(context.Background()) 536} 537 538// NotDone returns true if the enumeration should be started or is not yet complete. 539func (iter ClusterListResultIterator) NotDone() bool { 540 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 541} 542 543// Response returns the raw server response from the last page request. 544func (iter ClusterListResultIterator) Response() ClusterListResult { 545 return iter.page.Response() 546} 547 548// Value returns the current value or a zero-initialized value if the 549// iterator has advanced beyond the end of the collection. 550func (iter ClusterListResultIterator) Value() Cluster { 551 if !iter.page.NotDone() { 552 return Cluster{} 553 } 554 return iter.page.Values()[iter.i] 555} 556 557// Creates a new instance of the ClusterListResultIterator type. 558func NewClusterListResultIterator(page ClusterListResultPage) ClusterListResultIterator { 559 return ClusterListResultIterator{page: page} 560} 561 562// IsEmpty returns true if the ListResult contains no values. 563func (clr ClusterListResult) IsEmpty() bool { 564 return clr.Value == nil || len(*clr.Value) == 0 565} 566 567// clusterListResultPreparer prepares a request to retrieve the next set of results. 568// It returns nil if no more results exist. 569func (clr ClusterListResult) clusterListResultPreparer(ctx context.Context) (*http.Request, error) { 570 if clr.NextLink == nil || len(to.String(clr.NextLink)) < 1 { 571 return nil, nil 572 } 573 return autorest.Prepare((&http.Request{}).WithContext(ctx), 574 autorest.AsJSON(), 575 autorest.AsGet(), 576 autorest.WithBaseURL(to.String(clr.NextLink))) 577} 578 579// ClusterListResultPage contains a page of Cluster values. 580type ClusterListResultPage struct { 581 fn func(context.Context, ClusterListResult) (ClusterListResult, error) 582 clr ClusterListResult 583} 584 585// NextWithContext advances to the next page of values. If there was an error making 586// the request the page does not advance and the error is returned. 587func (page *ClusterListResultPage) NextWithContext(ctx context.Context) (err error) { 588 if tracing.IsEnabled() { 589 ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListResultPage.NextWithContext") 590 defer func() { 591 sc := -1 592 if page.Response().Response.Response != nil { 593 sc = page.Response().Response.Response.StatusCode 594 } 595 tracing.EndSpan(ctx, sc, err) 596 }() 597 } 598 next, err := page.fn(ctx, page.clr) 599 if err != nil { 600 return err 601 } 602 page.clr = next 603 return nil 604} 605 606// Next advances to the next page of values. If there was an error making 607// the request the page does not advance and the error is returned. 608// Deprecated: Use NextWithContext() instead. 609func (page *ClusterListResultPage) Next() error { 610 return page.NextWithContext(context.Background()) 611} 612 613// NotDone returns true if the page enumeration should be started or is not yet complete. 614func (page ClusterListResultPage) NotDone() bool { 615 return !page.clr.IsEmpty() 616} 617 618// Response returns the raw server response from the last page request. 619func (page ClusterListResultPage) Response() ClusterListResult { 620 return page.clr 621} 622 623// Values returns the slice of values for the current page or nil if there are no values. 624func (page ClusterListResultPage) Values() []Cluster { 625 if page.clr.IsEmpty() { 626 return nil 627 } 628 return *page.clr.Value 629} 630 631// Creates a new instance of the ClusterListResultPage type. 632func NewClusterListResultPage(getNextPage func(context.Context, ClusterListResult) (ClusterListResult, error)) ClusterListResultPage { 633 return ClusterListResultPage{fn: getNextPage} 634} 635 636// ClusterProperties cluster properties. 637type ClusterProperties struct { 638 // VMSize - The size of the virtual machines in the cluster. All nodes in a cluster have the same VM size. 639 VMSize *string `json:"vmSize,omitempty"` 640 // VMPriority - VM priority of cluster nodes. Possible values include: 'Dedicated', 'Lowpriority' 641 VMPriority VMPriority `json:"vmPriority,omitempty"` 642 // ScaleSettings - Scale settings of the cluster. 643 ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` 644 // VirtualMachineConfiguration - Virtual machine configuration (OS image) of the compute nodes. All nodes in a cluster have the same OS image configuration. 645 VirtualMachineConfiguration *VirtualMachineConfiguration `json:"virtualMachineConfiguration,omitempty"` 646 // NodeSetup - Setup (mount file systems, performance counters settings and custom setup task) to be performed on each compute node in the cluster. 647 NodeSetup *NodeSetup `json:"nodeSetup,omitempty"` 648 // UserAccountSettings - Administrator user account settings which can be used to SSH to compute nodes. 649 UserAccountSettings *UserAccountSettings `json:"userAccountSettings,omitempty"` 650 // Subnet - Virtual network subnet resource ID the cluster nodes belong to. 651 Subnet *ResourceID `json:"subnet,omitempty"` 652 // CreationTime - READ-ONLY; The time when the cluster was created. 653 CreationTime *date.Time `json:"creationTime,omitempty"` 654 // ProvisioningState - READ-ONLY; Provisioning state of the cluster. 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' 655 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 656 // ProvisioningStateTransitionTime - READ-ONLY; Time when the provisioning state was changed. 657 ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` 658 // AllocationState - READ-ONLY; Allocation state of the cluster. Possible values are: steady - 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 - Indicates that the cluster is resizing; that is, compute nodes are being added to or removed from the cluster. Possible values include: 'Steady', 'Resizing' 659 AllocationState AllocationState `json:"allocationState,omitempty"` 660 // AllocationStateTransitionTime - READ-ONLY; The time at which the cluster entered its current allocation state. 661 AllocationStateTransitionTime *date.Time `json:"allocationStateTransitionTime,omitempty"` 662 // Errors - READ-ONLY; Collection of errors encountered by various compute nodes during node setup. 663 Errors *[]Error `json:"errors,omitempty"` 664 // CurrentNodeCount - READ-ONLY; The number of compute nodes currently assigned to the cluster. 665 CurrentNodeCount *int32 `json:"currentNodeCount,omitempty"` 666 // NodeStateCounts - READ-ONLY; Counts of various node states on the cluster. 667 NodeStateCounts *NodeStateCounts `json:"nodeStateCounts,omitempty"` 668} 669 670// ClustersCreateFuture an abstraction for monitoring and retrieving the results of a long-running 671// operation. 672type ClustersCreateFuture struct { 673 azure.Future 674} 675 676// Result returns the result of the asynchronous operation. 677// If the operation has not completed it will return an error. 678func (future *ClustersCreateFuture) Result(client ClustersClient) (c Cluster, err error) { 679 var done bool 680 done, err = future.DoneWithContext(context.Background(), client) 681 if err != nil { 682 err = autorest.NewErrorWithError(err, "batchai.ClustersCreateFuture", "Result", future.Response(), "Polling failure") 683 return 684 } 685 if !done { 686 err = azure.NewAsyncOpIncompleteError("batchai.ClustersCreateFuture") 687 return 688 } 689 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 690 if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { 691 c, err = client.CreateResponder(c.Response.Response) 692 if err != nil { 693 err = autorest.NewErrorWithError(err, "batchai.ClustersCreateFuture", "Result", c.Response.Response, "Failure responding to request") 694 } 695 } 696 return 697} 698 699// ClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 700// operation. 701type ClustersDeleteFuture struct { 702 azure.Future 703} 704 705// Result returns the result of the asynchronous operation. 706// If the operation has not completed it will return an error. 707func (future *ClustersDeleteFuture) Result(client ClustersClient) (ar autorest.Response, err error) { 708 var done bool 709 done, err = future.DoneWithContext(context.Background(), client) 710 if err != nil { 711 err = autorest.NewErrorWithError(err, "batchai.ClustersDeleteFuture", "Result", future.Response(), "Polling failure") 712 return 713 } 714 if !done { 715 err = azure.NewAsyncOpIncompleteError("batchai.ClustersDeleteFuture") 716 return 717 } 718 ar.Response = future.Response() 719 return 720} 721 722// ClusterUpdateParameters cluster update parameters. 723type ClusterUpdateParameters struct { 724 // ClusterUpdateProperties - The properties of the Cluster. 725 *ClusterUpdateProperties `json:"properties,omitempty"` 726} 727 728// MarshalJSON is the custom marshaler for ClusterUpdateParameters. 729func (cup ClusterUpdateParameters) MarshalJSON() ([]byte, error) { 730 objectMap := make(map[string]interface{}) 731 if cup.ClusterUpdateProperties != nil { 732 objectMap["properties"] = cup.ClusterUpdateProperties 733 } 734 return json.Marshal(objectMap) 735} 736 737// UnmarshalJSON is the custom unmarshaler for ClusterUpdateParameters struct. 738func (cup *ClusterUpdateParameters) UnmarshalJSON(body []byte) error { 739 var m map[string]*json.RawMessage 740 err := json.Unmarshal(body, &m) 741 if err != nil { 742 return err 743 } 744 for k, v := range m { 745 switch k { 746 case "properties": 747 if v != nil { 748 var clusterUpdateProperties ClusterUpdateProperties 749 err = json.Unmarshal(*v, &clusterUpdateProperties) 750 if err != nil { 751 return err 752 } 753 cup.ClusterUpdateProperties = &clusterUpdateProperties 754 } 755 } 756 } 757 758 return nil 759} 760 761// ClusterUpdateProperties the properties of a Cluster that need to be updated. 762type ClusterUpdateProperties struct { 763 // ScaleSettings - Desired scale settings for the cluster. Batch AI service supports manual and auto scale clusters. 764 ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` 765} 766 767// CNTKsettings CNTK (aka Microsoft Cognitive Toolkit) job settings. 768type CNTKsettings struct { 769 // LanguageType - The language to use for launching CNTK (aka Microsoft Cognitive Toolkit) job. Valid values are 'BrainScript' or 'Python'. 770 LanguageType *string `json:"languageType,omitempty"` 771 // ConfigFilePath - Specifies the path of the BrainScript config file. This property can be specified only if the languageType is 'BrainScript'. 772 ConfigFilePath *string `json:"configFilePath,omitempty"` 773 // PythonScriptFilePath - Python script to execute. This property can be specified only if the languageType is 'Python'. 774 PythonScriptFilePath *string `json:"pythonScriptFilePath,omitempty"` 775 // PythonInterpreterPath - The path to the Python interpreter. This property can be specified only if the languageType is 'Python'. 776 PythonInterpreterPath *string `json:"pythonInterpreterPath,omitempty"` 777 // CommandLineArgs - Command line arguments that need to be passed to the python script or cntk executable. 778 CommandLineArgs *string `json:"commandLineArgs,omitempty"` 779 // ProcessCount - Number of processes to launch for the job execution. The default value for this property is equal to nodeCount property 780 ProcessCount *int32 `json:"processCount,omitempty"` 781} 782 783// ContainerSettings docker container settings. 784type ContainerSettings struct { 785 // ImageSourceRegistry - Information about docker image and docker registry to download the container from. 786 ImageSourceRegistry *ImageSourceRegistry `json:"imageSourceRegistry,omitempty"` 787 // ShmSize - Size of /dev/shm. Please refer to docker documentation for supported argument formats. 788 ShmSize *string `json:"shmSize,omitempty"` 789} 790 791// CustomMpiSettings custom MPI job settings. 792type CustomMpiSettings struct { 793 // CommandLine - The command line to be executed by mpi runtime on each compute node. 794 CommandLine *string `json:"commandLine,omitempty"` 795 // ProcessCount - Number of processes to launch for the job execution. The default value for this property is equal to nodeCount property 796 ProcessCount *int32 `json:"processCount,omitempty"` 797} 798 799// CustomToolkitSettings custom tool kit job settings. 800type CustomToolkitSettings struct { 801 // CommandLine - The command line to execute on the master node. 802 CommandLine *string `json:"commandLine,omitempty"` 803} 804 805// DataDisks data disks settings. 806type DataDisks struct { 807 // DiskSizeInGB - Disk size in GB for the blank data disks. 808 DiskSizeInGB *int32 `json:"diskSizeInGB,omitempty"` 809 // CachingType - Caching type for the disks. Available values are none (default), readonly, readwrite. Caching type can be set only for VM sizes supporting premium storage. Possible values include: 'None', 'Readonly', 'Readwrite' 810 CachingType CachingType `json:"cachingType,omitempty"` 811 // DiskCount - Number of data disks attached to the File Server. If multiple disks attached, they will be configured in RAID level 0. 812 DiskCount *int32 `json:"diskCount,omitempty"` 813 // StorageAccountType - Type of storage account to be used on the disk. Possible values are: Standard_LRS or Premium_LRS. Premium storage account type can only be used with VM sizes supporting premium storage. Possible values include: 'StandardLRS', 'PremiumLRS' 814 StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` 815} 816 817// EnvironmentVariable an environment variable definition. 818type EnvironmentVariable struct { 819 // Name - The name of the environment variable. 820 Name *string `json:"name,omitempty"` 821 // Value - The value of the environment variable. 822 Value *string `json:"value,omitempty"` 823} 824 825// EnvironmentVariableWithSecretValue an environment variable with secret value definition. 826type EnvironmentVariableWithSecretValue struct { 827 // Name - The name of the environment variable to store the secret value. 828 Name *string `json:"name,omitempty"` 829 // Value - The value of the environment variable. This value will never be reported back by Batch AI. 830 Value *string `json:"value,omitempty"` 831 // ValueSecretReference - KeyVault store and secret which contains the value for the environment variable. One of value or valueSecretReference must be provided. 832 ValueSecretReference *KeyVaultSecretReference `json:"valueSecretReference,omitempty"` 833} 834 835// Error an error response from the Batch AI service. 836type Error struct { 837 // Code - READ-ONLY; An identifier of the error. Codes are invariant and are intended to be consumed programmatically. 838 Code *string `json:"code,omitempty"` 839 // Message - READ-ONLY; A message describing the error, intended to be suitable for display in a user interface. 840 Message *string `json:"message,omitempty"` 841 // Details - READ-ONLY; A list of additional details about the error. 842 Details *[]NameValuePair `json:"details,omitempty"` 843} 844 845// Experiment experiment information. 846type Experiment struct { 847 autorest.Response `json:"-"` 848 // ExperimentProperties - The properties associated with the experiment. 849 *ExperimentProperties `json:"properties,omitempty"` 850 // ID - READ-ONLY; The ID of the resource. 851 ID *string `json:"id,omitempty"` 852 // Name - READ-ONLY; The name of the resource. 853 Name *string `json:"name,omitempty"` 854 // Type - READ-ONLY; The type of the resource. 855 Type *string `json:"type,omitempty"` 856} 857 858// MarshalJSON is the custom marshaler for Experiment. 859func (e Experiment) MarshalJSON() ([]byte, error) { 860 objectMap := make(map[string]interface{}) 861 if e.ExperimentProperties != nil { 862 objectMap["properties"] = e.ExperimentProperties 863 } 864 return json.Marshal(objectMap) 865} 866 867// UnmarshalJSON is the custom unmarshaler for Experiment struct. 868func (e *Experiment) UnmarshalJSON(body []byte) error { 869 var m map[string]*json.RawMessage 870 err := json.Unmarshal(body, &m) 871 if err != nil { 872 return err 873 } 874 for k, v := range m { 875 switch k { 876 case "properties": 877 if v != nil { 878 var experimentProperties ExperimentProperties 879 err = json.Unmarshal(*v, &experimentProperties) 880 if err != nil { 881 return err 882 } 883 e.ExperimentProperties = &experimentProperties 884 } 885 case "id": 886 if v != nil { 887 var ID string 888 err = json.Unmarshal(*v, &ID) 889 if err != nil { 890 return err 891 } 892 e.ID = &ID 893 } 894 case "name": 895 if v != nil { 896 var name string 897 err = json.Unmarshal(*v, &name) 898 if err != nil { 899 return err 900 } 901 e.Name = &name 902 } 903 case "type": 904 if v != nil { 905 var typeVar string 906 err = json.Unmarshal(*v, &typeVar) 907 if err != nil { 908 return err 909 } 910 e.Type = &typeVar 911 } 912 } 913 } 914 915 return nil 916} 917 918// ExperimentListResult values returned by the List operation. 919type ExperimentListResult struct { 920 autorest.Response `json:"-"` 921 // Value - READ-ONLY; The collection of experiments. 922 Value *[]Experiment `json:"value,omitempty"` 923 // NextLink - READ-ONLY; The continuation token. 924 NextLink *string `json:"nextLink,omitempty"` 925} 926 927// ExperimentListResultIterator provides access to a complete listing of Experiment values. 928type ExperimentListResultIterator struct { 929 i int 930 page ExperimentListResultPage 931} 932 933// NextWithContext advances to the next value. If there was an error making 934// the request the iterator does not advance and the error is returned. 935func (iter *ExperimentListResultIterator) NextWithContext(ctx context.Context) (err error) { 936 if tracing.IsEnabled() { 937 ctx = tracing.StartSpan(ctx, fqdn+"/ExperimentListResultIterator.NextWithContext") 938 defer func() { 939 sc := -1 940 if iter.Response().Response.Response != nil { 941 sc = iter.Response().Response.Response.StatusCode 942 } 943 tracing.EndSpan(ctx, sc, err) 944 }() 945 } 946 iter.i++ 947 if iter.i < len(iter.page.Values()) { 948 return nil 949 } 950 err = iter.page.NextWithContext(ctx) 951 if err != nil { 952 iter.i-- 953 return err 954 } 955 iter.i = 0 956 return nil 957} 958 959// Next advances to the next value. If there was an error making 960// the request the iterator does not advance and the error is returned. 961// Deprecated: Use NextWithContext() instead. 962func (iter *ExperimentListResultIterator) Next() error { 963 return iter.NextWithContext(context.Background()) 964} 965 966// NotDone returns true if the enumeration should be started or is not yet complete. 967func (iter ExperimentListResultIterator) NotDone() bool { 968 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 969} 970 971// Response returns the raw server response from the last page request. 972func (iter ExperimentListResultIterator) Response() ExperimentListResult { 973 return iter.page.Response() 974} 975 976// Value returns the current value or a zero-initialized value if the 977// iterator has advanced beyond the end of the collection. 978func (iter ExperimentListResultIterator) Value() Experiment { 979 if !iter.page.NotDone() { 980 return Experiment{} 981 } 982 return iter.page.Values()[iter.i] 983} 984 985// Creates a new instance of the ExperimentListResultIterator type. 986func NewExperimentListResultIterator(page ExperimentListResultPage) ExperimentListResultIterator { 987 return ExperimentListResultIterator{page: page} 988} 989 990// IsEmpty returns true if the ListResult contains no values. 991func (elr ExperimentListResult) IsEmpty() bool { 992 return elr.Value == nil || len(*elr.Value) == 0 993} 994 995// experimentListResultPreparer prepares a request to retrieve the next set of results. 996// It returns nil if no more results exist. 997func (elr ExperimentListResult) experimentListResultPreparer(ctx context.Context) (*http.Request, error) { 998 if elr.NextLink == nil || len(to.String(elr.NextLink)) < 1 { 999 return nil, nil 1000 } 1001 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1002 autorest.AsJSON(), 1003 autorest.AsGet(), 1004 autorest.WithBaseURL(to.String(elr.NextLink))) 1005} 1006 1007// ExperimentListResultPage contains a page of Experiment values. 1008type ExperimentListResultPage struct { 1009 fn func(context.Context, ExperimentListResult) (ExperimentListResult, error) 1010 elr ExperimentListResult 1011} 1012 1013// NextWithContext advances to the next page of values. If there was an error making 1014// the request the page does not advance and the error is returned. 1015func (page *ExperimentListResultPage) NextWithContext(ctx context.Context) (err error) { 1016 if tracing.IsEnabled() { 1017 ctx = tracing.StartSpan(ctx, fqdn+"/ExperimentListResultPage.NextWithContext") 1018 defer func() { 1019 sc := -1 1020 if page.Response().Response.Response != nil { 1021 sc = page.Response().Response.Response.StatusCode 1022 } 1023 tracing.EndSpan(ctx, sc, err) 1024 }() 1025 } 1026 next, err := page.fn(ctx, page.elr) 1027 if err != nil { 1028 return err 1029 } 1030 page.elr = next 1031 return nil 1032} 1033 1034// Next advances to the next page of values. If there was an error making 1035// the request the page does not advance and the error is returned. 1036// Deprecated: Use NextWithContext() instead. 1037func (page *ExperimentListResultPage) Next() error { 1038 return page.NextWithContext(context.Background()) 1039} 1040 1041// NotDone returns true if the page enumeration should be started or is not yet complete. 1042func (page ExperimentListResultPage) NotDone() bool { 1043 return !page.elr.IsEmpty() 1044} 1045 1046// Response returns the raw server response from the last page request. 1047func (page ExperimentListResultPage) Response() ExperimentListResult { 1048 return page.elr 1049} 1050 1051// Values returns the slice of values for the current page or nil if there are no values. 1052func (page ExperimentListResultPage) Values() []Experiment { 1053 if page.elr.IsEmpty() { 1054 return nil 1055 } 1056 return *page.elr.Value 1057} 1058 1059// Creates a new instance of the ExperimentListResultPage type. 1060func NewExperimentListResultPage(getNextPage func(context.Context, ExperimentListResult) (ExperimentListResult, error)) ExperimentListResultPage { 1061 return ExperimentListResultPage{fn: getNextPage} 1062} 1063 1064// ExperimentProperties experiment properties. 1065type ExperimentProperties struct { 1066 // CreationTime - READ-ONLY; Time when the Experiment was created. 1067 CreationTime *date.Time `json:"creationTime,omitempty"` 1068 // ProvisioningState - READ-ONLY; The provisioned state of the experiment. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateDeleting' 1069 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 1070 // ProvisioningStateTransitionTime - READ-ONLY; The time at which the experiment entered its current provisioning state. 1071 ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` 1072} 1073 1074// ExperimentsCreateFuture an abstraction for monitoring and retrieving the results of a long-running 1075// operation. 1076type ExperimentsCreateFuture struct { 1077 azure.Future 1078} 1079 1080// Result returns the result of the asynchronous operation. 1081// If the operation has not completed it will return an error. 1082func (future *ExperimentsCreateFuture) Result(client ExperimentsClient) (e Experiment, err error) { 1083 var done bool 1084 done, err = future.DoneWithContext(context.Background(), client) 1085 if err != nil { 1086 err = autorest.NewErrorWithError(err, "batchai.ExperimentsCreateFuture", "Result", future.Response(), "Polling failure") 1087 return 1088 } 1089 if !done { 1090 err = azure.NewAsyncOpIncompleteError("batchai.ExperimentsCreateFuture") 1091 return 1092 } 1093 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1094 if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { 1095 e, err = client.CreateResponder(e.Response.Response) 1096 if err != nil { 1097 err = autorest.NewErrorWithError(err, "batchai.ExperimentsCreateFuture", "Result", e.Response.Response, "Failure responding to request") 1098 } 1099 } 1100 return 1101} 1102 1103// ExperimentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 1104// operation. 1105type ExperimentsDeleteFuture struct { 1106 azure.Future 1107} 1108 1109// Result returns the result of the asynchronous operation. 1110// If the operation has not completed it will return an error. 1111func (future *ExperimentsDeleteFuture) Result(client ExperimentsClient) (ar autorest.Response, err error) { 1112 var done bool 1113 done, err = future.DoneWithContext(context.Background(), client) 1114 if err != nil { 1115 err = autorest.NewErrorWithError(err, "batchai.ExperimentsDeleteFuture", "Result", future.Response(), "Polling failure") 1116 return 1117 } 1118 if !done { 1119 err = azure.NewAsyncOpIncompleteError("batchai.ExperimentsDeleteFuture") 1120 return 1121 } 1122 ar.Response = future.Response() 1123 return 1124} 1125 1126// File properties of the file or directory. 1127type File struct { 1128 // Name - READ-ONLY; Name of the file. 1129 Name *string `json:"name,omitempty"` 1130 // FileType - READ-ONLY; Type of the file. Possible values are file and directory. Possible values include: 'FileTypeFile', 'FileTypeDirectory' 1131 FileType FileType `json:"fileType,omitempty"` 1132 // DownloadURL - READ-ONLY; URL to download the corresponding file. The downloadUrl is not returned for directories. 1133 DownloadURL *string `json:"downloadUrl,omitempty"` 1134 // FileProperties - The properties associated with the file. The properties are not returned for directories. 1135 *FileProperties `json:"properties,omitempty"` 1136} 1137 1138// MarshalJSON is the custom marshaler for File. 1139func (f File) MarshalJSON() ([]byte, error) { 1140 objectMap := make(map[string]interface{}) 1141 if f.FileProperties != nil { 1142 objectMap["properties"] = f.FileProperties 1143 } 1144 return json.Marshal(objectMap) 1145} 1146 1147// UnmarshalJSON is the custom unmarshaler for File struct. 1148func (f *File) UnmarshalJSON(body []byte) error { 1149 var m map[string]*json.RawMessage 1150 err := json.Unmarshal(body, &m) 1151 if err != nil { 1152 return err 1153 } 1154 for k, v := range m { 1155 switch k { 1156 case "name": 1157 if v != nil { 1158 var name string 1159 err = json.Unmarshal(*v, &name) 1160 if err != nil { 1161 return err 1162 } 1163 f.Name = &name 1164 } 1165 case "fileType": 1166 if v != nil { 1167 var fileType FileType 1168 err = json.Unmarshal(*v, &fileType) 1169 if err != nil { 1170 return err 1171 } 1172 f.FileType = fileType 1173 } 1174 case "downloadUrl": 1175 if v != nil { 1176 var downloadURL string 1177 err = json.Unmarshal(*v, &downloadURL) 1178 if err != nil { 1179 return err 1180 } 1181 f.DownloadURL = &downloadURL 1182 } 1183 case "properties": 1184 if v != nil { 1185 var fileProperties FileProperties 1186 err = json.Unmarshal(*v, &fileProperties) 1187 if err != nil { 1188 return err 1189 } 1190 f.FileProperties = &fileProperties 1191 } 1192 } 1193 } 1194 1195 return nil 1196} 1197 1198// FileListResult values returned by the List operation. 1199type FileListResult struct { 1200 autorest.Response `json:"-"` 1201 // Value - READ-ONLY; The collection of returned job directories and files. 1202 Value *[]File `json:"value,omitempty"` 1203 // NextLink - READ-ONLY; The continuation token. 1204 NextLink *string `json:"nextLink,omitempty"` 1205} 1206 1207// FileListResultIterator provides access to a complete listing of File values. 1208type FileListResultIterator struct { 1209 i int 1210 page FileListResultPage 1211} 1212 1213// NextWithContext advances to the next value. If there was an error making 1214// the request the iterator does not advance and the error is returned. 1215func (iter *FileListResultIterator) NextWithContext(ctx context.Context) (err error) { 1216 if tracing.IsEnabled() { 1217 ctx = tracing.StartSpan(ctx, fqdn+"/FileListResultIterator.NextWithContext") 1218 defer func() { 1219 sc := -1 1220 if iter.Response().Response.Response != nil { 1221 sc = iter.Response().Response.Response.StatusCode 1222 } 1223 tracing.EndSpan(ctx, sc, err) 1224 }() 1225 } 1226 iter.i++ 1227 if iter.i < len(iter.page.Values()) { 1228 return nil 1229 } 1230 err = iter.page.NextWithContext(ctx) 1231 if err != nil { 1232 iter.i-- 1233 return err 1234 } 1235 iter.i = 0 1236 return nil 1237} 1238 1239// Next advances to the next value. If there was an error making 1240// the request the iterator does not advance and the error is returned. 1241// Deprecated: Use NextWithContext() instead. 1242func (iter *FileListResultIterator) Next() error { 1243 return iter.NextWithContext(context.Background()) 1244} 1245 1246// NotDone returns true if the enumeration should be started or is not yet complete. 1247func (iter FileListResultIterator) NotDone() bool { 1248 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1249} 1250 1251// Response returns the raw server response from the last page request. 1252func (iter FileListResultIterator) Response() FileListResult { 1253 return iter.page.Response() 1254} 1255 1256// Value returns the current value or a zero-initialized value if the 1257// iterator has advanced beyond the end of the collection. 1258func (iter FileListResultIterator) Value() File { 1259 if !iter.page.NotDone() { 1260 return File{} 1261 } 1262 return iter.page.Values()[iter.i] 1263} 1264 1265// Creates a new instance of the FileListResultIterator type. 1266func NewFileListResultIterator(page FileListResultPage) FileListResultIterator { 1267 return FileListResultIterator{page: page} 1268} 1269 1270// IsEmpty returns true if the ListResult contains no values. 1271func (flr FileListResult) IsEmpty() bool { 1272 return flr.Value == nil || len(*flr.Value) == 0 1273} 1274 1275// fileListResultPreparer prepares a request to retrieve the next set of results. 1276// It returns nil if no more results exist. 1277func (flr FileListResult) fileListResultPreparer(ctx context.Context) (*http.Request, error) { 1278 if flr.NextLink == nil || len(to.String(flr.NextLink)) < 1 { 1279 return nil, nil 1280 } 1281 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1282 autorest.AsJSON(), 1283 autorest.AsGet(), 1284 autorest.WithBaseURL(to.String(flr.NextLink))) 1285} 1286 1287// FileListResultPage contains a page of File values. 1288type FileListResultPage struct { 1289 fn func(context.Context, FileListResult) (FileListResult, error) 1290 flr FileListResult 1291} 1292 1293// NextWithContext advances to the next page of values. If there was an error making 1294// the request the page does not advance and the error is returned. 1295func (page *FileListResultPage) NextWithContext(ctx context.Context) (err error) { 1296 if tracing.IsEnabled() { 1297 ctx = tracing.StartSpan(ctx, fqdn+"/FileListResultPage.NextWithContext") 1298 defer func() { 1299 sc := -1 1300 if page.Response().Response.Response != nil { 1301 sc = page.Response().Response.Response.StatusCode 1302 } 1303 tracing.EndSpan(ctx, sc, err) 1304 }() 1305 } 1306 next, err := page.fn(ctx, page.flr) 1307 if err != nil { 1308 return err 1309 } 1310 page.flr = next 1311 return nil 1312} 1313 1314// Next advances to the next page of values. If there was an error making 1315// the request the page does not advance and the error is returned. 1316// Deprecated: Use NextWithContext() instead. 1317func (page *FileListResultPage) Next() error { 1318 return page.NextWithContext(context.Background()) 1319} 1320 1321// NotDone returns true if the page enumeration should be started or is not yet complete. 1322func (page FileListResultPage) NotDone() bool { 1323 return !page.flr.IsEmpty() 1324} 1325 1326// Response returns the raw server response from the last page request. 1327func (page FileListResultPage) Response() FileListResult { 1328 return page.flr 1329} 1330 1331// Values returns the slice of values for the current page or nil if there are no values. 1332func (page FileListResultPage) Values() []File { 1333 if page.flr.IsEmpty() { 1334 return nil 1335 } 1336 return *page.flr.Value 1337} 1338 1339// Creates a new instance of the FileListResultPage type. 1340func NewFileListResultPage(getNextPage func(context.Context, FileListResult) (FileListResult, error)) FileListResultPage { 1341 return FileListResultPage{fn: getNextPage} 1342} 1343 1344// FileProperties file properties. 1345type FileProperties struct { 1346 // LastModified - READ-ONLY; The time at which the file was last modified. 1347 LastModified *date.Time `json:"lastModified,omitempty"` 1348 // ContentLength - READ-ONLY; The file of the size. 1349 ContentLength *int64 `json:"contentLength,omitempty"` 1350} 1351 1352// FileServer file Server information. 1353type FileServer struct { 1354 autorest.Response `json:"-"` 1355 // FileServerProperties - File Server properties. 1356 *FileServerProperties `json:"properties,omitempty"` 1357 // ID - READ-ONLY; The ID of the resource. 1358 ID *string `json:"id,omitempty"` 1359 // Name - READ-ONLY; The name of the resource. 1360 Name *string `json:"name,omitempty"` 1361 // Type - READ-ONLY; The type of the resource. 1362 Type *string `json:"type,omitempty"` 1363} 1364 1365// MarshalJSON is the custom marshaler for FileServer. 1366func (fs FileServer) MarshalJSON() ([]byte, error) { 1367 objectMap := make(map[string]interface{}) 1368 if fs.FileServerProperties != nil { 1369 objectMap["properties"] = fs.FileServerProperties 1370 } 1371 return json.Marshal(objectMap) 1372} 1373 1374// UnmarshalJSON is the custom unmarshaler for FileServer struct. 1375func (fs *FileServer) UnmarshalJSON(body []byte) error { 1376 var m map[string]*json.RawMessage 1377 err := json.Unmarshal(body, &m) 1378 if err != nil { 1379 return err 1380 } 1381 for k, v := range m { 1382 switch k { 1383 case "properties": 1384 if v != nil { 1385 var fileServerProperties FileServerProperties 1386 err = json.Unmarshal(*v, &fileServerProperties) 1387 if err != nil { 1388 return err 1389 } 1390 fs.FileServerProperties = &fileServerProperties 1391 } 1392 case "id": 1393 if v != nil { 1394 var ID string 1395 err = json.Unmarshal(*v, &ID) 1396 if err != nil { 1397 return err 1398 } 1399 fs.ID = &ID 1400 } 1401 case "name": 1402 if v != nil { 1403 var name string 1404 err = json.Unmarshal(*v, &name) 1405 if err != nil { 1406 return err 1407 } 1408 fs.Name = &name 1409 } 1410 case "type": 1411 if v != nil { 1412 var typeVar string 1413 err = json.Unmarshal(*v, &typeVar) 1414 if err != nil { 1415 return err 1416 } 1417 fs.Type = &typeVar 1418 } 1419 } 1420 } 1421 1422 return nil 1423} 1424 1425// FileServerBaseProperties the properties of a file server. 1426type FileServerBaseProperties struct { 1427 // VMSize - The size of the virtual machine for the File Server. For information about available VM sizes from the Virtual Machines Marketplace, see Sizes for Virtual Machines (Linux). 1428 VMSize *string `json:"vmSize,omitempty"` 1429 // SSHConfiguration - SSH configuration for the File Server node. 1430 SSHConfiguration *SSHConfiguration `json:"sshConfiguration,omitempty"` 1431 // DataDisks - Settings for the data disks which will be created for the File Server. 1432 DataDisks *DataDisks `json:"dataDisks,omitempty"` 1433 // Subnet - Identifier of an existing virtual network subnet to put the File Server in. If not provided, a new virtual network and subnet will be created. 1434 Subnet *ResourceID `json:"subnet,omitempty"` 1435} 1436 1437// FileServerCreateParameters file Server creation parameters. 1438type FileServerCreateParameters struct { 1439 // FileServerBaseProperties - The properties of the File Server. 1440 *FileServerBaseProperties `json:"properties,omitempty"` 1441} 1442 1443// MarshalJSON is the custom marshaler for FileServerCreateParameters. 1444func (fscp FileServerCreateParameters) MarshalJSON() ([]byte, error) { 1445 objectMap := make(map[string]interface{}) 1446 if fscp.FileServerBaseProperties != nil { 1447 objectMap["properties"] = fscp.FileServerBaseProperties 1448 } 1449 return json.Marshal(objectMap) 1450} 1451 1452// UnmarshalJSON is the custom unmarshaler for FileServerCreateParameters struct. 1453func (fscp *FileServerCreateParameters) UnmarshalJSON(body []byte) error { 1454 var m map[string]*json.RawMessage 1455 err := json.Unmarshal(body, &m) 1456 if err != nil { 1457 return err 1458 } 1459 for k, v := range m { 1460 switch k { 1461 case "properties": 1462 if v != nil { 1463 var fileServerBaseProperties FileServerBaseProperties 1464 err = json.Unmarshal(*v, &fileServerBaseProperties) 1465 if err != nil { 1466 return err 1467 } 1468 fscp.FileServerBaseProperties = &fileServerBaseProperties 1469 } 1470 } 1471 } 1472 1473 return nil 1474} 1475 1476// FileServerListResult values returned by the File Server List operation. 1477type FileServerListResult struct { 1478 autorest.Response `json:"-"` 1479 // Value - The collection of File Servers. 1480 Value *[]FileServer `json:"value,omitempty"` 1481 // NextLink - READ-ONLY; The continuation token. 1482 NextLink *string `json:"nextLink,omitempty"` 1483} 1484 1485// FileServerListResultIterator provides access to a complete listing of FileServer values. 1486type FileServerListResultIterator struct { 1487 i int 1488 page FileServerListResultPage 1489} 1490 1491// NextWithContext advances to the next value. If there was an error making 1492// the request the iterator does not advance and the error is returned. 1493func (iter *FileServerListResultIterator) NextWithContext(ctx context.Context) (err error) { 1494 if tracing.IsEnabled() { 1495 ctx = tracing.StartSpan(ctx, fqdn+"/FileServerListResultIterator.NextWithContext") 1496 defer func() { 1497 sc := -1 1498 if iter.Response().Response.Response != nil { 1499 sc = iter.Response().Response.Response.StatusCode 1500 } 1501 tracing.EndSpan(ctx, sc, err) 1502 }() 1503 } 1504 iter.i++ 1505 if iter.i < len(iter.page.Values()) { 1506 return nil 1507 } 1508 err = iter.page.NextWithContext(ctx) 1509 if err != nil { 1510 iter.i-- 1511 return err 1512 } 1513 iter.i = 0 1514 return nil 1515} 1516 1517// Next advances to the next value. If there was an error making 1518// the request the iterator does not advance and the error is returned. 1519// Deprecated: Use NextWithContext() instead. 1520func (iter *FileServerListResultIterator) Next() error { 1521 return iter.NextWithContext(context.Background()) 1522} 1523 1524// NotDone returns true if the enumeration should be started or is not yet complete. 1525func (iter FileServerListResultIterator) NotDone() bool { 1526 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1527} 1528 1529// Response returns the raw server response from the last page request. 1530func (iter FileServerListResultIterator) Response() FileServerListResult { 1531 return iter.page.Response() 1532} 1533 1534// Value returns the current value or a zero-initialized value if the 1535// iterator has advanced beyond the end of the collection. 1536func (iter FileServerListResultIterator) Value() FileServer { 1537 if !iter.page.NotDone() { 1538 return FileServer{} 1539 } 1540 return iter.page.Values()[iter.i] 1541} 1542 1543// Creates a new instance of the FileServerListResultIterator type. 1544func NewFileServerListResultIterator(page FileServerListResultPage) FileServerListResultIterator { 1545 return FileServerListResultIterator{page: page} 1546} 1547 1548// IsEmpty returns true if the ListResult contains no values. 1549func (fslr FileServerListResult) IsEmpty() bool { 1550 return fslr.Value == nil || len(*fslr.Value) == 0 1551} 1552 1553// fileServerListResultPreparer prepares a request to retrieve the next set of results. 1554// It returns nil if no more results exist. 1555func (fslr FileServerListResult) fileServerListResultPreparer(ctx context.Context) (*http.Request, error) { 1556 if fslr.NextLink == nil || len(to.String(fslr.NextLink)) < 1 { 1557 return nil, nil 1558 } 1559 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1560 autorest.AsJSON(), 1561 autorest.AsGet(), 1562 autorest.WithBaseURL(to.String(fslr.NextLink))) 1563} 1564 1565// FileServerListResultPage contains a page of FileServer values. 1566type FileServerListResultPage struct { 1567 fn func(context.Context, FileServerListResult) (FileServerListResult, error) 1568 fslr FileServerListResult 1569} 1570 1571// NextWithContext advances to the next page of values. If there was an error making 1572// the request the page does not advance and the error is returned. 1573func (page *FileServerListResultPage) NextWithContext(ctx context.Context) (err error) { 1574 if tracing.IsEnabled() { 1575 ctx = tracing.StartSpan(ctx, fqdn+"/FileServerListResultPage.NextWithContext") 1576 defer func() { 1577 sc := -1 1578 if page.Response().Response.Response != nil { 1579 sc = page.Response().Response.Response.StatusCode 1580 } 1581 tracing.EndSpan(ctx, sc, err) 1582 }() 1583 } 1584 next, err := page.fn(ctx, page.fslr) 1585 if err != nil { 1586 return err 1587 } 1588 page.fslr = next 1589 return nil 1590} 1591 1592// Next advances to the next page of values. If there was an error making 1593// the request the page does not advance and the error is returned. 1594// Deprecated: Use NextWithContext() instead. 1595func (page *FileServerListResultPage) Next() error { 1596 return page.NextWithContext(context.Background()) 1597} 1598 1599// NotDone returns true if the page enumeration should be started or is not yet complete. 1600func (page FileServerListResultPage) NotDone() bool { 1601 return !page.fslr.IsEmpty() 1602} 1603 1604// Response returns the raw server response from the last page request. 1605func (page FileServerListResultPage) Response() FileServerListResult { 1606 return page.fslr 1607} 1608 1609// Values returns the slice of values for the current page or nil if there are no values. 1610func (page FileServerListResultPage) Values() []FileServer { 1611 if page.fslr.IsEmpty() { 1612 return nil 1613 } 1614 return *page.fslr.Value 1615} 1616 1617// Creates a new instance of the FileServerListResultPage type. 1618func NewFileServerListResultPage(getNextPage func(context.Context, FileServerListResult) (FileServerListResult, error)) FileServerListResultPage { 1619 return FileServerListResultPage{fn: getNextPage} 1620} 1621 1622// FileServerProperties file Server properties. 1623type FileServerProperties struct { 1624 // VMSize - VM size of the File Server. 1625 VMSize *string `json:"vmSize,omitempty"` 1626 // SSHConfiguration - SSH configuration for accessing the File Server node. 1627 SSHConfiguration *SSHConfiguration `json:"sshConfiguration,omitempty"` 1628 // DataDisks - Information about disks attached to File Server VM. 1629 DataDisks *DataDisks `json:"dataDisks,omitempty"` 1630 // Subnet - File Server virtual network subnet resource ID. 1631 Subnet *ResourceID `json:"subnet,omitempty"` 1632 // MountSettings - READ-ONLY; File Server mount settings. 1633 MountSettings *MountSettings `json:"mountSettings,omitempty"` 1634 // ProvisioningStateTransitionTime - READ-ONLY; Time when the provisioning state was changed. 1635 ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` 1636 // CreationTime - READ-ONLY; Time when the FileServer was created. 1637 CreationTime *date.Time `json:"creationTime,omitempty"` 1638 // ProvisioningState - READ-ONLY; Provisioning state of the File Server. 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 error code. 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' 1639 ProvisioningState FileServerProvisioningState `json:"provisioningState,omitempty"` 1640} 1641 1642// FileServerReference file Server mounting configuration. 1643type FileServerReference struct { 1644 // FileServer - Resource ID of the existing File Server to be mounted. 1645 FileServer *ResourceID `json:"fileServer,omitempty"` 1646 // SourceDirectory - File Server directory that needs to be mounted. If this property is not specified, the entire File Server will be mounted. 1647 SourceDirectory *string `json:"sourceDirectory,omitempty"` 1648 // RelativeMountPath - The relative path on the compute node where the File Server will be mounted. Note that all cluster level file servers will be mounted under $AZ_BATCHAI_MOUNT_ROOT location and all job level file servers will be mounted under $AZ_BATCHAI_JOB_MOUNT_ROOT. 1649 RelativeMountPath *string `json:"relativeMountPath,omitempty"` 1650 // MountOptions - Mount options to be passed to mount command. 1651 MountOptions *string `json:"mountOptions,omitempty"` 1652} 1653 1654// FileServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running 1655// operation. 1656type FileServersCreateFuture struct { 1657 azure.Future 1658} 1659 1660// Result returns the result of the asynchronous operation. 1661// If the operation has not completed it will return an error. 1662func (future *FileServersCreateFuture) Result(client FileServersClient) (fs FileServer, err error) { 1663 var done bool 1664 done, err = future.DoneWithContext(context.Background(), client) 1665 if err != nil { 1666 err = autorest.NewErrorWithError(err, "batchai.FileServersCreateFuture", "Result", future.Response(), "Polling failure") 1667 return 1668 } 1669 if !done { 1670 err = azure.NewAsyncOpIncompleteError("batchai.FileServersCreateFuture") 1671 return 1672 } 1673 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1674 if fs.Response.Response, err = future.GetResult(sender); err == nil && fs.Response.Response.StatusCode != http.StatusNoContent { 1675 fs, err = client.CreateResponder(fs.Response.Response) 1676 if err != nil { 1677 err = autorest.NewErrorWithError(err, "batchai.FileServersCreateFuture", "Result", fs.Response.Response, "Failure responding to request") 1678 } 1679 } 1680 return 1681} 1682 1683// FileServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 1684// operation. 1685type FileServersDeleteFuture struct { 1686 azure.Future 1687} 1688 1689// Result returns the result of the asynchronous operation. 1690// If the operation has not completed it will return an error. 1691func (future *FileServersDeleteFuture) Result(client FileServersClient) (ar autorest.Response, err error) { 1692 var done bool 1693 done, err = future.DoneWithContext(context.Background(), client) 1694 if err != nil { 1695 err = autorest.NewErrorWithError(err, "batchai.FileServersDeleteFuture", "Result", future.Response(), "Polling failure") 1696 return 1697 } 1698 if !done { 1699 err = azure.NewAsyncOpIncompleteError("batchai.FileServersDeleteFuture") 1700 return 1701 } 1702 ar.Response = future.Response() 1703 return 1704} 1705 1706// HorovodSettings specifies the settings for Horovod job. 1707type HorovodSettings struct { 1708 // PythonScriptFilePath - The python script to execute. 1709 PythonScriptFilePath *string `json:"pythonScriptFilePath,omitempty"` 1710 // PythonInterpreterPath - The path to the Python interpreter. 1711 PythonInterpreterPath *string `json:"pythonInterpreterPath,omitempty"` 1712 // CommandLineArgs - Command line arguments that need to be passed to the python script. 1713 CommandLineArgs *string `json:"commandLineArgs,omitempty"` 1714 // ProcessCount - Number of processes to launch for the job execution. The default value for this property is equal to nodeCount property 1715 ProcessCount *int32 `json:"processCount,omitempty"` 1716} 1717 1718// ImageReference the OS image reference. 1719type ImageReference struct { 1720 // Publisher - Publisher of the image. 1721 Publisher *string `json:"publisher,omitempty"` 1722 // Offer - Offer of the image. 1723 Offer *string `json:"offer,omitempty"` 1724 // Sku - SKU of the image. 1725 Sku *string `json:"sku,omitempty"` 1726 // Version - Version of the image. 1727 Version *string `json:"version,omitempty"` 1728 // VirtualMachineImageID - The ARM resource identifier of the virtual machine image for the compute nodes. This is of the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}. 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. 1729 VirtualMachineImageID *string `json:"virtualMachineImageId,omitempty"` 1730} 1731 1732// ImageSourceRegistry information about docker image for the job. 1733type ImageSourceRegistry struct { 1734 // ServerURL - URL for image repository. 1735 ServerURL *string `json:"serverUrl,omitempty"` 1736 // Image - The name of the image in the image repository. 1737 Image *string `json:"image,omitempty"` 1738 // Credentials - Credentials to access the private docker repository. 1739 Credentials *PrivateRegistryCredentials `json:"credentials,omitempty"` 1740} 1741 1742// InputDirectory input directory for the job. 1743type InputDirectory struct { 1744 // ID - The ID for the input directory. The job can use AZ_BATCHAI_INPUT_<id> environment variable to find the directory path, where <id> is the value of id attribute. 1745 ID *string `json:"id,omitempty"` 1746 // Path - The path to the input directory. 1747 Path *string `json:"path,omitempty"` 1748} 1749 1750// Job information about a Job. 1751type Job struct { 1752 autorest.Response `json:"-"` 1753 // JobProperties - The properties associated with the Job. 1754 *JobProperties `json:"properties,omitempty"` 1755 // ID - READ-ONLY; The ID of the resource. 1756 ID *string `json:"id,omitempty"` 1757 // Name - READ-ONLY; The name of the resource. 1758 Name *string `json:"name,omitempty"` 1759 // Type - READ-ONLY; The type of the resource. 1760 Type *string `json:"type,omitempty"` 1761} 1762 1763// MarshalJSON is the custom marshaler for Job. 1764func (j Job) MarshalJSON() ([]byte, error) { 1765 objectMap := make(map[string]interface{}) 1766 if j.JobProperties != nil { 1767 objectMap["properties"] = j.JobProperties 1768 } 1769 return json.Marshal(objectMap) 1770} 1771 1772// UnmarshalJSON is the custom unmarshaler for Job struct. 1773func (j *Job) UnmarshalJSON(body []byte) error { 1774 var m map[string]*json.RawMessage 1775 err := json.Unmarshal(body, &m) 1776 if err != nil { 1777 return err 1778 } 1779 for k, v := range m { 1780 switch k { 1781 case "properties": 1782 if v != nil { 1783 var jobProperties JobProperties 1784 err = json.Unmarshal(*v, &jobProperties) 1785 if err != nil { 1786 return err 1787 } 1788 j.JobProperties = &jobProperties 1789 } 1790 case "id": 1791 if v != nil { 1792 var ID string 1793 err = json.Unmarshal(*v, &ID) 1794 if err != nil { 1795 return err 1796 } 1797 j.ID = &ID 1798 } 1799 case "name": 1800 if v != nil { 1801 var name string 1802 err = json.Unmarshal(*v, &name) 1803 if err != nil { 1804 return err 1805 } 1806 j.Name = &name 1807 } 1808 case "type": 1809 if v != nil { 1810 var typeVar string 1811 err = json.Unmarshal(*v, &typeVar) 1812 if err != nil { 1813 return err 1814 } 1815 j.Type = &typeVar 1816 } 1817 } 1818 } 1819 1820 return nil 1821} 1822 1823// JobBaseProperties the properties of a Batch AI Job. 1824type JobBaseProperties struct { 1825 // SchedulingPriority - Scheduling priority associated with the job. Possible values: low, normal, high. Possible values include: 'Low', 'Normal', 'High' 1826 SchedulingPriority JobPriority `json:"schedulingPriority,omitempty"` 1827 // Cluster - Resource ID of the cluster on which this job will run. 1828 Cluster *ResourceID `json:"cluster,omitempty"` 1829 // MountVolumes - Information on mount volumes to be used by the job. 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. 1830 MountVolumes *MountVolumes `json:"mountVolumes,omitempty"` 1831 // NodeCount - Number of compute nodes to run the job on. The job will be gang scheduled on that many compute nodes. 1832 NodeCount *int32 `json:"nodeCount,omitempty"` 1833 // ContainerSettings - Docker container settings for the job. If not provided, the job will run directly on the node. 1834 ContainerSettings *ContainerSettings `json:"containerSettings,omitempty"` 1835 // CntkSettings - Settings for CNTK (aka Microsoft Cognitive Toolkit) job. 1836 CntkSettings *CNTKsettings `json:"cntkSettings,omitempty"` 1837 // PyTorchSettings - Settings for pyTorch job. 1838 PyTorchSettings *PyTorchSettings `json:"pyTorchSettings,omitempty"` 1839 // TensorFlowSettings - Settings for Tensor Flow job. 1840 TensorFlowSettings *TensorFlowSettings `json:"tensorFlowSettings,omitempty"` 1841 // CaffeSettings - Settings for Caffe job. 1842 CaffeSettings *CaffeSettings `json:"caffeSettings,omitempty"` 1843 // Caffe2Settings - Settings for Caffe2 job. 1844 Caffe2Settings *Caffe2Settings `json:"caffe2Settings,omitempty"` 1845 // ChainerSettings - Settings for Chainer job. 1846 ChainerSettings *ChainerSettings `json:"chainerSettings,omitempty"` 1847 // CustomToolkitSettings - Settings for custom tool kit job. 1848 CustomToolkitSettings *CustomToolkitSettings `json:"customToolkitSettings,omitempty"` 1849 // CustomMpiSettings - Settings for custom MPI job. 1850 CustomMpiSettings *CustomMpiSettings `json:"customMpiSettings,omitempty"` 1851 // HorovodSettings - Settings for Horovod job. 1852 HorovodSettings *HorovodSettings `json:"horovodSettings,omitempty"` 1853 // JobPreparation - A command line to be executed on each node allocated for the job before tool kit is launched. 1854 JobPreparation *JobPreparation `json:"jobPreparation,omitempty"` 1855 // StdOutErrPathPrefix - The path where the Batch AI service will store stdout, stderror and execution log of the job. 1856 StdOutErrPathPrefix *string `json:"stdOutErrPathPrefix,omitempty"` 1857 // InputDirectories - A list of input directories for the job. 1858 InputDirectories *[]InputDirectory `json:"inputDirectories,omitempty"` 1859 // OutputDirectories - A list of output directories for the job. 1860 OutputDirectories *[]OutputDirectory `json:"outputDirectories,omitempty"` 1861 // EnvironmentVariables - A list of user defined environment variables which will be setup for the job. 1862 EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` 1863 // Secrets - A list of user defined environment variables with secret values which will be setup for the job. Server will never report values of these variables back. 1864 Secrets *[]EnvironmentVariableWithSecretValue `json:"secrets,omitempty"` 1865 // Constraints - Constraints associated with the Job. 1866 Constraints *JobBasePropertiesConstraints `json:"constraints,omitempty"` 1867} 1868 1869// JobBasePropertiesConstraints constraints associated with the Job. 1870type JobBasePropertiesConstraints struct { 1871 // MaxWallClockTime - Max time the job can run. Default value: 1 week. 1872 MaxWallClockTime *string `json:"maxWallClockTime,omitempty"` 1873} 1874 1875// JobCreateParameters job creation parameters. 1876type JobCreateParameters struct { 1877 // JobBaseProperties - The properties of the Job. 1878 *JobBaseProperties `json:"properties,omitempty"` 1879} 1880 1881// MarshalJSON is the custom marshaler for JobCreateParameters. 1882func (jcp JobCreateParameters) MarshalJSON() ([]byte, error) { 1883 objectMap := make(map[string]interface{}) 1884 if jcp.JobBaseProperties != nil { 1885 objectMap["properties"] = jcp.JobBaseProperties 1886 } 1887 return json.Marshal(objectMap) 1888} 1889 1890// UnmarshalJSON is the custom unmarshaler for JobCreateParameters struct. 1891func (jcp *JobCreateParameters) UnmarshalJSON(body []byte) error { 1892 var m map[string]*json.RawMessage 1893 err := json.Unmarshal(body, &m) 1894 if err != nil { 1895 return err 1896 } 1897 for k, v := range m { 1898 switch k { 1899 case "properties": 1900 if v != nil { 1901 var jobBaseProperties JobBaseProperties 1902 err = json.Unmarshal(*v, &jobBaseProperties) 1903 if err != nil { 1904 return err 1905 } 1906 jcp.JobBaseProperties = &jobBaseProperties 1907 } 1908 } 1909 } 1910 1911 return nil 1912} 1913 1914// JobListResult values returned by the List operation. 1915type JobListResult struct { 1916 autorest.Response `json:"-"` 1917 // Value - READ-ONLY; The collection of jobs. 1918 Value *[]Job `json:"value,omitempty"` 1919 // NextLink - READ-ONLY; The continuation token. 1920 NextLink *string `json:"nextLink,omitempty"` 1921} 1922 1923// JobListResultIterator provides access to a complete listing of Job values. 1924type JobListResultIterator struct { 1925 i int 1926 page JobListResultPage 1927} 1928 1929// NextWithContext advances to the next value. If there was an error making 1930// the request the iterator does not advance and the error is returned. 1931func (iter *JobListResultIterator) NextWithContext(ctx context.Context) (err error) { 1932 if tracing.IsEnabled() { 1933 ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultIterator.NextWithContext") 1934 defer func() { 1935 sc := -1 1936 if iter.Response().Response.Response != nil { 1937 sc = iter.Response().Response.Response.StatusCode 1938 } 1939 tracing.EndSpan(ctx, sc, err) 1940 }() 1941 } 1942 iter.i++ 1943 if iter.i < len(iter.page.Values()) { 1944 return nil 1945 } 1946 err = iter.page.NextWithContext(ctx) 1947 if err != nil { 1948 iter.i-- 1949 return err 1950 } 1951 iter.i = 0 1952 return nil 1953} 1954 1955// Next advances to the next value. If there was an error making 1956// the request the iterator does not advance and the error is returned. 1957// Deprecated: Use NextWithContext() instead. 1958func (iter *JobListResultIterator) Next() error { 1959 return iter.NextWithContext(context.Background()) 1960} 1961 1962// NotDone returns true if the enumeration should be started or is not yet complete. 1963func (iter JobListResultIterator) NotDone() bool { 1964 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1965} 1966 1967// Response returns the raw server response from the last page request. 1968func (iter JobListResultIterator) Response() JobListResult { 1969 return iter.page.Response() 1970} 1971 1972// Value returns the current value or a zero-initialized value if the 1973// iterator has advanced beyond the end of the collection. 1974func (iter JobListResultIterator) Value() Job { 1975 if !iter.page.NotDone() { 1976 return Job{} 1977 } 1978 return iter.page.Values()[iter.i] 1979} 1980 1981// Creates a new instance of the JobListResultIterator type. 1982func NewJobListResultIterator(page JobListResultPage) JobListResultIterator { 1983 return JobListResultIterator{page: page} 1984} 1985 1986// IsEmpty returns true if the ListResult contains no values. 1987func (jlr JobListResult) IsEmpty() bool { 1988 return jlr.Value == nil || len(*jlr.Value) == 0 1989} 1990 1991// jobListResultPreparer prepares a request to retrieve the next set of results. 1992// It returns nil if no more results exist. 1993func (jlr JobListResult) jobListResultPreparer(ctx context.Context) (*http.Request, error) { 1994 if jlr.NextLink == nil || len(to.String(jlr.NextLink)) < 1 { 1995 return nil, nil 1996 } 1997 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1998 autorest.AsJSON(), 1999 autorest.AsGet(), 2000 autorest.WithBaseURL(to.String(jlr.NextLink))) 2001} 2002 2003// JobListResultPage contains a page of Job values. 2004type JobListResultPage struct { 2005 fn func(context.Context, JobListResult) (JobListResult, error) 2006 jlr JobListResult 2007} 2008 2009// NextWithContext advances to the next page of values. If there was an error making 2010// the request the page does not advance and the error is returned. 2011func (page *JobListResultPage) NextWithContext(ctx context.Context) (err error) { 2012 if tracing.IsEnabled() { 2013 ctx = tracing.StartSpan(ctx, fqdn+"/JobListResultPage.NextWithContext") 2014 defer func() { 2015 sc := -1 2016 if page.Response().Response.Response != nil { 2017 sc = page.Response().Response.Response.StatusCode 2018 } 2019 tracing.EndSpan(ctx, sc, err) 2020 }() 2021 } 2022 next, err := page.fn(ctx, page.jlr) 2023 if err != nil { 2024 return err 2025 } 2026 page.jlr = next 2027 return nil 2028} 2029 2030// Next advances to the next page of values. If there was an error making 2031// the request the page does not advance and the error is returned. 2032// Deprecated: Use NextWithContext() instead. 2033func (page *JobListResultPage) Next() error { 2034 return page.NextWithContext(context.Background()) 2035} 2036 2037// NotDone returns true if the page enumeration should be started or is not yet complete. 2038func (page JobListResultPage) NotDone() bool { 2039 return !page.jlr.IsEmpty() 2040} 2041 2042// Response returns the raw server response from the last page request. 2043func (page JobListResultPage) Response() JobListResult { 2044 return page.jlr 2045} 2046 2047// Values returns the slice of values for the current page or nil if there are no values. 2048func (page JobListResultPage) Values() []Job { 2049 if page.jlr.IsEmpty() { 2050 return nil 2051 } 2052 return *page.jlr.Value 2053} 2054 2055// Creates a new instance of the JobListResultPage type. 2056func NewJobListResultPage(getNextPage func(context.Context, JobListResult) (JobListResult, error)) JobListResultPage { 2057 return JobListResultPage{fn: getNextPage} 2058} 2059 2060// JobPreparation job preparation settings. 2061type JobPreparation struct { 2062 // CommandLine - The command line to execute. 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. 2063 CommandLine *string `json:"commandLine,omitempty"` 2064} 2065 2066// JobProperties job properties. 2067type JobProperties struct { 2068 // SchedulingPriority - Scheduling priority associated with the job. Possible values include: 'Low', 'Normal', 'High' 2069 SchedulingPriority JobPriority `json:"schedulingPriority,omitempty"` 2070 // Cluster - Resource ID of the cluster associated with the job. 2071 Cluster *ResourceID `json:"cluster,omitempty"` 2072 // MountVolumes - Collection of mount volumes available to the job during execution. These volumes are mounted before the job execution and unmounted after the job completion. The volumes are mounted at location specified by $AZ_BATCHAI_JOB_MOUNT_ROOT environment variable. 2073 MountVolumes *MountVolumes `json:"mountVolumes,omitempty"` 2074 // NodeCount - The job will be gang scheduled on that many compute nodes 2075 NodeCount *int32 `json:"nodeCount,omitempty"` 2076 // 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. 2077 ContainerSettings *ContainerSettings `json:"containerSettings,omitempty"` 2078 // ToolType - Possible values are: cntk, tensorflow, caffe, caffe2, chainer, pytorch, custom, custommpi, horovod. Possible values include: 'Cntk', 'Tensorflow', 'Caffe', 'Caffe2', 'Chainer', 'Horovod', 'Custommpi', 'Custom' 2079 ToolType ToolType `json:"toolType,omitempty"` 2080 CntkSettings *CNTKsettings `json:"cntkSettings,omitempty"` 2081 PyTorchSettings *PyTorchSettings `json:"pyTorchSettings,omitempty"` 2082 TensorFlowSettings *TensorFlowSettings `json:"tensorFlowSettings,omitempty"` 2083 CaffeSettings *CaffeSettings `json:"caffeSettings,omitempty"` 2084 Caffe2Settings *Caffe2Settings `json:"caffe2Settings,omitempty"` 2085 ChainerSettings *ChainerSettings `json:"chainerSettings,omitempty"` 2086 CustomToolkitSettings *CustomToolkitSettings `json:"customToolkitSettings,omitempty"` 2087 CustomMpiSettings *CustomMpiSettings `json:"customMpiSettings,omitempty"` 2088 HorovodSettings *HorovodSettings `json:"horovodSettings,omitempty"` 2089 // JobPreparation - The specified actions will run on all the nodes that are part of the job 2090 JobPreparation *JobPreparation `json:"jobPreparation,omitempty"` 2091 // JobOutputDirectoryPathSegment - READ-ONLY; A segment of job's output directories path created by Batch AI. 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. 2092 JobOutputDirectoryPathSegment *string `json:"jobOutputDirectoryPathSegment,omitempty"` 2093 // StdOutErrPathPrefix - The path where the Batch AI service stores stdout, stderror and execution log of the job. 2094 StdOutErrPathPrefix *string `json:"stdOutErrPathPrefix,omitempty"` 2095 // InputDirectories - A list of input directories for the job. 2096 InputDirectories *[]InputDirectory `json:"inputDirectories,omitempty"` 2097 // OutputDirectories - A list of output directories for the job. 2098 OutputDirectories *[]OutputDirectory `json:"outputDirectories,omitempty"` 2099 // EnvironmentVariables - A collection of user defined environment variables to be setup for the job. 2100 EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` 2101 // Secrets - A collection of user defined environment variables with secret values to be setup for the job. Server will never report values of these variables back. 2102 Secrets *[]EnvironmentVariableWithSecretValue `json:"secrets,omitempty"` 2103 // Constraints - Constraints associated with the Job. 2104 Constraints *JobPropertiesConstraints `json:"constraints,omitempty"` 2105 // CreationTime - READ-ONLY; The creation time of the job. 2106 CreationTime *date.Time `json:"creationTime,omitempty"` 2107 // ProvisioningState - READ-ONLY; The provisioned state of the Batch AI job. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateDeleting' 2108 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 2109 // ProvisioningStateTransitionTime - READ-ONLY; The time at which the job entered its current provisioning state. 2110 ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` 2111 // ExecutionState - READ-ONLY; 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' 2112 ExecutionState ExecutionState `json:"executionState,omitempty"` 2113 // ExecutionStateTransitionTime - READ-ONLY; The time at which the job entered its current execution state. 2114 ExecutionStateTransitionTime *date.Time `json:"executionStateTransitionTime,omitempty"` 2115 // ExecutionInfo - Information about the execution of a job. 2116 ExecutionInfo *JobPropertiesExecutionInfo `json:"executionInfo,omitempty"` 2117} 2118 2119// JobPropertiesConstraints constraints associated with the Job. 2120type JobPropertiesConstraints struct { 2121 // MaxWallClockTime - Max time the job can run. Default value: 1 week. 2122 MaxWallClockTime *string `json:"maxWallClockTime,omitempty"` 2123} 2124 2125// JobPropertiesExecutionInfo information about the execution of a job. 2126type JobPropertiesExecutionInfo struct { 2127 // StartTime - READ-ONLY; The time at which the job started running. '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. 2128 StartTime *date.Time `json:"startTime,omitempty"` 2129 // EndTime - READ-ONLY; The time at which the job completed. This property is only returned if the job is in completed state. 2130 EndTime *date.Time `json:"endTime,omitempty"` 2131 // ExitCode - READ-ONLY; The exit code of the job. This property is only returned if the job is in completed state. 2132 ExitCode *int32 `json:"exitCode,omitempty"` 2133 // Errors - READ-ONLY; A collection of errors encountered by the service during job execution. 2134 Errors *[]Error `json:"errors,omitempty"` 2135} 2136 2137// JobsCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 2138type JobsCreateFuture struct { 2139 azure.Future 2140} 2141 2142// Result returns the result of the asynchronous operation. 2143// If the operation has not completed it will return an error. 2144func (future *JobsCreateFuture) Result(client JobsClient) (j Job, err error) { 2145 var done bool 2146 done, err = future.DoneWithContext(context.Background(), client) 2147 if err != nil { 2148 err = autorest.NewErrorWithError(err, "batchai.JobsCreateFuture", "Result", future.Response(), "Polling failure") 2149 return 2150 } 2151 if !done { 2152 err = azure.NewAsyncOpIncompleteError("batchai.JobsCreateFuture") 2153 return 2154 } 2155 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2156 if j.Response.Response, err = future.GetResult(sender); err == nil && j.Response.Response.StatusCode != http.StatusNoContent { 2157 j, err = client.CreateResponder(j.Response.Response) 2158 if err != nil { 2159 err = autorest.NewErrorWithError(err, "batchai.JobsCreateFuture", "Result", j.Response.Response, "Failure responding to request") 2160 } 2161 } 2162 return 2163} 2164 2165// JobsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 2166type JobsDeleteFuture struct { 2167 azure.Future 2168} 2169 2170// Result returns the result of the asynchronous operation. 2171// If the operation has not completed it will return an error. 2172func (future *JobsDeleteFuture) Result(client JobsClient) (ar autorest.Response, err error) { 2173 var done bool 2174 done, err = future.DoneWithContext(context.Background(), client) 2175 if err != nil { 2176 err = autorest.NewErrorWithError(err, "batchai.JobsDeleteFuture", "Result", future.Response(), "Polling failure") 2177 return 2178 } 2179 if !done { 2180 err = azure.NewAsyncOpIncompleteError("batchai.JobsDeleteFuture") 2181 return 2182 } 2183 ar.Response = future.Response() 2184 return 2185} 2186 2187// JobsTerminateFuture an abstraction for monitoring and retrieving the results of a long-running 2188// operation. 2189type JobsTerminateFuture struct { 2190 azure.Future 2191} 2192 2193// Result returns the result of the asynchronous operation. 2194// If the operation has not completed it will return an error. 2195func (future *JobsTerminateFuture) Result(client JobsClient) (ar autorest.Response, err error) { 2196 var done bool 2197 done, err = future.DoneWithContext(context.Background(), client) 2198 if err != nil { 2199 err = autorest.NewErrorWithError(err, "batchai.JobsTerminateFuture", "Result", future.Response(), "Polling failure") 2200 return 2201 } 2202 if !done { 2203 err = azure.NewAsyncOpIncompleteError("batchai.JobsTerminateFuture") 2204 return 2205 } 2206 ar.Response = future.Response() 2207 return 2208} 2209 2210// KeyVaultSecretReference key Vault Secret reference. 2211type KeyVaultSecretReference struct { 2212 // SourceVault - Fully qualified resource identifier of the Key Vault. 2213 SourceVault *ResourceID `json:"sourceVault,omitempty"` 2214 // SecretURL - The URL referencing a secret in the Key Vault. 2215 SecretURL *string `json:"secretUrl,omitempty"` 2216} 2217 2218// ListUsagesResult the List Usages operation response. 2219type ListUsagesResult struct { 2220 autorest.Response `json:"-"` 2221 // Value - READ-ONLY; The list of compute resource usages. 2222 Value *[]Usage `json:"value,omitempty"` 2223 // NextLink - READ-ONLY; 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. 2224 NextLink *string `json:"nextLink,omitempty"` 2225} 2226 2227// ListUsagesResultIterator provides access to a complete listing of Usage values. 2228type ListUsagesResultIterator struct { 2229 i int 2230 page ListUsagesResultPage 2231} 2232 2233// NextWithContext advances to the next value. If there was an error making 2234// the request the iterator does not advance and the error is returned. 2235func (iter *ListUsagesResultIterator) NextWithContext(ctx context.Context) (err error) { 2236 if tracing.IsEnabled() { 2237 ctx = tracing.StartSpan(ctx, fqdn+"/ListUsagesResultIterator.NextWithContext") 2238 defer func() { 2239 sc := -1 2240 if iter.Response().Response.Response != nil { 2241 sc = iter.Response().Response.Response.StatusCode 2242 } 2243 tracing.EndSpan(ctx, sc, err) 2244 }() 2245 } 2246 iter.i++ 2247 if iter.i < len(iter.page.Values()) { 2248 return nil 2249 } 2250 err = iter.page.NextWithContext(ctx) 2251 if err != nil { 2252 iter.i-- 2253 return err 2254 } 2255 iter.i = 0 2256 return nil 2257} 2258 2259// Next advances to the next value. If there was an error making 2260// the request the iterator does not advance and the error is returned. 2261// Deprecated: Use NextWithContext() instead. 2262func (iter *ListUsagesResultIterator) Next() error { 2263 return iter.NextWithContext(context.Background()) 2264} 2265 2266// NotDone returns true if the enumeration should be started or is not yet complete. 2267func (iter ListUsagesResultIterator) NotDone() bool { 2268 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2269} 2270 2271// Response returns the raw server response from the last page request. 2272func (iter ListUsagesResultIterator) Response() ListUsagesResult { 2273 return iter.page.Response() 2274} 2275 2276// Value returns the current value or a zero-initialized value if the 2277// iterator has advanced beyond the end of the collection. 2278func (iter ListUsagesResultIterator) Value() Usage { 2279 if !iter.page.NotDone() { 2280 return Usage{} 2281 } 2282 return iter.page.Values()[iter.i] 2283} 2284 2285// Creates a new instance of the ListUsagesResultIterator type. 2286func NewListUsagesResultIterator(page ListUsagesResultPage) ListUsagesResultIterator { 2287 return ListUsagesResultIterator{page: page} 2288} 2289 2290// IsEmpty returns true if the ListResult contains no values. 2291func (lur ListUsagesResult) IsEmpty() bool { 2292 return lur.Value == nil || len(*lur.Value) == 0 2293} 2294 2295// listUsagesResultPreparer prepares a request to retrieve the next set of results. 2296// It returns nil if no more results exist. 2297func (lur ListUsagesResult) listUsagesResultPreparer(ctx context.Context) (*http.Request, error) { 2298 if lur.NextLink == nil || len(to.String(lur.NextLink)) < 1 { 2299 return nil, nil 2300 } 2301 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2302 autorest.AsJSON(), 2303 autorest.AsGet(), 2304 autorest.WithBaseURL(to.String(lur.NextLink))) 2305} 2306 2307// ListUsagesResultPage contains a page of Usage values. 2308type ListUsagesResultPage struct { 2309 fn func(context.Context, ListUsagesResult) (ListUsagesResult, error) 2310 lur ListUsagesResult 2311} 2312 2313// NextWithContext advances to the next page of values. If there was an error making 2314// the request the page does not advance and the error is returned. 2315func (page *ListUsagesResultPage) NextWithContext(ctx context.Context) (err error) { 2316 if tracing.IsEnabled() { 2317 ctx = tracing.StartSpan(ctx, fqdn+"/ListUsagesResultPage.NextWithContext") 2318 defer func() { 2319 sc := -1 2320 if page.Response().Response.Response != nil { 2321 sc = page.Response().Response.Response.StatusCode 2322 } 2323 tracing.EndSpan(ctx, sc, err) 2324 }() 2325 } 2326 next, err := page.fn(ctx, page.lur) 2327 if err != nil { 2328 return err 2329 } 2330 page.lur = next 2331 return nil 2332} 2333 2334// Next advances to the next page of values. If there was an error making 2335// the request the page does not advance and the error is returned. 2336// Deprecated: Use NextWithContext() instead. 2337func (page *ListUsagesResultPage) Next() error { 2338 return page.NextWithContext(context.Background()) 2339} 2340 2341// NotDone returns true if the page enumeration should be started or is not yet complete. 2342func (page ListUsagesResultPage) NotDone() bool { 2343 return !page.lur.IsEmpty() 2344} 2345 2346// Response returns the raw server response from the last page request. 2347func (page ListUsagesResultPage) Response() ListUsagesResult { 2348 return page.lur 2349} 2350 2351// Values returns the slice of values for the current page or nil if there are no values. 2352func (page ListUsagesResultPage) Values() []Usage { 2353 if page.lur.IsEmpty() { 2354 return nil 2355 } 2356 return *page.lur.Value 2357} 2358 2359// Creates a new instance of the ListUsagesResultPage type. 2360func NewListUsagesResultPage(getNextPage func(context.Context, ListUsagesResult) (ListUsagesResult, error)) ListUsagesResultPage { 2361 return ListUsagesResultPage{fn: getNextPage} 2362} 2363 2364// ManualScaleSettings manual scale settings for the cluster. 2365type ManualScaleSettings struct { 2366 // TargetNodeCount - The desired number of compute nodes in the Cluster. Default is 0. 2367 TargetNodeCount *int32 `json:"targetNodeCount,omitempty"` 2368 // NodeDeallocationOption - An action to be performed when the cluster size is decreasing. The default value is requeue. Possible values include: 'Requeue', 'Terminate', 'Waitforjobcompletion' 2369 NodeDeallocationOption DeallocationOption `json:"nodeDeallocationOption,omitempty"` 2370} 2371 2372// MountSettings file Server mount Information. 2373type MountSettings struct { 2374 // MountPoint - Path where the data disks are mounted on the File Server. 2375 MountPoint *string `json:"mountPoint,omitempty"` 2376 // FileServerPublicIP - Public IP address of the File Server which can be used to SSH to the node from outside of the subnet. 2377 FileServerPublicIP *string `json:"fileServerPublicIP,omitempty"` 2378 // FileServerInternalIP - Internal IP address of the File Server which can be used to access the File Server from within the subnet. 2379 FileServerInternalIP *string `json:"fileServerInternalIP,omitempty"` 2380} 2381 2382// MountVolumes details of volumes to mount on the cluster. 2383type MountVolumes struct { 2384 // AzureFileShares - A collection of Azure File Shares that are to be mounted to the cluster nodes. 2385 AzureFileShares *[]AzureFileShareReference `json:"azureFileShares,omitempty"` 2386 // AzureBlobFileSystems - A collection of Azure Blob Containers that are to be mounted to the cluster nodes. 2387 AzureBlobFileSystems *[]AzureBlobFileSystemReference `json:"azureBlobFileSystems,omitempty"` 2388 // FileServers - A collection of Batch AI File Servers that are to be mounted to the cluster nodes. 2389 FileServers *[]FileServerReference `json:"fileServers,omitempty"` 2390 // UnmanagedFileSystems - A collection of unmanaged file systems that are to be mounted to the cluster nodes. 2391 UnmanagedFileSystems *[]UnmanagedFileSystemReference `json:"unmanagedFileSystems,omitempty"` 2392} 2393 2394// NameValuePair name-value pair. 2395type NameValuePair struct { 2396 // Name - The name in the name-value pair. 2397 Name *string `json:"name,omitempty"` 2398 // Value - The value in the name-value pair. 2399 Value *string `json:"value,omitempty"` 2400} 2401 2402// NodeSetup node setup settings. 2403type NodeSetup struct { 2404 // SetupTask - Setup task to run on cluster nodes when nodes got created or rebooted. The setup task code needs to be idempotent. Generally the setup task is used to download static data that is required for all jobs that run on the cluster VMs and/or to download/install software. 2405 SetupTask *SetupTask `json:"setupTask,omitempty"` 2406 // MountVolumes - Mount volumes to be available to setup task and all jobs executing on the cluster. The volumes will be mounted at location specified by $AZ_BATCHAI_MOUNT_ROOT environment variable. 2407 MountVolumes *MountVolumes `json:"mountVolumes,omitempty"` 2408 // PerformanceCountersSettings - Settings for performance counters collecting and uploading. 2409 PerformanceCountersSettings *PerformanceCountersSettings `json:"performanceCountersSettings,omitempty"` 2410} 2411 2412// NodeStateCounts counts of various compute node states on the cluster. 2413type NodeStateCounts struct { 2414 // IdleNodeCount - READ-ONLY; Number of compute nodes in idle state. 2415 IdleNodeCount *int32 `json:"idleNodeCount,omitempty"` 2416 // RunningNodeCount - READ-ONLY; Number of compute nodes which are running jobs. 2417 RunningNodeCount *int32 `json:"runningNodeCount,omitempty"` 2418 // PreparingNodeCount - READ-ONLY; Number of compute nodes which are being prepared. 2419 PreparingNodeCount *int32 `json:"preparingNodeCount,omitempty"` 2420 // UnusableNodeCount - READ-ONLY; Number of compute nodes which are in unusable state. 2421 UnusableNodeCount *int32 `json:"unusableNodeCount,omitempty"` 2422 // LeavingNodeCount - READ-ONLY; Number of compute nodes which are leaving the cluster. 2423 LeavingNodeCount *int32 `json:"leavingNodeCount,omitempty"` 2424} 2425 2426// Operation details of a REST API operation 2427type Operation struct { 2428 // Name - READ-ONLY; This is of the format {provider}/{resource}/{operation} 2429 Name *string `json:"name,omitempty"` 2430 // Display - The object that describes the operation. 2431 Display *OperationDisplay `json:"display,omitempty"` 2432 // Origin - READ-ONLY 2433 Origin *string `json:"origin,omitempty"` 2434 Properties interface{} `json:"properties,omitempty"` 2435} 2436 2437// OperationDisplay the object that describes the operation. 2438type OperationDisplay struct { 2439 // Provider - READ-ONLY 2440 Provider *string `json:"provider,omitempty"` 2441 // Operation - READ-ONLY; For example: read, write, delete, or listKeys/action 2442 Operation *string `json:"operation,omitempty"` 2443 // Resource - READ-ONLY 2444 Resource *string `json:"resource,omitempty"` 2445 // Description - READ-ONLY 2446 Description *string `json:"description,omitempty"` 2447} 2448 2449// OperationListResult contains the list of all operations supported by BatchAI resource provider 2450type OperationListResult struct { 2451 autorest.Response `json:"-"` 2452 // Value - READ-ONLY 2453 Value *[]Operation `json:"value,omitempty"` 2454 // NextLink - READ-ONLY 2455 NextLink *string `json:"nextLink,omitempty"` 2456} 2457 2458// OperationListResultIterator provides access to a complete listing of Operation values. 2459type OperationListResultIterator struct { 2460 i int 2461 page OperationListResultPage 2462} 2463 2464// NextWithContext advances to the next value. If there was an error making 2465// the request the iterator does not advance and the error is returned. 2466func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 2467 if tracing.IsEnabled() { 2468 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 2469 defer func() { 2470 sc := -1 2471 if iter.Response().Response.Response != nil { 2472 sc = iter.Response().Response.Response.StatusCode 2473 } 2474 tracing.EndSpan(ctx, sc, err) 2475 }() 2476 } 2477 iter.i++ 2478 if iter.i < len(iter.page.Values()) { 2479 return nil 2480 } 2481 err = iter.page.NextWithContext(ctx) 2482 if err != nil { 2483 iter.i-- 2484 return err 2485 } 2486 iter.i = 0 2487 return nil 2488} 2489 2490// Next advances to the next value. If there was an error making 2491// the request the iterator does not advance and the error is returned. 2492// Deprecated: Use NextWithContext() instead. 2493func (iter *OperationListResultIterator) Next() error { 2494 return iter.NextWithContext(context.Background()) 2495} 2496 2497// NotDone returns true if the enumeration should be started or is not yet complete. 2498func (iter OperationListResultIterator) NotDone() bool { 2499 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2500} 2501 2502// Response returns the raw server response from the last page request. 2503func (iter OperationListResultIterator) Response() OperationListResult { 2504 return iter.page.Response() 2505} 2506 2507// Value returns the current value or a zero-initialized value if the 2508// iterator has advanced beyond the end of the collection. 2509func (iter OperationListResultIterator) Value() Operation { 2510 if !iter.page.NotDone() { 2511 return Operation{} 2512 } 2513 return iter.page.Values()[iter.i] 2514} 2515 2516// Creates a new instance of the OperationListResultIterator type. 2517func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 2518 return OperationListResultIterator{page: page} 2519} 2520 2521// IsEmpty returns true if the ListResult contains no values. 2522func (olr OperationListResult) IsEmpty() bool { 2523 return olr.Value == nil || len(*olr.Value) == 0 2524} 2525 2526// operationListResultPreparer prepares a request to retrieve the next set of results. 2527// It returns nil if no more results exist. 2528func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 2529 if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { 2530 return nil, nil 2531 } 2532 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2533 autorest.AsJSON(), 2534 autorest.AsGet(), 2535 autorest.WithBaseURL(to.String(olr.NextLink))) 2536} 2537 2538// OperationListResultPage contains a page of Operation values. 2539type OperationListResultPage struct { 2540 fn func(context.Context, OperationListResult) (OperationListResult, error) 2541 olr OperationListResult 2542} 2543 2544// NextWithContext advances to the next page of values. If there was an error making 2545// the request the page does not advance and the error is returned. 2546func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 2547 if tracing.IsEnabled() { 2548 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 2549 defer func() { 2550 sc := -1 2551 if page.Response().Response.Response != nil { 2552 sc = page.Response().Response.Response.StatusCode 2553 } 2554 tracing.EndSpan(ctx, sc, err) 2555 }() 2556 } 2557 next, err := page.fn(ctx, page.olr) 2558 if err != nil { 2559 return err 2560 } 2561 page.olr = next 2562 return nil 2563} 2564 2565// Next advances to the next page of values. If there was an error making 2566// the request the page does not advance and the error is returned. 2567// Deprecated: Use NextWithContext() instead. 2568func (page *OperationListResultPage) Next() error { 2569 return page.NextWithContext(context.Background()) 2570} 2571 2572// NotDone returns true if the page enumeration should be started or is not yet complete. 2573func (page OperationListResultPage) NotDone() bool { 2574 return !page.olr.IsEmpty() 2575} 2576 2577// Response returns the raw server response from the last page request. 2578func (page OperationListResultPage) Response() OperationListResult { 2579 return page.olr 2580} 2581 2582// Values returns the slice of values for the current page or nil if there are no values. 2583func (page OperationListResultPage) Values() []Operation { 2584 if page.olr.IsEmpty() { 2585 return nil 2586 } 2587 return *page.olr.Value 2588} 2589 2590// Creates a new instance of the OperationListResultPage type. 2591func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 2592 return OperationListResultPage{fn: getNextPage} 2593} 2594 2595// OutputDirectory output directory for the job. 2596type OutputDirectory struct { 2597 // ID - The ID of the output directory. The job can use AZ_BATCHAI_OUTPUT_<id> environment variable to find the directory path, where <id> is the value of id attribute. 2598 ID *string `json:"id,omitempty"` 2599 // PathPrefix - The prefix path where the output directory will be created. Note, this is an absolute path to prefix. E.g. $AZ_BATCHAI_MOUNT_ROOT/MyNFS/MyLogs. The full path to the output directory by combining pathPrefix, jobOutputDirectoryPathSegment (reported by get job) and pathSuffix. 2600 PathPrefix *string `json:"pathPrefix,omitempty"` 2601 // 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. 2602 PathSuffix *string `json:"pathSuffix,omitempty"` 2603} 2604 2605// PerformanceCountersSettings performance counters reporting settings. 2606type PerformanceCountersSettings struct { 2607 // AppInsightsReference - Azure Application Insights information for performance counters reporting. If provided, Batch AI will upload node performance counters to the corresponding Azure Application Insights account. 2608 AppInsightsReference *AppInsightsReference `json:"appInsightsReference,omitempty"` 2609} 2610 2611// PrivateRegistryCredentials credentials to access a container image in a private repository. 2612type PrivateRegistryCredentials struct { 2613 // Username - User name to login to the repository. 2614 Username *string `json:"username,omitempty"` 2615 // Password - User password to login to the docker repository. One of password or passwordSecretReference must be specified. 2616 Password *string `json:"password,omitempty"` 2617 // PasswordSecretReference - KeyVault Secret storing the password. 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. 2618 PasswordSecretReference *KeyVaultSecretReference `json:"passwordSecretReference,omitempty"` 2619} 2620 2621// ProxyResource a definition of an Azure proxy resource. 2622type ProxyResource struct { 2623 // ID - READ-ONLY; The ID of the resource. 2624 ID *string `json:"id,omitempty"` 2625 // Name - READ-ONLY; The name of the resource. 2626 Name *string `json:"name,omitempty"` 2627 // Type - READ-ONLY; The type of the resource. 2628 Type *string `json:"type,omitempty"` 2629} 2630 2631// PyTorchSettings pyTorch job settings. 2632type PyTorchSettings struct { 2633 // PythonScriptFilePath - The python script to execute. 2634 PythonScriptFilePath *string `json:"pythonScriptFilePath,omitempty"` 2635 // PythonInterpreterPath - The path to the Python interpreter. 2636 PythonInterpreterPath *string `json:"pythonInterpreterPath,omitempty"` 2637 // CommandLineArgs - Command line arguments that need to be passed to the python script. 2638 CommandLineArgs *string `json:"commandLineArgs,omitempty"` 2639 // ProcessCount - Number of processes to launch for the job execution. The default value for this property is equal to nodeCount property 2640 ProcessCount *int32 `json:"processCount,omitempty"` 2641 // CommunicationBackend - Type of the communication backend for distributed jobs. Valid values are 'TCP', 'Gloo' or 'MPI'. Not required for non-distributed jobs. 2642 CommunicationBackend *string `json:"communicationBackend,omitempty"` 2643} 2644 2645// RemoteLoginInformation login details to SSH to a compute node in cluster. 2646type RemoteLoginInformation struct { 2647 // NodeID - READ-ONLY; ID of the compute node. 2648 NodeID *string `json:"nodeId,omitempty"` 2649 // IPAddress - READ-ONLY; Public IP address of the compute node. 2650 IPAddress *string `json:"ipAddress,omitempty"` 2651 // Port - READ-ONLY; SSH port number of the node. 2652 Port *float64 `json:"port,omitempty"` 2653} 2654 2655// RemoteLoginInformationListResult values returned by the List operation. 2656type RemoteLoginInformationListResult struct { 2657 autorest.Response `json:"-"` 2658 // Value - READ-ONLY; The collection of returned remote login details. 2659 Value *[]RemoteLoginInformation `json:"value,omitempty"` 2660 // NextLink - READ-ONLY; The continuation token. 2661 NextLink *string `json:"nextLink,omitempty"` 2662} 2663 2664// RemoteLoginInformationListResultIterator provides access to a complete listing of RemoteLoginInformation 2665// values. 2666type RemoteLoginInformationListResultIterator struct { 2667 i int 2668 page RemoteLoginInformationListResultPage 2669} 2670 2671// NextWithContext advances to the next value. If there was an error making 2672// the request the iterator does not advance and the error is returned. 2673func (iter *RemoteLoginInformationListResultIterator) NextWithContext(ctx context.Context) (err error) { 2674 if tracing.IsEnabled() { 2675 ctx = tracing.StartSpan(ctx, fqdn+"/RemoteLoginInformationListResultIterator.NextWithContext") 2676 defer func() { 2677 sc := -1 2678 if iter.Response().Response.Response != nil { 2679 sc = iter.Response().Response.Response.StatusCode 2680 } 2681 tracing.EndSpan(ctx, sc, err) 2682 }() 2683 } 2684 iter.i++ 2685 if iter.i < len(iter.page.Values()) { 2686 return nil 2687 } 2688 err = iter.page.NextWithContext(ctx) 2689 if err != nil { 2690 iter.i-- 2691 return err 2692 } 2693 iter.i = 0 2694 return nil 2695} 2696 2697// Next advances to the next value. If there was an error making 2698// the request the iterator does not advance and the error is returned. 2699// Deprecated: Use NextWithContext() instead. 2700func (iter *RemoteLoginInformationListResultIterator) Next() error { 2701 return iter.NextWithContext(context.Background()) 2702} 2703 2704// NotDone returns true if the enumeration should be started or is not yet complete. 2705func (iter RemoteLoginInformationListResultIterator) NotDone() bool { 2706 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2707} 2708 2709// Response returns the raw server response from the last page request. 2710func (iter RemoteLoginInformationListResultIterator) Response() RemoteLoginInformationListResult { 2711 return iter.page.Response() 2712} 2713 2714// Value returns the current value or a zero-initialized value if the 2715// iterator has advanced beyond the end of the collection. 2716func (iter RemoteLoginInformationListResultIterator) Value() RemoteLoginInformation { 2717 if !iter.page.NotDone() { 2718 return RemoteLoginInformation{} 2719 } 2720 return iter.page.Values()[iter.i] 2721} 2722 2723// Creates a new instance of the RemoteLoginInformationListResultIterator type. 2724func NewRemoteLoginInformationListResultIterator(page RemoteLoginInformationListResultPage) RemoteLoginInformationListResultIterator { 2725 return RemoteLoginInformationListResultIterator{page: page} 2726} 2727 2728// IsEmpty returns true if the ListResult contains no values. 2729func (rlilr RemoteLoginInformationListResult) IsEmpty() bool { 2730 return rlilr.Value == nil || len(*rlilr.Value) == 0 2731} 2732 2733// remoteLoginInformationListResultPreparer prepares a request to retrieve the next set of results. 2734// It returns nil if no more results exist. 2735func (rlilr RemoteLoginInformationListResult) remoteLoginInformationListResultPreparer(ctx context.Context) (*http.Request, error) { 2736 if rlilr.NextLink == nil || len(to.String(rlilr.NextLink)) < 1 { 2737 return nil, nil 2738 } 2739 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2740 autorest.AsJSON(), 2741 autorest.AsGet(), 2742 autorest.WithBaseURL(to.String(rlilr.NextLink))) 2743} 2744 2745// RemoteLoginInformationListResultPage contains a page of RemoteLoginInformation values. 2746type RemoteLoginInformationListResultPage struct { 2747 fn func(context.Context, RemoteLoginInformationListResult) (RemoteLoginInformationListResult, error) 2748 rlilr RemoteLoginInformationListResult 2749} 2750 2751// NextWithContext advances to the next page of values. If there was an error making 2752// the request the page does not advance and the error is returned. 2753func (page *RemoteLoginInformationListResultPage) NextWithContext(ctx context.Context) (err error) { 2754 if tracing.IsEnabled() { 2755 ctx = tracing.StartSpan(ctx, fqdn+"/RemoteLoginInformationListResultPage.NextWithContext") 2756 defer func() { 2757 sc := -1 2758 if page.Response().Response.Response != nil { 2759 sc = page.Response().Response.Response.StatusCode 2760 } 2761 tracing.EndSpan(ctx, sc, err) 2762 }() 2763 } 2764 next, err := page.fn(ctx, page.rlilr) 2765 if err != nil { 2766 return err 2767 } 2768 page.rlilr = next 2769 return nil 2770} 2771 2772// Next advances to the next page of values. If there was an error making 2773// the request the page does not advance and the error is returned. 2774// Deprecated: Use NextWithContext() instead. 2775func (page *RemoteLoginInformationListResultPage) Next() error { 2776 return page.NextWithContext(context.Background()) 2777} 2778 2779// NotDone returns true if the page enumeration should be started or is not yet complete. 2780func (page RemoteLoginInformationListResultPage) NotDone() bool { 2781 return !page.rlilr.IsEmpty() 2782} 2783 2784// Response returns the raw server response from the last page request. 2785func (page RemoteLoginInformationListResultPage) Response() RemoteLoginInformationListResult { 2786 return page.rlilr 2787} 2788 2789// Values returns the slice of values for the current page or nil if there are no values. 2790func (page RemoteLoginInformationListResultPage) Values() []RemoteLoginInformation { 2791 if page.rlilr.IsEmpty() { 2792 return nil 2793 } 2794 return *page.rlilr.Value 2795} 2796 2797// Creates a new instance of the RemoteLoginInformationListResultPage type. 2798func NewRemoteLoginInformationListResultPage(getNextPage func(context.Context, RemoteLoginInformationListResult) (RemoteLoginInformationListResult, error)) RemoteLoginInformationListResultPage { 2799 return RemoteLoginInformationListResultPage{fn: getNextPage} 2800} 2801 2802// Resource a definition of an Azure resource. 2803type Resource struct { 2804 // ID - READ-ONLY; The ID of the resource 2805 ID *string `json:"id,omitempty"` 2806 // Name - READ-ONLY; The name of the resource 2807 Name *string `json:"name,omitempty"` 2808 // Type - READ-ONLY; The type of the resource 2809 Type *string `json:"type,omitempty"` 2810 // Location - READ-ONLY; The location of the resource 2811 Location *string `json:"location,omitempty"` 2812 // Tags - READ-ONLY; The tags of the resource 2813 Tags map[string]*string `json:"tags"` 2814} 2815 2816// MarshalJSON is the custom marshaler for Resource. 2817func (r Resource) MarshalJSON() ([]byte, error) { 2818 objectMap := make(map[string]interface{}) 2819 return json.Marshal(objectMap) 2820} 2821 2822// ResourceID represents a resource ID. For example, for a subnet, it is the resource URL for the subnet. 2823type ResourceID struct { 2824 // ID - The ID of the resource 2825 ID *string `json:"id,omitempty"` 2826} 2827 2828// ScaleSettings at least one of manual or autoScale settings must be specified. Only one of manual or 2829// autoScale settings can be specified. If autoScale settings are specified, the system automatically 2830// scales the cluster up and down (within the supplied limits) based on the pending jobs on the cluster. 2831type ScaleSettings struct { 2832 // Manual - Manual scale settings for the cluster. 2833 Manual *ManualScaleSettings `json:"manual,omitempty"` 2834 // AutoScale - Auto-scale settings for the cluster. 2835 AutoScale *AutoScaleSettings `json:"autoScale,omitempty"` 2836} 2837 2838// SetupTask specifies a setup task which can be used to customize the compute nodes of the cluster. 2839type SetupTask struct { 2840 // CommandLine - The command line to be executed on each cluster's node after it being allocated or rebooted. The command is executed in a bash subshell as a root. 2841 CommandLine *string `json:"commandLine,omitempty"` 2842 // EnvironmentVariables - A collection of user defined environment variables to be set for setup task. 2843 EnvironmentVariables *[]EnvironmentVariable `json:"environmentVariables,omitempty"` 2844 // Secrets - A collection of user defined environment variables with secret values to be set for the setup task. Server will never report values of these variables back. 2845 Secrets *[]EnvironmentVariableWithSecretValue `json:"secrets,omitempty"` 2846 // StdOutErrPathPrefix - The prefix of a path where the Batch AI service will upload the stdout, stderr and execution log of the setup task. 2847 StdOutErrPathPrefix *string `json:"stdOutErrPathPrefix,omitempty"` 2848 // StdOutErrPathSuffix - READ-ONLY; A path segment appended by Batch AI to stdOutErrPathPrefix to form a path where stdout, stderr and execution log of the setup task will be uploaded. Batch AI creates the setup task output directories under an unique path to avoid conflicts between different clusters. The full path can be obtained by concatenation of stdOutErrPathPrefix and stdOutErrPathSuffix. 2849 StdOutErrPathSuffix *string `json:"stdOutErrPathSuffix,omitempty"` 2850} 2851 2852// SSHConfiguration SSH configuration. 2853type SSHConfiguration struct { 2854 // PublicIPsToAllow - List of source IP ranges to allow SSH connection from. The default value is '*' (all source IPs are allowed). Maximum number of IP ranges that can be specified is 400. 2855 PublicIPsToAllow *[]string `json:"publicIPsToAllow,omitempty"` 2856 // UserAccountSettings - Settings for administrator user account to be created on a node. The account can be used to establish SSH connection to the node. 2857 UserAccountSettings *UserAccountSettings `json:"userAccountSettings,omitempty"` 2858} 2859 2860// TensorFlowSettings tensorFlow job settings. 2861type TensorFlowSettings struct { 2862 // PythonScriptFilePath - The python script to execute. 2863 PythonScriptFilePath *string `json:"pythonScriptFilePath,omitempty"` 2864 // PythonInterpreterPath - The path to the Python interpreter. 2865 PythonInterpreterPath *string `json:"pythonInterpreterPath,omitempty"` 2866 // MasterCommandLineArgs - Command line arguments that need to be passed to the python script for the master task. 2867 MasterCommandLineArgs *string `json:"masterCommandLineArgs,omitempty"` 2868 // WorkerCommandLineArgs - Command line arguments that need to be passed to the python script for the worker task. Optional for single process jobs. 2869 WorkerCommandLineArgs *string `json:"workerCommandLineArgs,omitempty"` 2870 // ParameterServerCommandLineArgs - Command line arguments that need to be passed to the python script for the parameter server. Optional for single process jobs. 2871 ParameterServerCommandLineArgs *string `json:"parameterServerCommandLineArgs,omitempty"` 2872 // WorkerCount - The number of worker tasks. 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. 2873 WorkerCount *int32 `json:"workerCount,omitempty"` 2874 // ParameterServerCount - The number of parameter server tasks. 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 can be specified only for distributed TensorFlow training. 2875 ParameterServerCount *int32 `json:"parameterServerCount,omitempty"` 2876} 2877 2878// UnmanagedFileSystemReference unmanaged file system mounting configuration. 2879type UnmanagedFileSystemReference struct { 2880 // MountCommand - Mount command line. Note, Batch AI will append mount path to the command on its own. 2881 MountCommand *string `json:"mountCommand,omitempty"` 2882 // RelativeMountPath - The relative path on the compute node where the unmanaged file system will be mounted. Note that all cluster level unmanaged file systems will be mounted under $AZ_BATCHAI_MOUNT_ROOT location and all job level unmanaged file systems will be mounted under $AZ_BATCHAI_JOB_MOUNT_ROOT. 2883 RelativeMountPath *string `json:"relativeMountPath,omitempty"` 2884} 2885 2886// Usage describes Batch AI Resource Usage. 2887type Usage struct { 2888 // Unit - READ-ONLY; An enum describing the unit of usage measurement. Possible values include: 'Count' 2889 Unit UsageUnit `json:"unit,omitempty"` 2890 // CurrentValue - READ-ONLY; The current usage of the resource. 2891 CurrentValue *int32 `json:"currentValue,omitempty"` 2892 // Limit - READ-ONLY; The maximum permitted usage of the resource. 2893 Limit *int64 `json:"limit,omitempty"` 2894 // Name - READ-ONLY; The name of the type of usage. 2895 Name *UsageName `json:"name,omitempty"` 2896} 2897 2898// UsageName the Usage Names. 2899type UsageName struct { 2900 // Value - READ-ONLY; The name of the resource. 2901 Value *string `json:"value,omitempty"` 2902 // LocalizedValue - READ-ONLY; The localized name of the resource. 2903 LocalizedValue *string `json:"localizedValue,omitempty"` 2904} 2905 2906// UserAccountSettings settings for user account that gets created on each on the nodes of a cluster. 2907type UserAccountSettings struct { 2908 // AdminUserName - Name of the administrator user account which can be used to SSH to nodes. 2909 AdminUserName *string `json:"adminUserName,omitempty"` 2910 // AdminUserSSHPublicKey - SSH public key of the administrator user account. 2911 AdminUserSSHPublicKey *string `json:"adminUserSshPublicKey,omitempty"` 2912 // AdminUserPassword - Password of the administrator user account. 2913 AdminUserPassword *string `json:"adminUserPassword,omitempty"` 2914} 2915 2916// VirtualMachineConfiguration VM configuration. 2917type VirtualMachineConfiguration struct { 2918 // ImageReference - OS image reference for cluster nodes. 2919 ImageReference *ImageReference `json:"imageReference,omitempty"` 2920} 2921 2922// Workspace batch AI Workspace information. 2923type Workspace struct { 2924 autorest.Response `json:"-"` 2925 // WorkspaceProperties - The properties associated with the workspace. 2926 *WorkspaceProperties `json:"properties,omitempty"` 2927 // ID - READ-ONLY; The ID of the resource 2928 ID *string `json:"id,omitempty"` 2929 // Name - READ-ONLY; The name of the resource 2930 Name *string `json:"name,omitempty"` 2931 // Type - READ-ONLY; The type of the resource 2932 Type *string `json:"type,omitempty"` 2933 // Location - READ-ONLY; The location of the resource 2934 Location *string `json:"location,omitempty"` 2935 // Tags - READ-ONLY; The tags of the resource 2936 Tags map[string]*string `json:"tags"` 2937} 2938 2939// MarshalJSON is the custom marshaler for Workspace. 2940func (w Workspace) MarshalJSON() ([]byte, error) { 2941 objectMap := make(map[string]interface{}) 2942 if w.WorkspaceProperties != nil { 2943 objectMap["properties"] = w.WorkspaceProperties 2944 } 2945 return json.Marshal(objectMap) 2946} 2947 2948// UnmarshalJSON is the custom unmarshaler for Workspace struct. 2949func (w *Workspace) UnmarshalJSON(body []byte) error { 2950 var m map[string]*json.RawMessage 2951 err := json.Unmarshal(body, &m) 2952 if err != nil { 2953 return err 2954 } 2955 for k, v := range m { 2956 switch k { 2957 case "properties": 2958 if v != nil { 2959 var workspaceProperties WorkspaceProperties 2960 err = json.Unmarshal(*v, &workspaceProperties) 2961 if err != nil { 2962 return err 2963 } 2964 w.WorkspaceProperties = &workspaceProperties 2965 } 2966 case "id": 2967 if v != nil { 2968 var ID string 2969 err = json.Unmarshal(*v, &ID) 2970 if err != nil { 2971 return err 2972 } 2973 w.ID = &ID 2974 } 2975 case "name": 2976 if v != nil { 2977 var name string 2978 err = json.Unmarshal(*v, &name) 2979 if err != nil { 2980 return err 2981 } 2982 w.Name = &name 2983 } 2984 case "type": 2985 if v != nil { 2986 var typeVar string 2987 err = json.Unmarshal(*v, &typeVar) 2988 if err != nil { 2989 return err 2990 } 2991 w.Type = &typeVar 2992 } 2993 case "location": 2994 if v != nil { 2995 var location string 2996 err = json.Unmarshal(*v, &location) 2997 if err != nil { 2998 return err 2999 } 3000 w.Location = &location 3001 } 3002 case "tags": 3003 if v != nil { 3004 var tags map[string]*string 3005 err = json.Unmarshal(*v, &tags) 3006 if err != nil { 3007 return err 3008 } 3009 w.Tags = tags 3010 } 3011 } 3012 } 3013 3014 return nil 3015} 3016 3017// WorkspaceCreateParameters workspace creation parameters. 3018type WorkspaceCreateParameters struct { 3019 // Location - The region in which to create the Workspace. 3020 Location *string `json:"location,omitempty"` 3021 // Tags - The user specified tags associated with the Workspace. 3022 Tags map[string]*string `json:"tags"` 3023} 3024 3025// MarshalJSON is the custom marshaler for WorkspaceCreateParameters. 3026func (wcp WorkspaceCreateParameters) MarshalJSON() ([]byte, error) { 3027 objectMap := make(map[string]interface{}) 3028 if wcp.Location != nil { 3029 objectMap["location"] = wcp.Location 3030 } 3031 if wcp.Tags != nil { 3032 objectMap["tags"] = wcp.Tags 3033 } 3034 return json.Marshal(objectMap) 3035} 3036 3037// WorkspaceListResult values returned by the List operation. 3038type WorkspaceListResult struct { 3039 autorest.Response `json:"-"` 3040 // Value - READ-ONLY; The collection of workspaces. 3041 Value *[]Workspace `json:"value,omitempty"` 3042 // NextLink - READ-ONLY; The continuation token. 3043 NextLink *string `json:"nextLink,omitempty"` 3044} 3045 3046// WorkspaceListResultIterator provides access to a complete listing of Workspace values. 3047type WorkspaceListResultIterator struct { 3048 i int 3049 page WorkspaceListResultPage 3050} 3051 3052// NextWithContext advances to the next value. If there was an error making 3053// the request the iterator does not advance and the error is returned. 3054func (iter *WorkspaceListResultIterator) NextWithContext(ctx context.Context) (err error) { 3055 if tracing.IsEnabled() { 3056 ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListResultIterator.NextWithContext") 3057 defer func() { 3058 sc := -1 3059 if iter.Response().Response.Response != nil { 3060 sc = iter.Response().Response.Response.StatusCode 3061 } 3062 tracing.EndSpan(ctx, sc, err) 3063 }() 3064 } 3065 iter.i++ 3066 if iter.i < len(iter.page.Values()) { 3067 return nil 3068 } 3069 err = iter.page.NextWithContext(ctx) 3070 if err != nil { 3071 iter.i-- 3072 return err 3073 } 3074 iter.i = 0 3075 return nil 3076} 3077 3078// Next advances to the next value. If there was an error making 3079// the request the iterator does not advance and the error is returned. 3080// Deprecated: Use NextWithContext() instead. 3081func (iter *WorkspaceListResultIterator) Next() error { 3082 return iter.NextWithContext(context.Background()) 3083} 3084 3085// NotDone returns true if the enumeration should be started or is not yet complete. 3086func (iter WorkspaceListResultIterator) NotDone() bool { 3087 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 3088} 3089 3090// Response returns the raw server response from the last page request. 3091func (iter WorkspaceListResultIterator) Response() WorkspaceListResult { 3092 return iter.page.Response() 3093} 3094 3095// Value returns the current value or a zero-initialized value if the 3096// iterator has advanced beyond the end of the collection. 3097func (iter WorkspaceListResultIterator) Value() Workspace { 3098 if !iter.page.NotDone() { 3099 return Workspace{} 3100 } 3101 return iter.page.Values()[iter.i] 3102} 3103 3104// Creates a new instance of the WorkspaceListResultIterator type. 3105func NewWorkspaceListResultIterator(page WorkspaceListResultPage) WorkspaceListResultIterator { 3106 return WorkspaceListResultIterator{page: page} 3107} 3108 3109// IsEmpty returns true if the ListResult contains no values. 3110func (wlr WorkspaceListResult) IsEmpty() bool { 3111 return wlr.Value == nil || len(*wlr.Value) == 0 3112} 3113 3114// workspaceListResultPreparer prepares a request to retrieve the next set of results. 3115// It returns nil if no more results exist. 3116func (wlr WorkspaceListResult) workspaceListResultPreparer(ctx context.Context) (*http.Request, error) { 3117 if wlr.NextLink == nil || len(to.String(wlr.NextLink)) < 1 { 3118 return nil, nil 3119 } 3120 return autorest.Prepare((&http.Request{}).WithContext(ctx), 3121 autorest.AsJSON(), 3122 autorest.AsGet(), 3123 autorest.WithBaseURL(to.String(wlr.NextLink))) 3124} 3125 3126// WorkspaceListResultPage contains a page of Workspace values. 3127type WorkspaceListResultPage struct { 3128 fn func(context.Context, WorkspaceListResult) (WorkspaceListResult, error) 3129 wlr WorkspaceListResult 3130} 3131 3132// NextWithContext advances to the next page of values. If there was an error making 3133// the request the page does not advance and the error is returned. 3134func (page *WorkspaceListResultPage) NextWithContext(ctx context.Context) (err error) { 3135 if tracing.IsEnabled() { 3136 ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListResultPage.NextWithContext") 3137 defer func() { 3138 sc := -1 3139 if page.Response().Response.Response != nil { 3140 sc = page.Response().Response.Response.StatusCode 3141 } 3142 tracing.EndSpan(ctx, sc, err) 3143 }() 3144 } 3145 next, err := page.fn(ctx, page.wlr) 3146 if err != nil { 3147 return err 3148 } 3149 page.wlr = next 3150 return nil 3151} 3152 3153// Next advances to the next page of values. If there was an error making 3154// the request the page does not advance and the error is returned. 3155// Deprecated: Use NextWithContext() instead. 3156func (page *WorkspaceListResultPage) Next() error { 3157 return page.NextWithContext(context.Background()) 3158} 3159 3160// NotDone returns true if the page enumeration should be started or is not yet complete. 3161func (page WorkspaceListResultPage) NotDone() bool { 3162 return !page.wlr.IsEmpty() 3163} 3164 3165// Response returns the raw server response from the last page request. 3166func (page WorkspaceListResultPage) Response() WorkspaceListResult { 3167 return page.wlr 3168} 3169 3170// Values returns the slice of values for the current page or nil if there are no values. 3171func (page WorkspaceListResultPage) Values() []Workspace { 3172 if page.wlr.IsEmpty() { 3173 return nil 3174 } 3175 return *page.wlr.Value 3176} 3177 3178// Creates a new instance of the WorkspaceListResultPage type. 3179func NewWorkspaceListResultPage(getNextPage func(context.Context, WorkspaceListResult) (WorkspaceListResult, error)) WorkspaceListResultPage { 3180 return WorkspaceListResultPage{fn: getNextPage} 3181} 3182 3183// WorkspaceProperties workspace specific properties. 3184type WorkspaceProperties struct { 3185 // CreationTime - READ-ONLY; Time when the Workspace was created. 3186 CreationTime *date.Time `json:"creationTime,omitempty"` 3187 // ProvisioningState - READ-ONLY; The provisioned state of the Workspace. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateDeleting' 3188 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 3189 // ProvisioningStateTransitionTime - READ-ONLY; The time at which the workspace entered its current provisioning state. 3190 ProvisioningStateTransitionTime *date.Time `json:"provisioningStateTransitionTime,omitempty"` 3191} 3192 3193// WorkspacesCreateFuture an abstraction for monitoring and retrieving the results of a long-running 3194// operation. 3195type WorkspacesCreateFuture struct { 3196 azure.Future 3197} 3198 3199// Result returns the result of the asynchronous operation. 3200// If the operation has not completed it will return an error. 3201func (future *WorkspacesCreateFuture) Result(client WorkspacesClient) (w Workspace, err error) { 3202 var done bool 3203 done, err = future.DoneWithContext(context.Background(), client) 3204 if err != nil { 3205 err = autorest.NewErrorWithError(err, "batchai.WorkspacesCreateFuture", "Result", future.Response(), "Polling failure") 3206 return 3207 } 3208 if !done { 3209 err = azure.NewAsyncOpIncompleteError("batchai.WorkspacesCreateFuture") 3210 return 3211 } 3212 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 3213 if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { 3214 w, err = client.CreateResponder(w.Response.Response) 3215 if err != nil { 3216 err = autorest.NewErrorWithError(err, "batchai.WorkspacesCreateFuture", "Result", w.Response.Response, "Failure responding to request") 3217 } 3218 } 3219 return 3220} 3221 3222// WorkspacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 3223// operation. 3224type WorkspacesDeleteFuture struct { 3225 azure.Future 3226} 3227 3228// Result returns the result of the asynchronous operation. 3229// If the operation has not completed it will return an error. 3230func (future *WorkspacesDeleteFuture) Result(client WorkspacesClient) (ar autorest.Response, err error) { 3231 var done bool 3232 done, err = future.DoneWithContext(context.Background(), client) 3233 if err != nil { 3234 err = autorest.NewErrorWithError(err, "batchai.WorkspacesDeleteFuture", "Result", future.Response(), "Polling failure") 3235 return 3236 } 3237 if !done { 3238 err = azure.NewAsyncOpIncompleteError("batchai.WorkspacesDeleteFuture") 3239 return 3240 } 3241 ar.Response = future.Response() 3242 return 3243} 3244 3245// WorkspaceUpdateParameters workspace update parameters. 3246type WorkspaceUpdateParameters struct { 3247 // Tags - The user specified tags associated with the Workspace. 3248 Tags map[string]*string `json:"tags"` 3249} 3250 3251// MarshalJSON is the custom marshaler for WorkspaceUpdateParameters. 3252func (wup WorkspaceUpdateParameters) MarshalJSON() ([]byte, error) { 3253 objectMap := make(map[string]interface{}) 3254 if wup.Tags != nil { 3255 objectMap["tags"] = wup.Tags 3256 } 3257 return json.Marshal(objectMap) 3258} 3259