1package machinelearningservices 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "encoding/json" 12 "github.com/Azure/go-autorest/autorest" 13 "github.com/Azure/go-autorest/autorest/azure" 14 "github.com/Azure/go-autorest/autorest/date" 15 "github.com/Azure/go-autorest/autorest/to" 16 "github.com/Azure/go-autorest/tracing" 17 "net/http" 18) 19 20// The package's fully qualified name. 21const fqdn = "github.com/Azure/azure-sdk-for-go/services/machinelearningservices/mgmt/2018-11-19/machinelearningservices" 22 23// AKS a Machine Learning compute based on AKS. 24type AKS struct { 25 // Properties - AKS properties 26 Properties *AKSProperties `json:"properties,omitempty"` 27 // ComputeLocation - Location for the underlying compute 28 ComputeLocation *string `json:"computeLocation,omitempty"` 29 // ProvisioningState - READ-ONLY; The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Possible values include: 'Unknown', 'Updating', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 30 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 31 // Description - The description of the Machine Learning compute. 32 Description *string `json:"description,omitempty"` 33 // CreatedOn - READ-ONLY; The date and time when the compute was created. 34 CreatedOn *date.Time `json:"createdOn,omitempty"` 35 // ModifiedOn - READ-ONLY; The date and time when the compute was last modified. 36 ModifiedOn *date.Time `json:"modifiedOn,omitempty"` 37 // ResourceID - ARM resource id of the underlying compute 38 ResourceID *string `json:"resourceId,omitempty"` 39 // ProvisioningErrors - READ-ONLY; Errors during provisioning 40 ProvisioningErrors *[]Error `json:"provisioningErrors,omitempty"` 41 // IsAttachedCompute - READ-ONLY; Indicating whether the compute was provisioned by user and brought from outside if true, or machine learning service provisioned it if false. 42 IsAttachedCompute *bool `json:"isAttachedCompute,omitempty"` 43 // ComputeType - Possible values include: 'ComputeTypeCompute', 'ComputeTypeAKS1', 'ComputeTypeAmlCompute1', 'ComputeTypeVirtualMachine1', 'ComputeTypeHDInsight1', 'ComputeTypeDataFactory1', 'ComputeTypeDatabricks1', 'ComputeTypeDataLakeAnalytics1' 44 ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` 45} 46 47// MarshalJSON is the custom marshaler for AKS. 48func (a AKS) MarshalJSON() ([]byte, error) { 49 a.ComputeType = ComputeTypeAKS1 50 objectMap := make(map[string]interface{}) 51 if a.Properties != nil { 52 objectMap["properties"] = a.Properties 53 } 54 if a.ComputeLocation != nil { 55 objectMap["computeLocation"] = a.ComputeLocation 56 } 57 if a.Description != nil { 58 objectMap["description"] = a.Description 59 } 60 if a.ResourceID != nil { 61 objectMap["resourceId"] = a.ResourceID 62 } 63 if a.ComputeType != "" { 64 objectMap["computeType"] = a.ComputeType 65 } 66 return json.Marshal(objectMap) 67} 68 69// AsAKS is the BasicCompute implementation for AKS. 70func (a AKS) AsAKS() (*AKS, bool) { 71 return &a, true 72} 73 74// AsAmlCompute is the BasicCompute implementation for AKS. 75func (a AKS) AsAmlCompute() (*AmlCompute, bool) { 76 return nil, false 77} 78 79// AsVirtualMachine is the BasicCompute implementation for AKS. 80func (a AKS) AsVirtualMachine() (*VirtualMachine, bool) { 81 return nil, false 82} 83 84// AsHDInsight is the BasicCompute implementation for AKS. 85func (a AKS) AsHDInsight() (*HDInsight, bool) { 86 return nil, false 87} 88 89// AsDataFactory is the BasicCompute implementation for AKS. 90func (a AKS) AsDataFactory() (*DataFactory, bool) { 91 return nil, false 92} 93 94// AsDatabricks is the BasicCompute implementation for AKS. 95func (a AKS) AsDatabricks() (*Databricks, bool) { 96 return nil, false 97} 98 99// AsDataLakeAnalytics is the BasicCompute implementation for AKS. 100func (a AKS) AsDataLakeAnalytics() (*DataLakeAnalytics, bool) { 101 return nil, false 102} 103 104// AsCompute is the BasicCompute implementation for AKS. 105func (a AKS) AsCompute() (*Compute, bool) { 106 return nil, false 107} 108 109// AsBasicCompute is the BasicCompute implementation for AKS. 110func (a AKS) AsBasicCompute() (BasicCompute, bool) { 111 return &a, true 112} 113 114// AksComputeSecrets secrets related to a Machine Learning compute based on AKS. 115type AksComputeSecrets struct { 116 // UserKubeConfig - Content of kubeconfig file that can be used to connect to the Kubernetes cluster. 117 UserKubeConfig *string `json:"userKubeConfig,omitempty"` 118 // AdminKubeConfig - Content of kubeconfig file that can be used to connect to the Kubernetes cluster. 119 AdminKubeConfig *string `json:"adminKubeConfig,omitempty"` 120 // ImagePullSecretName - Image registry pull secret. 121 ImagePullSecretName *string `json:"imagePullSecretName,omitempty"` 122 // ComputeType - Possible values include: 'ComputeTypeBasicComputeSecretsComputeTypeComputeSecrets', 'ComputeTypeBasicComputeSecretsComputeTypeAKS', 'ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine', 'ComputeTypeBasicComputeSecretsComputeTypeDatabricks' 123 ComputeType ComputeTypeBasicComputeSecrets `json:"computeType,omitempty"` 124} 125 126// MarshalJSON is the custom marshaler for AksComputeSecrets. 127func (acs AksComputeSecrets) MarshalJSON() ([]byte, error) { 128 acs.ComputeType = ComputeTypeBasicComputeSecretsComputeTypeAKS 129 objectMap := make(map[string]interface{}) 130 if acs.UserKubeConfig != nil { 131 objectMap["userKubeConfig"] = acs.UserKubeConfig 132 } 133 if acs.AdminKubeConfig != nil { 134 objectMap["adminKubeConfig"] = acs.AdminKubeConfig 135 } 136 if acs.ImagePullSecretName != nil { 137 objectMap["imagePullSecretName"] = acs.ImagePullSecretName 138 } 139 if acs.ComputeType != "" { 140 objectMap["computeType"] = acs.ComputeType 141 } 142 return json.Marshal(objectMap) 143} 144 145// AsAksComputeSecrets is the BasicComputeSecrets implementation for AksComputeSecrets. 146func (acs AksComputeSecrets) AsAksComputeSecrets() (*AksComputeSecrets, bool) { 147 return &acs, true 148} 149 150// AsVirtualMachineSecrets is the BasicComputeSecrets implementation for AksComputeSecrets. 151func (acs AksComputeSecrets) AsVirtualMachineSecrets() (*VirtualMachineSecrets, bool) { 152 return nil, false 153} 154 155// AsDatabricksComputeSecrets is the BasicComputeSecrets implementation for AksComputeSecrets. 156func (acs AksComputeSecrets) AsDatabricksComputeSecrets() (*DatabricksComputeSecrets, bool) { 157 return nil, false 158} 159 160// AsComputeSecrets is the BasicComputeSecrets implementation for AksComputeSecrets. 161func (acs AksComputeSecrets) AsComputeSecrets() (*ComputeSecrets, bool) { 162 return nil, false 163} 164 165// AsBasicComputeSecrets is the BasicComputeSecrets implementation for AksComputeSecrets. 166func (acs AksComputeSecrets) AsBasicComputeSecrets() (BasicComputeSecrets, bool) { 167 return &acs, true 168} 169 170// AksNetworkingConfiguration advance configuration for AKS networking 171type AksNetworkingConfiguration struct { 172 // SubnetID - Virtual network subnet resource ID the compute nodes belong to 173 SubnetID *string `json:"subnetId,omitempty"` 174 // ServiceCidr - A CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges. 175 ServiceCidr *string `json:"serviceCidr,omitempty"` 176 // DNSServiceIP - An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr. 177 DNSServiceIP *string `json:"dnsServiceIP,omitempty"` 178 // DockerBridgeCidr - A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. 179 DockerBridgeCidr *string `json:"dockerBridgeCidr,omitempty"` 180} 181 182// AKSProperties AKS properties 183type AKSProperties struct { 184 // ClusterFqdn - Cluster full qualified domain name 185 ClusterFqdn *string `json:"clusterFqdn,omitempty"` 186 // SystemServices - READ-ONLY; System services 187 SystemServices *[]SystemService `json:"systemServices,omitempty"` 188 // AgentCount - Number of agents 189 AgentCount *int32 `json:"agentCount,omitempty"` 190 // AgentVMSize - Agent virtual machine size 191 AgentVMSize *string `json:"agentVMSize,omitempty"` 192 // SslConfiguration - SSL configuration 193 SslConfiguration *SslConfiguration `json:"sslConfiguration,omitempty"` 194 // AksNetworkingConfiguration - AKS networking configuration for vnet 195 AksNetworkingConfiguration *AksNetworkingConfiguration `json:"aksNetworkingConfiguration,omitempty"` 196} 197 198// MarshalJSON is the custom marshaler for AKSProperties. 199func (a AKSProperties) MarshalJSON() ([]byte, error) { 200 objectMap := make(map[string]interface{}) 201 if a.ClusterFqdn != nil { 202 objectMap["clusterFqdn"] = a.ClusterFqdn 203 } 204 if a.AgentCount != nil { 205 objectMap["agentCount"] = a.AgentCount 206 } 207 if a.AgentVMSize != nil { 208 objectMap["agentVMSize"] = a.AgentVMSize 209 } 210 if a.SslConfiguration != nil { 211 objectMap["sslConfiguration"] = a.SslConfiguration 212 } 213 if a.AksNetworkingConfiguration != nil { 214 objectMap["aksNetworkingConfiguration"] = a.AksNetworkingConfiguration 215 } 216 return json.Marshal(objectMap) 217} 218 219// AmlCompute an Azure Machine Learning compute. 220type AmlCompute struct { 221 // Properties - AML Compute properties 222 Properties *AmlComputeProperties `json:"properties,omitempty"` 223 // ComputeLocation - Location for the underlying compute 224 ComputeLocation *string `json:"computeLocation,omitempty"` 225 // ProvisioningState - READ-ONLY; The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Possible values include: 'Unknown', 'Updating', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 226 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 227 // Description - The description of the Machine Learning compute. 228 Description *string `json:"description,omitempty"` 229 // CreatedOn - READ-ONLY; The date and time when the compute was created. 230 CreatedOn *date.Time `json:"createdOn,omitempty"` 231 // ModifiedOn - READ-ONLY; The date and time when the compute was last modified. 232 ModifiedOn *date.Time `json:"modifiedOn,omitempty"` 233 // ResourceID - ARM resource id of the underlying compute 234 ResourceID *string `json:"resourceId,omitempty"` 235 // ProvisioningErrors - READ-ONLY; Errors during provisioning 236 ProvisioningErrors *[]Error `json:"provisioningErrors,omitempty"` 237 // IsAttachedCompute - READ-ONLY; Indicating whether the compute was provisioned by user and brought from outside if true, or machine learning service provisioned it if false. 238 IsAttachedCompute *bool `json:"isAttachedCompute,omitempty"` 239 // ComputeType - Possible values include: 'ComputeTypeCompute', 'ComputeTypeAKS1', 'ComputeTypeAmlCompute1', 'ComputeTypeVirtualMachine1', 'ComputeTypeHDInsight1', 'ComputeTypeDataFactory1', 'ComputeTypeDatabricks1', 'ComputeTypeDataLakeAnalytics1' 240 ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` 241} 242 243// MarshalJSON is the custom marshaler for AmlCompute. 244func (ac AmlCompute) MarshalJSON() ([]byte, error) { 245 ac.ComputeType = ComputeTypeAmlCompute1 246 objectMap := make(map[string]interface{}) 247 if ac.Properties != nil { 248 objectMap["properties"] = ac.Properties 249 } 250 if ac.ComputeLocation != nil { 251 objectMap["computeLocation"] = ac.ComputeLocation 252 } 253 if ac.Description != nil { 254 objectMap["description"] = ac.Description 255 } 256 if ac.ResourceID != nil { 257 objectMap["resourceId"] = ac.ResourceID 258 } 259 if ac.ComputeType != "" { 260 objectMap["computeType"] = ac.ComputeType 261 } 262 return json.Marshal(objectMap) 263} 264 265// AsAKS is the BasicCompute implementation for AmlCompute. 266func (ac AmlCompute) AsAKS() (*AKS, bool) { 267 return nil, false 268} 269 270// AsAmlCompute is the BasicCompute implementation for AmlCompute. 271func (ac AmlCompute) AsAmlCompute() (*AmlCompute, bool) { 272 return &ac, true 273} 274 275// AsVirtualMachine is the BasicCompute implementation for AmlCompute. 276func (ac AmlCompute) AsVirtualMachine() (*VirtualMachine, bool) { 277 return nil, false 278} 279 280// AsHDInsight is the BasicCompute implementation for AmlCompute. 281func (ac AmlCompute) AsHDInsight() (*HDInsight, bool) { 282 return nil, false 283} 284 285// AsDataFactory is the BasicCompute implementation for AmlCompute. 286func (ac AmlCompute) AsDataFactory() (*DataFactory, bool) { 287 return nil, false 288} 289 290// AsDatabricks is the BasicCompute implementation for AmlCompute. 291func (ac AmlCompute) AsDatabricks() (*Databricks, bool) { 292 return nil, false 293} 294 295// AsDataLakeAnalytics is the BasicCompute implementation for AmlCompute. 296func (ac AmlCompute) AsDataLakeAnalytics() (*DataLakeAnalytics, bool) { 297 return nil, false 298} 299 300// AsCompute is the BasicCompute implementation for AmlCompute. 301func (ac AmlCompute) AsCompute() (*Compute, bool) { 302 return nil, false 303} 304 305// AsBasicCompute is the BasicCompute implementation for AmlCompute. 306func (ac AmlCompute) AsBasicCompute() (BasicCompute, bool) { 307 return &ac, true 308} 309 310// AmlComputeNodeInformation compute node information related to a AmlCompute. 311type AmlComputeNodeInformation struct { 312 // NodeID - READ-ONLY; ID of the compute node. 313 NodeID *string `json:"nodeId,omitempty"` 314 // IPAddress - READ-ONLY; Public IP address of the compute node. 315 IPAddress *string `json:"ipAddress,omitempty"` 316 // Port - READ-ONLY; SSH port number of the node. 317 Port *float64 `json:"port,omitempty"` 318} 319 320// MarshalJSON is the custom marshaler for AmlComputeNodeInformation. 321func (acni AmlComputeNodeInformation) MarshalJSON() ([]byte, error) { 322 objectMap := make(map[string]interface{}) 323 return json.Marshal(objectMap) 324} 325 326// AmlComputeNodesInformation compute node information related to a AmlCompute. 327type AmlComputeNodesInformation struct { 328 autorest.Response `json:"-"` 329 // Nodes - READ-ONLY; The collection of returned AmlCompute nodes details. 330 Nodes *[]AmlComputeNodeInformation `json:"nodes,omitempty"` 331 // NextLink - READ-ONLY; The continuation token. 332 NextLink *string `json:"nextLink,omitempty"` 333 // ComputeType - Possible values include: 'ComputeTypeBasicComputeNodesInformationComputeTypeComputeNodesInformation', 'ComputeTypeBasicComputeNodesInformationComputeTypeAmlCompute' 334 ComputeType ComputeTypeBasicComputeNodesInformation `json:"computeType,omitempty"` 335} 336 337// MarshalJSON is the custom marshaler for AmlComputeNodesInformation. 338func (acni AmlComputeNodesInformation) MarshalJSON() ([]byte, error) { 339 acni.ComputeType = ComputeTypeBasicComputeNodesInformationComputeTypeAmlCompute 340 objectMap := make(map[string]interface{}) 341 if acni.ComputeType != "" { 342 objectMap["computeType"] = acni.ComputeType 343 } 344 return json.Marshal(objectMap) 345} 346 347// AsAmlComputeNodesInformation is the BasicComputeNodesInformation implementation for AmlComputeNodesInformation. 348func (acni AmlComputeNodesInformation) AsAmlComputeNodesInformation() (*AmlComputeNodesInformation, bool) { 349 return &acni, true 350} 351 352// AsComputeNodesInformation is the BasicComputeNodesInformation implementation for AmlComputeNodesInformation. 353func (acni AmlComputeNodesInformation) AsComputeNodesInformation() (*ComputeNodesInformation, bool) { 354 return nil, false 355} 356 357// AsBasicComputeNodesInformation is the BasicComputeNodesInformation implementation for AmlComputeNodesInformation. 358func (acni AmlComputeNodesInformation) AsBasicComputeNodesInformation() (BasicComputeNodesInformation, bool) { 359 return &acni, true 360} 361 362// AmlComputeNodesInformationIterator provides access to a complete listing of AmlComputeNodeInformation 363// values. 364type AmlComputeNodesInformationIterator struct { 365 i int 366 page AmlComputeNodesInformationPage 367} 368 369// NextWithContext advances to the next value. If there was an error making 370// the request the iterator does not advance and the error is returned. 371func (iter *AmlComputeNodesInformationIterator) NextWithContext(ctx context.Context) (err error) { 372 if tracing.IsEnabled() { 373 ctx = tracing.StartSpan(ctx, fqdn+"/AmlComputeNodesInformationIterator.NextWithContext") 374 defer func() { 375 sc := -1 376 if iter.Response().Response.Response != nil { 377 sc = iter.Response().Response.Response.StatusCode 378 } 379 tracing.EndSpan(ctx, sc, err) 380 }() 381 } 382 iter.i++ 383 if iter.i < len(iter.page.Values()) { 384 return nil 385 } 386 err = iter.page.NextWithContext(ctx) 387 if err != nil { 388 iter.i-- 389 return err 390 } 391 iter.i = 0 392 return nil 393} 394 395// Next advances to the next value. If there was an error making 396// the request the iterator does not advance and the error is returned. 397// Deprecated: Use NextWithContext() instead. 398func (iter *AmlComputeNodesInformationIterator) Next() error { 399 return iter.NextWithContext(context.Background()) 400} 401 402// NotDone returns true if the enumeration should be started or is not yet complete. 403func (iter AmlComputeNodesInformationIterator) NotDone() bool { 404 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 405} 406 407// Response returns the raw server response from the last page request. 408func (iter AmlComputeNodesInformationIterator) Response() AmlComputeNodesInformation { 409 return iter.page.Response() 410} 411 412// Value returns the current value or a zero-initialized value if the 413// iterator has advanced beyond the end of the collection. 414func (iter AmlComputeNodesInformationIterator) Value() AmlComputeNodeInformation { 415 if !iter.page.NotDone() { 416 return AmlComputeNodeInformation{} 417 } 418 return iter.page.Values()[iter.i] 419} 420 421// Creates a new instance of the AmlComputeNodesInformationIterator type. 422func NewAmlComputeNodesInformationIterator(page AmlComputeNodesInformationPage) AmlComputeNodesInformationIterator { 423 return AmlComputeNodesInformationIterator{page: page} 424} 425 426// IsEmpty returns true if the ListResult contains no values. 427func (acni AmlComputeNodesInformation) IsEmpty() bool { 428 return acni.Nodes == nil || len(*acni.Nodes) == 0 429} 430 431// hasNextLink returns true if the NextLink is not empty. 432func (acni AmlComputeNodesInformation) hasNextLink() bool { 433 return acni.NextLink != nil && len(*acni.NextLink) != 0 434} 435 436// amlComputeNodesInformationPreparer prepares a request to retrieve the next set of results. 437// It returns nil if no more results exist. 438func (acni AmlComputeNodesInformation) amlComputeNodesInformationPreparer(ctx context.Context) (*http.Request, error) { 439 if !acni.hasNextLink() { 440 return nil, nil 441 } 442 return autorest.Prepare((&http.Request{}).WithContext(ctx), 443 autorest.AsJSON(), 444 autorest.AsGet(), 445 autorest.WithBaseURL(to.String(acni.NextLink))) 446} 447 448// AmlComputeNodesInformationPage contains a page of AmlComputeNodeInformation values. 449type AmlComputeNodesInformationPage struct { 450 fn func(context.Context, AmlComputeNodesInformation) (AmlComputeNodesInformation, error) 451 acni AmlComputeNodesInformation 452} 453 454// NextWithContext advances to the next page of values. If there was an error making 455// the request the page does not advance and the error is returned. 456func (page *AmlComputeNodesInformationPage) NextWithContext(ctx context.Context) (err error) { 457 if tracing.IsEnabled() { 458 ctx = tracing.StartSpan(ctx, fqdn+"/AmlComputeNodesInformationPage.NextWithContext") 459 defer func() { 460 sc := -1 461 if page.Response().Response.Response != nil { 462 sc = page.Response().Response.Response.StatusCode 463 } 464 tracing.EndSpan(ctx, sc, err) 465 }() 466 } 467 for { 468 next, err := page.fn(ctx, page.acni) 469 if err != nil { 470 return err 471 } 472 page.acni = next 473 if !next.hasNextLink() || !next.IsEmpty() { 474 break 475 } 476 } 477 return nil 478} 479 480// Next advances to the next page of values. If there was an error making 481// the request the page does not advance and the error is returned. 482// Deprecated: Use NextWithContext() instead. 483func (page *AmlComputeNodesInformationPage) Next() error { 484 return page.NextWithContext(context.Background()) 485} 486 487// NotDone returns true if the page enumeration should be started or is not yet complete. 488func (page AmlComputeNodesInformationPage) NotDone() bool { 489 return !page.acni.IsEmpty() 490} 491 492// Response returns the raw server response from the last page request. 493func (page AmlComputeNodesInformationPage) Response() AmlComputeNodesInformation { 494 return page.acni 495} 496 497// Values returns the slice of values for the current page or nil if there are no values. 498func (page AmlComputeNodesInformationPage) Values() []AmlComputeNodeInformation { 499 if page.acni.IsEmpty() { 500 return nil 501 } 502 return *page.acni.Nodes 503} 504 505// Creates a new instance of the AmlComputeNodesInformationPage type. 506func NewAmlComputeNodesInformationPage(cur AmlComputeNodesInformation, getNextPage func(context.Context, AmlComputeNodesInformation) (AmlComputeNodesInformation, error)) AmlComputeNodesInformationPage { 507 return AmlComputeNodesInformationPage{ 508 fn: getNextPage, 509 acni: cur, 510 } 511} 512 513// AmlComputeProperties AML Compute properties 514type AmlComputeProperties struct { 515 // VMSize - Virtual Machine Size 516 VMSize *string `json:"vmSize,omitempty"` 517 // VMPriority - Virtual Machine priority. Possible values include: 'Dedicated', 'LowPriority' 518 VMPriority VMPriority `json:"vmPriority,omitempty"` 519 // ScaleSettings - Scale settings for AML Compute 520 ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` 521 // UserAccountCredentials - Credentials for an administrator user account that will be created on each compute node. 522 UserAccountCredentials *UserAccountCredentials `json:"userAccountCredentials,omitempty"` 523 // Subnet - Virtual network subnet resource ID the compute nodes belong to. 524 Subnet *ResourceID `json:"subnet,omitempty"` 525 // AllocationState - READ-ONLY; Allocation state of the compute. Possible values are: steady - Indicates that the compute is not resizing. There are no changes to the number of compute nodes in the compute in progress. A compute enters this state when it is created and when no operations are being performed on the compute to change the number of compute nodes. resizing - Indicates that the compute is resizing; that is, compute nodes are being added to or removed from the compute. Possible values include: 'Steady', 'Resizing' 526 AllocationState AllocationState `json:"allocationState,omitempty"` 527 // AllocationStateTransitionTime - READ-ONLY; The time at which the compute entered its current allocation state. 528 AllocationStateTransitionTime *date.Time `json:"allocationStateTransitionTime,omitempty"` 529 // Errors - READ-ONLY; Collection of errors encountered by various compute nodes during node setup. 530 Errors *[]Error `json:"errors,omitempty"` 531 // CurrentNodeCount - READ-ONLY; The number of compute nodes currently assigned to the compute. 532 CurrentNodeCount *int32 `json:"currentNodeCount,omitempty"` 533 // TargetNodeCount - READ-ONLY; The target number of compute nodes for the compute. If the allocationState is resizing, this property denotes the target node count for the ongoing resize operation. If the allocationState is steady, this property denotes the target node count for the previous resize operation. 534 TargetNodeCount *int32 `json:"targetNodeCount,omitempty"` 535 // NodeStateCounts - READ-ONLY; Counts of various node states on the compute. 536 NodeStateCounts *NodeStateCounts `json:"nodeStateCounts,omitempty"` 537} 538 539// MarshalJSON is the custom marshaler for AmlComputeProperties. 540func (ac AmlComputeProperties) MarshalJSON() ([]byte, error) { 541 objectMap := make(map[string]interface{}) 542 if ac.VMSize != nil { 543 objectMap["vmSize"] = ac.VMSize 544 } 545 if ac.VMPriority != "" { 546 objectMap["vmPriority"] = ac.VMPriority 547 } 548 if ac.ScaleSettings != nil { 549 objectMap["scaleSettings"] = ac.ScaleSettings 550 } 551 if ac.UserAccountCredentials != nil { 552 objectMap["userAccountCredentials"] = ac.UserAccountCredentials 553 } 554 if ac.Subnet != nil { 555 objectMap["subnet"] = ac.Subnet 556 } 557 return json.Marshal(objectMap) 558} 559 560// ClusterUpdateParameters amlCompute update parameters. 561type ClusterUpdateParameters struct { 562 // ClusterUpdateProperties - The properties of the amlCompute. 563 *ClusterUpdateProperties `json:"properties,omitempty"` 564} 565 566// MarshalJSON is the custom marshaler for ClusterUpdateParameters. 567func (cup ClusterUpdateParameters) MarshalJSON() ([]byte, error) { 568 objectMap := make(map[string]interface{}) 569 if cup.ClusterUpdateProperties != nil { 570 objectMap["properties"] = cup.ClusterUpdateProperties 571 } 572 return json.Marshal(objectMap) 573} 574 575// UnmarshalJSON is the custom unmarshaler for ClusterUpdateParameters struct. 576func (cup *ClusterUpdateParameters) UnmarshalJSON(body []byte) error { 577 var m map[string]*json.RawMessage 578 err := json.Unmarshal(body, &m) 579 if err != nil { 580 return err 581 } 582 for k, v := range m { 583 switch k { 584 case "properties": 585 if v != nil { 586 var clusterUpdateProperties ClusterUpdateProperties 587 err = json.Unmarshal(*v, &clusterUpdateProperties) 588 if err != nil { 589 return err 590 } 591 cup.ClusterUpdateProperties = &clusterUpdateProperties 592 } 593 } 594 } 595 596 return nil 597} 598 599// ClusterUpdateProperties the properties of a amlCompute that need to be updated. 600type ClusterUpdateProperties struct { 601 // ScaleSettings - Desired scale settings for the amlCompute. 602 ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` 603} 604 605// BasicCompute machine Learning compute object. 606type BasicCompute interface { 607 AsAKS() (*AKS, bool) 608 AsAmlCompute() (*AmlCompute, bool) 609 AsVirtualMachine() (*VirtualMachine, bool) 610 AsHDInsight() (*HDInsight, bool) 611 AsDataFactory() (*DataFactory, bool) 612 AsDatabricks() (*Databricks, bool) 613 AsDataLakeAnalytics() (*DataLakeAnalytics, bool) 614 AsCompute() (*Compute, bool) 615} 616 617// Compute machine Learning compute object. 618type Compute struct { 619 // ComputeLocation - Location for the underlying compute 620 ComputeLocation *string `json:"computeLocation,omitempty"` 621 // ProvisioningState - READ-ONLY; The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Possible values include: 'Unknown', 'Updating', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 622 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 623 // Description - The description of the Machine Learning compute. 624 Description *string `json:"description,omitempty"` 625 // CreatedOn - READ-ONLY; The date and time when the compute was created. 626 CreatedOn *date.Time `json:"createdOn,omitempty"` 627 // ModifiedOn - READ-ONLY; The date and time when the compute was last modified. 628 ModifiedOn *date.Time `json:"modifiedOn,omitempty"` 629 // ResourceID - ARM resource id of the underlying compute 630 ResourceID *string `json:"resourceId,omitempty"` 631 // ProvisioningErrors - READ-ONLY; Errors during provisioning 632 ProvisioningErrors *[]Error `json:"provisioningErrors,omitempty"` 633 // IsAttachedCompute - READ-ONLY; Indicating whether the compute was provisioned by user and brought from outside if true, or machine learning service provisioned it if false. 634 IsAttachedCompute *bool `json:"isAttachedCompute,omitempty"` 635 // ComputeType - Possible values include: 'ComputeTypeCompute', 'ComputeTypeAKS1', 'ComputeTypeAmlCompute1', 'ComputeTypeVirtualMachine1', 'ComputeTypeHDInsight1', 'ComputeTypeDataFactory1', 'ComputeTypeDatabricks1', 'ComputeTypeDataLakeAnalytics1' 636 ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` 637} 638 639func unmarshalBasicCompute(body []byte) (BasicCompute, error) { 640 var m map[string]interface{} 641 err := json.Unmarshal(body, &m) 642 if err != nil { 643 return nil, err 644 } 645 646 switch m["computeType"] { 647 case string(ComputeTypeAKS1): 648 var a AKS 649 err := json.Unmarshal(body, &a) 650 return a, err 651 case string(ComputeTypeAmlCompute1): 652 var ac AmlCompute 653 err := json.Unmarshal(body, &ac) 654 return ac, err 655 case string(ComputeTypeVirtualMachine1): 656 var VM VirtualMachine 657 err := json.Unmarshal(body, &VM) 658 return VM, err 659 case string(ComputeTypeHDInsight1): 660 var hi HDInsight 661 err := json.Unmarshal(body, &hi) 662 return hi, err 663 case string(ComputeTypeDataFactory1): 664 var df DataFactory 665 err := json.Unmarshal(body, &df) 666 return df, err 667 case string(ComputeTypeDatabricks1): 668 var d Databricks 669 err := json.Unmarshal(body, &d) 670 return d, err 671 case string(ComputeTypeDataLakeAnalytics1): 672 var dla DataLakeAnalytics 673 err := json.Unmarshal(body, &dla) 674 return dla, err 675 default: 676 var c Compute 677 err := json.Unmarshal(body, &c) 678 return c, err 679 } 680} 681func unmarshalBasicComputeArray(body []byte) ([]BasicCompute, error) { 682 var rawMessages []*json.RawMessage 683 err := json.Unmarshal(body, &rawMessages) 684 if err != nil { 685 return nil, err 686 } 687 688 cArray := make([]BasicCompute, len(rawMessages)) 689 690 for index, rawMessage := range rawMessages { 691 c, err := unmarshalBasicCompute(*rawMessage) 692 if err != nil { 693 return nil, err 694 } 695 cArray[index] = c 696 } 697 return cArray, nil 698} 699 700// MarshalJSON is the custom marshaler for Compute. 701func (c Compute) MarshalJSON() ([]byte, error) { 702 c.ComputeType = ComputeTypeCompute 703 objectMap := make(map[string]interface{}) 704 if c.ComputeLocation != nil { 705 objectMap["computeLocation"] = c.ComputeLocation 706 } 707 if c.Description != nil { 708 objectMap["description"] = c.Description 709 } 710 if c.ResourceID != nil { 711 objectMap["resourceId"] = c.ResourceID 712 } 713 if c.ComputeType != "" { 714 objectMap["computeType"] = c.ComputeType 715 } 716 return json.Marshal(objectMap) 717} 718 719// AsAKS is the BasicCompute implementation for Compute. 720func (c Compute) AsAKS() (*AKS, bool) { 721 return nil, false 722} 723 724// AsAmlCompute is the BasicCompute implementation for Compute. 725func (c Compute) AsAmlCompute() (*AmlCompute, bool) { 726 return nil, false 727} 728 729// AsVirtualMachine is the BasicCompute implementation for Compute. 730func (c Compute) AsVirtualMachine() (*VirtualMachine, bool) { 731 return nil, false 732} 733 734// AsHDInsight is the BasicCompute implementation for Compute. 735func (c Compute) AsHDInsight() (*HDInsight, bool) { 736 return nil, false 737} 738 739// AsDataFactory is the BasicCompute implementation for Compute. 740func (c Compute) AsDataFactory() (*DataFactory, bool) { 741 return nil, false 742} 743 744// AsDatabricks is the BasicCompute implementation for Compute. 745func (c Compute) AsDatabricks() (*Databricks, bool) { 746 return nil, false 747} 748 749// AsDataLakeAnalytics is the BasicCompute implementation for Compute. 750func (c Compute) AsDataLakeAnalytics() (*DataLakeAnalytics, bool) { 751 return nil, false 752} 753 754// AsCompute is the BasicCompute implementation for Compute. 755func (c Compute) AsCompute() (*Compute, bool) { 756 return &c, true 757} 758 759// AsBasicCompute is the BasicCompute implementation for Compute. 760func (c Compute) AsBasicCompute() (BasicCompute, bool) { 761 return &c, true 762} 763 764// BasicComputeNodesInformation compute nodes information related to a Machine Learning compute. Might differ for every 765// type of compute. 766type BasicComputeNodesInformation interface { 767 AsAmlComputeNodesInformation() (*AmlComputeNodesInformation, bool) 768 AsComputeNodesInformation() (*ComputeNodesInformation, bool) 769} 770 771// ComputeNodesInformation compute nodes information related to a Machine Learning compute. Might differ for 772// every type of compute. 773type ComputeNodesInformation struct { 774 // NextLink - READ-ONLY; The continuation token. 775 NextLink *string `json:"nextLink,omitempty"` 776 // ComputeType - Possible values include: 'ComputeTypeBasicComputeNodesInformationComputeTypeComputeNodesInformation', 'ComputeTypeBasicComputeNodesInformationComputeTypeAmlCompute' 777 ComputeType ComputeTypeBasicComputeNodesInformation `json:"computeType,omitempty"` 778} 779 780func unmarshalBasicComputeNodesInformation(body []byte) (BasicComputeNodesInformation, error) { 781 var m map[string]interface{} 782 err := json.Unmarshal(body, &m) 783 if err != nil { 784 return nil, err 785 } 786 787 switch m["computeType"] { 788 case string(ComputeTypeBasicComputeNodesInformationComputeTypeAmlCompute): 789 var acni AmlComputeNodesInformation 790 err := json.Unmarshal(body, &acni) 791 return acni, err 792 default: 793 var cni ComputeNodesInformation 794 err := json.Unmarshal(body, &cni) 795 return cni, err 796 } 797} 798func unmarshalBasicComputeNodesInformationArray(body []byte) ([]BasicComputeNodesInformation, error) { 799 var rawMessages []*json.RawMessage 800 err := json.Unmarshal(body, &rawMessages) 801 if err != nil { 802 return nil, err 803 } 804 805 cniArray := make([]BasicComputeNodesInformation, len(rawMessages)) 806 807 for index, rawMessage := range rawMessages { 808 cni, err := unmarshalBasicComputeNodesInformation(*rawMessage) 809 if err != nil { 810 return nil, err 811 } 812 cniArray[index] = cni 813 } 814 return cniArray, nil 815} 816 817// MarshalJSON is the custom marshaler for ComputeNodesInformation. 818func (cni ComputeNodesInformation) MarshalJSON() ([]byte, error) { 819 cni.ComputeType = ComputeTypeBasicComputeNodesInformationComputeTypeComputeNodesInformation 820 objectMap := make(map[string]interface{}) 821 if cni.ComputeType != "" { 822 objectMap["computeType"] = cni.ComputeType 823 } 824 return json.Marshal(objectMap) 825} 826 827// AsAmlComputeNodesInformation is the BasicComputeNodesInformation implementation for ComputeNodesInformation. 828func (cni ComputeNodesInformation) AsAmlComputeNodesInformation() (*AmlComputeNodesInformation, bool) { 829 return nil, false 830} 831 832// AsComputeNodesInformation is the BasicComputeNodesInformation implementation for ComputeNodesInformation. 833func (cni ComputeNodesInformation) AsComputeNodesInformation() (*ComputeNodesInformation, bool) { 834 return &cni, true 835} 836 837// AsBasicComputeNodesInformation is the BasicComputeNodesInformation implementation for ComputeNodesInformation. 838func (cni ComputeNodesInformation) AsBasicComputeNodesInformation() (BasicComputeNodesInformation, bool) { 839 return &cni, true 840} 841 842// ComputeResource machine Learning compute object wrapped into ARM resource envelope. 843type ComputeResource struct { 844 autorest.Response `json:"-"` 845 // Properties - Compute properties 846 Properties BasicCompute `json:"properties,omitempty"` 847 // ID - READ-ONLY; Specifies the resource ID. 848 ID *string `json:"id,omitempty"` 849 // Name - READ-ONLY; Specifies the name of the resource. 850 Name *string `json:"name,omitempty"` 851 // Identity - The identity of the resource. 852 Identity *Identity `json:"identity,omitempty"` 853 // Location - Specifies the location of the resource. 854 Location *string `json:"location,omitempty"` 855 // Type - READ-ONLY; Specifies the type of the resource. 856 Type *string `json:"type,omitempty"` 857 // Tags - Contains resource tags defined as key/value pairs. 858 Tags map[string]*string `json:"tags"` 859} 860 861// MarshalJSON is the custom marshaler for ComputeResource. 862func (cr ComputeResource) MarshalJSON() ([]byte, error) { 863 objectMap := make(map[string]interface{}) 864 objectMap["properties"] = cr.Properties 865 if cr.Identity != nil { 866 objectMap["identity"] = cr.Identity 867 } 868 if cr.Location != nil { 869 objectMap["location"] = cr.Location 870 } 871 if cr.Tags != nil { 872 objectMap["tags"] = cr.Tags 873 } 874 return json.Marshal(objectMap) 875} 876 877// UnmarshalJSON is the custom unmarshaler for ComputeResource struct. 878func (cr *ComputeResource) UnmarshalJSON(body []byte) error { 879 var m map[string]*json.RawMessage 880 err := json.Unmarshal(body, &m) 881 if err != nil { 882 return err 883 } 884 for k, v := range m { 885 switch k { 886 case "properties": 887 if v != nil { 888 properties, err := unmarshalBasicCompute(*v) 889 if err != nil { 890 return err 891 } 892 cr.Properties = properties 893 } 894 case "id": 895 if v != nil { 896 var ID string 897 err = json.Unmarshal(*v, &ID) 898 if err != nil { 899 return err 900 } 901 cr.ID = &ID 902 } 903 case "name": 904 if v != nil { 905 var name string 906 err = json.Unmarshal(*v, &name) 907 if err != nil { 908 return err 909 } 910 cr.Name = &name 911 } 912 case "identity": 913 if v != nil { 914 var identity Identity 915 err = json.Unmarshal(*v, &identity) 916 if err != nil { 917 return err 918 } 919 cr.Identity = &identity 920 } 921 case "location": 922 if v != nil { 923 var location string 924 err = json.Unmarshal(*v, &location) 925 if err != nil { 926 return err 927 } 928 cr.Location = &location 929 } 930 case "type": 931 if v != nil { 932 var typeVar string 933 err = json.Unmarshal(*v, &typeVar) 934 if err != nil { 935 return err 936 } 937 cr.Type = &typeVar 938 } 939 case "tags": 940 if v != nil { 941 var tags map[string]*string 942 err = json.Unmarshal(*v, &tags) 943 if err != nil { 944 return err 945 } 946 cr.Tags = tags 947 } 948 } 949 } 950 951 return nil 952} 953 954// BasicComputeSecrets secrets related to a Machine Learning compute. Might differ for every type of compute. 955type BasicComputeSecrets interface { 956 AsAksComputeSecrets() (*AksComputeSecrets, bool) 957 AsVirtualMachineSecrets() (*VirtualMachineSecrets, bool) 958 AsDatabricksComputeSecrets() (*DatabricksComputeSecrets, bool) 959 AsComputeSecrets() (*ComputeSecrets, bool) 960} 961 962// ComputeSecrets secrets related to a Machine Learning compute. Might differ for every type of compute. 963type ComputeSecrets struct { 964 autorest.Response `json:"-"` 965 // ComputeType - Possible values include: 'ComputeTypeBasicComputeSecretsComputeTypeComputeSecrets', 'ComputeTypeBasicComputeSecretsComputeTypeAKS', 'ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine', 'ComputeTypeBasicComputeSecretsComputeTypeDatabricks' 966 ComputeType ComputeTypeBasicComputeSecrets `json:"computeType,omitempty"` 967} 968 969func unmarshalBasicComputeSecrets(body []byte) (BasicComputeSecrets, error) { 970 var m map[string]interface{} 971 err := json.Unmarshal(body, &m) 972 if err != nil { 973 return nil, err 974 } 975 976 switch m["computeType"] { 977 case string(ComputeTypeBasicComputeSecretsComputeTypeAKS): 978 var acs AksComputeSecrets 979 err := json.Unmarshal(body, &acs) 980 return acs, err 981 case string(ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine): 982 var vms VirtualMachineSecrets 983 err := json.Unmarshal(body, &vms) 984 return vms, err 985 case string(ComputeTypeBasicComputeSecretsComputeTypeDatabricks): 986 var dcs DatabricksComputeSecrets 987 err := json.Unmarshal(body, &dcs) 988 return dcs, err 989 default: 990 var cs ComputeSecrets 991 err := json.Unmarshal(body, &cs) 992 return cs, err 993 } 994} 995func unmarshalBasicComputeSecretsArray(body []byte) ([]BasicComputeSecrets, error) { 996 var rawMessages []*json.RawMessage 997 err := json.Unmarshal(body, &rawMessages) 998 if err != nil { 999 return nil, err 1000 } 1001 1002 csArray := make([]BasicComputeSecrets, len(rawMessages)) 1003 1004 for index, rawMessage := range rawMessages { 1005 cs, err := unmarshalBasicComputeSecrets(*rawMessage) 1006 if err != nil { 1007 return nil, err 1008 } 1009 csArray[index] = cs 1010 } 1011 return csArray, nil 1012} 1013 1014// MarshalJSON is the custom marshaler for ComputeSecrets. 1015func (cs ComputeSecrets) MarshalJSON() ([]byte, error) { 1016 cs.ComputeType = ComputeTypeBasicComputeSecretsComputeTypeComputeSecrets 1017 objectMap := make(map[string]interface{}) 1018 if cs.ComputeType != "" { 1019 objectMap["computeType"] = cs.ComputeType 1020 } 1021 return json.Marshal(objectMap) 1022} 1023 1024// AsAksComputeSecrets is the BasicComputeSecrets implementation for ComputeSecrets. 1025func (cs ComputeSecrets) AsAksComputeSecrets() (*AksComputeSecrets, bool) { 1026 return nil, false 1027} 1028 1029// AsVirtualMachineSecrets is the BasicComputeSecrets implementation for ComputeSecrets. 1030func (cs ComputeSecrets) AsVirtualMachineSecrets() (*VirtualMachineSecrets, bool) { 1031 return nil, false 1032} 1033 1034// AsDatabricksComputeSecrets is the BasicComputeSecrets implementation for ComputeSecrets. 1035func (cs ComputeSecrets) AsDatabricksComputeSecrets() (*DatabricksComputeSecrets, bool) { 1036 return nil, false 1037} 1038 1039// AsComputeSecrets is the BasicComputeSecrets implementation for ComputeSecrets. 1040func (cs ComputeSecrets) AsComputeSecrets() (*ComputeSecrets, bool) { 1041 return &cs, true 1042} 1043 1044// AsBasicComputeSecrets is the BasicComputeSecrets implementation for ComputeSecrets. 1045func (cs ComputeSecrets) AsBasicComputeSecrets() (BasicComputeSecrets, bool) { 1046 return &cs, true 1047} 1048 1049// ComputeSecretsModel ... 1050type ComputeSecretsModel struct { 1051 autorest.Response `json:"-"` 1052 Value BasicComputeSecrets `json:"value,omitempty"` 1053} 1054 1055// UnmarshalJSON is the custom unmarshaler for ComputeSecretsModel struct. 1056func (csm *ComputeSecretsModel) UnmarshalJSON(body []byte) error { 1057 cs, err := unmarshalBasicComputeSecrets(body) 1058 if err != nil { 1059 return err 1060 } 1061 csm.Value = cs 1062 1063 return nil 1064} 1065 1066// Databricks a DataFactory compute. 1067type Databricks struct { 1068 Properties *DatabricksProperties `json:"properties,omitempty"` 1069 // ComputeLocation - Location for the underlying compute 1070 ComputeLocation *string `json:"computeLocation,omitempty"` 1071 // ProvisioningState - READ-ONLY; The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Possible values include: 'Unknown', 'Updating', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 1072 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 1073 // Description - The description of the Machine Learning compute. 1074 Description *string `json:"description,omitempty"` 1075 // CreatedOn - READ-ONLY; The date and time when the compute was created. 1076 CreatedOn *date.Time `json:"createdOn,omitempty"` 1077 // ModifiedOn - READ-ONLY; The date and time when the compute was last modified. 1078 ModifiedOn *date.Time `json:"modifiedOn,omitempty"` 1079 // ResourceID - ARM resource id of the underlying compute 1080 ResourceID *string `json:"resourceId,omitempty"` 1081 // ProvisioningErrors - READ-ONLY; Errors during provisioning 1082 ProvisioningErrors *[]Error `json:"provisioningErrors,omitempty"` 1083 // IsAttachedCompute - READ-ONLY; Indicating whether the compute was provisioned by user and brought from outside if true, or machine learning service provisioned it if false. 1084 IsAttachedCompute *bool `json:"isAttachedCompute,omitempty"` 1085 // ComputeType - Possible values include: 'ComputeTypeCompute', 'ComputeTypeAKS1', 'ComputeTypeAmlCompute1', 'ComputeTypeVirtualMachine1', 'ComputeTypeHDInsight1', 'ComputeTypeDataFactory1', 'ComputeTypeDatabricks1', 'ComputeTypeDataLakeAnalytics1' 1086 ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` 1087} 1088 1089// MarshalJSON is the custom marshaler for Databricks. 1090func (d Databricks) MarshalJSON() ([]byte, error) { 1091 d.ComputeType = ComputeTypeDatabricks1 1092 objectMap := make(map[string]interface{}) 1093 if d.Properties != nil { 1094 objectMap["properties"] = d.Properties 1095 } 1096 if d.ComputeLocation != nil { 1097 objectMap["computeLocation"] = d.ComputeLocation 1098 } 1099 if d.Description != nil { 1100 objectMap["description"] = d.Description 1101 } 1102 if d.ResourceID != nil { 1103 objectMap["resourceId"] = d.ResourceID 1104 } 1105 if d.ComputeType != "" { 1106 objectMap["computeType"] = d.ComputeType 1107 } 1108 return json.Marshal(objectMap) 1109} 1110 1111// AsAKS is the BasicCompute implementation for Databricks. 1112func (d Databricks) AsAKS() (*AKS, bool) { 1113 return nil, false 1114} 1115 1116// AsAmlCompute is the BasicCompute implementation for Databricks. 1117func (d Databricks) AsAmlCompute() (*AmlCompute, bool) { 1118 return nil, false 1119} 1120 1121// AsVirtualMachine is the BasicCompute implementation for Databricks. 1122func (d Databricks) AsVirtualMachine() (*VirtualMachine, bool) { 1123 return nil, false 1124} 1125 1126// AsHDInsight is the BasicCompute implementation for Databricks. 1127func (d Databricks) AsHDInsight() (*HDInsight, bool) { 1128 return nil, false 1129} 1130 1131// AsDataFactory is the BasicCompute implementation for Databricks. 1132func (d Databricks) AsDataFactory() (*DataFactory, bool) { 1133 return nil, false 1134} 1135 1136// AsDatabricks is the BasicCompute implementation for Databricks. 1137func (d Databricks) AsDatabricks() (*Databricks, bool) { 1138 return &d, true 1139} 1140 1141// AsDataLakeAnalytics is the BasicCompute implementation for Databricks. 1142func (d Databricks) AsDataLakeAnalytics() (*DataLakeAnalytics, bool) { 1143 return nil, false 1144} 1145 1146// AsCompute is the BasicCompute implementation for Databricks. 1147func (d Databricks) AsCompute() (*Compute, bool) { 1148 return nil, false 1149} 1150 1151// AsBasicCompute is the BasicCompute implementation for Databricks. 1152func (d Databricks) AsBasicCompute() (BasicCompute, bool) { 1153 return &d, true 1154} 1155 1156// DatabricksComputeSecrets secrets related to a Machine Learning compute based on Databricks. 1157type DatabricksComputeSecrets struct { 1158 // DatabricksAccessToken - access token for databricks account. 1159 DatabricksAccessToken *string `json:"databricksAccessToken,omitempty"` 1160 // ComputeType - Possible values include: 'ComputeTypeBasicComputeSecretsComputeTypeComputeSecrets', 'ComputeTypeBasicComputeSecretsComputeTypeAKS', 'ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine', 'ComputeTypeBasicComputeSecretsComputeTypeDatabricks' 1161 ComputeType ComputeTypeBasicComputeSecrets `json:"computeType,omitempty"` 1162} 1163 1164// MarshalJSON is the custom marshaler for DatabricksComputeSecrets. 1165func (dcs DatabricksComputeSecrets) MarshalJSON() ([]byte, error) { 1166 dcs.ComputeType = ComputeTypeBasicComputeSecretsComputeTypeDatabricks 1167 objectMap := make(map[string]interface{}) 1168 if dcs.DatabricksAccessToken != nil { 1169 objectMap["databricksAccessToken"] = dcs.DatabricksAccessToken 1170 } 1171 if dcs.ComputeType != "" { 1172 objectMap["computeType"] = dcs.ComputeType 1173 } 1174 return json.Marshal(objectMap) 1175} 1176 1177// AsAksComputeSecrets is the BasicComputeSecrets implementation for DatabricksComputeSecrets. 1178func (dcs DatabricksComputeSecrets) AsAksComputeSecrets() (*AksComputeSecrets, bool) { 1179 return nil, false 1180} 1181 1182// AsVirtualMachineSecrets is the BasicComputeSecrets implementation for DatabricksComputeSecrets. 1183func (dcs DatabricksComputeSecrets) AsVirtualMachineSecrets() (*VirtualMachineSecrets, bool) { 1184 return nil, false 1185} 1186 1187// AsDatabricksComputeSecrets is the BasicComputeSecrets implementation for DatabricksComputeSecrets. 1188func (dcs DatabricksComputeSecrets) AsDatabricksComputeSecrets() (*DatabricksComputeSecrets, bool) { 1189 return &dcs, true 1190} 1191 1192// AsComputeSecrets is the BasicComputeSecrets implementation for DatabricksComputeSecrets. 1193func (dcs DatabricksComputeSecrets) AsComputeSecrets() (*ComputeSecrets, bool) { 1194 return nil, false 1195} 1196 1197// AsBasicComputeSecrets is the BasicComputeSecrets implementation for DatabricksComputeSecrets. 1198func (dcs DatabricksComputeSecrets) AsBasicComputeSecrets() (BasicComputeSecrets, bool) { 1199 return &dcs, true 1200} 1201 1202// DatabricksProperties ... 1203type DatabricksProperties struct { 1204 // DatabricksAccessToken - Databricks access token 1205 DatabricksAccessToken *string `json:"databricksAccessToken,omitempty"` 1206} 1207 1208// DataFactory a DataFactory compute. 1209type DataFactory struct { 1210 // ComputeLocation - Location for the underlying compute 1211 ComputeLocation *string `json:"computeLocation,omitempty"` 1212 // ProvisioningState - READ-ONLY; The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Possible values include: 'Unknown', 'Updating', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 1213 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 1214 // Description - The description of the Machine Learning compute. 1215 Description *string `json:"description,omitempty"` 1216 // CreatedOn - READ-ONLY; The date and time when the compute was created. 1217 CreatedOn *date.Time `json:"createdOn,omitempty"` 1218 // ModifiedOn - READ-ONLY; The date and time when the compute was last modified. 1219 ModifiedOn *date.Time `json:"modifiedOn,omitempty"` 1220 // ResourceID - ARM resource id of the underlying compute 1221 ResourceID *string `json:"resourceId,omitempty"` 1222 // ProvisioningErrors - READ-ONLY; Errors during provisioning 1223 ProvisioningErrors *[]Error `json:"provisioningErrors,omitempty"` 1224 // IsAttachedCompute - READ-ONLY; Indicating whether the compute was provisioned by user and brought from outside if true, or machine learning service provisioned it if false. 1225 IsAttachedCompute *bool `json:"isAttachedCompute,omitempty"` 1226 // ComputeType - Possible values include: 'ComputeTypeCompute', 'ComputeTypeAKS1', 'ComputeTypeAmlCompute1', 'ComputeTypeVirtualMachine1', 'ComputeTypeHDInsight1', 'ComputeTypeDataFactory1', 'ComputeTypeDatabricks1', 'ComputeTypeDataLakeAnalytics1' 1227 ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` 1228} 1229 1230// MarshalJSON is the custom marshaler for DataFactory. 1231func (df DataFactory) MarshalJSON() ([]byte, error) { 1232 df.ComputeType = ComputeTypeDataFactory1 1233 objectMap := make(map[string]interface{}) 1234 if df.ComputeLocation != nil { 1235 objectMap["computeLocation"] = df.ComputeLocation 1236 } 1237 if df.Description != nil { 1238 objectMap["description"] = df.Description 1239 } 1240 if df.ResourceID != nil { 1241 objectMap["resourceId"] = df.ResourceID 1242 } 1243 if df.ComputeType != "" { 1244 objectMap["computeType"] = df.ComputeType 1245 } 1246 return json.Marshal(objectMap) 1247} 1248 1249// AsAKS is the BasicCompute implementation for DataFactory. 1250func (df DataFactory) AsAKS() (*AKS, bool) { 1251 return nil, false 1252} 1253 1254// AsAmlCompute is the BasicCompute implementation for DataFactory. 1255func (df DataFactory) AsAmlCompute() (*AmlCompute, bool) { 1256 return nil, false 1257} 1258 1259// AsVirtualMachine is the BasicCompute implementation for DataFactory. 1260func (df DataFactory) AsVirtualMachine() (*VirtualMachine, bool) { 1261 return nil, false 1262} 1263 1264// AsHDInsight is the BasicCompute implementation for DataFactory. 1265func (df DataFactory) AsHDInsight() (*HDInsight, bool) { 1266 return nil, false 1267} 1268 1269// AsDataFactory is the BasicCompute implementation for DataFactory. 1270func (df DataFactory) AsDataFactory() (*DataFactory, bool) { 1271 return &df, true 1272} 1273 1274// AsDatabricks is the BasicCompute implementation for DataFactory. 1275func (df DataFactory) AsDatabricks() (*Databricks, bool) { 1276 return nil, false 1277} 1278 1279// AsDataLakeAnalytics is the BasicCompute implementation for DataFactory. 1280func (df DataFactory) AsDataLakeAnalytics() (*DataLakeAnalytics, bool) { 1281 return nil, false 1282} 1283 1284// AsCompute is the BasicCompute implementation for DataFactory. 1285func (df DataFactory) AsCompute() (*Compute, bool) { 1286 return nil, false 1287} 1288 1289// AsBasicCompute is the BasicCompute implementation for DataFactory. 1290func (df DataFactory) AsBasicCompute() (BasicCompute, bool) { 1291 return &df, true 1292} 1293 1294// DataLakeAnalytics a DataLakeAnalytics compute. 1295type DataLakeAnalytics struct { 1296 Properties *DataLakeAnalyticsProperties `json:"properties,omitempty"` 1297 // ComputeLocation - Location for the underlying compute 1298 ComputeLocation *string `json:"computeLocation,omitempty"` 1299 // ProvisioningState - READ-ONLY; The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Possible values include: 'Unknown', 'Updating', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 1300 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 1301 // Description - The description of the Machine Learning compute. 1302 Description *string `json:"description,omitempty"` 1303 // CreatedOn - READ-ONLY; The date and time when the compute was created. 1304 CreatedOn *date.Time `json:"createdOn,omitempty"` 1305 // ModifiedOn - READ-ONLY; The date and time when the compute was last modified. 1306 ModifiedOn *date.Time `json:"modifiedOn,omitempty"` 1307 // ResourceID - ARM resource id of the underlying compute 1308 ResourceID *string `json:"resourceId,omitempty"` 1309 // ProvisioningErrors - READ-ONLY; Errors during provisioning 1310 ProvisioningErrors *[]Error `json:"provisioningErrors,omitempty"` 1311 // IsAttachedCompute - READ-ONLY; Indicating whether the compute was provisioned by user and brought from outside if true, or machine learning service provisioned it if false. 1312 IsAttachedCompute *bool `json:"isAttachedCompute,omitempty"` 1313 // ComputeType - Possible values include: 'ComputeTypeCompute', 'ComputeTypeAKS1', 'ComputeTypeAmlCompute1', 'ComputeTypeVirtualMachine1', 'ComputeTypeHDInsight1', 'ComputeTypeDataFactory1', 'ComputeTypeDatabricks1', 'ComputeTypeDataLakeAnalytics1' 1314 ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` 1315} 1316 1317// MarshalJSON is the custom marshaler for DataLakeAnalytics. 1318func (dla DataLakeAnalytics) MarshalJSON() ([]byte, error) { 1319 dla.ComputeType = ComputeTypeDataLakeAnalytics1 1320 objectMap := make(map[string]interface{}) 1321 if dla.Properties != nil { 1322 objectMap["properties"] = dla.Properties 1323 } 1324 if dla.ComputeLocation != nil { 1325 objectMap["computeLocation"] = dla.ComputeLocation 1326 } 1327 if dla.Description != nil { 1328 objectMap["description"] = dla.Description 1329 } 1330 if dla.ResourceID != nil { 1331 objectMap["resourceId"] = dla.ResourceID 1332 } 1333 if dla.ComputeType != "" { 1334 objectMap["computeType"] = dla.ComputeType 1335 } 1336 return json.Marshal(objectMap) 1337} 1338 1339// AsAKS is the BasicCompute implementation for DataLakeAnalytics. 1340func (dla DataLakeAnalytics) AsAKS() (*AKS, bool) { 1341 return nil, false 1342} 1343 1344// AsAmlCompute is the BasicCompute implementation for DataLakeAnalytics. 1345func (dla DataLakeAnalytics) AsAmlCompute() (*AmlCompute, bool) { 1346 return nil, false 1347} 1348 1349// AsVirtualMachine is the BasicCompute implementation for DataLakeAnalytics. 1350func (dla DataLakeAnalytics) AsVirtualMachine() (*VirtualMachine, bool) { 1351 return nil, false 1352} 1353 1354// AsHDInsight is the BasicCompute implementation for DataLakeAnalytics. 1355func (dla DataLakeAnalytics) AsHDInsight() (*HDInsight, bool) { 1356 return nil, false 1357} 1358 1359// AsDataFactory is the BasicCompute implementation for DataLakeAnalytics. 1360func (dla DataLakeAnalytics) AsDataFactory() (*DataFactory, bool) { 1361 return nil, false 1362} 1363 1364// AsDatabricks is the BasicCompute implementation for DataLakeAnalytics. 1365func (dla DataLakeAnalytics) AsDatabricks() (*Databricks, bool) { 1366 return nil, false 1367} 1368 1369// AsDataLakeAnalytics is the BasicCompute implementation for DataLakeAnalytics. 1370func (dla DataLakeAnalytics) AsDataLakeAnalytics() (*DataLakeAnalytics, bool) { 1371 return &dla, true 1372} 1373 1374// AsCompute is the BasicCompute implementation for DataLakeAnalytics. 1375func (dla DataLakeAnalytics) AsCompute() (*Compute, bool) { 1376 return nil, false 1377} 1378 1379// AsBasicCompute is the BasicCompute implementation for DataLakeAnalytics. 1380func (dla DataLakeAnalytics) AsBasicCompute() (BasicCompute, bool) { 1381 return &dla, true 1382} 1383 1384// DataLakeAnalyticsProperties ... 1385type DataLakeAnalyticsProperties struct { 1386 // DataLakeStoreAccountName - DataLake Store Account Name 1387 DataLakeStoreAccountName *string `json:"dataLakeStoreAccountName,omitempty"` 1388} 1389 1390// Error wrapper for error response to follow ARM guidelines. 1391type Error struct { 1392 // Error - READ-ONLY; The error response. 1393 Error *ErrorResponse `json:"error,omitempty"` 1394} 1395 1396// MarshalJSON is the custom marshaler for Error. 1397func (e Error) MarshalJSON() ([]byte, error) { 1398 objectMap := make(map[string]interface{}) 1399 return json.Marshal(objectMap) 1400} 1401 1402// ErrorDetail error detail information. 1403type ErrorDetail struct { 1404 // Code - Error code. 1405 Code *string `json:"code,omitempty"` 1406 // Message - Error message. 1407 Message *string `json:"message,omitempty"` 1408} 1409 1410// ErrorResponse error response information. 1411type ErrorResponse struct { 1412 // Code - READ-ONLY; Error code. 1413 Code *string `json:"code,omitempty"` 1414 // Message - READ-ONLY; Error message. 1415 Message *string `json:"message,omitempty"` 1416 // Details - READ-ONLY; An array of error detail objects. 1417 Details *[]ErrorDetail `json:"details,omitempty"` 1418} 1419 1420// MarshalJSON is the custom marshaler for ErrorResponse. 1421func (er ErrorResponse) MarshalJSON() ([]byte, error) { 1422 objectMap := make(map[string]interface{}) 1423 return json.Marshal(objectMap) 1424} 1425 1426// HDInsight a HDInsight compute. 1427type HDInsight struct { 1428 Properties *HDInsightProperties `json:"properties,omitempty"` 1429 // ComputeLocation - Location for the underlying compute 1430 ComputeLocation *string `json:"computeLocation,omitempty"` 1431 // ProvisioningState - READ-ONLY; The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Possible values include: 'Unknown', 'Updating', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 1432 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 1433 // Description - The description of the Machine Learning compute. 1434 Description *string `json:"description,omitempty"` 1435 // CreatedOn - READ-ONLY; The date and time when the compute was created. 1436 CreatedOn *date.Time `json:"createdOn,omitempty"` 1437 // ModifiedOn - READ-ONLY; The date and time when the compute was last modified. 1438 ModifiedOn *date.Time `json:"modifiedOn,omitempty"` 1439 // ResourceID - ARM resource id of the underlying compute 1440 ResourceID *string `json:"resourceId,omitempty"` 1441 // ProvisioningErrors - READ-ONLY; Errors during provisioning 1442 ProvisioningErrors *[]Error `json:"provisioningErrors,omitempty"` 1443 // IsAttachedCompute - READ-ONLY; Indicating whether the compute was provisioned by user and brought from outside if true, or machine learning service provisioned it if false. 1444 IsAttachedCompute *bool `json:"isAttachedCompute,omitempty"` 1445 // ComputeType - Possible values include: 'ComputeTypeCompute', 'ComputeTypeAKS1', 'ComputeTypeAmlCompute1', 'ComputeTypeVirtualMachine1', 'ComputeTypeHDInsight1', 'ComputeTypeDataFactory1', 'ComputeTypeDatabricks1', 'ComputeTypeDataLakeAnalytics1' 1446 ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` 1447} 1448 1449// MarshalJSON is the custom marshaler for HDInsight. 1450func (hi HDInsight) MarshalJSON() ([]byte, error) { 1451 hi.ComputeType = ComputeTypeHDInsight1 1452 objectMap := make(map[string]interface{}) 1453 if hi.Properties != nil { 1454 objectMap["properties"] = hi.Properties 1455 } 1456 if hi.ComputeLocation != nil { 1457 objectMap["computeLocation"] = hi.ComputeLocation 1458 } 1459 if hi.Description != nil { 1460 objectMap["description"] = hi.Description 1461 } 1462 if hi.ResourceID != nil { 1463 objectMap["resourceId"] = hi.ResourceID 1464 } 1465 if hi.ComputeType != "" { 1466 objectMap["computeType"] = hi.ComputeType 1467 } 1468 return json.Marshal(objectMap) 1469} 1470 1471// AsAKS is the BasicCompute implementation for HDInsight. 1472func (hi HDInsight) AsAKS() (*AKS, bool) { 1473 return nil, false 1474} 1475 1476// AsAmlCompute is the BasicCompute implementation for HDInsight. 1477func (hi HDInsight) AsAmlCompute() (*AmlCompute, bool) { 1478 return nil, false 1479} 1480 1481// AsVirtualMachine is the BasicCompute implementation for HDInsight. 1482func (hi HDInsight) AsVirtualMachine() (*VirtualMachine, bool) { 1483 return nil, false 1484} 1485 1486// AsHDInsight is the BasicCompute implementation for HDInsight. 1487func (hi HDInsight) AsHDInsight() (*HDInsight, bool) { 1488 return &hi, true 1489} 1490 1491// AsDataFactory is the BasicCompute implementation for HDInsight. 1492func (hi HDInsight) AsDataFactory() (*DataFactory, bool) { 1493 return nil, false 1494} 1495 1496// AsDatabricks is the BasicCompute implementation for HDInsight. 1497func (hi HDInsight) AsDatabricks() (*Databricks, bool) { 1498 return nil, false 1499} 1500 1501// AsDataLakeAnalytics is the BasicCompute implementation for HDInsight. 1502func (hi HDInsight) AsDataLakeAnalytics() (*DataLakeAnalytics, bool) { 1503 return nil, false 1504} 1505 1506// AsCompute is the BasicCompute implementation for HDInsight. 1507func (hi HDInsight) AsCompute() (*Compute, bool) { 1508 return nil, false 1509} 1510 1511// AsBasicCompute is the BasicCompute implementation for HDInsight. 1512func (hi HDInsight) AsBasicCompute() (BasicCompute, bool) { 1513 return &hi, true 1514} 1515 1516// HDInsightProperties ... 1517type HDInsightProperties struct { 1518 // SSHPort - Port open for ssh connections on the master node of the cluster. 1519 SSHPort *int32 `json:"sshPort,omitempty"` 1520 // Address - Public IP address of the master node of the cluster. 1521 Address *string `json:"address,omitempty"` 1522 // AdministratorAccount - Admin credentials for master node of the cluster 1523 AdministratorAccount *VirtualMachineSSHCredentials `json:"administratorAccount,omitempty"` 1524} 1525 1526// Identity identity for the resource. 1527type Identity struct { 1528 // PrincipalID - READ-ONLY; The principal ID of resource identity. 1529 PrincipalID *string `json:"principalId,omitempty"` 1530 // TenantID - READ-ONLY; The tenant ID of resource. 1531 TenantID *string `json:"tenantId,omitempty"` 1532 // Type - The identity type. Possible values include: 'SystemAssigned' 1533 Type ResourceIdentityType `json:"type,omitempty"` 1534} 1535 1536// MarshalJSON is the custom marshaler for Identity. 1537func (i Identity) MarshalJSON() ([]byte, error) { 1538 objectMap := make(map[string]interface{}) 1539 if i.Type != "" { 1540 objectMap["type"] = i.Type 1541 } 1542 return json.Marshal(objectMap) 1543} 1544 1545// ListUsagesResult the List Usages operation response. 1546type ListUsagesResult struct { 1547 autorest.Response `json:"-"` 1548 // Value - READ-ONLY; The list of AML resource usages. 1549 Value *[]Usage `json:"value,omitempty"` 1550 // NextLink - READ-ONLY; The URI to fetch the next page of AML resource usage information. Call ListNext() with this to fetch the next page of AML resource usage information. 1551 NextLink *string `json:"nextLink,omitempty"` 1552} 1553 1554// MarshalJSON is the custom marshaler for ListUsagesResult. 1555func (lur ListUsagesResult) MarshalJSON() ([]byte, error) { 1556 objectMap := make(map[string]interface{}) 1557 return json.Marshal(objectMap) 1558} 1559 1560// ListUsagesResultIterator provides access to a complete listing of Usage values. 1561type ListUsagesResultIterator struct { 1562 i int 1563 page ListUsagesResultPage 1564} 1565 1566// NextWithContext advances to the next value. If there was an error making 1567// the request the iterator does not advance and the error is returned. 1568func (iter *ListUsagesResultIterator) NextWithContext(ctx context.Context) (err error) { 1569 if tracing.IsEnabled() { 1570 ctx = tracing.StartSpan(ctx, fqdn+"/ListUsagesResultIterator.NextWithContext") 1571 defer func() { 1572 sc := -1 1573 if iter.Response().Response.Response != nil { 1574 sc = iter.Response().Response.Response.StatusCode 1575 } 1576 tracing.EndSpan(ctx, sc, err) 1577 }() 1578 } 1579 iter.i++ 1580 if iter.i < len(iter.page.Values()) { 1581 return nil 1582 } 1583 err = iter.page.NextWithContext(ctx) 1584 if err != nil { 1585 iter.i-- 1586 return err 1587 } 1588 iter.i = 0 1589 return nil 1590} 1591 1592// Next advances to the next value. If there was an error making 1593// the request the iterator does not advance and the error is returned. 1594// Deprecated: Use NextWithContext() instead. 1595func (iter *ListUsagesResultIterator) Next() error { 1596 return iter.NextWithContext(context.Background()) 1597} 1598 1599// NotDone returns true if the enumeration should be started or is not yet complete. 1600func (iter ListUsagesResultIterator) NotDone() bool { 1601 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1602} 1603 1604// Response returns the raw server response from the last page request. 1605func (iter ListUsagesResultIterator) Response() ListUsagesResult { 1606 return iter.page.Response() 1607} 1608 1609// Value returns the current value or a zero-initialized value if the 1610// iterator has advanced beyond the end of the collection. 1611func (iter ListUsagesResultIterator) Value() Usage { 1612 if !iter.page.NotDone() { 1613 return Usage{} 1614 } 1615 return iter.page.Values()[iter.i] 1616} 1617 1618// Creates a new instance of the ListUsagesResultIterator type. 1619func NewListUsagesResultIterator(page ListUsagesResultPage) ListUsagesResultIterator { 1620 return ListUsagesResultIterator{page: page} 1621} 1622 1623// IsEmpty returns true if the ListResult contains no values. 1624func (lur ListUsagesResult) IsEmpty() bool { 1625 return lur.Value == nil || len(*lur.Value) == 0 1626} 1627 1628// hasNextLink returns true if the NextLink is not empty. 1629func (lur ListUsagesResult) hasNextLink() bool { 1630 return lur.NextLink != nil && len(*lur.NextLink) != 0 1631} 1632 1633// listUsagesResultPreparer prepares a request to retrieve the next set of results. 1634// It returns nil if no more results exist. 1635func (lur ListUsagesResult) listUsagesResultPreparer(ctx context.Context) (*http.Request, error) { 1636 if !lur.hasNextLink() { 1637 return nil, nil 1638 } 1639 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1640 autorest.AsJSON(), 1641 autorest.AsGet(), 1642 autorest.WithBaseURL(to.String(lur.NextLink))) 1643} 1644 1645// ListUsagesResultPage contains a page of Usage values. 1646type ListUsagesResultPage struct { 1647 fn func(context.Context, ListUsagesResult) (ListUsagesResult, error) 1648 lur ListUsagesResult 1649} 1650 1651// NextWithContext advances to the next page of values. If there was an error making 1652// the request the page does not advance and the error is returned. 1653func (page *ListUsagesResultPage) NextWithContext(ctx context.Context) (err error) { 1654 if tracing.IsEnabled() { 1655 ctx = tracing.StartSpan(ctx, fqdn+"/ListUsagesResultPage.NextWithContext") 1656 defer func() { 1657 sc := -1 1658 if page.Response().Response.Response != nil { 1659 sc = page.Response().Response.Response.StatusCode 1660 } 1661 tracing.EndSpan(ctx, sc, err) 1662 }() 1663 } 1664 for { 1665 next, err := page.fn(ctx, page.lur) 1666 if err != nil { 1667 return err 1668 } 1669 page.lur = next 1670 if !next.hasNextLink() || !next.IsEmpty() { 1671 break 1672 } 1673 } 1674 return nil 1675} 1676 1677// Next advances to the next page of values. If there was an error making 1678// the request the page does not advance and the error is returned. 1679// Deprecated: Use NextWithContext() instead. 1680func (page *ListUsagesResultPage) Next() error { 1681 return page.NextWithContext(context.Background()) 1682} 1683 1684// NotDone returns true if the page enumeration should be started or is not yet complete. 1685func (page ListUsagesResultPage) NotDone() bool { 1686 return !page.lur.IsEmpty() 1687} 1688 1689// Response returns the raw server response from the last page request. 1690func (page ListUsagesResultPage) Response() ListUsagesResult { 1691 return page.lur 1692} 1693 1694// Values returns the slice of values for the current page or nil if there are no values. 1695func (page ListUsagesResultPage) Values() []Usage { 1696 if page.lur.IsEmpty() { 1697 return nil 1698 } 1699 return *page.lur.Value 1700} 1701 1702// Creates a new instance of the ListUsagesResultPage type. 1703func NewListUsagesResultPage(cur ListUsagesResult, getNextPage func(context.Context, ListUsagesResult) (ListUsagesResult, error)) ListUsagesResultPage { 1704 return ListUsagesResultPage{ 1705 fn: getNextPage, 1706 lur: cur, 1707 } 1708} 1709 1710// ListWorkspaceKeysResult ... 1711type ListWorkspaceKeysResult struct { 1712 autorest.Response `json:"-"` 1713 // UserStorageKey - READ-ONLY 1714 UserStorageKey *string `json:"userStorageKey,omitempty"` 1715 // UserStorageResourceID - READ-ONLY 1716 UserStorageResourceID *string `json:"userStorageResourceId,omitempty"` 1717 // AppInsightsInstrumentationKey - READ-ONLY 1718 AppInsightsInstrumentationKey *string `json:"appInsightsInstrumentationKey,omitempty"` 1719 // ContainerRegistryCredentials - READ-ONLY 1720 ContainerRegistryCredentials *RegistryListCredentialsResult `json:"containerRegistryCredentials,omitempty"` 1721} 1722 1723// MarshalJSON is the custom marshaler for ListWorkspaceKeysResult. 1724func (lwkr ListWorkspaceKeysResult) MarshalJSON() ([]byte, error) { 1725 objectMap := make(map[string]interface{}) 1726 return json.Marshal(objectMap) 1727} 1728 1729// MachineLearningComputeCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 1730// long-running operation. 1731type MachineLearningComputeCreateOrUpdateFuture struct { 1732 azure.FutureAPI 1733 // Result returns the result of the asynchronous operation. 1734 // If the operation has not completed it will return an error. 1735 Result func(MachineLearningComputeClient) (ComputeResource, error) 1736} 1737 1738// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1739func (future *MachineLearningComputeCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 1740 var azFuture azure.Future 1741 if err := json.Unmarshal(body, &azFuture); err != nil { 1742 return err 1743 } 1744 future.FutureAPI = &azFuture 1745 future.Result = future.result 1746 return nil 1747} 1748 1749// result is the default implementation for MachineLearningComputeCreateOrUpdateFuture.Result. 1750func (future *MachineLearningComputeCreateOrUpdateFuture) result(client MachineLearningComputeClient) (cr ComputeResource, err error) { 1751 var done bool 1752 done, err = future.DoneWithContext(context.Background(), client) 1753 if err != nil { 1754 err = autorest.NewErrorWithError(err, "machinelearningservices.MachineLearningComputeCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1755 return 1756 } 1757 if !done { 1758 cr.Response.Response = future.Response() 1759 err = azure.NewAsyncOpIncompleteError("machinelearningservices.MachineLearningComputeCreateOrUpdateFuture") 1760 return 1761 } 1762 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1763 if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { 1764 cr, err = client.CreateOrUpdateResponder(cr.Response.Response) 1765 if err != nil { 1766 err = autorest.NewErrorWithError(err, "machinelearningservices.MachineLearningComputeCreateOrUpdateFuture", "Result", cr.Response.Response, "Failure responding to request") 1767 } 1768 } 1769 return 1770} 1771 1772// MachineLearningComputeDeleteFuture an abstraction for monitoring and retrieving the results of a 1773// long-running operation. 1774type MachineLearningComputeDeleteFuture struct { 1775 azure.FutureAPI 1776 // Result returns the result of the asynchronous operation. 1777 // If the operation has not completed it will return an error. 1778 Result func(MachineLearningComputeClient) (autorest.Response, error) 1779} 1780 1781// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1782func (future *MachineLearningComputeDeleteFuture) UnmarshalJSON(body []byte) error { 1783 var azFuture azure.Future 1784 if err := json.Unmarshal(body, &azFuture); err != nil { 1785 return err 1786 } 1787 future.FutureAPI = &azFuture 1788 future.Result = future.result 1789 return nil 1790} 1791 1792// result is the default implementation for MachineLearningComputeDeleteFuture.Result. 1793func (future *MachineLearningComputeDeleteFuture) result(client MachineLearningComputeClient) (ar autorest.Response, err error) { 1794 var done bool 1795 done, err = future.DoneWithContext(context.Background(), client) 1796 if err != nil { 1797 err = autorest.NewErrorWithError(err, "machinelearningservices.MachineLearningComputeDeleteFuture", "Result", future.Response(), "Polling failure") 1798 return 1799 } 1800 if !done { 1801 ar.Response = future.Response() 1802 err = azure.NewAsyncOpIncompleteError("machinelearningservices.MachineLearningComputeDeleteFuture") 1803 return 1804 } 1805 ar.Response = future.Response() 1806 return 1807} 1808 1809// MachineLearningComputeUpdateFuture an abstraction for monitoring and retrieving the results of a 1810// long-running operation. 1811type MachineLearningComputeUpdateFuture struct { 1812 azure.FutureAPI 1813 // Result returns the result of the asynchronous operation. 1814 // If the operation has not completed it will return an error. 1815 Result func(MachineLearningComputeClient) (ComputeResource, error) 1816} 1817 1818// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1819func (future *MachineLearningComputeUpdateFuture) UnmarshalJSON(body []byte) error { 1820 var azFuture azure.Future 1821 if err := json.Unmarshal(body, &azFuture); err != nil { 1822 return err 1823 } 1824 future.FutureAPI = &azFuture 1825 future.Result = future.result 1826 return nil 1827} 1828 1829// result is the default implementation for MachineLearningComputeUpdateFuture.Result. 1830func (future *MachineLearningComputeUpdateFuture) result(client MachineLearningComputeClient) (cr ComputeResource, err error) { 1831 var done bool 1832 done, err = future.DoneWithContext(context.Background(), client) 1833 if err != nil { 1834 err = autorest.NewErrorWithError(err, "machinelearningservices.MachineLearningComputeUpdateFuture", "Result", future.Response(), "Polling failure") 1835 return 1836 } 1837 if !done { 1838 cr.Response.Response = future.Response() 1839 err = azure.NewAsyncOpIncompleteError("machinelearningservices.MachineLearningComputeUpdateFuture") 1840 return 1841 } 1842 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1843 if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { 1844 cr, err = client.UpdateResponder(cr.Response.Response) 1845 if err != nil { 1846 err = autorest.NewErrorWithError(err, "machinelearningservices.MachineLearningComputeUpdateFuture", "Result", cr.Response.Response, "Failure responding to request") 1847 } 1848 } 1849 return 1850} 1851 1852// NodeStateCounts counts of various compute node states on the amlCompute. 1853type NodeStateCounts struct { 1854 // IdleNodeCount - READ-ONLY; Number of compute nodes in idle state. 1855 IdleNodeCount *int32 `json:"idleNodeCount,omitempty"` 1856 // RunningNodeCount - READ-ONLY; Number of compute nodes which are running jobs. 1857 RunningNodeCount *int32 `json:"runningNodeCount,omitempty"` 1858 // PreparingNodeCount - READ-ONLY; Number of compute nodes which are being prepared. 1859 PreparingNodeCount *int32 `json:"preparingNodeCount,omitempty"` 1860 // UnusableNodeCount - READ-ONLY; Number of compute nodes which are in unusable state. 1861 UnusableNodeCount *int32 `json:"unusableNodeCount,omitempty"` 1862 // LeavingNodeCount - READ-ONLY; Number of compute nodes which are leaving the amlCompute. 1863 LeavingNodeCount *int32 `json:"leavingNodeCount,omitempty"` 1864 // PreemptedNodeCount - READ-ONLY; Number of compute nodes which are in preempted state. 1865 PreemptedNodeCount *int32 `json:"preemptedNodeCount,omitempty"` 1866} 1867 1868// MarshalJSON is the custom marshaler for NodeStateCounts. 1869func (nsc NodeStateCounts) MarshalJSON() ([]byte, error) { 1870 objectMap := make(map[string]interface{}) 1871 return json.Marshal(objectMap) 1872} 1873 1874// Operation azure Machine Learning workspace REST API operation 1875type Operation struct { 1876 // Name - Operation name: {provider}/{resource}/{operation} 1877 Name *string `json:"name,omitempty"` 1878 // Display - Display name of operation 1879 Display *OperationDisplay `json:"display,omitempty"` 1880} 1881 1882// OperationDisplay display name of operation 1883type OperationDisplay struct { 1884 // Provider - The resource provider name: Microsoft.MachineLearningExperimentation 1885 Provider *string `json:"provider,omitempty"` 1886 // Resource - The resource on which the operation is performed. 1887 Resource *string `json:"resource,omitempty"` 1888 // Operation - The operation that users can perform. 1889 Operation *string `json:"operation,omitempty"` 1890 // Description - The description for the operation. 1891 Description *string `json:"description,omitempty"` 1892} 1893 1894// OperationListResult an array of operations supported by the resource provider. 1895type OperationListResult struct { 1896 autorest.Response `json:"-"` 1897 // Value - List of AML workspace operations supported by the AML workspace resource provider. 1898 Value *[]Operation `json:"value,omitempty"` 1899} 1900 1901// PaginatedComputeResourcesList paginated list of Machine Learning compute objects wrapped in ARM resource 1902// envelope. 1903type PaginatedComputeResourcesList struct { 1904 autorest.Response `json:"-"` 1905 // Value - An array of Machine Learning compute objects wrapped in ARM resource envelope. 1906 Value *[]ComputeResource `json:"value,omitempty"` 1907 // NextLink - A continuation link (absolute URI) to the next page of results in the list. 1908 NextLink *string `json:"nextLink,omitempty"` 1909} 1910 1911// PaginatedComputeResourcesListIterator provides access to a complete listing of ComputeResource values. 1912type PaginatedComputeResourcesListIterator struct { 1913 i int 1914 page PaginatedComputeResourcesListPage 1915} 1916 1917// NextWithContext advances to the next value. If there was an error making 1918// the request the iterator does not advance and the error is returned. 1919func (iter *PaginatedComputeResourcesListIterator) NextWithContext(ctx context.Context) (err error) { 1920 if tracing.IsEnabled() { 1921 ctx = tracing.StartSpan(ctx, fqdn+"/PaginatedComputeResourcesListIterator.NextWithContext") 1922 defer func() { 1923 sc := -1 1924 if iter.Response().Response.Response != nil { 1925 sc = iter.Response().Response.Response.StatusCode 1926 } 1927 tracing.EndSpan(ctx, sc, err) 1928 }() 1929 } 1930 iter.i++ 1931 if iter.i < len(iter.page.Values()) { 1932 return nil 1933 } 1934 err = iter.page.NextWithContext(ctx) 1935 if err != nil { 1936 iter.i-- 1937 return err 1938 } 1939 iter.i = 0 1940 return nil 1941} 1942 1943// Next advances to the next value. If there was an error making 1944// the request the iterator does not advance and the error is returned. 1945// Deprecated: Use NextWithContext() instead. 1946func (iter *PaginatedComputeResourcesListIterator) Next() error { 1947 return iter.NextWithContext(context.Background()) 1948} 1949 1950// NotDone returns true if the enumeration should be started or is not yet complete. 1951func (iter PaginatedComputeResourcesListIterator) NotDone() bool { 1952 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1953} 1954 1955// Response returns the raw server response from the last page request. 1956func (iter PaginatedComputeResourcesListIterator) Response() PaginatedComputeResourcesList { 1957 return iter.page.Response() 1958} 1959 1960// Value returns the current value or a zero-initialized value if the 1961// iterator has advanced beyond the end of the collection. 1962func (iter PaginatedComputeResourcesListIterator) Value() ComputeResource { 1963 if !iter.page.NotDone() { 1964 return ComputeResource{} 1965 } 1966 return iter.page.Values()[iter.i] 1967} 1968 1969// Creates a new instance of the PaginatedComputeResourcesListIterator type. 1970func NewPaginatedComputeResourcesListIterator(page PaginatedComputeResourcesListPage) PaginatedComputeResourcesListIterator { 1971 return PaginatedComputeResourcesListIterator{page: page} 1972} 1973 1974// IsEmpty returns true if the ListResult contains no values. 1975func (pcrl PaginatedComputeResourcesList) IsEmpty() bool { 1976 return pcrl.Value == nil || len(*pcrl.Value) == 0 1977} 1978 1979// hasNextLink returns true if the NextLink is not empty. 1980func (pcrl PaginatedComputeResourcesList) hasNextLink() bool { 1981 return pcrl.NextLink != nil && len(*pcrl.NextLink) != 0 1982} 1983 1984// paginatedComputeResourcesListPreparer prepares a request to retrieve the next set of results. 1985// It returns nil if no more results exist. 1986func (pcrl PaginatedComputeResourcesList) paginatedComputeResourcesListPreparer(ctx context.Context) (*http.Request, error) { 1987 if !pcrl.hasNextLink() { 1988 return nil, nil 1989 } 1990 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1991 autorest.AsJSON(), 1992 autorest.AsGet(), 1993 autorest.WithBaseURL(to.String(pcrl.NextLink))) 1994} 1995 1996// PaginatedComputeResourcesListPage contains a page of ComputeResource values. 1997type PaginatedComputeResourcesListPage struct { 1998 fn func(context.Context, PaginatedComputeResourcesList) (PaginatedComputeResourcesList, error) 1999 pcrl PaginatedComputeResourcesList 2000} 2001 2002// NextWithContext advances to the next page of values. If there was an error making 2003// the request the page does not advance and the error is returned. 2004func (page *PaginatedComputeResourcesListPage) NextWithContext(ctx context.Context) (err error) { 2005 if tracing.IsEnabled() { 2006 ctx = tracing.StartSpan(ctx, fqdn+"/PaginatedComputeResourcesListPage.NextWithContext") 2007 defer func() { 2008 sc := -1 2009 if page.Response().Response.Response != nil { 2010 sc = page.Response().Response.Response.StatusCode 2011 } 2012 tracing.EndSpan(ctx, sc, err) 2013 }() 2014 } 2015 for { 2016 next, err := page.fn(ctx, page.pcrl) 2017 if err != nil { 2018 return err 2019 } 2020 page.pcrl = next 2021 if !next.hasNextLink() || !next.IsEmpty() { 2022 break 2023 } 2024 } 2025 return nil 2026} 2027 2028// Next advances to the next page of values. If there was an error making 2029// the request the page does not advance and the error is returned. 2030// Deprecated: Use NextWithContext() instead. 2031func (page *PaginatedComputeResourcesListPage) Next() error { 2032 return page.NextWithContext(context.Background()) 2033} 2034 2035// NotDone returns true if the page enumeration should be started or is not yet complete. 2036func (page PaginatedComputeResourcesListPage) NotDone() bool { 2037 return !page.pcrl.IsEmpty() 2038} 2039 2040// Response returns the raw server response from the last page request. 2041func (page PaginatedComputeResourcesListPage) Response() PaginatedComputeResourcesList { 2042 return page.pcrl 2043} 2044 2045// Values returns the slice of values for the current page or nil if there are no values. 2046func (page PaginatedComputeResourcesListPage) Values() []ComputeResource { 2047 if page.pcrl.IsEmpty() { 2048 return nil 2049 } 2050 return *page.pcrl.Value 2051} 2052 2053// Creates a new instance of the PaginatedComputeResourcesListPage type. 2054func NewPaginatedComputeResourcesListPage(cur PaginatedComputeResourcesList, getNextPage func(context.Context, PaginatedComputeResourcesList) (PaginatedComputeResourcesList, error)) PaginatedComputeResourcesListPage { 2055 return PaginatedComputeResourcesListPage{ 2056 fn: getNextPage, 2057 pcrl: cur, 2058 } 2059} 2060 2061// Password ... 2062type Password struct { 2063 // Name - READ-ONLY 2064 Name *string `json:"name,omitempty"` 2065 // Value - READ-ONLY 2066 Value *string `json:"value,omitempty"` 2067} 2068 2069// MarshalJSON is the custom marshaler for Password. 2070func (p Password) MarshalJSON() ([]byte, error) { 2071 objectMap := make(map[string]interface{}) 2072 return json.Marshal(objectMap) 2073} 2074 2075// RegistryListCredentialsResult ... 2076type RegistryListCredentialsResult struct { 2077 // Location - READ-ONLY 2078 Location *string `json:"location,omitempty"` 2079 // Username - READ-ONLY 2080 Username *string `json:"username,omitempty"` 2081 Passwords *[]Password `json:"passwords,omitempty"` 2082} 2083 2084// MarshalJSON is the custom marshaler for RegistryListCredentialsResult. 2085func (rlcr RegistryListCredentialsResult) MarshalJSON() ([]byte, error) { 2086 objectMap := make(map[string]interface{}) 2087 if rlcr.Passwords != nil { 2088 objectMap["passwords"] = rlcr.Passwords 2089 } 2090 return json.Marshal(objectMap) 2091} 2092 2093// Resource azure Resource Manager resource envelope. 2094type Resource struct { 2095 // ID - READ-ONLY; Specifies the resource ID. 2096 ID *string `json:"id,omitempty"` 2097 // Name - READ-ONLY; Specifies the name of the resource. 2098 Name *string `json:"name,omitempty"` 2099 // Identity - The identity of the resource. 2100 Identity *Identity `json:"identity,omitempty"` 2101 // Location - Specifies the location of the resource. 2102 Location *string `json:"location,omitempty"` 2103 // Type - READ-ONLY; Specifies the type of the resource. 2104 Type *string `json:"type,omitempty"` 2105 // Tags - Contains resource tags defined as key/value pairs. 2106 Tags map[string]*string `json:"tags"` 2107} 2108 2109// MarshalJSON is the custom marshaler for Resource. 2110func (r Resource) MarshalJSON() ([]byte, error) { 2111 objectMap := make(map[string]interface{}) 2112 if r.Identity != nil { 2113 objectMap["identity"] = r.Identity 2114 } 2115 if r.Location != nil { 2116 objectMap["location"] = r.Location 2117 } 2118 if r.Tags != nil { 2119 objectMap["tags"] = r.Tags 2120 } 2121 return json.Marshal(objectMap) 2122} 2123 2124// ResourceID represents a resource ID. For example, for a subnet, it is the resource URL for the subnet. 2125type ResourceID struct { 2126 // ID - The ID of the resource 2127 ID *string `json:"id,omitempty"` 2128} 2129 2130// ScaleSettings scale settings for AML Compute 2131type ScaleSettings struct { 2132 // MaxNodeCount - Max number of nodes to use 2133 MaxNodeCount *int32 `json:"maxNodeCount,omitempty"` 2134 // MinNodeCount - Min number of nodes to use 2135 MinNodeCount *int32 `json:"minNodeCount,omitempty"` 2136 // NodeIdleTimeBeforeScaleDown - Node Idle Time before scaling down amlCompute 2137 NodeIdleTimeBeforeScaleDown *string `json:"nodeIdleTimeBeforeScaleDown,omitempty"` 2138} 2139 2140// ServicePrincipalCredentials service principal credentials. 2141type ServicePrincipalCredentials struct { 2142 // ClientID - Client Id 2143 ClientID *string `json:"clientId,omitempty"` 2144 // ClientSecret - Client secret 2145 ClientSecret *string `json:"clientSecret,omitempty"` 2146} 2147 2148// SslConfiguration the ssl configuration for scoring 2149type SslConfiguration struct { 2150 // Status - Enable or disable ssl for scoring. Possible values include: 'Disabled', 'Enabled' 2151 Status Status `json:"status,omitempty"` 2152 // Cert - Cert data 2153 Cert *string `json:"cert,omitempty"` 2154 // Key - Key data 2155 Key *string `json:"key,omitempty"` 2156 // Cname - CNAME of the cert 2157 Cname *string `json:"cname,omitempty"` 2158} 2159 2160// SystemService a system service running on a compute. 2161type SystemService struct { 2162 // SystemServiceType - READ-ONLY; The type of this system service. 2163 SystemServiceType *string `json:"systemServiceType,omitempty"` 2164 // PublicIPAddress - READ-ONLY; Public IP address 2165 PublicIPAddress *string `json:"publicIpAddress,omitempty"` 2166 // Version - READ-ONLY; The version for this type. 2167 Version *string `json:"version,omitempty"` 2168} 2169 2170// MarshalJSON is the custom marshaler for SystemService. 2171func (ss SystemService) MarshalJSON() ([]byte, error) { 2172 objectMap := make(map[string]interface{}) 2173 return json.Marshal(objectMap) 2174} 2175 2176// Usage describes AML Resource Usage. 2177type Usage struct { 2178 // Unit - READ-ONLY; An enum describing the unit of usage measurement. Possible values include: 'Count' 2179 Unit UsageUnit `json:"unit,omitempty"` 2180 // CurrentValue - READ-ONLY; The current usage of the resource. 2181 CurrentValue *int64 `json:"currentValue,omitempty"` 2182 // Limit - READ-ONLY; The maximum permitted usage of the resource. 2183 Limit *int64 `json:"limit,omitempty"` 2184 // Name - READ-ONLY; The name of the type of usage. 2185 Name *UsageName `json:"name,omitempty"` 2186} 2187 2188// MarshalJSON is the custom marshaler for Usage. 2189func (u Usage) MarshalJSON() ([]byte, error) { 2190 objectMap := make(map[string]interface{}) 2191 return json.Marshal(objectMap) 2192} 2193 2194// UsageName the Usage Names. 2195type UsageName struct { 2196 // Value - READ-ONLY; The name of the resource. 2197 Value *string `json:"value,omitempty"` 2198 // LocalizedValue - READ-ONLY; The localized name of the resource. 2199 LocalizedValue *string `json:"localizedValue,omitempty"` 2200} 2201 2202// MarshalJSON is the custom marshaler for UsageName. 2203func (un UsageName) MarshalJSON() ([]byte, error) { 2204 objectMap := make(map[string]interface{}) 2205 return json.Marshal(objectMap) 2206} 2207 2208// UserAccountCredentials settings for user account that gets created on each on the nodes of a compute. 2209type UserAccountCredentials struct { 2210 // AdminUserName - Name of the administrator user account which can be used to SSH to nodes. 2211 AdminUserName *string `json:"adminUserName,omitempty"` 2212 // AdminUserSSHPublicKey - SSH public key of the administrator user account. 2213 AdminUserSSHPublicKey *string `json:"adminUserSshPublicKey,omitempty"` 2214 // AdminUserPassword - Password of the administrator user account. 2215 AdminUserPassword *string `json:"adminUserPassword,omitempty"` 2216} 2217 2218// VirtualMachine a Machine Learning compute based on Azure Virtual Machines. 2219type VirtualMachine struct { 2220 Properties *VirtualMachineProperties `json:"properties,omitempty"` 2221 // ComputeLocation - Location for the underlying compute 2222 ComputeLocation *string `json:"computeLocation,omitempty"` 2223 // ProvisioningState - READ-ONLY; The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Possible values include: 'Unknown', 'Updating', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 2224 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 2225 // Description - The description of the Machine Learning compute. 2226 Description *string `json:"description,omitempty"` 2227 // CreatedOn - READ-ONLY; The date and time when the compute was created. 2228 CreatedOn *date.Time `json:"createdOn,omitempty"` 2229 // ModifiedOn - READ-ONLY; The date and time when the compute was last modified. 2230 ModifiedOn *date.Time `json:"modifiedOn,omitempty"` 2231 // ResourceID - ARM resource id of the underlying compute 2232 ResourceID *string `json:"resourceId,omitempty"` 2233 // ProvisioningErrors - READ-ONLY; Errors during provisioning 2234 ProvisioningErrors *[]Error `json:"provisioningErrors,omitempty"` 2235 // IsAttachedCompute - READ-ONLY; Indicating whether the compute was provisioned by user and brought from outside if true, or machine learning service provisioned it if false. 2236 IsAttachedCompute *bool `json:"isAttachedCompute,omitempty"` 2237 // ComputeType - Possible values include: 'ComputeTypeCompute', 'ComputeTypeAKS1', 'ComputeTypeAmlCompute1', 'ComputeTypeVirtualMachine1', 'ComputeTypeHDInsight1', 'ComputeTypeDataFactory1', 'ComputeTypeDatabricks1', 'ComputeTypeDataLakeAnalytics1' 2238 ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` 2239} 2240 2241// MarshalJSON is the custom marshaler for VirtualMachine. 2242func (VM VirtualMachine) MarshalJSON() ([]byte, error) { 2243 VM.ComputeType = ComputeTypeVirtualMachine1 2244 objectMap := make(map[string]interface{}) 2245 if VM.Properties != nil { 2246 objectMap["properties"] = VM.Properties 2247 } 2248 if VM.ComputeLocation != nil { 2249 objectMap["computeLocation"] = VM.ComputeLocation 2250 } 2251 if VM.Description != nil { 2252 objectMap["description"] = VM.Description 2253 } 2254 if VM.ResourceID != nil { 2255 objectMap["resourceId"] = VM.ResourceID 2256 } 2257 if VM.ComputeType != "" { 2258 objectMap["computeType"] = VM.ComputeType 2259 } 2260 return json.Marshal(objectMap) 2261} 2262 2263// AsAKS is the BasicCompute implementation for VirtualMachine. 2264func (VM VirtualMachine) AsAKS() (*AKS, bool) { 2265 return nil, false 2266} 2267 2268// AsAmlCompute is the BasicCompute implementation for VirtualMachine. 2269func (VM VirtualMachine) AsAmlCompute() (*AmlCompute, bool) { 2270 return nil, false 2271} 2272 2273// AsVirtualMachine is the BasicCompute implementation for VirtualMachine. 2274func (VM VirtualMachine) AsVirtualMachine() (*VirtualMachine, bool) { 2275 return &VM, true 2276} 2277 2278// AsHDInsight is the BasicCompute implementation for VirtualMachine. 2279func (VM VirtualMachine) AsHDInsight() (*HDInsight, bool) { 2280 return nil, false 2281} 2282 2283// AsDataFactory is the BasicCompute implementation for VirtualMachine. 2284func (VM VirtualMachine) AsDataFactory() (*DataFactory, bool) { 2285 return nil, false 2286} 2287 2288// AsDatabricks is the BasicCompute implementation for VirtualMachine. 2289func (VM VirtualMachine) AsDatabricks() (*Databricks, bool) { 2290 return nil, false 2291} 2292 2293// AsDataLakeAnalytics is the BasicCompute implementation for VirtualMachine. 2294func (VM VirtualMachine) AsDataLakeAnalytics() (*DataLakeAnalytics, bool) { 2295 return nil, false 2296} 2297 2298// AsCompute is the BasicCompute implementation for VirtualMachine. 2299func (VM VirtualMachine) AsCompute() (*Compute, bool) { 2300 return nil, false 2301} 2302 2303// AsBasicCompute is the BasicCompute implementation for VirtualMachine. 2304func (VM VirtualMachine) AsBasicCompute() (BasicCompute, bool) { 2305 return &VM, true 2306} 2307 2308// VirtualMachineProperties ... 2309type VirtualMachineProperties struct { 2310 // VirtualMachineSize - Virtual Machine size 2311 VirtualMachineSize *string `json:"virtualMachineSize,omitempty"` 2312 // SSHPort - Port open for ssh connections. 2313 SSHPort *int32 `json:"sshPort,omitempty"` 2314 // Address - Public IP address of the virtual machine. 2315 Address *string `json:"address,omitempty"` 2316 // AdministratorAccount - Admin credentials for virtual machine 2317 AdministratorAccount *VirtualMachineSSHCredentials `json:"administratorAccount,omitempty"` 2318} 2319 2320// VirtualMachineSecrets secrets related to a Machine Learning compute based on AKS. 2321type VirtualMachineSecrets struct { 2322 // AdministratorAccount - Admin credentials for virtual machine. 2323 AdministratorAccount *VirtualMachineSSHCredentials `json:"administratorAccount,omitempty"` 2324 // ComputeType - Possible values include: 'ComputeTypeBasicComputeSecretsComputeTypeComputeSecrets', 'ComputeTypeBasicComputeSecretsComputeTypeAKS', 'ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine', 'ComputeTypeBasicComputeSecretsComputeTypeDatabricks' 2325 ComputeType ComputeTypeBasicComputeSecrets `json:"computeType,omitempty"` 2326} 2327 2328// MarshalJSON is the custom marshaler for VirtualMachineSecrets. 2329func (vms VirtualMachineSecrets) MarshalJSON() ([]byte, error) { 2330 vms.ComputeType = ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine 2331 objectMap := make(map[string]interface{}) 2332 if vms.AdministratorAccount != nil { 2333 objectMap["administratorAccount"] = vms.AdministratorAccount 2334 } 2335 if vms.ComputeType != "" { 2336 objectMap["computeType"] = vms.ComputeType 2337 } 2338 return json.Marshal(objectMap) 2339} 2340 2341// AsAksComputeSecrets is the BasicComputeSecrets implementation for VirtualMachineSecrets. 2342func (vms VirtualMachineSecrets) AsAksComputeSecrets() (*AksComputeSecrets, bool) { 2343 return nil, false 2344} 2345 2346// AsVirtualMachineSecrets is the BasicComputeSecrets implementation for VirtualMachineSecrets. 2347func (vms VirtualMachineSecrets) AsVirtualMachineSecrets() (*VirtualMachineSecrets, bool) { 2348 return &vms, true 2349} 2350 2351// AsDatabricksComputeSecrets is the BasicComputeSecrets implementation for VirtualMachineSecrets. 2352func (vms VirtualMachineSecrets) AsDatabricksComputeSecrets() (*DatabricksComputeSecrets, bool) { 2353 return nil, false 2354} 2355 2356// AsComputeSecrets is the BasicComputeSecrets implementation for VirtualMachineSecrets. 2357func (vms VirtualMachineSecrets) AsComputeSecrets() (*ComputeSecrets, bool) { 2358 return nil, false 2359} 2360 2361// AsBasicComputeSecrets is the BasicComputeSecrets implementation for VirtualMachineSecrets. 2362func (vms VirtualMachineSecrets) AsBasicComputeSecrets() (BasicComputeSecrets, bool) { 2363 return &vms, true 2364} 2365 2366// VirtualMachineSize describes the properties of a VM size. 2367type VirtualMachineSize struct { 2368 // Name - READ-ONLY; The name of the virtual machine size. 2369 Name *string `json:"name,omitempty"` 2370 // Family - READ-ONLY; The family name of the virtual machine size. 2371 Family *string `json:"family,omitempty"` 2372 // VCPUs - READ-ONLY; The number of vCPUs supported by the virtual machine size. 2373 VCPUs *int32 `json:"vCPUs,omitempty"` 2374 // OsVhdSizeMB - READ-ONLY; The OS VHD disk size, in MB, allowed by the virtual machine size. 2375 OsVhdSizeMB *int32 `json:"osVhdSizeMB,omitempty"` 2376 // MaxResourceVolumeMB - READ-ONLY; The resource volume size, in MB, allowed by the virtual machine size. 2377 MaxResourceVolumeMB *int32 `json:"maxResourceVolumeMB,omitempty"` 2378 // MemoryGB - READ-ONLY; The amount of memory, in GB, supported by the virtual machine size. 2379 MemoryGB *float64 `json:"memoryGB,omitempty"` 2380 // LowPriorityCapable - READ-ONLY; Specifies if the virtual machine size supports low priority VMs. 2381 LowPriorityCapable *bool `json:"lowPriorityCapable,omitempty"` 2382 // PremiumIO - READ-ONLY; Specifies if the virtual machine size supports premium IO. 2383 PremiumIO *bool `json:"premiumIO,omitempty"` 2384} 2385 2386// MarshalJSON is the custom marshaler for VirtualMachineSize. 2387func (vms VirtualMachineSize) MarshalJSON() ([]byte, error) { 2388 objectMap := make(map[string]interface{}) 2389 return json.Marshal(objectMap) 2390} 2391 2392// VirtualMachineSizeListResult the List Virtual Machine size operation response. 2393type VirtualMachineSizeListResult struct { 2394 autorest.Response `json:"-"` 2395 // AmlCompute - The list of virtual machine sizes supported by AmlCompute. 2396 AmlCompute *[]VirtualMachineSize `json:"amlCompute,omitempty"` 2397} 2398 2399// VirtualMachineSSHCredentials admin credentials for virtual machine 2400type VirtualMachineSSHCredentials struct { 2401 // Username - Username of admin account 2402 Username *string `json:"username,omitempty"` 2403 // Password - Password of admin account 2404 Password *string `json:"password,omitempty"` 2405 // PublicKeyData - Public key data 2406 PublicKeyData *string `json:"publicKeyData,omitempty"` 2407 // PrivateKeyData - Private key data 2408 PrivateKeyData *string `json:"privateKeyData,omitempty"` 2409} 2410 2411// Workspace an object that represents a machine learning workspace. 2412type Workspace struct { 2413 autorest.Response `json:"-"` 2414 // WorkspaceProperties - The properties of the machine learning workspace. 2415 *WorkspaceProperties `json:"properties,omitempty"` 2416 // ID - READ-ONLY; Specifies the resource ID. 2417 ID *string `json:"id,omitempty"` 2418 // Name - READ-ONLY; Specifies the name of the resource. 2419 Name *string `json:"name,omitempty"` 2420 // Identity - The identity of the resource. 2421 Identity *Identity `json:"identity,omitempty"` 2422 // Location - Specifies the location of the resource. 2423 Location *string `json:"location,omitempty"` 2424 // Type - READ-ONLY; Specifies the type of the resource. 2425 Type *string `json:"type,omitempty"` 2426 // Tags - Contains resource tags defined as key/value pairs. 2427 Tags map[string]*string `json:"tags"` 2428} 2429 2430// MarshalJSON is the custom marshaler for Workspace. 2431func (w Workspace) MarshalJSON() ([]byte, error) { 2432 objectMap := make(map[string]interface{}) 2433 if w.WorkspaceProperties != nil { 2434 objectMap["properties"] = w.WorkspaceProperties 2435 } 2436 if w.Identity != nil { 2437 objectMap["identity"] = w.Identity 2438 } 2439 if w.Location != nil { 2440 objectMap["location"] = w.Location 2441 } 2442 if w.Tags != nil { 2443 objectMap["tags"] = w.Tags 2444 } 2445 return json.Marshal(objectMap) 2446} 2447 2448// UnmarshalJSON is the custom unmarshaler for Workspace struct. 2449func (w *Workspace) UnmarshalJSON(body []byte) error { 2450 var m map[string]*json.RawMessage 2451 err := json.Unmarshal(body, &m) 2452 if err != nil { 2453 return err 2454 } 2455 for k, v := range m { 2456 switch k { 2457 case "properties": 2458 if v != nil { 2459 var workspaceProperties WorkspaceProperties 2460 err = json.Unmarshal(*v, &workspaceProperties) 2461 if err != nil { 2462 return err 2463 } 2464 w.WorkspaceProperties = &workspaceProperties 2465 } 2466 case "id": 2467 if v != nil { 2468 var ID string 2469 err = json.Unmarshal(*v, &ID) 2470 if err != nil { 2471 return err 2472 } 2473 w.ID = &ID 2474 } 2475 case "name": 2476 if v != nil { 2477 var name string 2478 err = json.Unmarshal(*v, &name) 2479 if err != nil { 2480 return err 2481 } 2482 w.Name = &name 2483 } 2484 case "identity": 2485 if v != nil { 2486 var identity Identity 2487 err = json.Unmarshal(*v, &identity) 2488 if err != nil { 2489 return err 2490 } 2491 w.Identity = &identity 2492 } 2493 case "location": 2494 if v != nil { 2495 var location string 2496 err = json.Unmarshal(*v, &location) 2497 if err != nil { 2498 return err 2499 } 2500 w.Location = &location 2501 } 2502 case "type": 2503 if v != nil { 2504 var typeVar string 2505 err = json.Unmarshal(*v, &typeVar) 2506 if err != nil { 2507 return err 2508 } 2509 w.Type = &typeVar 2510 } 2511 case "tags": 2512 if v != nil { 2513 var tags map[string]*string 2514 err = json.Unmarshal(*v, &tags) 2515 if err != nil { 2516 return err 2517 } 2518 w.Tags = tags 2519 } 2520 } 2521 } 2522 2523 return nil 2524} 2525 2526// WorkspaceListResult the result of a request to list machine learning workspaces. 2527type WorkspaceListResult struct { 2528 autorest.Response `json:"-"` 2529 // Value - The list of machine learning workspaces. Since this list may be incomplete, the nextLink field should be used to request the next list of machine learning workspaces. 2530 Value *[]Workspace `json:"value,omitempty"` 2531 // NextLink - The URI that can be used to request the next list of machine learning workspaces. 2532 NextLink *string `json:"nextLink,omitempty"` 2533} 2534 2535// WorkspaceListResultIterator provides access to a complete listing of Workspace values. 2536type WorkspaceListResultIterator struct { 2537 i int 2538 page WorkspaceListResultPage 2539} 2540 2541// NextWithContext advances to the next value. If there was an error making 2542// the request the iterator does not advance and the error is returned. 2543func (iter *WorkspaceListResultIterator) NextWithContext(ctx context.Context) (err error) { 2544 if tracing.IsEnabled() { 2545 ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListResultIterator.NextWithContext") 2546 defer func() { 2547 sc := -1 2548 if iter.Response().Response.Response != nil { 2549 sc = iter.Response().Response.Response.StatusCode 2550 } 2551 tracing.EndSpan(ctx, sc, err) 2552 }() 2553 } 2554 iter.i++ 2555 if iter.i < len(iter.page.Values()) { 2556 return nil 2557 } 2558 err = iter.page.NextWithContext(ctx) 2559 if err != nil { 2560 iter.i-- 2561 return err 2562 } 2563 iter.i = 0 2564 return nil 2565} 2566 2567// Next advances to the next value. If there was an error making 2568// the request the iterator does not advance and the error is returned. 2569// Deprecated: Use NextWithContext() instead. 2570func (iter *WorkspaceListResultIterator) Next() error { 2571 return iter.NextWithContext(context.Background()) 2572} 2573 2574// NotDone returns true if the enumeration should be started or is not yet complete. 2575func (iter WorkspaceListResultIterator) NotDone() bool { 2576 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2577} 2578 2579// Response returns the raw server response from the last page request. 2580func (iter WorkspaceListResultIterator) Response() WorkspaceListResult { 2581 return iter.page.Response() 2582} 2583 2584// Value returns the current value or a zero-initialized value if the 2585// iterator has advanced beyond the end of the collection. 2586func (iter WorkspaceListResultIterator) Value() Workspace { 2587 if !iter.page.NotDone() { 2588 return Workspace{} 2589 } 2590 return iter.page.Values()[iter.i] 2591} 2592 2593// Creates a new instance of the WorkspaceListResultIterator type. 2594func NewWorkspaceListResultIterator(page WorkspaceListResultPage) WorkspaceListResultIterator { 2595 return WorkspaceListResultIterator{page: page} 2596} 2597 2598// IsEmpty returns true if the ListResult contains no values. 2599func (wlr WorkspaceListResult) IsEmpty() bool { 2600 return wlr.Value == nil || len(*wlr.Value) == 0 2601} 2602 2603// hasNextLink returns true if the NextLink is not empty. 2604func (wlr WorkspaceListResult) hasNextLink() bool { 2605 return wlr.NextLink != nil && len(*wlr.NextLink) != 0 2606} 2607 2608// workspaceListResultPreparer prepares a request to retrieve the next set of results. 2609// It returns nil if no more results exist. 2610func (wlr WorkspaceListResult) workspaceListResultPreparer(ctx context.Context) (*http.Request, error) { 2611 if !wlr.hasNextLink() { 2612 return nil, nil 2613 } 2614 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2615 autorest.AsJSON(), 2616 autorest.AsGet(), 2617 autorest.WithBaseURL(to.String(wlr.NextLink))) 2618} 2619 2620// WorkspaceListResultPage contains a page of Workspace values. 2621type WorkspaceListResultPage struct { 2622 fn func(context.Context, WorkspaceListResult) (WorkspaceListResult, error) 2623 wlr WorkspaceListResult 2624} 2625 2626// NextWithContext advances to the next page of values. If there was an error making 2627// the request the page does not advance and the error is returned. 2628func (page *WorkspaceListResultPage) NextWithContext(ctx context.Context) (err error) { 2629 if tracing.IsEnabled() { 2630 ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListResultPage.NextWithContext") 2631 defer func() { 2632 sc := -1 2633 if page.Response().Response.Response != nil { 2634 sc = page.Response().Response.Response.StatusCode 2635 } 2636 tracing.EndSpan(ctx, sc, err) 2637 }() 2638 } 2639 for { 2640 next, err := page.fn(ctx, page.wlr) 2641 if err != nil { 2642 return err 2643 } 2644 page.wlr = next 2645 if !next.hasNextLink() || !next.IsEmpty() { 2646 break 2647 } 2648 } 2649 return nil 2650} 2651 2652// Next advances to the next page of values. If there was an error making 2653// the request the page does not advance and the error is returned. 2654// Deprecated: Use NextWithContext() instead. 2655func (page *WorkspaceListResultPage) Next() error { 2656 return page.NextWithContext(context.Background()) 2657} 2658 2659// NotDone returns true if the page enumeration should be started or is not yet complete. 2660func (page WorkspaceListResultPage) NotDone() bool { 2661 return !page.wlr.IsEmpty() 2662} 2663 2664// Response returns the raw server response from the last page request. 2665func (page WorkspaceListResultPage) Response() WorkspaceListResult { 2666 return page.wlr 2667} 2668 2669// Values returns the slice of values for the current page or nil if there are no values. 2670func (page WorkspaceListResultPage) Values() []Workspace { 2671 if page.wlr.IsEmpty() { 2672 return nil 2673 } 2674 return *page.wlr.Value 2675} 2676 2677// Creates a new instance of the WorkspaceListResultPage type. 2678func NewWorkspaceListResultPage(cur WorkspaceListResult, getNextPage func(context.Context, WorkspaceListResult) (WorkspaceListResult, error)) WorkspaceListResultPage { 2679 return WorkspaceListResultPage{ 2680 fn: getNextPage, 2681 wlr: cur, 2682 } 2683} 2684 2685// WorkspaceProperties the properties of a machine learning workspace. 2686type WorkspaceProperties struct { 2687 // WorkspaceID - READ-ONLY; The immutable id associated with this workspace. 2688 WorkspaceID *string `json:"workspaceId,omitempty"` 2689 // Description - The description of this workspace. 2690 Description *string `json:"description,omitempty"` 2691 // FriendlyName - The friendly name for this workspace. This name in mutable 2692 FriendlyName *string `json:"friendlyName,omitempty"` 2693 // CreationTime - READ-ONLY; The creation time of the machine learning workspace in ISO8601 format. 2694 CreationTime *date.Time `json:"creationTime,omitempty"` 2695 // KeyVault - ARM id of the key vault associated with this workspace. This cannot be changed once the workspace has been created 2696 KeyVault *string `json:"keyVault,omitempty"` 2697 // ApplicationInsights - ARM id of the application insights associated with this workspace. This cannot be changed once the workspace has been created 2698 ApplicationInsights *string `json:"applicationInsights,omitempty"` 2699 // ContainerRegistry - ARM id of the container registry associated with this workspace. This cannot be changed once the workspace has been created 2700 ContainerRegistry *string `json:"containerRegistry,omitempty"` 2701 // StorageAccount - ARM id of the storage account associated with this workspace. This cannot be changed once the workspace has been created 2702 StorageAccount *string `json:"storageAccount,omitempty"` 2703 // DiscoveryURL - Url for the discovery service to identify regional endpoints for machine learning experimentation services 2704 DiscoveryURL *string `json:"discoveryUrl,omitempty"` 2705 // ProvisioningState - READ-ONLY; The current deployment state of workspace resource. The provisioningState is to indicate states for resource provisioning. Possible values include: 'Unknown', 'Updating', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Canceled' 2706 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 2707} 2708 2709// MarshalJSON is the custom marshaler for WorkspaceProperties. 2710func (wp WorkspaceProperties) MarshalJSON() ([]byte, error) { 2711 objectMap := make(map[string]interface{}) 2712 if wp.Description != nil { 2713 objectMap["description"] = wp.Description 2714 } 2715 if wp.FriendlyName != nil { 2716 objectMap["friendlyName"] = wp.FriendlyName 2717 } 2718 if wp.KeyVault != nil { 2719 objectMap["keyVault"] = wp.KeyVault 2720 } 2721 if wp.ApplicationInsights != nil { 2722 objectMap["applicationInsights"] = wp.ApplicationInsights 2723 } 2724 if wp.ContainerRegistry != nil { 2725 objectMap["containerRegistry"] = wp.ContainerRegistry 2726 } 2727 if wp.StorageAccount != nil { 2728 objectMap["storageAccount"] = wp.StorageAccount 2729 } 2730 if wp.DiscoveryURL != nil { 2731 objectMap["discoveryUrl"] = wp.DiscoveryURL 2732 } 2733 return json.Marshal(objectMap) 2734} 2735 2736// WorkspacePropertiesUpdateParameters the parameters for updating the properties of a machine learning 2737// workspace. 2738type WorkspacePropertiesUpdateParameters struct { 2739 // Description - The description of this workspace. 2740 Description *string `json:"description,omitempty"` 2741 // FriendlyName - The friendly name for this workspace. 2742 FriendlyName *string `json:"friendlyName,omitempty"` 2743} 2744 2745// WorkspacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 2746// long-running operation. 2747type WorkspacesCreateOrUpdateFuture struct { 2748 azure.FutureAPI 2749 // Result returns the result of the asynchronous operation. 2750 // If the operation has not completed it will return an error. 2751 Result func(WorkspacesClient) (Workspace, error) 2752} 2753 2754// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2755func (future *WorkspacesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 2756 var azFuture azure.Future 2757 if err := json.Unmarshal(body, &azFuture); err != nil { 2758 return err 2759 } 2760 future.FutureAPI = &azFuture 2761 future.Result = future.result 2762 return nil 2763} 2764 2765// result is the default implementation for WorkspacesCreateOrUpdateFuture.Result. 2766func (future *WorkspacesCreateOrUpdateFuture) result(client WorkspacesClient) (w Workspace, err error) { 2767 var done bool 2768 done, err = future.DoneWithContext(context.Background(), client) 2769 if err != nil { 2770 err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 2771 return 2772 } 2773 if !done { 2774 w.Response.Response = future.Response() 2775 err = azure.NewAsyncOpIncompleteError("machinelearningservices.WorkspacesCreateOrUpdateFuture") 2776 return 2777 } 2778 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2779 if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { 2780 w, err = client.CreateOrUpdateResponder(w.Response.Response) 2781 if err != nil { 2782 err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesCreateOrUpdateFuture", "Result", w.Response.Response, "Failure responding to request") 2783 } 2784 } 2785 return 2786} 2787 2788// WorkspacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 2789// operation. 2790type WorkspacesDeleteFuture struct { 2791 azure.FutureAPI 2792 // Result returns the result of the asynchronous operation. 2793 // If the operation has not completed it will return an error. 2794 Result func(WorkspacesClient) (autorest.Response, error) 2795} 2796 2797// UnmarshalJSON is the custom unmarshaller for CreateFuture. 2798func (future *WorkspacesDeleteFuture) UnmarshalJSON(body []byte) error { 2799 var azFuture azure.Future 2800 if err := json.Unmarshal(body, &azFuture); err != nil { 2801 return err 2802 } 2803 future.FutureAPI = &azFuture 2804 future.Result = future.result 2805 return nil 2806} 2807 2808// result is the default implementation for WorkspacesDeleteFuture.Result. 2809func (future *WorkspacesDeleteFuture) result(client WorkspacesClient) (ar autorest.Response, err error) { 2810 var done bool 2811 done, err = future.DoneWithContext(context.Background(), client) 2812 if err != nil { 2813 err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesDeleteFuture", "Result", future.Response(), "Polling failure") 2814 return 2815 } 2816 if !done { 2817 ar.Response = future.Response() 2818 err = azure.NewAsyncOpIncompleteError("machinelearningservices.WorkspacesDeleteFuture") 2819 return 2820 } 2821 ar.Response = future.Response() 2822 return 2823} 2824 2825// WorkspaceUpdateParameters the parameters for updating a machine learning workspace. 2826type WorkspaceUpdateParameters struct { 2827 // Tags - The resource tags for the machine learning workspace. 2828 Tags map[string]*string `json:"tags"` 2829 // WorkspacePropertiesUpdateParameters - The properties that the machine learning workspace will be updated with. 2830 *WorkspacePropertiesUpdateParameters `json:"properties,omitempty"` 2831} 2832 2833// MarshalJSON is the custom marshaler for WorkspaceUpdateParameters. 2834func (wup WorkspaceUpdateParameters) MarshalJSON() ([]byte, error) { 2835 objectMap := make(map[string]interface{}) 2836 if wup.Tags != nil { 2837 objectMap["tags"] = wup.Tags 2838 } 2839 if wup.WorkspacePropertiesUpdateParameters != nil { 2840 objectMap["properties"] = wup.WorkspacePropertiesUpdateParameters 2841 } 2842 return json.Marshal(objectMap) 2843} 2844 2845// UnmarshalJSON is the custom unmarshaler for WorkspaceUpdateParameters struct. 2846func (wup *WorkspaceUpdateParameters) UnmarshalJSON(body []byte) error { 2847 var m map[string]*json.RawMessage 2848 err := json.Unmarshal(body, &m) 2849 if err != nil { 2850 return err 2851 } 2852 for k, v := range m { 2853 switch k { 2854 case "tags": 2855 if v != nil { 2856 var tags map[string]*string 2857 err = json.Unmarshal(*v, &tags) 2858 if err != nil { 2859 return err 2860 } 2861 wup.Tags = tags 2862 } 2863 case "properties": 2864 if v != nil { 2865 var workspacePropertiesUpdateParameters WorkspacePropertiesUpdateParameters 2866 err = json.Unmarshal(*v, &workspacePropertiesUpdateParameters) 2867 if err != nil { 2868 return err 2869 } 2870 wup.WorkspacePropertiesUpdateParameters = &workspacePropertiesUpdateParameters 2871 } 2872 } 2873 } 2874 2875 return nil 2876} 2877