From 1c30162f48513aae49412654f8cea5a922fc24d5 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 1 Jul 2021 19:03:38 +0000 Subject: [PATCH] CodeGen from PR 14705 in Azure/azure-rest-api-specs Remove WorkspaceConnectionDto and use WorkspaceConnection instead for PUT request (#14705) * Add Identity to createWorkpace example * change for getTransitivePEUsages * update * prettier code * add another new endpoint * address comments * change for getTransitivePEUsages * update * prettier code * add another new endpoint * address comments * revert change on transitivePE and notebookKeys * revert change on transitivePE and notebookKeys * add new stable version 2021-01-01 * add ListNotebookAccessToken * add primaryUserAssignedIdentity * fix missing properties and apis * fix one more missing property * 202 status for start and stop CI * make resync keys long runnin operation in version Jan2021 * resync keys 204 * update resync keys example * Dont throw 204 for resync * update resync keys * Formatting * revert Jan2021changes and add new version * start apr2021 version for azure ml rp * undo remove new line in jan2021 * use systemData definition in common * removed old files * fix small swagger bugs * run prettier * remove reference to sku * update readme * minimum agentCount should be 0 * add createdOn and ModifiedOn to compute properties * add LoadBalancerType to aks compute * add isNotebookInstanceCompute to virtualMachine * add leafDomainLabel to SslConfiguration * add overwriteExistingDomain to SslConfiguration * add synapseSpark as supported compute-type * update patch compute response to 202 * remove location from example responses * Revert "remove location from example responses" This reverts commit 048bf2551513afae842a9c4fbb5861aeddc6c33a. * MachineLearningCompute_Update should have a 200 response * sys data to use local def due to naming conflicts. * Fix enum casing * Fix operationId PR comment. * Change opId in apr version * remove 20210401 for easy review * only change api version * merge changes for 20210401 version * Add x-ms-discriminator-value for Synapse spark * camelcase loadbalancer properties * add createdOn and Modified on to examples * address AvoidAnonymousTypes error for SynapseSpark * Minor fixes + new property * Remove subscription state. * fix swagger bug * fix example * fix more reported problems * remove nullable flag for tags * make containerRegistry nullable * address comments * fix example Co-authored-by: Vinay Rajmal Soni Co-authored-by: Suba Co-authored-by: jopet@microsoft.com Co-authored-by: Josh Peterson <15050193+joshanator@users.noreply.github.com> Co-authored-by: Suba --- .../machinelearningservices/CHANGELOG.md | 17 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 17 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 21 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 24 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 25 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 24 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 25 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 9 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 27 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 2 + .../machinelearningservices/_meta.json | 11 + .../batchdeployments.go | 553 + .../machinelearningservices/batchendpoints.go | 614 + .../machinelearningservices/client.go | 42 + .../machinelearningservices/codecontainers.go | 431 + .../machinelearningservices/codeversions.go | 450 + .../machinelearningservices/compute.go | 1098 ++ .../machinelearningservices/datacontainers.go | 431 + .../machinelearningservices/datastores.go | 552 + .../machinelearningservices/dataversions.go | 454 + .../machinelearningservices/enums.go | 1634 ++ .../environmentcontainers.go | 433 + .../environmentspecificationversions.go | 467 + .../machinelearningservices/jobs.go | 529 + .../machinelearningservices/labelingjobs.go | 711 + .../machinelearningservicesapi/interfaces.go | 305 + .../modelcontainers.go | 435 + .../machinelearningservices/models.go | 16072 ++++++++++++++++ .../machinelearningservices/modelversions.go | 470 + .../onlinedeployments.go | 642 + .../onlineendpoints.go | 818 + .../machinelearningservices/operations.go | 98 + .../privateendpointconnections.go | 385 + .../privatelinkresources.go | 119 + .../machinelearningservices/quotas.go | 241 + .../machinelearningservices/usages.go | 156 + .../machinelearningservices/version.go | 19 + .../virtualmachinesizes.go | 116 + .../workspaceconnections.go | 393 + .../workspacefeatures.go | 160 + .../machinelearningservices/workspaces.go | 1158 ++ .../machinelearningservices/workspaceskus.go | 151 + 51 files changed, 30168 insertions(+), 189 deletions(-) create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/CHANGELOG.md create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/_meta.json create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/batchdeployments.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/batchendpoints.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/client.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/codecontainers.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/codeversions.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/compute.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/datacontainers.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/datastores.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/dataversions.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/enums.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/environmentcontainers.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/environmentspecificationversions.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/jobs.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/labelingjobs.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/machinelearningservicesapi/interfaces.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/modelcontainers.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/models.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/modelversions.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/onlinedeployments.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/onlineendpoints.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/operations.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/privateendpointconnections.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/privatelinkresources.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/quotas.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/usages.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/version.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/virtualmachinesizes.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/workspaceconnections.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/workspacefeatures.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/workspaces.go create mode 100644 services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/workspaceskus.go diff --git a/services/machinelearningservices/mgmt/2018-11-19/machinelearningservices/CHANGELOG.md b/services/machinelearningservices/mgmt/2018-11-19/machinelearningservices/CHANGELOG.md index 23e72e49b0a2..a1ecf841edb0 100644 --- a/services/machinelearningservices/mgmt/2018-11-19/machinelearningservices/CHANGELOG.md +++ b/services/machinelearningservices/mgmt/2018-11-19/machinelearningservices/CHANGELOG.md @@ -1,17 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AmlComputeNodeInformation.MarshalJSON() ([]byte, error) -1. Error.MarshalJSON() ([]byte, error) -1. ErrorResponse.MarshalJSON() ([]byte, error) -1. ListUsagesResult.MarshalJSON() ([]byte, error) -1. ListWorkspaceKeysResult.MarshalJSON() ([]byte, error) -1. NodeStateCounts.MarshalJSON() ([]byte, error) -1. Password.MarshalJSON() ([]byte, error) -1. SystemService.MarshalJSON() ([]byte, error) -1. Usage.MarshalJSON() ([]byte, error) -1. UsageName.MarshalJSON() ([]byte, error) -1. VirtualMachineSize.MarshalJSON() ([]byte, error) diff --git a/services/machinelearningservices/mgmt/2018-11-19/machinelearningservices/_meta.json b/services/machinelearningservices/mgmt/2018-11-19/machinelearningservices/_meta.json index 6a31240eb574..9dd31cf5623e 100644 --- a/services/machinelearningservices/mgmt/2018-11-19/machinelearningservices/_meta.json +++ b/services/machinelearningservices/mgmt/2018-11-19/machinelearningservices/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a2792ff53ed316c367d77b622ba59cf9a6c88da4", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2018-11-19", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/machinelearningservices/mgmt/2019-05-01/machinelearningservices/CHANGELOG.md b/services/machinelearningservices/mgmt/2019-05-01/machinelearningservices/CHANGELOG.md index 23e72e49b0a2..a1ecf841edb0 100644 --- a/services/machinelearningservices/mgmt/2019-05-01/machinelearningservices/CHANGELOG.md +++ b/services/machinelearningservices/mgmt/2019-05-01/machinelearningservices/CHANGELOG.md @@ -1,17 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AmlComputeNodeInformation.MarshalJSON() ([]byte, error) -1. Error.MarshalJSON() ([]byte, error) -1. ErrorResponse.MarshalJSON() ([]byte, error) -1. ListUsagesResult.MarshalJSON() ([]byte, error) -1. ListWorkspaceKeysResult.MarshalJSON() ([]byte, error) -1. NodeStateCounts.MarshalJSON() ([]byte, error) -1. Password.MarshalJSON() ([]byte, error) -1. SystemService.MarshalJSON() ([]byte, error) -1. Usage.MarshalJSON() ([]byte, error) -1. UsageName.MarshalJSON() ([]byte, error) -1. VirtualMachineSize.MarshalJSON() ([]byte, error) diff --git a/services/machinelearningservices/mgmt/2019-05-01/machinelearningservices/_meta.json b/services/machinelearningservices/mgmt/2019-05-01/machinelearningservices/_meta.json index 93e5c7294d6a..f5448d427cfd 100644 --- a/services/machinelearningservices/mgmt/2019-05-01/machinelearningservices/_meta.json +++ b/services/machinelearningservices/mgmt/2019-05-01/machinelearningservices/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a2792ff53ed316c367d77b622ba59cf9a6c88da4", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2019-05-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/machinelearningservices/mgmt/2019-06-01/machinelearningservices/CHANGELOG.md b/services/machinelearningservices/mgmt/2019-06-01/machinelearningservices/CHANGELOG.md index ccc1bdfa3054..a1ecf841edb0 100644 --- a/services/machinelearningservices/mgmt/2019-06-01/machinelearningservices/CHANGELOG.md +++ b/services/machinelearningservices/mgmt/2019-06-01/machinelearningservices/CHANGELOG.md @@ -1,21 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AmlComputeNodeInformation.MarshalJSON() ([]byte, error) -1. Error.MarshalJSON() ([]byte, error) -1. ErrorResponse.MarshalJSON() ([]byte, error) -1. ListUsagesResult.MarshalJSON() ([]byte, error) -1. ListWorkspaceKeysResult.MarshalJSON() ([]byte, error) -1. ListWorkspaceQuotas.MarshalJSON() ([]byte, error) -1. NodeStateCounts.MarshalJSON() ([]byte, error) -1. Password.MarshalJSON() ([]byte, error) -1. ResourceName.MarshalJSON() ([]byte, error) -1. ResourceQuota.MarshalJSON() ([]byte, error) -1. SystemService.MarshalJSON() ([]byte, error) -1. UpdateWorkspaceQuotasResult.MarshalJSON() ([]byte, error) -1. Usage.MarshalJSON() ([]byte, error) -1. UsageName.MarshalJSON() ([]byte, error) -1. VirtualMachineSize.MarshalJSON() ([]byte, error) diff --git a/services/machinelearningservices/mgmt/2019-06-01/machinelearningservices/_meta.json b/services/machinelearningservices/mgmt/2019-06-01/machinelearningservices/_meta.json index 894da4ef9924..15a0c7f943d9 100644 --- a/services/machinelearningservices/mgmt/2019-06-01/machinelearningservices/_meta.json +++ b/services/machinelearningservices/mgmt/2019-06-01/machinelearningservices/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a2792ff53ed316c367d77b622ba59cf9a6c88da4", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2019-06-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/machinelearningservices/mgmt/2019-11-01/machinelearningservices/CHANGELOG.md b/services/machinelearningservices/mgmt/2019-11-01/machinelearningservices/CHANGELOG.md index 5c498af3a4af..a1ecf841edb0 100644 --- a/services/machinelearningservices/mgmt/2019-11-01/machinelearningservices/CHANGELOG.md +++ b/services/machinelearningservices/mgmt/2019-11-01/machinelearningservices/CHANGELOG.md @@ -1,24 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AmlComputeNodeInformation.MarshalJSON() ([]byte, error) -1. Error.MarshalJSON() ([]byte, error) -1. ErrorResponse.MarshalJSON() ([]byte, error) -1. ListAmlUserFeatureResult.MarshalJSON() ([]byte, error) -1. ListUsagesResult.MarshalJSON() ([]byte, error) -1. ListWorkspaceKeysResult.MarshalJSON() ([]byte, error) -1. ListWorkspaceQuotas.MarshalJSON() ([]byte, error) -1. NodeStateCounts.MarshalJSON() ([]byte, error) -1. Password.MarshalJSON() ([]byte, error) -1. ResourceName.MarshalJSON() ([]byte, error) -1. ResourceQuota.MarshalJSON() ([]byte, error) -1. ResourceSkuLocationInfo.MarshalJSON() ([]byte, error) -1. ResourceSkuZoneDetails.MarshalJSON() ([]byte, error) -1. SystemService.MarshalJSON() ([]byte, error) -1. UpdateWorkspaceQuotasResult.MarshalJSON() ([]byte, error) -1. Usage.MarshalJSON() ([]byte, error) -1. UsageName.MarshalJSON() ([]byte, error) -1. VirtualMachineSize.MarshalJSON() ([]byte, error) diff --git a/services/machinelearningservices/mgmt/2019-11-01/machinelearningservices/_meta.json b/services/machinelearningservices/mgmt/2019-11-01/machinelearningservices/_meta.json index 096473b04d55..4813bea47cd3 100644 --- a/services/machinelearningservices/mgmt/2019-11-01/machinelearningservices/_meta.json +++ b/services/machinelearningservices/mgmt/2019-11-01/machinelearningservices/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a2792ff53ed316c367d77b622ba59cf9a6c88da4", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2019-11-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/machinelearningservices/mgmt/2020-01-01/machinelearningservices/CHANGELOG.md b/services/machinelearningservices/mgmt/2020-01-01/machinelearningservices/CHANGELOG.md index c5fc21568129..a1ecf841edb0 100644 --- a/services/machinelearningservices/mgmt/2020-01-01/machinelearningservices/CHANGELOG.md +++ b/services/machinelearningservices/mgmt/2020-01-01/machinelearningservices/CHANGELOG.md @@ -1,25 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AmlComputeNodeInformation.MarshalJSON() ([]byte, error) -1. Error.MarshalJSON() ([]byte, error) -1. ErrorResponse.MarshalJSON() ([]byte, error) -1. ListAmlUserFeatureResult.MarshalJSON() ([]byte, error) -1. ListUsagesResult.MarshalJSON() ([]byte, error) -1. ListWorkspaceKeysResult.MarshalJSON() ([]byte, error) -1. ListWorkspaceQuotas.MarshalJSON() ([]byte, error) -1. NodeStateCounts.MarshalJSON() ([]byte, error) -1. Password.MarshalJSON() ([]byte, error) -1. PrivateEndpoint.MarshalJSON() ([]byte, error) -1. ResourceName.MarshalJSON() ([]byte, error) -1. ResourceQuota.MarshalJSON() ([]byte, error) -1. ResourceSkuLocationInfo.MarshalJSON() ([]byte, error) -1. ResourceSkuZoneDetails.MarshalJSON() ([]byte, error) -1. SystemService.MarshalJSON() ([]byte, error) -1. UpdateWorkspaceQuotasResult.MarshalJSON() ([]byte, error) -1. Usage.MarshalJSON() ([]byte, error) -1. UsageName.MarshalJSON() ([]byte, error) -1. VirtualMachineSize.MarshalJSON() ([]byte, error) diff --git a/services/machinelearningservices/mgmt/2020-01-01/machinelearningservices/_meta.json b/services/machinelearningservices/mgmt/2020-01-01/machinelearningservices/_meta.json index b55408e14360..98f56969dfd4 100644 --- a/services/machinelearningservices/mgmt/2020-01-01/machinelearningservices/_meta.json +++ b/services/machinelearningservices/mgmt/2020-01-01/machinelearningservices/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a2792ff53ed316c367d77b622ba59cf9a6c88da4", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2020-01-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/machinelearningservices/mgmt/2020-03-01/machinelearningservices/CHANGELOG.md b/services/machinelearningservices/mgmt/2020-03-01/machinelearningservices/CHANGELOG.md index db64bc8d9f1d..a1ecf841edb0 100644 --- a/services/machinelearningservices/mgmt/2020-03-01/machinelearningservices/CHANGELOG.md +++ b/services/machinelearningservices/mgmt/2020-03-01/machinelearningservices/CHANGELOG.md @@ -1,24 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AmlComputeNodeInformation.MarshalJSON() ([]byte, error) -1. Error.MarshalJSON() ([]byte, error) -1. ErrorResponse.MarshalJSON() ([]byte, error) -1. ListAmlUserFeatureResult.MarshalJSON() ([]byte, error) -1. ListUsagesResult.MarshalJSON() ([]byte, error) -1. ListWorkspaceQuotas.MarshalJSON() ([]byte, error) -1. NodeStateCounts.MarshalJSON() ([]byte, error) -1. Password.MarshalJSON() ([]byte, error) -1. PrivateEndpoint.MarshalJSON() ([]byte, error) -1. ResourceName.MarshalJSON() ([]byte, error) -1. ResourceQuota.MarshalJSON() ([]byte, error) -1. ResourceSkuLocationInfo.MarshalJSON() ([]byte, error) -1. ResourceSkuZoneDetails.MarshalJSON() ([]byte, error) -1. SystemService.MarshalJSON() ([]byte, error) -1. UpdateWorkspaceQuotasResult.MarshalJSON() ([]byte, error) -1. Usage.MarshalJSON() ([]byte, error) -1. UsageName.MarshalJSON() ([]byte, error) -1. VirtualMachineSize.MarshalJSON() ([]byte, error) diff --git a/services/machinelearningservices/mgmt/2020-03-01/machinelearningservices/_meta.json b/services/machinelearningservices/mgmt/2020-03-01/machinelearningservices/_meta.json index 4f4faf6a79c5..e4d11b42cea0 100644 --- a/services/machinelearningservices/mgmt/2020-03-01/machinelearningservices/_meta.json +++ b/services/machinelearningservices/mgmt/2020-03-01/machinelearningservices/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a2792ff53ed316c367d77b622ba59cf9a6c88da4", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2020-03-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/machinelearningservices/mgmt/2020-04-01/machinelearningservices/CHANGELOG.md b/services/machinelearningservices/mgmt/2020-04-01/machinelearningservices/CHANGELOG.md index 24c21299d39d..a1ecf841edb0 100644 --- a/services/machinelearningservices/mgmt/2020-04-01/machinelearningservices/CHANGELOG.md +++ b/services/machinelearningservices/mgmt/2020-04-01/machinelearningservices/CHANGELOG.md @@ -1,25 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AmlComputeNodeInformation.MarshalJSON() ([]byte, error) -1. Error.MarshalJSON() ([]byte, error) -1. ErrorResponse.MarshalJSON() ([]byte, error) -1. IdentityUserAssignedIdentitiesValue.MarshalJSON() ([]byte, error) -1. ListAmlUserFeatureResult.MarshalJSON() ([]byte, error) -1. ListUsagesResult.MarshalJSON() ([]byte, error) -1. ListWorkspaceQuotas.MarshalJSON() ([]byte, error) -1. NodeStateCounts.MarshalJSON() ([]byte, error) -1. Password.MarshalJSON() ([]byte, error) -1. PrivateEndpoint.MarshalJSON() ([]byte, error) -1. ResourceName.MarshalJSON() ([]byte, error) -1. ResourceQuota.MarshalJSON() ([]byte, error) -1. ResourceSkuLocationInfo.MarshalJSON() ([]byte, error) -1. ResourceSkuZoneDetails.MarshalJSON() ([]byte, error) -1. SystemService.MarshalJSON() ([]byte, error) -1. UpdateWorkspaceQuotasResult.MarshalJSON() ([]byte, error) -1. Usage.MarshalJSON() ([]byte, error) -1. UsageName.MarshalJSON() ([]byte, error) -1. VirtualMachineSize.MarshalJSON() ([]byte, error) diff --git a/services/machinelearningservices/mgmt/2020-04-01/machinelearningservices/_meta.json b/services/machinelearningservices/mgmt/2020-04-01/machinelearningservices/_meta.json index 9a28c4daa9a4..22b45ef3d1a0 100644 --- a/services/machinelearningservices/mgmt/2020-04-01/machinelearningservices/_meta.json +++ b/services/machinelearningservices/mgmt/2020-04-01/machinelearningservices/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a2792ff53ed316c367d77b622ba59cf9a6c88da4", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2020-04-01", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/preview/machinelearningservices/mgmt/2018-03-01-preview/machinelearningservices/CHANGELOG.md b/services/preview/machinelearningservices/mgmt/2018-03-01-preview/machinelearningservices/CHANGELOG.md index 4f8aac3b8d4a..a1ecf841edb0 100644 --- a/services/preview/machinelearningservices/mgmt/2018-03-01-preview/machinelearningservices/CHANGELOG.md +++ b/services/preview/machinelearningservices/mgmt/2018-03-01-preview/machinelearningservices/CHANGELOG.md @@ -1,9 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. ListWorkspaceKeysResult.MarshalJSON() ([]byte, error) -1. Password.MarshalJSON() ([]byte, error) -1. SystemService.MarshalJSON() ([]byte, error) diff --git a/services/preview/machinelearningservices/mgmt/2018-03-01-preview/machinelearningservices/_meta.json b/services/preview/machinelearningservices/mgmt/2018-03-01-preview/machinelearningservices/_meta.json index 851ad591b0c1..150071b4d1d8 100644 --- a/services/preview/machinelearningservices/mgmt/2018-03-01-preview/machinelearningservices/_meta.json +++ b/services/preview/machinelearningservices/mgmt/2018-03-01-preview/machinelearningservices/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a2792ff53ed316c367d77b622ba59cf9a6c88da4", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2018-03-preview", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/preview/machinelearningservices/mgmt/2020-02-18-preview/machinelearningservices/CHANGELOG.md b/services/preview/machinelearningservices/mgmt/2020-02-18-preview/machinelearningservices/CHANGELOG.md index 8c60247dcea4..a1ecf841edb0 100644 --- a/services/preview/machinelearningservices/mgmt/2020-02-18-preview/machinelearningservices/CHANGELOG.md +++ b/services/preview/machinelearningservices/mgmt/2020-02-18-preview/machinelearningservices/CHANGELOG.md @@ -1,27 +1,2 @@ -# Change History +# Unreleased -## Additive Changes - -### New Funcs - -1. AmlComputeNodeInformation.MarshalJSON() ([]byte, error) -1. ComputeInstanceConnectivityEndpoints.MarshalJSON() ([]byte, error) -1. ComputeInstanceCreatedBy.MarshalJSON() ([]byte, error) -1. Error.MarshalJSON() ([]byte, error) -1. ErrorResponse.MarshalJSON() ([]byte, error) -1. ListAmlUserFeatureResult.MarshalJSON() ([]byte, error) -1. ListUsagesResult.MarshalJSON() ([]byte, error) -1. ListWorkspaceKeysResult.MarshalJSON() ([]byte, error) -1. ListWorkspaceQuotas.MarshalJSON() ([]byte, error) -1. NodeStateCounts.MarshalJSON() ([]byte, error) -1. Password.MarshalJSON() ([]byte, error) -1. PrivateEndpoint.MarshalJSON() ([]byte, error) -1. ResourceName.MarshalJSON() ([]byte, error) -1. ResourceQuota.MarshalJSON() ([]byte, error) -1. ResourceSkuLocationInfo.MarshalJSON() ([]byte, error) -1. ResourceSkuZoneDetails.MarshalJSON() ([]byte, error) -1. SystemService.MarshalJSON() ([]byte, error) -1. UpdateWorkspaceQuotasResult.MarshalJSON() ([]byte, error) -1. Usage.MarshalJSON() ([]byte, error) -1. UsageName.MarshalJSON() ([]byte, error) -1. VirtualMachineSize.MarshalJSON() ([]byte, error) diff --git a/services/preview/machinelearningservices/mgmt/2020-02-18-preview/machinelearningservices/_meta.json b/services/preview/machinelearningservices/mgmt/2020-02-18-preview/machinelearningservices/_meta.json index 8203c41cb607..923efe5100d3 100644 --- a/services/preview/machinelearningservices/mgmt/2020-02-18-preview/machinelearningservices/_meta.json +++ b/services/preview/machinelearningservices/mgmt/2020-02-18-preview/machinelearningservices/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "a2792ff53ed316c367d77b622ba59cf9a6c88da4", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2020-02-18-preview", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/CHANGELOG.md b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/_meta.json b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/_meta.json new file mode 100644 index 000000000000..eab2b5759259 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "a2792ff53ed316c367d77b622ba59cf9a6c88da4", + "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", + "tag": "package-2021-03-01-preview", + "use": "@microsoft.azure/autorest.go@2.1.183", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2021-03-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/batchdeployments.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/batchdeployments.go new file mode 100644 index 000000000000..412fe70d43c9 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/batchdeployments.go @@ -0,0 +1,553 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// BatchDeploymentsClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type BatchDeploymentsClient struct { + BaseClient +} + +// NewBatchDeploymentsClient creates an instance of the BatchDeploymentsClient client. +func NewBatchDeploymentsClient(subscriptionID string) BatchDeploymentsClient { + return NewBatchDeploymentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBatchDeploymentsClientWithBaseURI creates an instance of the BatchDeploymentsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewBatchDeploymentsClientWithBaseURI(baseURI string, subscriptionID string) BatchDeploymentsClient { + return BatchDeploymentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// endpointName - inference endpoint name +// deploymentName - the identifier for the Batch inference deployment. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - batch inference deployment definition object. +func (client BatchDeploymentsClient) CreateOrUpdate(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string, body BatchDeploymentTrackedResource) (result BatchDeploymentTrackedResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchDeploymentsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: endpointName, + Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.CodeConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.CodeConfiguration.ScoringScript", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.CodeConfiguration.ScoringScript", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "body.Properties.CodeConfiguration.ScoringScript", Name: validation.Pattern, Rule: `[a-zA-Z0-9_]`, Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchDeploymentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, endpointName, deploymentName, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BatchDeploymentsClient) CreateOrUpdatePreparer(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string, body BatchDeploymentTrackedResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client BatchDeploymentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client BatchDeploymentsClient) CreateOrUpdateResponder(resp *http.Response) (result BatchDeploymentTrackedResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// endpointName - endpoint name +// deploymentName - inference deployment identifier. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client BatchDeploymentsClient) Delete(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchDeploymentsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchDeploymentsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, endpointName, deploymentName, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BatchDeploymentsClient) DeletePreparer(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client BatchDeploymentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client BatchDeploymentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// endpointName - endpoint name +// deploymentName - the identifier for the Batch deployments. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client BatchDeploymentsClient) Get(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string) (result BatchDeploymentTrackedResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchDeploymentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchDeploymentsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, endpointName, deploymentName, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BatchDeploymentsClient) GetPreparer(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BatchDeploymentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BatchDeploymentsClient) GetResponder(resp *http.Response) (result BatchDeploymentTrackedResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// endpointName - endpoint name +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// orderBy - ordering of list. +// top - top of list. +// skip - continuation token for pagination. +func (client BatchDeploymentsClient) List(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (result BatchDeploymentTrackedResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchDeploymentsClient.List") + defer func() { + sc := -1 + if result.bdtrapr.Response.Response != nil { + sc = result.bdtrapr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchDeploymentsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, endpointName, resourceGroupName, workspaceName, orderBy, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.bdtrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "List", resp, "Failure sending request") + return + } + + result.bdtrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "List", resp, "Failure responding to request") + return + } + if result.bdtrapr.hasNextLink() && result.bdtrapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BatchDeploymentsClient) ListPreparer(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(orderBy) > 0 { + queryParameters["$orderBy"] = autorest.Encode("query", orderBy) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BatchDeploymentsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BatchDeploymentsClient) ListResponder(resp *http.Response) (result BatchDeploymentTrackedResourceArmPaginatedResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client BatchDeploymentsClient) listNextResults(ctx context.Context, lastResults BatchDeploymentTrackedResourceArmPaginatedResult) (result BatchDeploymentTrackedResourceArmPaginatedResult, err error) { + req, err := lastResults.batchDeploymentTrackedResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client BatchDeploymentsClient) ListComplete(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (result BatchDeploymentTrackedResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchDeploymentsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, endpointName, resourceGroupName, workspaceName, orderBy, top, skip) + return +} + +// Update sends the update request. +// Parameters: +// endpointName - inference endpoint name +// deploymentName - the identifier for the Batch inference deployment. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - batch inference deployment definition object. +func (client BatchDeploymentsClient) Update(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string, body PartialBatchDeploymentPartialTrackedResource) (result BatchDeploymentTrackedResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchDeploymentsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: endpointName, + Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchDeploymentsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, endpointName, deploymentName, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client BatchDeploymentsClient) UpdatePreparer(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string, body PartialBatchDeploymentPartialTrackedResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client BatchDeploymentsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client BatchDeploymentsClient) UpdateResponder(resp *http.Response) (result BatchDeploymentTrackedResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/batchendpoints.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/batchendpoints.go new file mode 100644 index 000000000000..96921a61c3ec --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/batchendpoints.go @@ -0,0 +1,614 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// BatchEndpointsClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type BatchEndpointsClient struct { + BaseClient +} + +// NewBatchEndpointsClient creates an instance of the BatchEndpointsClient client. +func NewBatchEndpointsClient(subscriptionID string) BatchEndpointsClient { + return NewBatchEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBatchEndpointsClientWithBaseURI creates an instance of the BatchEndpointsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewBatchEndpointsClientWithBaseURI(baseURI string, subscriptionID string) BatchEndpointsClient { + return BatchEndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// endpointName - name for the Batch inference endpoint. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - batch inference endpoint definition object. +func (client BatchEndpointsClient) CreateOrUpdate(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, body BatchEndpointTrackedResource) (result BatchEndpointTrackedResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchEndpointsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: endpointName, + Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchEndpointsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, endpointName, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BatchEndpointsClient) CreateOrUpdatePreparer(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, body BatchEndpointTrackedResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client BatchEndpointsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client BatchEndpointsClient) CreateOrUpdateResponder(resp *http.Response) (result BatchEndpointTrackedResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// endpointName - inference Endpoint name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client BatchEndpointsClient) Delete(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchEndpointsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchEndpointsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, endpointName, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BatchEndpointsClient) DeletePreparer(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client BatchEndpointsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client BatchEndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// endpointName - name for the Batch Endpoint. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client BatchEndpointsClient) Get(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (result BatchEndpointTrackedResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchEndpointsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchEndpointsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, endpointName, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BatchEndpointsClient) GetPreparer(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BatchEndpointsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BatchEndpointsClient) GetResponder(resp *http.Response) (result BatchEndpointTrackedResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// count - number of endpoints to be retrieved in a page of results. +// skip - continuation token for pagination. +func (client BatchEndpointsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, count *int32, skip string) (result BatchEndpointTrackedResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchEndpointsClient.List") + defer func() { + sc := -1 + if result.betrapr.Response.Response != nil { + sc = result.betrapr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchEndpointsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, count, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.betrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "List", resp, "Failure sending request") + return + } + + result.betrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "List", resp, "Failure responding to request") + return + } + if result.betrapr.hasNextLink() && result.betrapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BatchEndpointsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, count *int32, skip string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if count != nil { + queryParameters["count"] = autorest.Encode("query", *count) + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BatchEndpointsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BatchEndpointsClient) ListResponder(resp *http.Response) (result BatchEndpointTrackedResourceArmPaginatedResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client BatchEndpointsClient) listNextResults(ctx context.Context, lastResults BatchEndpointTrackedResourceArmPaginatedResult) (result BatchEndpointTrackedResourceArmPaginatedResult, err error) { + req, err := lastResults.batchEndpointTrackedResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client BatchEndpointsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, count *int32, skip string) (result BatchEndpointTrackedResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchEndpointsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, count, skip) + return +} + +// ListKeys sends the list keys request. +// Parameters: +// endpointName - inference Endpoint name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client BatchEndpointsClient) ListKeys(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (result EndpointAuthKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchEndpointsClient.ListKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchEndpointsClient", "ListKeys", err.Error()) + } + + req, err := client.ListKeysPreparer(ctx, endpointName, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "ListKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client BatchEndpointsClient) ListKeysPreparer(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/listkeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client BatchEndpointsClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client BatchEndpointsClient) ListKeysResponder(resp *http.Response) (result EndpointAuthKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update sends the update request. +// Parameters: +// endpointName - name for the Batch inference endpoint. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - mutable batch inference endpoint definition object. +func (client BatchEndpointsClient) Update(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, body PartialBatchEndpointPartialTrackedResource) (result BatchEndpointTrackedResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchEndpointsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: endpointName, + Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchEndpointsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, endpointName, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client BatchEndpointsClient) UpdatePreparer(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, body PartialBatchEndpointPartialTrackedResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client BatchEndpointsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client BatchEndpointsClient) UpdateResponder(resp *http.Response) (result BatchEndpointTrackedResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/client.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/client.go new file mode 100644 index 000000000000..0c7f8c2ff0df --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/client.go @@ -0,0 +1,42 @@ +// Package machinelearningservices implements the Azure ARM Machinelearningservices service API version +// 2021-03-01-preview. +// +// These APIs allow end users to operate on Azure Machine Learning Workspace resources. +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Machinelearningservices + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Machinelearningservices. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/codecontainers.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/codecontainers.go new file mode 100644 index 000000000000..3f2cfc7e964e --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/codecontainers.go @@ -0,0 +1,431 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// CodeContainersClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type CodeContainersClient struct { + BaseClient +} + +// NewCodeContainersClient creates an instance of the CodeContainersClient client. +func NewCodeContainersClient(subscriptionID string) CodeContainersClient { + return NewCodeContainersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCodeContainersClientWithBaseURI creates an instance of the CodeContainersClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewCodeContainersClientWithBaseURI(baseURI string, subscriptionID string) CodeContainersClient { + return CodeContainersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// name - container name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - container entity to create or update. +func (client CodeContainersClient) CreateOrUpdate(ctx context.Context, name string, resourceGroupName string, workspaceName string, body CodeContainerResource) (result CodeContainerResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CodeContainersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.CodeContainersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, name, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeContainersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeContainersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeContainersClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CodeContainersClient) CreateOrUpdatePreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string, body CodeContainerResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CodeContainersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client CodeContainersClient) CreateOrUpdateResponder(resp *http.Response) (result CodeContainerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// name - container name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client CodeContainersClient) Delete(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CodeContainersClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.CodeContainersClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, name, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeContainersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeContainersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeContainersClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CodeContainersClient) DeletePreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CodeContainersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CodeContainersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// name - container name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client CodeContainersClient) Get(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result CodeContainerResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CodeContainersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.CodeContainersClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, name, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeContainersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeContainersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeContainersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client CodeContainersClient) GetPreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CodeContainersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CodeContainersClient) GetResponder(resp *http.Response) (result CodeContainerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// skip - continuation token for pagination. +func (client CodeContainersClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (result CodeContainerResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CodeContainersClient.List") + defer func() { + sc := -1 + if result.ccrapr.Response.Response != nil { + sc = result.ccrapr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.CodeContainersClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeContainersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ccrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeContainersClient", "List", resp, "Failure sending request") + return + } + + result.ccrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeContainersClient", "List", resp, "Failure responding to request") + return + } + if result.ccrapr.hasNextLink() && result.ccrapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client CodeContainersClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client CodeContainersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client CodeContainersClient) ListResponder(resp *http.Response) (result CodeContainerResourceArmPaginatedResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client CodeContainersClient) listNextResults(ctx context.Context, lastResults CodeContainerResourceArmPaginatedResult) (result CodeContainerResourceArmPaginatedResult, err error) { + req, err := lastResults.codeContainerResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.CodeContainersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.CodeContainersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeContainersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client CodeContainersClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (result CodeContainerResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CodeContainersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, skip) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/codeversions.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/codeversions.go new file mode 100644 index 000000000000..97477dde94e3 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/codeversions.go @@ -0,0 +1,450 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// CodeVersionsClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type CodeVersionsClient struct { + BaseClient +} + +// NewCodeVersionsClient creates an instance of the CodeVersionsClient client. +func NewCodeVersionsClient(subscriptionID string) CodeVersionsClient { + return NewCodeVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCodeVersionsClientWithBaseURI creates an instance of the CodeVersionsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewCodeVersionsClientWithBaseURI(baseURI string, subscriptionID string) CodeVersionsClient { + return CodeVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// name - container name. +// version - version identifier. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - version entity to create or update. +func (client CodeVersionsClient) CreateOrUpdate(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string, body CodeVersionResource) (result CodeVersionResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CodeVersionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.Path", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.Path", Name: validation.Pattern, Rule: `[a-zA-Z0-9_]`, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("machinelearningservices.CodeVersionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, name, version, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeVersionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeVersionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeVersionsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CodeVersionsClient) CreateOrUpdatePreparer(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string, body CodeVersionResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "version": autorest.Encode("path", version), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CodeVersionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client CodeVersionsClient) CreateOrUpdateResponder(resp *http.Response) (result CodeVersionResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// name - container name. +// version - version identifier. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client CodeVersionsClient) Delete(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CodeVersionsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.CodeVersionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, name, version, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeVersionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeVersionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeVersionsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CodeVersionsClient) DeletePreparer(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "version": autorest.Encode("path", version), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CodeVersionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CodeVersionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// name - container name. +// version - version identifier. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client CodeVersionsClient) Get(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (result CodeVersionResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CodeVersionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.CodeVersionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, name, version, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeVersionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeVersionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeVersionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client CodeVersionsClient) GetPreparer(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "version": autorest.Encode("path", version), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CodeVersionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CodeVersionsClient) GetResponder(resp *http.Response) (result CodeVersionResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// name - container name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// orderBy - ordering of list. +// top - maximum number of records to return. +// skip - continuation token for pagination. +func (client CodeVersionsClient) List(ctx context.Context, name string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (result CodeVersionResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CodeVersionsClient.List") + defer func() { + sc := -1 + if result.cvrapr.Response.Response != nil { + sc = result.cvrapr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.CodeVersionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, name, resourceGroupName, workspaceName, orderBy, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.cvrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeVersionsClient", "List", resp, "Failure sending request") + return + } + + result.cvrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeVersionsClient", "List", resp, "Failure responding to request") + return + } + if result.cvrapr.hasNextLink() && result.cvrapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client CodeVersionsClient) ListPreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(orderBy) > 0 { + queryParameters["$orderBy"] = autorest.Encode("query", orderBy) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client CodeVersionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client CodeVersionsClient) ListResponder(resp *http.Response) (result CodeVersionResourceArmPaginatedResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client CodeVersionsClient) listNextResults(ctx context.Context, lastResults CodeVersionResourceArmPaginatedResult) (result CodeVersionResourceArmPaginatedResult, err error) { + req, err := lastResults.codeVersionResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.CodeVersionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.CodeVersionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.CodeVersionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client CodeVersionsClient) ListComplete(ctx context.Context, name string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (result CodeVersionResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CodeVersionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, name, resourceGroupName, workspaceName, orderBy, top, skip) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/compute.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/compute.go new file mode 100644 index 000000000000..4c337855ee84 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/compute.go @@ -0,0 +1,1098 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ComputeClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type ComputeClient struct { + BaseClient +} + +// NewComputeClient creates an instance of the ComputeClient client. +func NewComputeClient(subscriptionID string) ComputeClient { + return NewComputeClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewComputeClientWithBaseURI creates an instance of the ComputeClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewComputeClientWithBaseURI(baseURI string, subscriptionID string) ComputeClient { + return ComputeClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates compute. This call will overwrite a compute if it exists. This is a nonrecoverable +// operation. If your intent is to create a new compute, do a GET first to verify that it does not exist yet. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// computeName - name of the Azure Machine Learning compute. +// parameters - payload with Machine Learning compute definition. +func (client ComputeClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, parameters ComputeResource) (result ComputeCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ComputeClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, computeName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ComputeClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, parameters ComputeResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "computeName": autorest.Encode("path", computeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeClient) CreateOrUpdateSender(req *http.Request) (future ComputeCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ComputeClient) CreateOrUpdateResponder(resp *http.Response) (result ComputeResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes specified Machine Learning compute. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// computeName - name of the Azure Machine Learning compute. +// underlyingResourceAction - delete the underlying compute if 'Delete', or detach the underlying compute from +// workspace if 'Detach'. +func (client ComputeClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, underlyingResourceAction UnderlyingResourceAction) (result ComputeDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ComputeClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, computeName, underlyingResourceAction) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ComputeClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, underlyingResourceAction UnderlyingResourceAction) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "computeName": autorest.Encode("path", computeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "underlyingResourceAction": autorest.Encode("query", underlyingResourceAction), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeClient) DeleteSender(req *http.Request) (future ComputeDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ComputeClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets compute definition by its name. Any secrets (storage keys, service credentials, etc) are not returned - use +// 'keys' nested resource to get them. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// computeName - name of the Azure Machine Learning compute. +func (client ComputeClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (result ComputeResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ComputeClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, computeName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComputeClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "computeName": autorest.Encode("path", computeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ComputeClient) GetResponder(resp *http.Response) (result ComputeResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets computes in specified workspace. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// skip - continuation token for pagination. +func (client ComputeClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (result PaginatedComputeResourcesListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeClient.List") + defer func() { + sc := -1 + if result.pcrl.Response.Response != nil { + sc = result.pcrl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ComputeClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.pcrl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "List", resp, "Failure sending request") + return + } + + result.pcrl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "List", resp, "Failure responding to request") + return + } + if result.pcrl.hasNextLink() && result.pcrl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ComputeClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ComputeClient) ListResponder(resp *http.Response) (result PaginatedComputeResourcesList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ComputeClient) listNextResults(ctx context.Context, lastResults PaginatedComputeResourcesList) (result PaginatedComputeResourcesList, err error) { + req, err := lastResults.paginatedComputeResourcesListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ComputeClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (result PaginatedComputeResourcesListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, skip) + return +} + +// ListKeys gets secrets related to Machine Learning compute (storage keys, service credentials, etc). +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// computeName - name of the Azure Machine Learning compute. +func (client ComputeClient) ListKeys(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (result ComputeSecretsModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeClient.ListKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ComputeClient", "ListKeys", err.Error()) + } + + req, err := client.ListKeysPreparer(ctx, resourceGroupName, workspaceName, computeName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "ListKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client ComputeClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "computeName": autorest.Encode("path", computeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client ComputeClient) ListKeysResponder(resp *http.Response) (result ComputeSecretsModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNodes get the details (e.g IP address, port etc) of all the compute nodes in the compute. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// computeName - name of the Azure Machine Learning compute. +func (client ComputeClient) ListNodes(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (result AmlComputeNodesInformationPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeClient.ListNodes") + defer func() { + sc := -1 + if result.acni.Response.Response != nil { + sc = result.acni.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ComputeClient", "ListNodes", err.Error()) + } + + result.fn = client.listNodesNextResults + req, err := client.ListNodesPreparer(ctx, resourceGroupName, workspaceName, computeName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "ListNodes", nil, "Failure preparing request") + return + } + + resp, err := client.ListNodesSender(req) + if err != nil { + result.acni.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "ListNodes", resp, "Failure sending request") + return + } + + result.acni, err = client.ListNodesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "ListNodes", resp, "Failure responding to request") + return + } + if result.acni.hasNextLink() && result.acni.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListNodesPreparer prepares the ListNodes request. +func (client ComputeClient) ListNodesPreparer(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "computeName": autorest.Encode("path", computeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/listNodes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListNodesSender sends the ListNodes request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeClient) ListNodesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListNodesResponder handles the response to the ListNodes request. The method always +// closes the http.Response Body. +func (client ComputeClient) ListNodesResponder(resp *http.Response) (result AmlComputeNodesInformation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNodesNextResults retrieves the next set of results, if any. +func (client ComputeClient) listNodesNextResults(ctx context.Context, lastResults AmlComputeNodesInformation) (result AmlComputeNodesInformation, err error) { + req, err := lastResults.amlComputeNodesInformationPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "listNodesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListNodesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "listNodesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListNodesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "listNodesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListNodesComplete enumerates all values, automatically crossing page boundaries as required. +func (client ComputeClient) ListNodesComplete(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (result AmlComputeNodesInformationIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeClient.ListNodes") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListNodes(ctx, resourceGroupName, workspaceName, computeName) + return +} + +// Restart posts a restart action to a compute instance +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// computeName - name of the Azure Machine Learning compute. +func (client ComputeClient) Restart(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeClient.Restart") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ComputeClient", "Restart", err.Error()) + } + + req, err := client.RestartPreparer(ctx, resourceGroupName, workspaceName, computeName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "Restart", nil, "Failure preparing request") + return + } + + resp, err := client.RestartSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "Restart", resp, "Failure sending request") + return + } + + result, err = client.RestartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "Restart", resp, "Failure responding to request") + return + } + + return +} + +// RestartPreparer prepares the Restart request. +func (client ComputeClient) RestartPreparer(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "computeName": autorest.Encode("path", computeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestartSender sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeClient) RestartSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RestartResponder handles the response to the Restart request. The method always +// closes the http.Response Body. +func (client ComputeClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Start posts a start action to a compute instance +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// computeName - name of the Azure Machine Learning compute. +func (client ComputeClient) Start(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (result ComputeStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeClient.Start") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ComputeClient", "Start", err.Error()) + } + + req, err := client.StartPreparer(ctx, resourceGroupName, workspaceName, computeName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "Start", nil, "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client ComputeClient) StartPreparer(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "computeName": autorest.Encode("path", computeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeClient) StartSender(req *http.Request) (future ComputeStartFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client ComputeClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop posts a stop action to a compute instance +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// computeName - name of the Azure Machine Learning compute. +func (client ComputeClient) Stop(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (result ComputeStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeClient.Stop") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ComputeClient", "Stop", err.Error()) + } + + req, err := client.StopPreparer(ctx, resourceGroupName, workspaceName, computeName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "Stop", nil, "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client ComputeClient) StopPreparer(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "computeName": autorest.Encode("path", computeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeClient) StopSender(req *http.Request) (future ComputeStopFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client ComputeClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates properties of a compute. This call will overwrite a compute if it exists. This is a nonrecoverable +// operation. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// computeName - name of the Azure Machine Learning compute. +// parameters - additional parameters for cluster update. +func (client ComputeClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, parameters ClusterUpdateParameters) (result ComputeUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ComputeClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, computeName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ComputeClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, parameters ClusterUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "computeName": autorest.Encode("path", computeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeClient) UpdateSender(req *http.Request) (future ComputeUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ComputeClient) UpdateResponder(resp *http.Response) (result ComputeResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateSchedules updates schedules of a compute instance +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// computeName - name of the Azure Machine Learning compute. +// parameters - the object for updating schedules of specified ComputeInstance. +func (client ComputeClient) UpdateSchedules(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, parameters *ComputeSchedules) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeClient.UpdateSchedules") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ComputeClient", "UpdateSchedules", err.Error()) + } + + req, err := client.UpdateSchedulesPreparer(ctx, resourceGroupName, workspaceName, computeName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "UpdateSchedules", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSchedulesSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "UpdateSchedules", resp, "Failure sending request") + return + } + + result, err = client.UpdateSchedulesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "UpdateSchedules", resp, "Failure responding to request") + return + } + + return +} + +// UpdateSchedulesPreparer prepares the UpdateSchedules request. +func (client ComputeClient) UpdateSchedulesPreparer(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, parameters *ComputeSchedules) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "computeName": autorest.Encode("path", computeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/updateSchedules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSchedulesSender sends the UpdateSchedules request. The method will close the +// http.Response Body if it receives an error. +func (client ComputeClient) UpdateSchedulesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateSchedulesResponder handles the response to the UpdateSchedules request. The method always +// closes the http.Response Body. +func (client ComputeClient) UpdateSchedulesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/datacontainers.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/datacontainers.go new file mode 100644 index 000000000000..479e1a70479a --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/datacontainers.go @@ -0,0 +1,431 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DataContainersClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type DataContainersClient struct { + BaseClient +} + +// NewDataContainersClient creates an instance of the DataContainersClient client. +func NewDataContainersClient(subscriptionID string) DataContainersClient { + return NewDataContainersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDataContainersClientWithBaseURI creates an instance of the DataContainersClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewDataContainersClientWithBaseURI(baseURI string, subscriptionID string) DataContainersClient { + return DataContainersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// name - container name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - container entity to create or update. +func (client DataContainersClient) CreateOrUpdate(ctx context.Context, name string, resourceGroupName string, workspaceName string, body DataContainerResource) (result DataContainerResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataContainersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.DataContainersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, name, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataContainersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.DataContainersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataContainersClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DataContainersClient) CreateOrUpdatePreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string, body DataContainerResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DataContainersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DataContainersClient) CreateOrUpdateResponder(resp *http.Response) (result DataContainerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// name - container name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client DataContainersClient) Delete(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataContainersClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.DataContainersClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, name, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataContainersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.DataContainersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataContainersClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DataContainersClient) DeletePreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DataContainersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DataContainersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// name - container name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client DataContainersClient) Get(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result DataContainerResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataContainersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.DataContainersClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, name, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataContainersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.DataContainersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataContainersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DataContainersClient) GetPreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DataContainersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DataContainersClient) GetResponder(resp *http.Response) (result DataContainerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// skip - continuation token for pagination. +func (client DataContainersClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (result DataContainerResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataContainersClient.List") + defer func() { + sc := -1 + if result.dcrapr.Response.Response != nil { + sc = result.dcrapr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.DataContainersClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataContainersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dcrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.DataContainersClient", "List", resp, "Failure sending request") + return + } + + result.dcrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataContainersClient", "List", resp, "Failure responding to request") + return + } + if result.dcrapr.hasNextLink() && result.dcrapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DataContainersClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DataContainersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DataContainersClient) ListResponder(resp *http.Response) (result DataContainerResourceArmPaginatedResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client DataContainersClient) listNextResults(ctx context.Context, lastResults DataContainerResourceArmPaginatedResult) (result DataContainerResourceArmPaginatedResult, err error) { + req, err := lastResults.dataContainerResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.DataContainersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.DataContainersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataContainersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DataContainersClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (result DataContainerResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataContainersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, skip) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/datastores.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/datastores.go new file mode 100644 index 000000000000..5f0435d27b3b --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/datastores.go @@ -0,0 +1,552 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DatastoresClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type DatastoresClient struct { + BaseClient +} + +// NewDatastoresClient creates an instance of the DatastoresClient client. +func NewDatastoresClient(subscriptionID string) DatastoresClient { + return NewDatastoresClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDatastoresClientWithBaseURI creates an instance of the DatastoresClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewDatastoresClientWithBaseURI(baseURI string, subscriptionID string) DatastoresClient { + return DatastoresClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// name - datastore name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - datastore entity to create or update. +// skipValidation - flag to skip validation. +func (client DatastoresClient) CreateOrUpdate(ctx context.Context, name string, resourceGroupName string, workspaceName string, body DatastorePropertiesResource, skipValidation *bool) (result DatastorePropertiesResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatastoresClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.DatastoresClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, name, resourceGroupName, workspaceName, body, skipValidation) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DatastoresClient) CreateOrUpdatePreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string, body DatastorePropertiesResource, skipValidation *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if skipValidation != nil { + queryParameters["skipValidation"] = autorest.Encode("query", *skipValidation) + } else { + queryParameters["skipValidation"] = autorest.Encode("query", false) + } + + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datastores/{name}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DatastoresClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DatastoresClient) CreateOrUpdateResponder(resp *http.Response) (result DatastorePropertiesResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// name - datastore name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client DatastoresClient) Delete(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatastoresClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.DatastoresClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, name, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DatastoresClient) DeletePreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datastores/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DatastoresClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DatastoresClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// name - datastore name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client DatastoresClient) Get(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result DatastorePropertiesResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatastoresClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.DatastoresClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, name, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DatastoresClient) GetPreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datastores/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DatastoresClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DatastoresClient) GetResponder(resp *http.Response) (result DatastorePropertiesResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// skip - continuation token for pagination. +// count - maximum number of results to return. +// isDefault - filter down to the workspace default datastore. +// names - names of datastores to return. +// searchText - text to search for in the datastore names. +// orderBy - order by property (createdtime | modifiedtime | name). +// orderByAsc - order by property in ascending order. +func (client DatastoresClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32, isDefault *bool, names []string, searchText string, orderBy string, orderByAsc *bool) (result DatastorePropertiesResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatastoresClient.List") + defer func() { + sc := -1 + if result.dprapr.Response.Response != nil { + sc = result.dprapr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.DatastoresClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, skip, count, isDefault, names, searchText, orderBy, orderByAsc) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dprapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "List", resp, "Failure sending request") + return + } + + result.dprapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "List", resp, "Failure responding to request") + return + } + if result.dprapr.hasNextLink() && result.dprapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DatastoresClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32, isDefault *bool, names []string, searchText string, orderBy string, orderByAsc *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + if count != nil { + queryParameters["count"] = autorest.Encode("query", *count) + } else { + queryParameters["count"] = autorest.Encode("query", 30) + } + if isDefault != nil { + queryParameters["isDefault"] = autorest.Encode("query", *isDefault) + } + if names != nil && len(names) > 0 { + queryParameters["names"] = autorest.Encode("query", names, ",") + } + if len(searchText) > 0 { + queryParameters["searchText"] = autorest.Encode("query", searchText) + } + if len(orderBy) > 0 { + queryParameters["orderBy"] = autorest.Encode("query", orderBy) + } + if orderByAsc != nil { + queryParameters["orderByAsc"] = autorest.Encode("query", *orderByAsc) + } else { + queryParameters["orderByAsc"] = autorest.Encode("query", false) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datastores", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DatastoresClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DatastoresClient) ListResponder(resp *http.Response) (result DatastorePropertiesResourceArmPaginatedResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client DatastoresClient) listNextResults(ctx context.Context, lastResults DatastorePropertiesResourceArmPaginatedResult) (result DatastorePropertiesResourceArmPaginatedResult, err error) { + req, err := lastResults.datastorePropertiesResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DatastoresClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32, isDefault *bool, names []string, searchText string, orderBy string, orderByAsc *bool) (result DatastorePropertiesResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatastoresClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, skip, count, isDefault, names, searchText, orderBy, orderByAsc) + return +} + +// ListSecrets sends the list secrets request. +// Parameters: +// name - datastore name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client DatastoresClient) ListSecrets(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result DatastoreSecretsModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatastoresClient.ListSecrets") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.DatastoresClient", "ListSecrets", err.Error()) + } + + req, err := client.ListSecretsPreparer(ctx, name, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "ListSecrets", nil, "Failure preparing request") + return + } + + resp, err := client.ListSecretsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "ListSecrets", resp, "Failure sending request") + return + } + + result, err = client.ListSecretsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "ListSecrets", resp, "Failure responding to request") + return + } + + return +} + +// ListSecretsPreparer prepares the ListSecrets request. +func (client DatastoresClient) ListSecretsPreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datastores/{name}/listSecrets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSecretsSender sends the ListSecrets request. The method will close the +// http.Response Body if it receives an error. +func (client DatastoresClient) ListSecretsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSecretsResponder handles the response to the ListSecrets request. The method always +// closes the http.Response Body. +func (client DatastoresClient) ListSecretsResponder(resp *http.Response) (result DatastoreSecretsModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/dataversions.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/dataversions.go new file mode 100644 index 000000000000..e313a3c8ce18 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/dataversions.go @@ -0,0 +1,454 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DataVersionsClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type DataVersionsClient struct { + BaseClient +} + +// NewDataVersionsClient creates an instance of the DataVersionsClient client. +func NewDataVersionsClient(subscriptionID string) DataVersionsClient { + return NewDataVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDataVersionsClientWithBaseURI creates an instance of the DataVersionsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewDataVersionsClientWithBaseURI(baseURI string, subscriptionID string) DataVersionsClient { + return DataVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// name - container name. +// version - version identifier. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - version entity to create or update. +func (client DataVersionsClient) CreateOrUpdate(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string, body DataVersionResource) (result DataVersionResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataVersionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.Path", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.Path", Name: validation.Pattern, Rule: `[a-zA-Z0-9_]`, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("machinelearningservices.DataVersionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, name, version, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DataVersionsClient) CreateOrUpdatePreparer(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string, body DataVersionResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "version": autorest.Encode("path", version), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DataVersionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DataVersionsClient) CreateOrUpdateResponder(resp *http.Response) (result DataVersionResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// name - container name. +// version - version identifier. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client DataVersionsClient) Delete(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataVersionsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.DataVersionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, name, version, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DataVersionsClient) DeletePreparer(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "version": autorest.Encode("path", version), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DataVersionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DataVersionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// name - container name. +// version - version identifier. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client DataVersionsClient) Get(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (result DataVersionResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataVersionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.DataVersionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, name, version, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DataVersionsClient) GetPreparer(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "version": autorest.Encode("path", version), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DataVersionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DataVersionsClient) GetResponder(resp *http.Response) (result DataVersionResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// name - data name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// orderBy - ordering of list. +// top - maximum number of records to return. +// skip - continuation token for pagination. +// tags - comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2 +func (client DataVersionsClient) List(ctx context.Context, name string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string, tags string) (result DataVersionResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataVersionsClient.List") + defer func() { + sc := -1 + if result.dvrapr.Response.Response != nil { + sc = result.dvrapr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.DataVersionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, name, resourceGroupName, workspaceName, orderBy, top, skip, tags) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dvrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "List", resp, "Failure sending request") + return + } + + result.dvrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "List", resp, "Failure responding to request") + return + } + if result.dvrapr.hasNextLink() && result.dvrapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DataVersionsClient) ListPreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string, tags string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(orderBy) > 0 { + queryParameters["$orderBy"] = autorest.Encode("query", orderBy) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + if len(tags) > 0 { + queryParameters["$tags"] = autorest.Encode("query", tags) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DataVersionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DataVersionsClient) ListResponder(resp *http.Response) (result DataVersionResourceArmPaginatedResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client DataVersionsClient) listNextResults(ctx context.Context, lastResults DataVersionResourceArmPaginatedResult) (result DataVersionResourceArmPaginatedResult, err error) { + req, err := lastResults.dataVersionResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DataVersionsClient) ListComplete(ctx context.Context, name string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string, tags string) (result DataVersionResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataVersionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, name, resourceGroupName, workspaceName, orderBy, top, skip, tags) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/enums.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/enums.go new file mode 100644 index 000000000000..15b45a5e544b --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/enums.go @@ -0,0 +1,1634 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AllocationState enumerates the values for allocation state. +type AllocationState string + +const ( + // Resizing ... + Resizing AllocationState = "Resizing" + // Steady ... + Steady AllocationState = "Steady" +) + +// PossibleAllocationStateValues returns an array of possible values for the AllocationState const type. +func PossibleAllocationStateValues() []AllocationState { + return []AllocationState{Resizing, Steady} +} + +// ApplicationSharingPolicy enumerates the values for application sharing policy. +type ApplicationSharingPolicy string + +const ( + // Personal ... + Personal ApplicationSharingPolicy = "Personal" + // Shared ... + Shared ApplicationSharingPolicy = "Shared" +) + +// PossibleApplicationSharingPolicyValues returns an array of possible values for the ApplicationSharingPolicy const type. +func PossibleApplicationSharingPolicyValues() []ApplicationSharingPolicy { + return []ApplicationSharingPolicy{Personal, Shared} +} + +// BatchLoggingLevel enumerates the values for batch logging level. +type BatchLoggingLevel string + +const ( + // Debug ... + Debug BatchLoggingLevel = "Debug" + // Info ... + Info BatchLoggingLevel = "Info" + // Warning ... + Warning BatchLoggingLevel = "Warning" +) + +// PossibleBatchLoggingLevelValues returns an array of possible values for the BatchLoggingLevel const type. +func PossibleBatchLoggingLevelValues() []BatchLoggingLevel { + return []BatchLoggingLevel{Debug, Info, Warning} +} + +// BatchOutputAction enumerates the values for batch output action. +type BatchOutputAction string + +const ( + // AppendRow ... + AppendRow BatchOutputAction = "AppendRow" + // SummaryOnly ... + SummaryOnly BatchOutputAction = "SummaryOnly" +) + +// PossibleBatchOutputActionValues returns an array of possible values for the BatchOutputAction const type. +func PossibleBatchOutputActionValues() []BatchOutputAction { + return []BatchOutputAction{AppendRow, SummaryOnly} +} + +// ClusterPurpose enumerates the values for cluster purpose. +type ClusterPurpose string + +const ( + // DenseProd ... + DenseProd ClusterPurpose = "DenseProd" + // DevTest ... + DevTest ClusterPurpose = "DevTest" + // FastProd ... + FastProd ClusterPurpose = "FastProd" +) + +// PossibleClusterPurposeValues returns an array of possible values for the ClusterPurpose const type. +func PossibleClusterPurposeValues() []ClusterPurpose { + return []ClusterPurpose{DenseProd, DevTest, FastProd} +} + +// ComputeInstanceAuthorizationType enumerates the values for compute instance authorization type. +type ComputeInstanceAuthorizationType string + +const ( + // ComputeInstanceAuthorizationTypePersonal ... + ComputeInstanceAuthorizationTypePersonal ComputeInstanceAuthorizationType = "personal" +) + +// PossibleComputeInstanceAuthorizationTypeValues returns an array of possible values for the ComputeInstanceAuthorizationType const type. +func PossibleComputeInstanceAuthorizationTypeValues() []ComputeInstanceAuthorizationType { + return []ComputeInstanceAuthorizationType{ComputeInstanceAuthorizationTypePersonal} +} + +// ComputeInstanceState enumerates the values for compute instance state. +type ComputeInstanceState string + +const ( + // CreateFailed ... + CreateFailed ComputeInstanceState = "CreateFailed" + // Creating ... + Creating ComputeInstanceState = "Creating" + // Deleting ... + Deleting ComputeInstanceState = "Deleting" + // JobRunning ... + JobRunning ComputeInstanceState = "JobRunning" + // Restarting ... + Restarting ComputeInstanceState = "Restarting" + // Running ... + Running ComputeInstanceState = "Running" + // SettingUp ... + SettingUp ComputeInstanceState = "SettingUp" + // SetupFailed ... + SetupFailed ComputeInstanceState = "SetupFailed" + // Starting ... + Starting ComputeInstanceState = "Starting" + // Stopped ... + Stopped ComputeInstanceState = "Stopped" + // Stopping ... + Stopping ComputeInstanceState = "Stopping" + // Unknown ... + Unknown ComputeInstanceState = "Unknown" + // Unusable ... + Unusable ComputeInstanceState = "Unusable" + // UserSettingUp ... + UserSettingUp ComputeInstanceState = "UserSettingUp" + // UserSetupFailed ... + UserSetupFailed ComputeInstanceState = "UserSetupFailed" +) + +// PossibleComputeInstanceStateValues returns an array of possible values for the ComputeInstanceState const type. +func PossibleComputeInstanceStateValues() []ComputeInstanceState { + return []ComputeInstanceState{CreateFailed, Creating, Deleting, JobRunning, Restarting, Running, SettingUp, SetupFailed, Starting, Stopped, Stopping, Unknown, Unusable, UserSettingUp, UserSetupFailed} +} + +// ComputePowerAction enumerates the values for compute power action. +type ComputePowerAction string + +const ( + // Start ... + Start ComputePowerAction = "Start" + // Stop ... + Stop ComputePowerAction = "Stop" +) + +// PossibleComputePowerActionValues returns an array of possible values for the ComputePowerAction const type. +func PossibleComputePowerActionValues() []ComputePowerAction { + return []ComputePowerAction{Start, Stop} +} + +// ComputeType enumerates the values for compute type. +type ComputeType string + +const ( + // ComputeTypeAKS ... + ComputeTypeAKS ComputeType = "AKS" + // ComputeTypeAmlCompute ... + ComputeTypeAmlCompute ComputeType = "AmlCompute" + // ComputeTypeComputeInstance ... + ComputeTypeComputeInstance ComputeType = "ComputeInstance" + // ComputeTypeDatabricks ... + ComputeTypeDatabricks ComputeType = "Databricks" + // ComputeTypeDataFactory ... + ComputeTypeDataFactory ComputeType = "DataFactory" + // ComputeTypeDataLakeAnalytics ... + ComputeTypeDataLakeAnalytics ComputeType = "DataLakeAnalytics" + // ComputeTypeHDInsight ... + ComputeTypeHDInsight ComputeType = "HDInsight" + // ComputeTypeSynapseSpark ... + ComputeTypeSynapseSpark ComputeType = "SynapseSpark" + // ComputeTypeVirtualMachine ... + ComputeTypeVirtualMachine ComputeType = "VirtualMachine" +) + +// PossibleComputeTypeValues returns an array of possible values for the ComputeType const type. +func PossibleComputeTypeValues() []ComputeType { + return []ComputeType{ComputeTypeAKS, ComputeTypeAmlCompute, ComputeTypeComputeInstance, ComputeTypeDatabricks, ComputeTypeDataFactory, ComputeTypeDataLakeAnalytics, ComputeTypeHDInsight, ComputeTypeSynapseSpark, ComputeTypeVirtualMachine} +} + +// ComputeTypeBasicCompute enumerates the values for compute type basic compute. +type ComputeTypeBasicCompute string + +const ( + // ComputeTypeAKS1 ... + ComputeTypeAKS1 ComputeTypeBasicCompute = "AKS" + // ComputeTypeAmlCompute1 ... + ComputeTypeAmlCompute1 ComputeTypeBasicCompute = "AmlCompute" + // ComputeTypeCompute ... + ComputeTypeCompute ComputeTypeBasicCompute = "Compute" + // ComputeTypeComputeInstance1 ... + ComputeTypeComputeInstance1 ComputeTypeBasicCompute = "ComputeInstance" + // ComputeTypeDatabricks1 ... + ComputeTypeDatabricks1 ComputeTypeBasicCompute = "Databricks" + // ComputeTypeDataFactory1 ... + ComputeTypeDataFactory1 ComputeTypeBasicCompute = "DataFactory" + // ComputeTypeDataLakeAnalytics1 ... + ComputeTypeDataLakeAnalytics1 ComputeTypeBasicCompute = "DataLakeAnalytics" + // ComputeTypeHDInsight1 ... + ComputeTypeHDInsight1 ComputeTypeBasicCompute = "HDInsight" + // ComputeTypeVirtualMachine1 ... + ComputeTypeVirtualMachine1 ComputeTypeBasicCompute = "VirtualMachine" +) + +// PossibleComputeTypeBasicComputeValues returns an array of possible values for the ComputeTypeBasicCompute const type. +func PossibleComputeTypeBasicComputeValues() []ComputeTypeBasicCompute { + return []ComputeTypeBasicCompute{ComputeTypeAKS1, ComputeTypeAmlCompute1, ComputeTypeCompute, ComputeTypeComputeInstance1, ComputeTypeDatabricks1, ComputeTypeDataFactory1, ComputeTypeDataLakeAnalytics1, ComputeTypeHDInsight1, ComputeTypeVirtualMachine1} +} + +// ComputeTypeBasicComputeNodesInformation enumerates the values for compute type basic compute nodes +// information. +type ComputeTypeBasicComputeNodesInformation string + +const ( + // ComputeTypeBasicComputeNodesInformationComputeTypeAmlCompute ... + ComputeTypeBasicComputeNodesInformationComputeTypeAmlCompute ComputeTypeBasicComputeNodesInformation = "AmlCompute" + // ComputeTypeBasicComputeNodesInformationComputeTypeComputeNodesInformation ... + ComputeTypeBasicComputeNodesInformationComputeTypeComputeNodesInformation ComputeTypeBasicComputeNodesInformation = "ComputeNodesInformation" +) + +// PossibleComputeTypeBasicComputeNodesInformationValues returns an array of possible values for the ComputeTypeBasicComputeNodesInformation const type. +func PossibleComputeTypeBasicComputeNodesInformationValues() []ComputeTypeBasicComputeNodesInformation { + return []ComputeTypeBasicComputeNodesInformation{ComputeTypeBasicComputeNodesInformationComputeTypeAmlCompute, ComputeTypeBasicComputeNodesInformationComputeTypeComputeNodesInformation} +} + +// ComputeTypeBasicComputeSecrets enumerates the values for compute type basic compute secrets. +type ComputeTypeBasicComputeSecrets string + +const ( + // ComputeTypeBasicComputeSecretsComputeTypeAKS ... + ComputeTypeBasicComputeSecretsComputeTypeAKS ComputeTypeBasicComputeSecrets = "AKS" + // ComputeTypeBasicComputeSecretsComputeTypeComputeSecrets ... + ComputeTypeBasicComputeSecretsComputeTypeComputeSecrets ComputeTypeBasicComputeSecrets = "ComputeSecrets" + // ComputeTypeBasicComputeSecretsComputeTypeDatabricks ... + ComputeTypeBasicComputeSecretsComputeTypeDatabricks ComputeTypeBasicComputeSecrets = "Databricks" + // ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine ... + ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine ComputeTypeBasicComputeSecrets = "VirtualMachine" +) + +// PossibleComputeTypeBasicComputeSecretsValues returns an array of possible values for the ComputeTypeBasicComputeSecrets const type. +func PossibleComputeTypeBasicComputeSecretsValues() []ComputeTypeBasicComputeSecrets { + return []ComputeTypeBasicComputeSecrets{ComputeTypeBasicComputeSecretsComputeTypeAKS, ComputeTypeBasicComputeSecretsComputeTypeComputeSecrets, ComputeTypeBasicComputeSecretsComputeTypeDatabricks, ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine} +} + +// ContainerType enumerates the values for container type. +type ContainerType string + +const ( + // InferenceServer ... + InferenceServer ContainerType = "InferenceServer" + // StorageInitializer ... + StorageInitializer ContainerType = "StorageInitializer" +) + +// PossibleContainerTypeValues returns an array of possible values for the ContainerType const type. +func PossibleContainerTypeValues() []ContainerType { + return []ContainerType{InferenceServer, StorageInitializer} +} + +// ContentsType enumerates the values for contents type. +type ContentsType string + +const ( + // AzureBlob ... + AzureBlob ContentsType = "AzureBlob" + // AzureDataLakeGen1 ... + AzureDataLakeGen1 ContentsType = "AzureDataLakeGen1" + // AzureDataLakeGen2 ... + AzureDataLakeGen2 ContentsType = "AzureDataLakeGen2" + // AzureFile ... + AzureFile ContentsType = "AzureFile" + // AzureMySQL ... + AzureMySQL ContentsType = "AzureMySql" + // AzurePostgreSQL ... + AzurePostgreSQL ContentsType = "AzurePostgreSql" + // AzureSQLDatabase ... + AzureSQLDatabase ContentsType = "AzureSqlDatabase" + // GlusterFs ... + GlusterFs ContentsType = "GlusterFs" +) + +// PossibleContentsTypeValues returns an array of possible values for the ContentsType const type. +func PossibleContentsTypeValues() []ContentsType { + return []ContentsType{AzureBlob, AzureDataLakeGen1, AzureDataLakeGen2, AzureFile, AzureMySQL, AzurePostgreSQL, AzureSQLDatabase, GlusterFs} +} + +// ContentsTypeBasicDatastoreContents enumerates the values for contents type basic datastore contents. +type ContentsTypeBasicDatastoreContents string + +const ( + // ContentsTypeAzureBlob ... + ContentsTypeAzureBlob ContentsTypeBasicDatastoreContents = "AzureBlob" + // ContentsTypeAzureDataLakeGen1 ... + ContentsTypeAzureDataLakeGen1 ContentsTypeBasicDatastoreContents = "AzureDataLakeGen1" + // ContentsTypeAzureDataLakeGen2 ... + ContentsTypeAzureDataLakeGen2 ContentsTypeBasicDatastoreContents = "AzureDataLakeGen2" + // ContentsTypeAzureFile ... + ContentsTypeAzureFile ContentsTypeBasicDatastoreContents = "AzureFile" + // ContentsTypeAzurePostgreSQL ... + ContentsTypeAzurePostgreSQL ContentsTypeBasicDatastoreContents = "AzurePostgreSql" + // ContentsTypeAzureSQLDatabase ... + ContentsTypeAzureSQLDatabase ContentsTypeBasicDatastoreContents = "AzureSqlDatabase" + // ContentsTypeDatastoreContents ... + ContentsTypeDatastoreContents ContentsTypeBasicDatastoreContents = "DatastoreContents" + // ContentsTypeGlusterFs ... + ContentsTypeGlusterFs ContentsTypeBasicDatastoreContents = "GlusterFs" +) + +// PossibleContentsTypeBasicDatastoreContentsValues returns an array of possible values for the ContentsTypeBasicDatastoreContents const type. +func PossibleContentsTypeBasicDatastoreContentsValues() []ContentsTypeBasicDatastoreContents { + return []ContentsTypeBasicDatastoreContents{ContentsTypeAzureBlob, ContentsTypeAzureDataLakeGen1, ContentsTypeAzureDataLakeGen2, ContentsTypeAzureFile, ContentsTypeAzurePostgreSQL, ContentsTypeAzureSQLDatabase, ContentsTypeDatastoreContents, ContentsTypeGlusterFs} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// CredentialsType enumerates the values for credentials type. +type CredentialsType string + +const ( + // AccountKey ... + AccountKey CredentialsType = "AccountKey" + // Certificate ... + Certificate CredentialsType = "Certificate" + // None ... + None CredentialsType = "None" + // Sas ... + Sas CredentialsType = "Sas" + // ServicePrincipal ... + ServicePrincipal CredentialsType = "ServicePrincipal" + // SQLAdmin ... + SQLAdmin CredentialsType = "SqlAdmin" +) + +// PossibleCredentialsTypeValues returns an array of possible values for the CredentialsType const type. +func PossibleCredentialsTypeValues() []CredentialsType { + return []CredentialsType{AccountKey, Certificate, None, Sas, ServicePrincipal, SQLAdmin} +} + +// CredentialsTypeBasicDatastoreCredentials enumerates the values for credentials type basic datastore +// credentials. +type CredentialsTypeBasicDatastoreCredentials string + +const ( + // CredentialsTypeAccountKey ... + CredentialsTypeAccountKey CredentialsTypeBasicDatastoreCredentials = "AccountKey" + // CredentialsTypeCertificate ... + CredentialsTypeCertificate CredentialsTypeBasicDatastoreCredentials = "Certificate" + // CredentialsTypeDatastoreCredentials ... + CredentialsTypeDatastoreCredentials CredentialsTypeBasicDatastoreCredentials = "DatastoreCredentials" + // CredentialsTypeNone ... + CredentialsTypeNone CredentialsTypeBasicDatastoreCredentials = "None" + // CredentialsTypeSas ... + CredentialsTypeSas CredentialsTypeBasicDatastoreCredentials = "Sas" + // CredentialsTypeServicePrincipal ... + CredentialsTypeServicePrincipal CredentialsTypeBasicDatastoreCredentials = "ServicePrincipal" + // CredentialsTypeSQLAdmin ... + CredentialsTypeSQLAdmin CredentialsTypeBasicDatastoreCredentials = "SqlAdmin" +) + +// PossibleCredentialsTypeBasicDatastoreCredentialsValues returns an array of possible values for the CredentialsTypeBasicDatastoreCredentials const type. +func PossibleCredentialsTypeBasicDatastoreCredentialsValues() []CredentialsTypeBasicDatastoreCredentials { + return []CredentialsTypeBasicDatastoreCredentials{CredentialsTypeAccountKey, CredentialsTypeCertificate, CredentialsTypeDatastoreCredentials, CredentialsTypeNone, CredentialsTypeSas, CredentialsTypeServicePrincipal, CredentialsTypeSQLAdmin} +} + +// DataBindingMode enumerates the values for data binding mode. +type DataBindingMode string + +const ( + // Download ... + Download DataBindingMode = "Download" + // Mount ... + Mount DataBindingMode = "Mount" + // Upload ... + Upload DataBindingMode = "Upload" +) + +// PossibleDataBindingModeValues returns an array of possible values for the DataBindingMode const type. +func PossibleDataBindingModeValues() []DataBindingMode { + return []DataBindingMode{Download, Mount, Upload} +} + +// DatasetType enumerates the values for dataset type. +type DatasetType string + +const ( + // Dataflow ... + Dataflow DatasetType = "Dataflow" + // Simple ... + Simple DatasetType = "Simple" +) + +// PossibleDatasetTypeValues returns an array of possible values for the DatasetType const type. +func PossibleDatasetTypeValues() []DatasetType { + return []DatasetType{Dataflow, Simple} +} + +// DaysOfWeek enumerates the values for days of week. +type DaysOfWeek string + +const ( + // Friday ... + Friday DaysOfWeek = "Friday" + // Monday ... + Monday DaysOfWeek = "Monday" + // Saturday ... + Saturday DaysOfWeek = "Saturday" + // Sunday ... + Sunday DaysOfWeek = "Sunday" + // Thursday ... + Thursday DaysOfWeek = "Thursday" + // Tuesday ... + Tuesday DaysOfWeek = "Tuesday" + // Wednesday ... + Wednesday DaysOfWeek = "Wednesday" +) + +// PossibleDaysOfWeekValues returns an array of possible values for the DaysOfWeek const type. +func PossibleDaysOfWeekValues() []DaysOfWeek { + return []DaysOfWeek{Friday, Monday, Saturday, Sunday, Thursday, Tuesday, Wednesday} +} + +// DeploymentProvisioningState enumerates the values for deployment provisioning state. +type DeploymentProvisioningState string + +const ( + // DeploymentProvisioningStateCanceled ... + DeploymentProvisioningStateCanceled DeploymentProvisioningState = "Canceled" + // DeploymentProvisioningStateCreating ... + DeploymentProvisioningStateCreating DeploymentProvisioningState = "Creating" + // DeploymentProvisioningStateDeleting ... + DeploymentProvisioningStateDeleting DeploymentProvisioningState = "Deleting" + // DeploymentProvisioningStateFailed ... + DeploymentProvisioningStateFailed DeploymentProvisioningState = "Failed" + // DeploymentProvisioningStateScaling ... + DeploymentProvisioningStateScaling DeploymentProvisioningState = "Scaling" + // DeploymentProvisioningStateSucceeded ... + DeploymentProvisioningStateSucceeded DeploymentProvisioningState = "Succeeded" + // DeploymentProvisioningStateUpdating ... + DeploymentProvisioningStateUpdating DeploymentProvisioningState = "Updating" +) + +// PossibleDeploymentProvisioningStateValues returns an array of possible values for the DeploymentProvisioningState const type. +func PossibleDeploymentProvisioningStateValues() []DeploymentProvisioningState { + return []DeploymentProvisioningState{DeploymentProvisioningStateCanceled, DeploymentProvisioningStateCreating, DeploymentProvisioningStateDeleting, DeploymentProvisioningStateFailed, DeploymentProvisioningStateScaling, DeploymentProvisioningStateSucceeded, DeploymentProvisioningStateUpdating} +} + +// DistributionType enumerates the values for distribution type. +type DistributionType string + +const ( + // DistributionTypeMpi ... + DistributionTypeMpi DistributionType = "Mpi" + // DistributionTypePyTorch ... + DistributionTypePyTorch DistributionType = "PyTorch" + // DistributionTypeTensorFlow ... + DistributionTypeTensorFlow DistributionType = "TensorFlow" +) + +// PossibleDistributionTypeValues returns an array of possible values for the DistributionType const type. +func PossibleDistributionTypeValues() []DistributionType { + return []DistributionType{DistributionTypeMpi, DistributionTypePyTorch, DistributionTypeTensorFlow} +} + +// DistributionTypeBasicDistributionConfiguration enumerates the values for distribution type basic +// distribution configuration. +type DistributionTypeBasicDistributionConfiguration string + +const ( + // DistributionTypeDistributionConfiguration ... + DistributionTypeDistributionConfiguration DistributionTypeBasicDistributionConfiguration = "DistributionConfiguration" + // DistributionTypeMpi1 ... + DistributionTypeMpi1 DistributionTypeBasicDistributionConfiguration = "Mpi" + // DistributionTypePyTorch1 ... + DistributionTypePyTorch1 DistributionTypeBasicDistributionConfiguration = "PyTorch" + // DistributionTypeTensorFlow1 ... + DistributionTypeTensorFlow1 DistributionTypeBasicDistributionConfiguration = "TensorFlow" +) + +// PossibleDistributionTypeBasicDistributionConfigurationValues returns an array of possible values for the DistributionTypeBasicDistributionConfiguration const type. +func PossibleDistributionTypeBasicDistributionConfigurationValues() []DistributionTypeBasicDistributionConfiguration { + return []DistributionTypeBasicDistributionConfiguration{DistributionTypeDistributionConfiguration, DistributionTypeMpi1, DistributionTypePyTorch1, DistributionTypeTensorFlow1} +} + +// DockerSpecificationType enumerates the values for docker specification type. +type DockerSpecificationType string + +const ( + // Build ... + Build DockerSpecificationType = "Build" + // Image ... + Image DockerSpecificationType = "Image" +) + +// PossibleDockerSpecificationTypeValues returns an array of possible values for the DockerSpecificationType const type. +func PossibleDockerSpecificationTypeValues() []DockerSpecificationType { + return []DockerSpecificationType{Build, Image} +} + +// DockerSpecificationTypeBasicDockerSpecification enumerates the values for docker specification type basic +// docker specification. +type DockerSpecificationTypeBasicDockerSpecification string + +const ( + // DockerSpecificationTypeBuild ... + DockerSpecificationTypeBuild DockerSpecificationTypeBasicDockerSpecification = "Build" + // DockerSpecificationTypeDockerSpecification ... + DockerSpecificationTypeDockerSpecification DockerSpecificationTypeBasicDockerSpecification = "DockerSpecification" + // DockerSpecificationTypeImage ... + DockerSpecificationTypeImage DockerSpecificationTypeBasicDockerSpecification = "Image" +) + +// PossibleDockerSpecificationTypeBasicDockerSpecificationValues returns an array of possible values for the DockerSpecificationTypeBasicDockerSpecification const type. +func PossibleDockerSpecificationTypeBasicDockerSpecificationValues() []DockerSpecificationTypeBasicDockerSpecification { + return []DockerSpecificationTypeBasicDockerSpecification{DockerSpecificationTypeBuild, DockerSpecificationTypeDockerSpecification, DockerSpecificationTypeImage} +} + +// EarlyTerminationPolicyType enumerates the values for early termination policy type. +type EarlyTerminationPolicyType string + +const ( + // Bandit ... + Bandit EarlyTerminationPolicyType = "Bandit" + // MedianStopping ... + MedianStopping EarlyTerminationPolicyType = "MedianStopping" + // TruncationSelection ... + TruncationSelection EarlyTerminationPolicyType = "TruncationSelection" +) + +// PossibleEarlyTerminationPolicyTypeValues returns an array of possible values for the EarlyTerminationPolicyType const type. +func PossibleEarlyTerminationPolicyTypeValues() []EarlyTerminationPolicyType { + return []EarlyTerminationPolicyType{Bandit, MedianStopping, TruncationSelection} +} + +// EncryptionStatus enumerates the values for encryption status. +type EncryptionStatus string + +const ( + // Disabled ... + Disabled EncryptionStatus = "Disabled" + // Enabled ... + Enabled EncryptionStatus = "Enabled" +) + +// PossibleEncryptionStatusValues returns an array of possible values for the EncryptionStatus const type. +func PossibleEncryptionStatusValues() []EncryptionStatus { + return []EncryptionStatus{Disabled, Enabled} +} + +// EndpointAuthMode enumerates the values for endpoint auth mode. +type EndpointAuthMode string + +const ( + // AADToken ... + AADToken EndpointAuthMode = "AADToken" + // AMLToken ... + AMLToken EndpointAuthMode = "AMLToken" + // Key ... + Key EndpointAuthMode = "Key" +) + +// PossibleEndpointAuthModeValues returns an array of possible values for the EndpointAuthMode const type. +func PossibleEndpointAuthModeValues() []EndpointAuthMode { + return []EndpointAuthMode{AADToken, AMLToken, Key} +} + +// EndpointComputeType enumerates the values for endpoint compute type. +type EndpointComputeType string + +const ( + // AzureMLCompute ... + AzureMLCompute EndpointComputeType = "AzureMLCompute" + // K8S ... + K8S EndpointComputeType = "K8S" + // Managed ... + Managed EndpointComputeType = "Managed" +) + +// PossibleEndpointComputeTypeValues returns an array of possible values for the EndpointComputeType const type. +func PossibleEndpointComputeTypeValues() []EndpointComputeType { + return []EndpointComputeType{AzureMLCompute, K8S, Managed} +} + +// EndpointComputeTypeBasicOnlineDeployment enumerates the values for endpoint compute type basic online +// deployment. +type EndpointComputeTypeBasicOnlineDeployment string + +const ( + // EndpointComputeTypeK8S ... + EndpointComputeTypeK8S EndpointComputeTypeBasicOnlineDeployment = "K8S" + // EndpointComputeTypeManaged ... + EndpointComputeTypeManaged EndpointComputeTypeBasicOnlineDeployment = "Managed" + // EndpointComputeTypeOnlineDeployment ... + EndpointComputeTypeOnlineDeployment EndpointComputeTypeBasicOnlineDeployment = "OnlineDeployment" +) + +// PossibleEndpointComputeTypeBasicOnlineDeploymentValues returns an array of possible values for the EndpointComputeTypeBasicOnlineDeployment const type. +func PossibleEndpointComputeTypeBasicOnlineDeploymentValues() []EndpointComputeTypeBasicOnlineDeployment { + return []EndpointComputeTypeBasicOnlineDeployment{EndpointComputeTypeK8S, EndpointComputeTypeManaged, EndpointComputeTypeOnlineDeployment} +} + +// EndpointComputeTypeBasicPartialOnlineDeployment enumerates the values for endpoint compute type basic +// partial online deployment. +type EndpointComputeTypeBasicPartialOnlineDeployment string + +const ( + // EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeK8S ... + EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeK8S EndpointComputeTypeBasicPartialOnlineDeployment = "K8S" + // EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeManaged ... + EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeManaged EndpointComputeTypeBasicPartialOnlineDeployment = "Managed" + // EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypePartialOnlineDeployment ... + EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypePartialOnlineDeployment EndpointComputeTypeBasicPartialOnlineDeployment = "PartialOnlineDeployment" +) + +// PossibleEndpointComputeTypeBasicPartialOnlineDeploymentValues returns an array of possible values for the EndpointComputeTypeBasicPartialOnlineDeployment const type. +func PossibleEndpointComputeTypeBasicPartialOnlineDeploymentValues() []EndpointComputeTypeBasicPartialOnlineDeployment { + return []EndpointComputeTypeBasicPartialOnlineDeployment{EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeK8S, EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeManaged, EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypePartialOnlineDeployment} +} + +// EndpointProvisioningState enumerates the values for endpoint provisioning state. +type EndpointProvisioningState string + +const ( + // EndpointProvisioningStateCanceled ... + EndpointProvisioningStateCanceled EndpointProvisioningState = "Canceled" + // EndpointProvisioningStateCreating ... + EndpointProvisioningStateCreating EndpointProvisioningState = "Creating" + // EndpointProvisioningStateDeleting ... + EndpointProvisioningStateDeleting EndpointProvisioningState = "Deleting" + // EndpointProvisioningStateFailed ... + EndpointProvisioningStateFailed EndpointProvisioningState = "Failed" + // EndpointProvisioningStateSucceeded ... + EndpointProvisioningStateSucceeded EndpointProvisioningState = "Succeeded" + // EndpointProvisioningStateUpdating ... + EndpointProvisioningStateUpdating EndpointProvisioningState = "Updating" +) + +// PossibleEndpointProvisioningStateValues returns an array of possible values for the EndpointProvisioningState const type. +func PossibleEndpointProvisioningStateValues() []EndpointProvisioningState { + return []EndpointProvisioningState{EndpointProvisioningStateCanceled, EndpointProvisioningStateCreating, EndpointProvisioningStateDeleting, EndpointProvisioningStateFailed, EndpointProvisioningStateSucceeded, EndpointProvisioningStateUpdating} +} + +// EnvironmentSpecificationType enumerates the values for environment specification type. +type EnvironmentSpecificationType string + +const ( + // Curated ... + Curated EnvironmentSpecificationType = "Curated" + // UserCreated ... + UserCreated EnvironmentSpecificationType = "UserCreated" +) + +// PossibleEnvironmentSpecificationTypeValues returns an array of possible values for the EnvironmentSpecificationType const type. +func PossibleEnvironmentSpecificationTypeValues() []EnvironmentSpecificationType { + return []EnvironmentSpecificationType{Curated, UserCreated} +} + +// ExportFormatType enumerates the values for export format type. +type ExportFormatType string + +const ( + // Coco ... + Coco ExportFormatType = "Coco" + // CSV ... + CSV ExportFormatType = "CSV" + // Dataset ... + Dataset ExportFormatType = "Dataset" +) + +// PossibleExportFormatTypeValues returns an array of possible values for the ExportFormatType const type. +func PossibleExportFormatTypeValues() []ExportFormatType { + return []ExportFormatType{Coco, CSV, Dataset} +} + +// Format enumerates the values for format. +type Format string + +const ( + // FormatCoco ... + FormatCoco Format = "Coco" + // FormatCSV ... + FormatCSV Format = "CSV" + // FormatDataset ... + FormatDataset Format = "Dataset" + // FormatExportSummary ... + FormatExportSummary Format = "ExportSummary" +) + +// PossibleFormatValues returns an array of possible values for the Format const type. +func PossibleFormatValues() []Format { + return []Format{FormatCoco, FormatCSV, FormatDataset, FormatExportSummary} +} + +// Goal enumerates the values for goal. +type Goal string + +const ( + // Maximize ... + Maximize Goal = "Maximize" + // Minimize ... + Minimize Goal = "Minimize" +) + +// PossibleGoalValues returns an array of possible values for the Goal const type. +func PossibleGoalValues() []Goal { + return []Goal{Maximize, Minimize} +} + +// IdentityConfigurationType enumerates the values for identity configuration type. +type IdentityConfigurationType string + +const ( + // IdentityConfigurationTypeAMLToken ... + IdentityConfigurationTypeAMLToken IdentityConfigurationType = "AMLToken" + // IdentityConfigurationTypeManaged ... + IdentityConfigurationTypeManaged IdentityConfigurationType = "Managed" +) + +// PossibleIdentityConfigurationTypeValues returns an array of possible values for the IdentityConfigurationType const type. +func PossibleIdentityConfigurationTypeValues() []IdentityConfigurationType { + return []IdentityConfigurationType{IdentityConfigurationTypeAMLToken, IdentityConfigurationTypeManaged} +} + +// IdentityType enumerates the values for identity type. +type IdentityType string + +const ( + // IdentityTypeAMLToken ... + IdentityTypeAMLToken IdentityType = "AMLToken" + // IdentityTypeIdentityConfiguration ... + IdentityTypeIdentityConfiguration IdentityType = "IdentityConfiguration" + // IdentityTypeManaged ... + IdentityTypeManaged IdentityType = "Managed" +) + +// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{IdentityTypeAMLToken, IdentityTypeIdentityConfiguration, IdentityTypeManaged} +} + +// ImageAnnotationType enumerates the values for image annotation type. +type ImageAnnotationType string + +const ( + // BoundingBox ... + BoundingBox ImageAnnotationType = "BoundingBox" + // Classification ... + Classification ImageAnnotationType = "Classification" + // InstanceSegmentation ... + InstanceSegmentation ImageAnnotationType = "InstanceSegmentation" +) + +// PossibleImageAnnotationTypeValues returns an array of possible values for the ImageAnnotationType const type. +func PossibleImageAnnotationTypeValues() []ImageAnnotationType { + return []ImageAnnotationType{BoundingBox, Classification, InstanceSegmentation} +} + +// JobProvisioningState enumerates the values for job provisioning state. +type JobProvisioningState string + +const ( + // Canceled ... + Canceled JobProvisioningState = "Canceled" + // Failed ... + Failed JobProvisioningState = "Failed" + // InProgress ... + InProgress JobProvisioningState = "InProgress" + // Succeeded ... + Succeeded JobProvisioningState = "Succeeded" +) + +// PossibleJobProvisioningStateValues returns an array of possible values for the JobProvisioningState const type. +func PossibleJobProvisioningStateValues() []JobProvisioningState { + return []JobProvisioningState{Canceled, Failed, InProgress, Succeeded} +} + +// JobStatus enumerates the values for job status. +type JobStatus string + +const ( + // JobStatusCanceled ... + JobStatusCanceled JobStatus = "Canceled" + // JobStatusCancelRequested ... + JobStatusCancelRequested JobStatus = "CancelRequested" + // JobStatusCompleted ... + JobStatusCompleted JobStatus = "Completed" + // JobStatusFailed ... + JobStatusFailed JobStatus = "Failed" + // JobStatusFinalizing ... + JobStatusFinalizing JobStatus = "Finalizing" + // JobStatusNotResponding ... + JobStatusNotResponding JobStatus = "NotResponding" + // JobStatusNotStarted ... + JobStatusNotStarted JobStatus = "NotStarted" + // JobStatusPaused ... + JobStatusPaused JobStatus = "Paused" + // JobStatusPreparing ... + JobStatusPreparing JobStatus = "Preparing" + // JobStatusProvisioning ... + JobStatusProvisioning JobStatus = "Provisioning" + // JobStatusQueued ... + JobStatusQueued JobStatus = "Queued" + // JobStatusRunning ... + JobStatusRunning JobStatus = "Running" + // JobStatusStarting ... + JobStatusStarting JobStatus = "Starting" + // JobStatusUnknown ... + JobStatusUnknown JobStatus = "Unknown" +) + +// PossibleJobStatusValues returns an array of possible values for the JobStatus const type. +func PossibleJobStatusValues() []JobStatus { + return []JobStatus{JobStatusCanceled, JobStatusCancelRequested, JobStatusCompleted, JobStatusFailed, JobStatusFinalizing, JobStatusNotResponding, JobStatusNotStarted, JobStatusPaused, JobStatusPreparing, JobStatusProvisioning, JobStatusQueued, JobStatusRunning, JobStatusStarting, JobStatusUnknown} +} + +// JobType enumerates the values for job type. +type JobType string + +const ( + // Command ... + Command JobType = "Command" + // Labeling ... + Labeling JobType = "Labeling" + // Sweep ... + Sweep JobType = "Sweep" +) + +// PossibleJobTypeValues returns an array of possible values for the JobType const type. +func PossibleJobTypeValues() []JobType { + return []JobType{Command, Labeling, Sweep} +} + +// JobTypeBasicJobBase enumerates the values for job type basic job base. +type JobTypeBasicJobBase string + +const ( + // JobTypeCommand ... + JobTypeCommand JobTypeBasicJobBase = "Command" + // JobTypeJobBase ... + JobTypeJobBase JobTypeBasicJobBase = "JobBase" + // JobTypeSweep ... + JobTypeSweep JobTypeBasicJobBase = "Sweep" +) + +// PossibleJobTypeBasicJobBaseValues returns an array of possible values for the JobTypeBasicJobBase const type. +func PossibleJobTypeBasicJobBaseValues() []JobTypeBasicJobBase { + return []JobTypeBasicJobBase{JobTypeCommand, JobTypeJobBase, JobTypeSweep} +} + +// KeyType enumerates the values for key type. +type KeyType string + +const ( + // Primary ... + Primary KeyType = "Primary" + // Secondary ... + Secondary KeyType = "Secondary" +) + +// PossibleKeyTypeValues returns an array of possible values for the KeyType const type. +func PossibleKeyTypeValues() []KeyType { + return []KeyType{Primary, Secondary} +} + +// LoadBalancerType enumerates the values for load balancer type. +type LoadBalancerType string + +const ( + // InternalLoadBalancer ... + InternalLoadBalancer LoadBalancerType = "InternalLoadBalancer" + // PublicIP ... + PublicIP LoadBalancerType = "PublicIp" +) + +// PossibleLoadBalancerTypeValues returns an array of possible values for the LoadBalancerType const type. +func PossibleLoadBalancerTypeValues() []LoadBalancerType { + return []LoadBalancerType{InternalLoadBalancer, PublicIP} +} + +// MediaType enumerates the values for media type. +type MediaType string + +const ( + // MediaTypeImage ... + MediaTypeImage MediaType = "Image" + // MediaTypeText ... + MediaTypeText MediaType = "Text" +) + +// PossibleMediaTypeValues returns an array of possible values for the MediaType const type. +func PossibleMediaTypeValues() []MediaType { + return []MediaType{MediaTypeImage, MediaTypeText} +} + +// MediaTypeBasicLabelingJobMediaProperties enumerates the values for media type basic labeling job media +// properties. +type MediaTypeBasicLabelingJobMediaProperties string + +const ( + // MediaTypeImage1 ... + MediaTypeImage1 MediaTypeBasicLabelingJobMediaProperties = "Image" + // MediaTypeLabelingJobMediaProperties ... + MediaTypeLabelingJobMediaProperties MediaTypeBasicLabelingJobMediaProperties = "LabelingJobMediaProperties" + // MediaTypeText1 ... + MediaTypeText1 MediaTypeBasicLabelingJobMediaProperties = "Text" +) + +// PossibleMediaTypeBasicLabelingJobMediaPropertiesValues returns an array of possible values for the MediaTypeBasicLabelingJobMediaProperties const type. +func PossibleMediaTypeBasicLabelingJobMediaPropertiesValues() []MediaTypeBasicLabelingJobMediaProperties { + return []MediaTypeBasicLabelingJobMediaProperties{MediaTypeImage1, MediaTypeLabelingJobMediaProperties, MediaTypeText1} +} + +// NodeState enumerates the values for node state. +type NodeState string + +const ( + // NodeStateIdle ... + NodeStateIdle NodeState = "idle" + // NodeStateLeaving ... + NodeStateLeaving NodeState = "leaving" + // NodeStatePreempted ... + NodeStatePreempted NodeState = "preempted" + // NodeStatePreparing ... + NodeStatePreparing NodeState = "preparing" + // NodeStateRunning ... + NodeStateRunning NodeState = "running" + // NodeStateUnusable ... + NodeStateUnusable NodeState = "unusable" +) + +// PossibleNodeStateValues returns an array of possible values for the NodeState const type. +func PossibleNodeStateValues() []NodeState { + return []NodeState{NodeStateIdle, NodeStateLeaving, NodeStatePreempted, NodeStatePreparing, NodeStateRunning, NodeStateUnusable} +} + +// OperatingSystemType enumerates the values for operating system type. +type OperatingSystemType string + +const ( + // Linux ... + Linux OperatingSystemType = "Linux" + // Windows ... + Windows OperatingSystemType = "Windows" +) + +// PossibleOperatingSystemTypeValues returns an array of possible values for the OperatingSystemType const type. +func PossibleOperatingSystemTypeValues() []OperatingSystemType { + return []OperatingSystemType{Linux, Windows} +} + +// OperationName enumerates the values for operation name. +type OperationName string + +const ( + // OperationNameCreate ... + OperationNameCreate OperationName = "Create" + // OperationNameDelete ... + OperationNameDelete OperationName = "Delete" + // OperationNameReimage ... + OperationNameReimage OperationName = "Reimage" + // OperationNameRestart ... + OperationNameRestart OperationName = "Restart" + // OperationNameStart ... + OperationNameStart OperationName = "Start" + // OperationNameStop ... + OperationNameStop OperationName = "Stop" +) + +// PossibleOperationNameValues returns an array of possible values for the OperationName const type. +func PossibleOperationNameValues() []OperationName { + return []OperationName{OperationNameCreate, OperationNameDelete, OperationNameReimage, OperationNameRestart, OperationNameStart, OperationNameStop} +} + +// OperationStatus enumerates the values for operation status. +type OperationStatus string + +const ( + // OperationStatusCreateFailed ... + OperationStatusCreateFailed OperationStatus = "CreateFailed" + // OperationStatusDeleteFailed ... + OperationStatusDeleteFailed OperationStatus = "DeleteFailed" + // OperationStatusInProgress ... + OperationStatusInProgress OperationStatus = "InProgress" + // OperationStatusReimageFailed ... + OperationStatusReimageFailed OperationStatus = "ReimageFailed" + // OperationStatusRestartFailed ... + OperationStatusRestartFailed OperationStatus = "RestartFailed" + // OperationStatusStartFailed ... + OperationStatusStartFailed OperationStatus = "StartFailed" + // OperationStatusStopFailed ... + OperationStatusStopFailed OperationStatus = "StopFailed" + // OperationStatusSucceeded ... + OperationStatusSucceeded OperationStatus = "Succeeded" +) + +// PossibleOperationStatusValues returns an array of possible values for the OperationStatus const type. +func PossibleOperationStatusValues() []OperationStatus { + return []OperationStatus{OperationStatusCreateFailed, OperationStatusDeleteFailed, OperationStatusInProgress, OperationStatusReimageFailed, OperationStatusRestartFailed, OperationStatusStartFailed, OperationStatusStopFailed, OperationStatusSucceeded} +} + +// OrderString enumerates the values for order string. +type OrderString string + +const ( + // CreatedAtAsc ... + CreatedAtAsc OrderString = "CreatedAtAsc" + // CreatedAtDesc ... + CreatedAtDesc OrderString = "CreatedAtDesc" + // UpdatedAtAsc ... + UpdatedAtAsc OrderString = "UpdatedAtAsc" + // UpdatedAtDesc ... + UpdatedAtDesc OrderString = "UpdatedAtDesc" +) + +// PossibleOrderStringValues returns an array of possible values for the OrderString const type. +func PossibleOrderStringValues() []OrderString { + return []OrderString{CreatedAtAsc, CreatedAtDesc, UpdatedAtAsc, UpdatedAtDesc} +} + +// OriginType enumerates the values for origin type. +type OriginType string + +const ( + // Synapse ... + Synapse OriginType = "Synapse" +) + +// PossibleOriginTypeValues returns an array of possible values for the OriginType const type. +func PossibleOriginTypeValues() []OriginType { + return []OriginType{Synapse} +} + +// OsType enumerates the values for os type. +type OsType string + +const ( + // OsTypeLinux ... + OsTypeLinux OsType = "Linux" + // OsTypeWindows ... + OsTypeWindows OsType = "Windows" +) + +// PossibleOsTypeValues returns an array of possible values for the OsType const type. +func PossibleOsTypeValues() []OsType { + return []OsType{OsTypeLinux, OsTypeWindows} +} + +// PolicyType enumerates the values for policy type. +type PolicyType string + +const ( + // PolicyTypeBandit ... + PolicyTypeBandit PolicyType = "Bandit" + // PolicyTypeEarlyTerminationPolicy ... + PolicyTypeEarlyTerminationPolicy PolicyType = "EarlyTerminationPolicy" + // PolicyTypeMedianStopping ... + PolicyTypeMedianStopping PolicyType = "MedianStopping" + // PolicyTypeTruncationSelection ... + PolicyTypeTruncationSelection PolicyType = "TruncationSelection" +) + +// PossiblePolicyTypeValues returns an array of possible values for the PolicyType const type. +func PossiblePolicyTypeValues() []PolicyType { + return []PolicyType{PolicyTypeBandit, PolicyTypeEarlyTerminationPolicy, PolicyTypeMedianStopping, PolicyTypeTruncationSelection} +} + +// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection +// provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + // PrivateEndpointConnectionProvisioningStateCreating ... + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + // PrivateEndpointConnectionProvisioningStateDeleting ... + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + // PrivateEndpointConnectionProvisioningStateFailed ... + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + // PrivateEndpointConnectionProvisioningStateSucceeded ... + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateCreating, PrivateEndpointConnectionProvisioningStateDeleting, PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded} +} + +// PrivateEndpointServiceConnectionStatus enumerates the values for private endpoint service connection status. +type PrivateEndpointServiceConnectionStatus string + +const ( + // Approved ... + Approved PrivateEndpointServiceConnectionStatus = "Approved" + // Disconnected ... + Disconnected PrivateEndpointServiceConnectionStatus = "Disconnected" + // Pending ... + Pending PrivateEndpointServiceConnectionStatus = "Pending" + // Rejected ... + Rejected PrivateEndpointServiceConnectionStatus = "Rejected" + // Timeout ... + Timeout PrivateEndpointServiceConnectionStatus = "Timeout" +) + +// PossiblePrivateEndpointServiceConnectionStatusValues returns an array of possible values for the PrivateEndpointServiceConnectionStatus const type. +func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { + return []PrivateEndpointServiceConnectionStatus{Approved, Disconnected, Pending, Rejected, Timeout} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUnknown ... + ProvisioningStateUnknown ProvisioningState = "Unknown" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUnknown, ProvisioningStateUpdating} +} + +// ProvisioningStatus enumerates the values for provisioning status. +type ProvisioningStatus string + +const ( + // ProvisioningStatusCompleted ... + ProvisioningStatusCompleted ProvisioningStatus = "Completed" + // ProvisioningStatusFailed ... + ProvisioningStatusFailed ProvisioningStatus = "Failed" + // ProvisioningStatusProvisioning ... + ProvisioningStatusProvisioning ProvisioningStatus = "Provisioning" +) + +// PossibleProvisioningStatusValues returns an array of possible values for the ProvisioningStatus const type. +func PossibleProvisioningStatusValues() []ProvisioningStatus { + return []ProvisioningStatus{ProvisioningStatusCompleted, ProvisioningStatusFailed, ProvisioningStatusProvisioning} +} + +// QuotaUnit enumerates the values for quota unit. +type QuotaUnit string + +const ( + // Count ... + Count QuotaUnit = "Count" +) + +// PossibleQuotaUnitValues returns an array of possible values for the QuotaUnit const type. +func PossibleQuotaUnitValues() []QuotaUnit { + return []QuotaUnit{Count} +} + +// ReasonCode enumerates the values for reason code. +type ReasonCode string + +const ( + // NotAvailableForRegion ... + NotAvailableForRegion ReasonCode = "NotAvailableForRegion" + // NotAvailableForSubscription ... + NotAvailableForSubscription ReasonCode = "NotAvailableForSubscription" + // NotSpecified ... + NotSpecified ReasonCode = "NotSpecified" +) + +// PossibleReasonCodeValues returns an array of possible values for the ReasonCode const type. +func PossibleReasonCodeValues() []ReasonCode { + return []ReasonCode{NotAvailableForRegion, NotAvailableForSubscription, NotSpecified} +} + +// RecurrenceFrequency enumerates the values for recurrence frequency. +type RecurrenceFrequency string + +const ( + // RecurrenceFrequencyDay ... + RecurrenceFrequencyDay RecurrenceFrequency = "Day" + // RecurrenceFrequencyHour ... + RecurrenceFrequencyHour RecurrenceFrequency = "Hour" + // RecurrenceFrequencyMinute ... + RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" + // RecurrenceFrequencyMonth ... + RecurrenceFrequencyMonth RecurrenceFrequency = "Month" + // RecurrenceFrequencyNotSpecified ... + RecurrenceFrequencyNotSpecified RecurrenceFrequency = "NotSpecified" + // RecurrenceFrequencySecond ... + RecurrenceFrequencySecond RecurrenceFrequency = "Second" + // RecurrenceFrequencyWeek ... + RecurrenceFrequencyWeek RecurrenceFrequency = "Week" + // RecurrenceFrequencyYear ... + RecurrenceFrequencyYear RecurrenceFrequency = "Year" +) + +// PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. +func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { + return []RecurrenceFrequency{RecurrenceFrequencyDay, RecurrenceFrequencyHour, RecurrenceFrequencyMinute, RecurrenceFrequencyMonth, RecurrenceFrequencyNotSpecified, RecurrenceFrequencySecond, RecurrenceFrequencyWeek, RecurrenceFrequencyYear} +} + +// ReferenceType enumerates the values for reference type. +type ReferenceType string + +const ( + // DataPath ... + DataPath ReferenceType = "DataPath" + // ID ... + ID ReferenceType = "Id" + // OutputPath ... + OutputPath ReferenceType = "OutputPath" +) + +// PossibleReferenceTypeValues returns an array of possible values for the ReferenceType const type. +func PossibleReferenceTypeValues() []ReferenceType { + return []ReferenceType{DataPath, ID, OutputPath} +} + +// ReferenceTypeBasicAssetReferenceBase enumerates the values for reference type basic asset reference base. +type ReferenceTypeBasicAssetReferenceBase string + +const ( + // ReferenceTypeAssetReferenceBase ... + ReferenceTypeAssetReferenceBase ReferenceTypeBasicAssetReferenceBase = "AssetReferenceBase" + // ReferenceTypeDataPath ... + ReferenceTypeDataPath ReferenceTypeBasicAssetReferenceBase = "DataPath" + // ReferenceTypeID ... + ReferenceTypeID ReferenceTypeBasicAssetReferenceBase = "Id" + // ReferenceTypeOutputPath ... + ReferenceTypeOutputPath ReferenceTypeBasicAssetReferenceBase = "OutputPath" +) + +// PossibleReferenceTypeBasicAssetReferenceBaseValues returns an array of possible values for the ReferenceTypeBasicAssetReferenceBase const type. +func PossibleReferenceTypeBasicAssetReferenceBaseValues() []ReferenceTypeBasicAssetReferenceBase { + return []ReferenceTypeBasicAssetReferenceBase{ReferenceTypeAssetReferenceBase, ReferenceTypeDataPath, ReferenceTypeID, ReferenceTypeOutputPath} +} + +// RemoteLoginPortPublicAccess enumerates the values for remote login port public access. +type RemoteLoginPortPublicAccess string + +const ( + // RemoteLoginPortPublicAccessDisabled ... + RemoteLoginPortPublicAccessDisabled RemoteLoginPortPublicAccess = "Disabled" + // RemoteLoginPortPublicAccessEnabled ... + RemoteLoginPortPublicAccessEnabled RemoteLoginPortPublicAccess = "Enabled" + // RemoteLoginPortPublicAccessNotSpecified ... + RemoteLoginPortPublicAccessNotSpecified RemoteLoginPortPublicAccess = "NotSpecified" +) + +// PossibleRemoteLoginPortPublicAccessValues returns an array of possible values for the RemoteLoginPortPublicAccess const type. +func PossibleRemoteLoginPortPublicAccessValues() []RemoteLoginPortPublicAccess { + return []RemoteLoginPortPublicAccess{RemoteLoginPortPublicAccessDisabled, RemoteLoginPortPublicAccessEnabled, RemoteLoginPortPublicAccessNotSpecified} +} + +// ResourceIdentityAssignment enumerates the values for resource identity assignment. +type ResourceIdentityAssignment string + +const ( + // ResourceIdentityAssignmentNone ... + ResourceIdentityAssignmentNone ResourceIdentityAssignment = "None" + // ResourceIdentityAssignmentSystemAssigned ... + ResourceIdentityAssignmentSystemAssigned ResourceIdentityAssignment = "SystemAssigned" + // ResourceIdentityAssignmentSystemAssignedUserAssigned ... + ResourceIdentityAssignmentSystemAssignedUserAssigned ResourceIdentityAssignment = "SystemAssigned,UserAssigned" + // ResourceIdentityAssignmentUserAssigned ... + ResourceIdentityAssignmentUserAssigned ResourceIdentityAssignment = "UserAssigned" +) + +// PossibleResourceIdentityAssignmentValues returns an array of possible values for the ResourceIdentityAssignment const type. +func PossibleResourceIdentityAssignmentValues() []ResourceIdentityAssignment { + return []ResourceIdentityAssignment{ResourceIdentityAssignmentNone, ResourceIdentityAssignmentSystemAssigned, ResourceIdentityAssignmentSystemAssignedUserAssigned, ResourceIdentityAssignmentUserAssigned} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // ResourceIdentityTypeNone ... + ResourceIdentityTypeNone ResourceIdentityType = "None" + // ResourceIdentityTypeSystemAssigned ... + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + // ResourceIdentityTypeSystemAssignedUserAssigned ... + ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned,UserAssigned" + // ResourceIdentityTypeUserAssigned ... + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} +} + +// SamplingAlgorithm enumerates the values for sampling algorithm. +type SamplingAlgorithm string + +const ( + // Bayesian ... + Bayesian SamplingAlgorithm = "Bayesian" + // Grid ... + Grid SamplingAlgorithm = "Grid" + // Random ... + Random SamplingAlgorithm = "Random" +) + +// PossibleSamplingAlgorithmValues returns an array of possible values for the SamplingAlgorithm const type. +func PossibleSamplingAlgorithmValues() []SamplingAlgorithm { + return []SamplingAlgorithm{Bayesian, Grid, Random} +} + +// ScaleType enumerates the values for scale type. +type ScaleType string + +const ( + // Auto ... + Auto ScaleType = "Auto" + // Manual ... + Manual ScaleType = "Manual" +) + +// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. +func PossibleScaleTypeValues() []ScaleType { + return []ScaleType{Auto, Manual} +} + +// ScaleTypeBasicOnlineScaleSettings enumerates the values for scale type basic online scale settings. +type ScaleTypeBasicOnlineScaleSettings string + +const ( + // ScaleTypeAuto ... + ScaleTypeAuto ScaleTypeBasicOnlineScaleSettings = "Auto" + // ScaleTypeManual ... + ScaleTypeManual ScaleTypeBasicOnlineScaleSettings = "Manual" + // ScaleTypeOnlineScaleSettings ... + ScaleTypeOnlineScaleSettings ScaleTypeBasicOnlineScaleSettings = "OnlineScaleSettings" +) + +// PossibleScaleTypeBasicOnlineScaleSettingsValues returns an array of possible values for the ScaleTypeBasicOnlineScaleSettings const type. +func PossibleScaleTypeBasicOnlineScaleSettingsValues() []ScaleTypeBasicOnlineScaleSettings { + return []ScaleTypeBasicOnlineScaleSettings{ScaleTypeAuto, ScaleTypeManual, ScaleTypeOnlineScaleSettings} +} + +// ScheduleStatus enumerates the values for schedule status. +type ScheduleStatus string + +const ( + // ScheduleStatusDisabled ... + ScheduleStatusDisabled ScheduleStatus = "Disabled" + // ScheduleStatusEnabled ... + ScheduleStatusEnabled ScheduleStatus = "Enabled" +) + +// PossibleScheduleStatusValues returns an array of possible values for the ScheduleStatus const type. +func PossibleScheduleStatusValues() []ScheduleStatus { + return []ScheduleStatus{ScheduleStatusDisabled, ScheduleStatusEnabled} +} + +// ScheduleType enumerates the values for schedule type. +type ScheduleType string + +const ( + // ComputeStartStop ... + ComputeStartStop ScheduleType = "ComputeStartStop" +) + +// PossibleScheduleTypeValues returns an array of possible values for the ScheduleType const type. +func PossibleScheduleTypeValues() []ScheduleType { + return []ScheduleType{ComputeStartStop} +} + +// SecretsType enumerates the values for secrets type. +type SecretsType string + +const ( + // SecretsTypeAccountKey ... + SecretsTypeAccountKey SecretsType = "AccountKey" + // SecretsTypeCertificate ... + SecretsTypeCertificate SecretsType = "Certificate" + // SecretsTypeNone ... + SecretsTypeNone SecretsType = "None" + // SecretsTypeSas ... + SecretsTypeSas SecretsType = "Sas" + // SecretsTypeServicePrincipal ... + SecretsTypeServicePrincipal SecretsType = "ServicePrincipal" + // SecretsTypeSQLAdmin ... + SecretsTypeSQLAdmin SecretsType = "SqlAdmin" +) + +// PossibleSecretsTypeValues returns an array of possible values for the SecretsType const type. +func PossibleSecretsTypeValues() []SecretsType { + return []SecretsType{SecretsTypeAccountKey, SecretsTypeCertificate, SecretsTypeNone, SecretsTypeSas, SecretsTypeServicePrincipal, SecretsTypeSQLAdmin} +} + +// SecretsTypeBasicDatastoreSecrets enumerates the values for secrets type basic datastore secrets. +type SecretsTypeBasicDatastoreSecrets string + +const ( + // SecretsTypeAccountKey1 ... + SecretsTypeAccountKey1 SecretsTypeBasicDatastoreSecrets = "AccountKey" + // SecretsTypeCertificate1 ... + SecretsTypeCertificate1 SecretsTypeBasicDatastoreSecrets = "Certificate" + // SecretsTypeDatastoreSecrets ... + SecretsTypeDatastoreSecrets SecretsTypeBasicDatastoreSecrets = "DatastoreSecrets" + // SecretsTypeNone1 ... + SecretsTypeNone1 SecretsTypeBasicDatastoreSecrets = "None" + // SecretsTypeSas1 ... + SecretsTypeSas1 SecretsTypeBasicDatastoreSecrets = "Sas" + // SecretsTypeServicePrincipal1 ... + SecretsTypeServicePrincipal1 SecretsTypeBasicDatastoreSecrets = "ServicePrincipal" + // SecretsTypeSQLAdmin1 ... + SecretsTypeSQLAdmin1 SecretsTypeBasicDatastoreSecrets = "SqlAdmin" +) + +// PossibleSecretsTypeBasicDatastoreSecretsValues returns an array of possible values for the SecretsTypeBasicDatastoreSecrets const type. +func PossibleSecretsTypeBasicDatastoreSecretsValues() []SecretsTypeBasicDatastoreSecrets { + return []SecretsTypeBasicDatastoreSecrets{SecretsTypeAccountKey1, SecretsTypeCertificate1, SecretsTypeDatastoreSecrets, SecretsTypeNone1, SecretsTypeSas1, SecretsTypeServicePrincipal1, SecretsTypeSQLAdmin1} +} + +// SSHPublicAccess enumerates the values for ssh public access. +type SSHPublicAccess string + +const ( + // SSHPublicAccessDisabled ... + SSHPublicAccessDisabled SSHPublicAccess = "Disabled" + // SSHPublicAccessEnabled ... + SSHPublicAccessEnabled SSHPublicAccess = "Enabled" +) + +// PossibleSSHPublicAccessValues returns an array of possible values for the SSHPublicAccess const type. +func PossibleSSHPublicAccessValues() []SSHPublicAccess { + return []SSHPublicAccess{SSHPublicAccessDisabled, SSHPublicAccessEnabled} +} + +// Status enumerates the values for status. +type Status string + +const ( + // Failure ... + Failure Status = "Failure" + // InvalidQuotaBelowClusterMinimum ... + InvalidQuotaBelowClusterMinimum Status = "InvalidQuotaBelowClusterMinimum" + // InvalidQuotaExceedsSubscriptionLimit ... + InvalidQuotaExceedsSubscriptionLimit Status = "InvalidQuotaExceedsSubscriptionLimit" + // InvalidVMFamilyName ... + InvalidVMFamilyName Status = "InvalidVMFamilyName" + // OperationNotEnabledForRegion ... + OperationNotEnabledForRegion Status = "OperationNotEnabledForRegion" + // OperationNotSupportedForSku ... + OperationNotSupportedForSku Status = "OperationNotSupportedForSku" + // Success ... + Success Status = "Success" + // Undefined ... + Undefined Status = "Undefined" +) + +// PossibleStatusValues returns an array of possible values for the Status const type. +func PossibleStatusValues() []Status { + return []Status{Failure, InvalidQuotaBelowClusterMinimum, InvalidQuotaExceedsSubscriptionLimit, InvalidVMFamilyName, OperationNotEnabledForRegion, OperationNotSupportedForSku, Success, Undefined} +} + +// Status1 enumerates the values for status 1. +type Status1 string + +const ( + // Status1Auto ... + Status1Auto Status1 = "Auto" + // Status1Disabled ... + Status1Disabled Status1 = "Disabled" + // Status1Enabled ... + Status1Enabled Status1 = "Enabled" +) + +// PossibleStatus1Values returns an array of possible values for the Status1 const type. +func PossibleStatus1Values() []Status1 { + return []Status1{Status1Auto, Status1Disabled, Status1Enabled} +} + +// StatusMessageLevel enumerates the values for status message level. +type StatusMessageLevel string + +const ( + // StatusMessageLevelError ... + StatusMessageLevelError StatusMessageLevel = "Error" + // StatusMessageLevelInformation ... + StatusMessageLevelInformation StatusMessageLevel = "Information" + // StatusMessageLevelWarning ... + StatusMessageLevelWarning StatusMessageLevel = "Warning" +) + +// PossibleStatusMessageLevelValues returns an array of possible values for the StatusMessageLevel const type. +func PossibleStatusMessageLevelValues() []StatusMessageLevel { + return []StatusMessageLevel{StatusMessageLevelError, StatusMessageLevelInformation, StatusMessageLevelWarning} +} + +// TextAnnotationType enumerates the values for text annotation type. +type TextAnnotationType string + +const ( + // TextAnnotationTypeClassification ... + TextAnnotationTypeClassification TextAnnotationType = "Classification" +) + +// PossibleTextAnnotationTypeValues returns an array of possible values for the TextAnnotationType const type. +func PossibleTextAnnotationTypeValues() []TextAnnotationType { + return []TextAnnotationType{TextAnnotationTypeClassification} +} + +// TriggerType enumerates the values for trigger type. +type TriggerType string + +const ( + // TriggerTypeCron ... + TriggerTypeCron TriggerType = "Cron" + // TriggerTypeRecurrence ... + TriggerTypeRecurrence TriggerType = "Recurrence" +) + +// PossibleTriggerTypeValues returns an array of possible values for the TriggerType const type. +func PossibleTriggerTypeValues() []TriggerType { + return []TriggerType{TriggerTypeCron, TriggerTypeRecurrence} +} + +// UnderlyingResourceAction enumerates the values for underlying resource action. +type UnderlyingResourceAction string + +const ( + // Delete ... + Delete UnderlyingResourceAction = "Delete" + // Detach ... + Detach UnderlyingResourceAction = "Detach" +) + +// PossibleUnderlyingResourceActionValues returns an array of possible values for the UnderlyingResourceAction const type. +func PossibleUnderlyingResourceActionValues() []UnderlyingResourceAction { + return []UnderlyingResourceAction{Delete, Detach} +} + +// UsageUnit enumerates the values for usage unit. +type UsageUnit string + +const ( + // UsageUnitCount ... + UsageUnitCount UsageUnit = "Count" +) + +// PossibleUsageUnitValues returns an array of possible values for the UsageUnit const type. +func PossibleUsageUnitValues() []UsageUnit { + return []UsageUnit{UsageUnitCount} +} + +// ValueFormat enumerates the values for value format. +type ValueFormat string + +const ( + // JSON ... + JSON ValueFormat = "JSON" +) + +// PossibleValueFormatValues returns an array of possible values for the ValueFormat const type. +func PossibleValueFormatValues() []ValueFormat { + return []ValueFormat{JSON} +} + +// VMPriceOSType enumerates the values for vm price os type. +type VMPriceOSType string + +const ( + // VMPriceOSTypeLinux ... + VMPriceOSTypeLinux VMPriceOSType = "Linux" + // VMPriceOSTypeWindows ... + VMPriceOSTypeWindows VMPriceOSType = "Windows" +) + +// PossibleVMPriceOSTypeValues returns an array of possible values for the VMPriceOSType const type. +func PossibleVMPriceOSTypeValues() []VMPriceOSType { + return []VMPriceOSType{VMPriceOSTypeLinux, VMPriceOSTypeWindows} +} + +// VMPriority enumerates the values for vm priority. +type VMPriority string + +const ( + // Dedicated ... + Dedicated VMPriority = "Dedicated" + // LowPriority ... + LowPriority VMPriority = "LowPriority" +) + +// PossibleVMPriorityValues returns an array of possible values for the VMPriority const type. +func PossibleVMPriorityValues() []VMPriority { + return []VMPriority{Dedicated, LowPriority} +} + +// VMTier enumerates the values for vm tier. +type VMTier string + +const ( + // VMTierLowPriority ... + VMTierLowPriority VMTier = "LowPriority" + // VMTierSpot ... + VMTierSpot VMTier = "Spot" + // VMTierStandard ... + VMTierStandard VMTier = "Standard" +) + +// PossibleVMTierValues returns an array of possible values for the VMTier const type. +func PossibleVMTierValues() []VMTier { + return []VMTier{VMTierLowPriority, VMTierSpot, VMTierStandard} +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/environmentcontainers.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/environmentcontainers.go new file mode 100644 index 000000000000..6b9003a73d33 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/environmentcontainers.go @@ -0,0 +1,433 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// EnvironmentContainersClient is the these APIs allow end users to operate on Azure Machine Learning Workspace +// resources. +type EnvironmentContainersClient struct { + BaseClient +} + +// NewEnvironmentContainersClient creates an instance of the EnvironmentContainersClient client. +func NewEnvironmentContainersClient(subscriptionID string) EnvironmentContainersClient { + return NewEnvironmentContainersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEnvironmentContainersClientWithBaseURI creates an instance of the EnvironmentContainersClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewEnvironmentContainersClientWithBaseURI(baseURI string, subscriptionID string) EnvironmentContainersClient { + return EnvironmentContainersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// name - container name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - container entity to create or update. +func (client EnvironmentContainersClient) CreateOrUpdate(ctx context.Context, name string, resourceGroupName string, workspaceName string, body EnvironmentContainerResource) (result EnvironmentContainerResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentContainersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.EnvironmentContainersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, name, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentContainersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentContainersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentContainersClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client EnvironmentContainersClient) CreateOrUpdatePreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string, body EnvironmentContainerResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentContainersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client EnvironmentContainersClient) CreateOrUpdateResponder(resp *http.Response) (result EnvironmentContainerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// name - container name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client EnvironmentContainersClient) Delete(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentContainersClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.EnvironmentContainersClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, name, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentContainersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentContainersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentContainersClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client EnvironmentContainersClient) DeletePreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentContainersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client EnvironmentContainersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// name - container name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client EnvironmentContainersClient) Get(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result EnvironmentContainerResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentContainersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.EnvironmentContainersClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, name, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentContainersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentContainersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentContainersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client EnvironmentContainersClient) GetPreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentContainersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client EnvironmentContainersClient) GetResponder(resp *http.Response) (result EnvironmentContainerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// skip - continuation token for pagination. +func (client EnvironmentContainersClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (result EnvironmentContainerResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentContainersClient.List") + defer func() { + sc := -1 + if result.ecrapr.Response.Response != nil { + sc = result.ecrapr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.EnvironmentContainersClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentContainersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ecrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentContainersClient", "List", resp, "Failure sending request") + return + } + + result.ecrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentContainersClient", "List", resp, "Failure responding to request") + return + } + if result.ecrapr.hasNextLink() && result.ecrapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client EnvironmentContainersClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentContainersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client EnvironmentContainersClient) ListResponder(resp *http.Response) (result EnvironmentContainerResourceArmPaginatedResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client EnvironmentContainersClient) listNextResults(ctx context.Context, lastResults EnvironmentContainerResourceArmPaginatedResult) (result EnvironmentContainerResourceArmPaginatedResult, err error) { + req, err := lastResults.environmentContainerResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentContainersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentContainersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentContainersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client EnvironmentContainersClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (result EnvironmentContainerResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentContainersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, skip) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/environmentspecificationversions.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/environmentspecificationversions.go new file mode 100644 index 000000000000..aa608ab7d070 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/environmentspecificationversions.go @@ -0,0 +1,467 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// EnvironmentSpecificationVersionsClient is the these APIs allow end users to operate on Azure Machine Learning +// Workspace resources. +type EnvironmentSpecificationVersionsClient struct { + BaseClient +} + +// NewEnvironmentSpecificationVersionsClient creates an instance of the EnvironmentSpecificationVersionsClient client. +func NewEnvironmentSpecificationVersionsClient(subscriptionID string) EnvironmentSpecificationVersionsClient { + return NewEnvironmentSpecificationVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEnvironmentSpecificationVersionsClientWithBaseURI creates an instance of the +// EnvironmentSpecificationVersionsClient client using a custom endpoint. Use this when interacting with an Azure +// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewEnvironmentSpecificationVersionsClientWithBaseURI(baseURI string, subscriptionID string) EnvironmentSpecificationVersionsClient { + return EnvironmentSpecificationVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// name - name of EnvironmentSpecificationVersion. +// version - version of EnvironmentSpecificationVersion. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - definition of EnvironmentSpecificationVersion. +func (client EnvironmentSpecificationVersionsClient) CreateOrUpdate(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string, body EnvironmentSpecificationVersionResource) (result EnvironmentSpecificationVersionResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentSpecificationVersionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceContainerProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceContainerProperties.LivenessRoute", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceContainerProperties.LivenessRoute.Path", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceContainerProperties.LivenessRoute.Path", Name: validation.Pattern, Rule: `[a-zA-Z0-9_]`, Chain: nil}}}, + {Target: "body.Properties.InferenceContainerProperties.LivenessRoute.Port", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "body.Properties.InferenceContainerProperties.ReadinessRoute", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceContainerProperties.ReadinessRoute.Path", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceContainerProperties.ReadinessRoute.Path", Name: validation.Pattern, Rule: `[a-zA-Z0-9_]`, Chain: nil}}}, + {Target: "body.Properties.InferenceContainerProperties.ReadinessRoute.Port", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "body.Properties.InferenceContainerProperties.ScoringRoute", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceContainerProperties.ScoringRoute.Path", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceContainerProperties.ScoringRoute.Path", Name: validation.Pattern, Rule: `[a-zA-Z0-9_]`, Chain: nil}}}, + {Target: "body.Properties.InferenceContainerProperties.ScoringRoute.Port", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("machinelearningservices.EnvironmentSpecificationVersionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, name, version, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentSpecificationVersionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentSpecificationVersionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentSpecificationVersionsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client EnvironmentSpecificationVersionsClient) CreateOrUpdatePreparer(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string, body EnvironmentSpecificationVersionResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "version": autorest.Encode("path", version), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentSpecificationVersionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client EnvironmentSpecificationVersionsClient) CreateOrUpdateResponder(resp *http.Response) (result EnvironmentSpecificationVersionResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// name - container name. +// version - version identifier. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client EnvironmentSpecificationVersionsClient) Delete(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentSpecificationVersionsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.EnvironmentSpecificationVersionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, name, version, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentSpecificationVersionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentSpecificationVersionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentSpecificationVersionsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client EnvironmentSpecificationVersionsClient) DeletePreparer(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "version": autorest.Encode("path", version), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentSpecificationVersionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client EnvironmentSpecificationVersionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// name - container name. +// version - version identifier. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client EnvironmentSpecificationVersionsClient) Get(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (result EnvironmentSpecificationVersionResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentSpecificationVersionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.EnvironmentSpecificationVersionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, name, version, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentSpecificationVersionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentSpecificationVersionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentSpecificationVersionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client EnvironmentSpecificationVersionsClient) GetPreparer(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "version": autorest.Encode("path", version), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentSpecificationVersionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client EnvironmentSpecificationVersionsClient) GetResponder(resp *http.Response) (result EnvironmentSpecificationVersionResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// name - container name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// orderBy - ordering of list. +// top - maximum number of records to return. +// skip - continuation token for pagination. +func (client EnvironmentSpecificationVersionsClient) List(ctx context.Context, name string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (result EnvironmentSpecificationVersionResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentSpecificationVersionsClient.List") + defer func() { + sc := -1 + if result.esvrapr.Response.Response != nil { + sc = result.esvrapr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.EnvironmentSpecificationVersionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, name, resourceGroupName, workspaceName, orderBy, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentSpecificationVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.esvrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentSpecificationVersionsClient", "List", resp, "Failure sending request") + return + } + + result.esvrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentSpecificationVersionsClient", "List", resp, "Failure responding to request") + return + } + if result.esvrapr.hasNextLink() && result.esvrapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client EnvironmentSpecificationVersionsClient) ListPreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(orderBy) > 0 { + queryParameters["$orderBy"] = autorest.Encode("query", orderBy) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentSpecificationVersionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client EnvironmentSpecificationVersionsClient) ListResponder(resp *http.Response) (result EnvironmentSpecificationVersionResourceArmPaginatedResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client EnvironmentSpecificationVersionsClient) listNextResults(ctx context.Context, lastResults EnvironmentSpecificationVersionResourceArmPaginatedResult) (result EnvironmentSpecificationVersionResourceArmPaginatedResult, err error) { + req, err := lastResults.environmentSpecificationVersionResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentSpecificationVersionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentSpecificationVersionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentSpecificationVersionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client EnvironmentSpecificationVersionsClient) ListComplete(ctx context.Context, name string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (result EnvironmentSpecificationVersionResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentSpecificationVersionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, name, resourceGroupName, workspaceName, orderBy, top, skip) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/jobs.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/jobs.go new file mode 100644 index 000000000000..d5a1e56ecd85 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/jobs.go @@ -0,0 +1,529 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// JobsClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type JobsClient struct { + BaseClient +} + +// NewJobsClient creates an instance of the JobsClient client. +func NewJobsClient(subscriptionID string) JobsClient { + return NewJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewJobsClientWithBaseURI creates an instance of the JobsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewJobsClientWithBaseURI(baseURI string, subscriptionID string) JobsClient { + return JobsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Cancel sends the cancel request. +// Parameters: +// ID - the name and identifier for the Job. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client JobsClient) Cancel(ctx context.Context, ID string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.Cancel") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.JobsClient", "Cancel", err.Error()) + } + + req, err := client.CancelPreparer(ctx, ID, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "Cancel", nil, "Failure preparing request") + return + } + + resp, err := client.CancelSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "Cancel", resp, "Failure sending request") + return + } + + result, err = client.CancelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "Cancel", resp, "Failure responding to request") + return + } + + return +} + +// CancelPreparer prepares the Cancel request. +func (client JobsClient) CancelPreparer(ctx context.Context, ID string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CancelSender sends the Cancel request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) CancelSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CancelResponder handles the response to the Cancel request. The method always +// closes the http.Response Body. +func (client JobsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// ID - the name and identifier for the Job. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - job definition object. +func (client JobsClient) CreateOrUpdate(ctx context.Context, ID string, resourceGroupName string, workspaceName string, body JobBaseResource) (result JobBaseResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: ID, + Constraints: []validation.Constraint{{Target: "ID", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.JobsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, ID, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client JobsClient) CreateOrUpdatePreparer(ctx context.Context, ID string, resourceGroupName string, workspaceName string, body JobBaseResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client JobsClient) CreateOrUpdateResponder(resp *http.Response) (result JobBaseResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// ID - the name and identifier for the Job. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client JobsClient) Delete(ctx context.Context, ID string, resourceGroupName string, workspaceName string) (result JobsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.JobsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, ID, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client JobsClient) DeletePreparer(ctx context.Context, ID string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) DeleteSender(req *http.Request) (future JobsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client JobsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// ID - the name and identifier for the Job. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client JobsClient) Get(ctx context.Context, ID string, resourceGroupName string, workspaceName string) (result JobBaseResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.JobsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, ID, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client JobsClient) GetPreparer(ctx context.Context, ID string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client JobsClient) GetResponder(resp *http.Response) (result JobBaseResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// skip - continuation token for pagination. +// jobType - type of job to be returned. +// tags - tags for job to be returned. +// tag - jobs returned will have this tag key. +func (client JobsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, jobType string, tags string, tag string) (result JobBaseResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.List") + defer func() { + sc := -1 + if result.jbrapr.Response.Response != nil { + sc = result.jbrapr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.JobsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, skip, jobType, tags, tag) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.jbrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "List", resp, "Failure sending request") + return + } + + result.jbrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "List", resp, "Failure responding to request") + return + } + if result.jbrapr.hasNextLink() && result.jbrapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client JobsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, skip string, jobType string, tags string, tag string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + if len(jobType) > 0 { + queryParameters["jobType"] = autorest.Encode("query", jobType) + } + if len(tags) > 0 { + queryParameters["tags"] = autorest.Encode("query", tags) + } + if len(tag) > 0 { + queryParameters["tag"] = autorest.Encode("query", tag) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client JobsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client JobsClient) ListResponder(resp *http.Response) (result JobBaseResourceArmPaginatedResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client JobsClient) listNextResults(ctx context.Context, lastResults JobBaseResourceArmPaginatedResult) (result JobBaseResourceArmPaginatedResult, err error) { + req, err := lastResults.jobBaseResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client JobsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, jobType string, tags string, tag string) (result JobBaseResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, skip, jobType, tags, tag) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/labelingjobs.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/labelingjobs.go new file mode 100644 index 000000000000..a09d9ec003a6 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/labelingjobs.go @@ -0,0 +1,711 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LabelingJobsClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type LabelingJobsClient struct { + BaseClient +} + +// NewLabelingJobsClient creates an instance of the LabelingJobsClient client. +func NewLabelingJobsClient(subscriptionID string) LabelingJobsClient { + return NewLabelingJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLabelingJobsClientWithBaseURI creates an instance of the LabelingJobsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewLabelingJobsClientWithBaseURI(baseURI string, subscriptionID string) LabelingJobsClient { + return LabelingJobsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// ID - the name and identifier for the LabelingJob. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - labelingJob definition object. +func (client LabelingJobsClient) CreateOrUpdate(ctx context.Context, ID string, resourceGroupName string, workspaceName string, body LabelingJobResource) (result LabelingJobsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabelingJobsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: ID, + Constraints: []validation.Constraint{{Target: "ID", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.LabelingJobsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, ID, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LabelingJobsClient) CreateOrUpdatePreparer(ctx context.Context, ID string, resourceGroupName string, workspaceName string, body LabelingJobResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LabelingJobsClient) CreateOrUpdateSender(req *http.Request) (future LabelingJobsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client LabelingJobsClient) CreateOrUpdateResponder(resp *http.Response) (result LabelingJobResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// ID - the name and identifier for the LabelingJob. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client LabelingJobsClient) Delete(ctx context.Context, ID string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabelingJobsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.LabelingJobsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, ID, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client LabelingJobsClient) DeletePreparer(ctx context.Context, ID string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client LabelingJobsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client LabelingJobsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ExportLabels sends the export labels request. +// Parameters: +// ID - the name and identifier for the LabelingJob. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - the export summary. +func (client LabelingJobsClient) ExportLabels(ctx context.Context, ID string, resourceGroupName string, workspaceName string, body BasicExportSummary) (result LabelingJobsExportLabelsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabelingJobsClient.ExportLabels") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.LabelingJobsClient", "ExportLabels", err.Error()) + } + + req, err := client.ExportLabelsPreparer(ctx, ID, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "ExportLabels", nil, "Failure preparing request") + return + } + + result, err = client.ExportLabelsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "ExportLabels", nil, "Failure sending request") + return + } + + return +} + +// ExportLabelsPreparer prepares the ExportLabels request. +func (client LabelingJobsClient) ExportLabelsPreparer(ctx context.Context, ID string, resourceGroupName string, workspaceName string, body BasicExportSummary) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/exportLabels", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ExportLabelsSender sends the ExportLabels request. The method will close the +// http.Response Body if it receives an error. +func (client LabelingJobsClient) ExportLabelsSender(req *http.Request) (future LabelingJobsExportLabelsFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ExportLabelsResponder handles the response to the ExportLabels request. The method always +// closes the http.Response Body. +func (client LabelingJobsClient) ExportLabelsResponder(resp *http.Response) (result ExportSummaryModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get sends the get request. +// Parameters: +// ID - the name and identifier for the LabelingJob. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// includeJobInstructions - boolean value to indicate whether to include JobInstructions in response. +// includeLabelCategories - boolean value to indicate Whether to include LabelCategories in response. +func (client LabelingJobsClient) Get(ctx context.Context, ID string, resourceGroupName string, workspaceName string, includeJobInstructions *bool, includeLabelCategories *bool) (result LabelingJobResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabelingJobsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.LabelingJobsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, ID, resourceGroupName, workspaceName, includeJobInstructions, includeLabelCategories) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client LabelingJobsClient) GetPreparer(ctx context.Context, ID string, resourceGroupName string, workspaceName string, includeJobInstructions *bool, includeLabelCategories *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if includeJobInstructions != nil { + queryParameters["includeJobInstructions"] = autorest.Encode("query", *includeJobInstructions) + } + if includeLabelCategories != nil { + queryParameters["includeLabelCategories"] = autorest.Encode("query", *includeLabelCategories) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LabelingJobsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LabelingJobsClient) GetResponder(resp *http.Response) (result LabelingJobResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// skip - continuation token for pagination. +// count - number of labeling jobs to return. +func (client LabelingJobsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32) (result LabelingJobResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabelingJobsClient.List") + defer func() { + sc := -1 + if result.ljrapr.Response.Response != nil { + sc = result.ljrapr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.LabelingJobsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, skip, count) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ljrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "List", resp, "Failure sending request") + return + } + + result.ljrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "List", resp, "Failure responding to request") + return + } + if result.ljrapr.hasNextLink() && result.ljrapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LabelingJobsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + if count != nil { + queryParameters["count"] = autorest.Encode("query", *count) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LabelingJobsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LabelingJobsClient) ListResponder(resp *http.Response) (result LabelingJobResourceArmPaginatedResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client LabelingJobsClient) listNextResults(ctx context.Context, lastResults LabelingJobResourceArmPaginatedResult) (result LabelingJobResourceArmPaginatedResult, err error) { + req, err := lastResults.labelingJobResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client LabelingJobsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32) (result LabelingJobResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabelingJobsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, skip, count) + return +} + +// Pause sends the pause request. +// Parameters: +// ID - the name and identifier for the LabelingJob. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client LabelingJobsClient) Pause(ctx context.Context, ID string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabelingJobsClient.Pause") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.LabelingJobsClient", "Pause", err.Error()) + } + + req, err := client.PausePreparer(ctx, ID, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "Pause", nil, "Failure preparing request") + return + } + + resp, err := client.PauseSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "Pause", resp, "Failure sending request") + return + } + + result, err = client.PauseResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "Pause", resp, "Failure responding to request") + return + } + + return +} + +// PausePreparer prepares the Pause request. +func (client LabelingJobsClient) PausePreparer(ctx context.Context, ID string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/pause", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PauseSender sends the Pause request. The method will close the +// http.Response Body if it receives an error. +func (client LabelingJobsClient) PauseSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PauseResponder handles the response to the Pause request. The method always +// closes the http.Response Body. +func (client LabelingJobsClient) PauseResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Resume sends the resume request. +// Parameters: +// ID - the name and identifier for the LabelingJob. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client LabelingJobsClient) Resume(ctx context.Context, ID string, resourceGroupName string, workspaceName string) (result LabelingJobsResumeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabelingJobsClient.Resume") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.LabelingJobsClient", "Resume", err.Error()) + } + + req, err := client.ResumePreparer(ctx, ID, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "Resume", nil, "Failure preparing request") + return + } + + result, err = client.ResumeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsClient", "Resume", nil, "Failure sending request") + return + } + + return +} + +// ResumePreparer prepares the Resume request. +func (client LabelingJobsClient) ResumePreparer(ctx context.Context, ID string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/resume", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResumeSender sends the Resume request. The method will close the +// http.Response Body if it receives an error. +func (client LabelingJobsClient) ResumeSender(req *http.Request) (future LabelingJobsResumeFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResumeResponder handles the response to the Resume request. The method always +// closes the http.Response Body. +func (client LabelingJobsClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/machinelearningservicesapi/interfaces.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/machinelearningservicesapi/interfaces.go new file mode 100644 index 000000000000..999a3f72468e --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/machinelearningservicesapi/interfaces.go @@ -0,0 +1,305 @@ +package machinelearningservicesapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices" + "github.com/Azure/go-autorest/autorest" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result machinelearningservices.OperationListResult, err error) +} + +var _ OperationsClientAPI = (*machinelearningservices.OperationsClient)(nil) + +// WorkspacesClientAPI contains the set of methods on the WorkspacesClient type. +type WorkspacesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters machinelearningservices.Workspace) (result machinelearningservices.WorkspacesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result machinelearningservices.WorkspacesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string) (result machinelearningservices.Workspace, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, skip string) (result machinelearningservices.WorkspaceListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, skip string) (result machinelearningservices.WorkspaceListResultIterator, err error) + ListBySubscription(ctx context.Context, skip string) (result machinelearningservices.WorkspaceListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context, skip string) (result machinelearningservices.WorkspaceListResultIterator, err error) + ListKeys(ctx context.Context, resourceGroupName string, workspaceName string) (result machinelearningservices.ListWorkspaceKeysResult, err error) + ListNotebookAccessToken(ctx context.Context, resourceGroupName string, workspaceName string) (result machinelearningservices.NotebookAccessTokenResult, err error) + ListNotebookKeys(ctx context.Context, resourceGroupName string, workspaceName string) (result machinelearningservices.ListNotebookKeysResult, err error) + ListStorageAccountKeys(ctx context.Context, resourceGroupName string, workspaceName string) (result machinelearningservices.ListStorageAccountKeysResult, err error) + PrepareNotebook(ctx context.Context, resourceGroupName string, workspaceName string) (result machinelearningservices.WorkspacesPrepareNotebookFuture, err error) + ResyncKeys(ctx context.Context, resourceGroupName string, workspaceName string) (result machinelearningservices.WorkspacesResyncKeysFuture, err error) + Update(ctx context.Context, resourceGroupName string, workspaceName string, parameters machinelearningservices.WorkspaceUpdateParameters) (result machinelearningservices.Workspace, err error) +} + +var _ WorkspacesClientAPI = (*machinelearningservices.WorkspacesClient)(nil) + +// UsagesClientAPI contains the set of methods on the UsagesClient type. +type UsagesClientAPI interface { + List(ctx context.Context, location string) (result machinelearningservices.ListUsagesResultPage, err error) + ListComplete(ctx context.Context, location string) (result machinelearningservices.ListUsagesResultIterator, err error) +} + +var _ UsagesClientAPI = (*machinelearningservices.UsagesClient)(nil) + +// VirtualMachineSizesClientAPI contains the set of methods on the VirtualMachineSizesClient type. +type VirtualMachineSizesClientAPI interface { + List(ctx context.Context, location string) (result machinelearningservices.VirtualMachineSizeListResult, err error) +} + +var _ VirtualMachineSizesClientAPI = (*machinelearningservices.VirtualMachineSizesClient)(nil) + +// QuotasClientAPI contains the set of methods on the QuotasClient type. +type QuotasClientAPI interface { + List(ctx context.Context, location string) (result machinelearningservices.ListWorkspaceQuotasPage, err error) + ListComplete(ctx context.Context, location string) (result machinelearningservices.ListWorkspaceQuotasIterator, err error) + Update(ctx context.Context, location string, parameters machinelearningservices.QuotaUpdateParameters) (result machinelearningservices.UpdateWorkspaceQuotasResult, err error) +} + +var _ QuotasClientAPI = (*machinelearningservices.QuotasClient)(nil) + +// ComputeClientAPI contains the set of methods on the ComputeClient type. +type ComputeClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, parameters machinelearningservices.ComputeResource) (result machinelearningservices.ComputeCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, underlyingResourceAction machinelearningservices.UnderlyingResourceAction) (result machinelearningservices.ComputeDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (result machinelearningservices.ComputeResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (result machinelearningservices.PaginatedComputeResourcesListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (result machinelearningservices.PaginatedComputeResourcesListIterator, err error) + ListKeys(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (result machinelearningservices.ComputeSecretsModel, err error) + ListNodes(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (result machinelearningservices.AmlComputeNodesInformationPage, err error) + ListNodesComplete(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (result machinelearningservices.AmlComputeNodesInformationIterator, err error) + Restart(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (result autorest.Response, err error) + Start(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (result machinelearningservices.ComputeStartFuture, err error) + Stop(ctx context.Context, resourceGroupName string, workspaceName string, computeName string) (result machinelearningservices.ComputeStopFuture, err error) + Update(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, parameters machinelearningservices.ClusterUpdateParameters) (result machinelearningservices.ComputeUpdateFuture, err error) + UpdateSchedules(ctx context.Context, resourceGroupName string, workspaceName string, computeName string, parameters *machinelearningservices.ComputeSchedules) (result autorest.Response, err error) +} + +var _ ComputeClientAPI = (*machinelearningservices.ComputeClient)(nil) + +// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, properties machinelearningservices.PrivateEndpointConnection) (result machinelearningservices.PrivateEndpointConnection, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result machinelearningservices.PrivateEndpointConnection, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string) (result machinelearningservices.PrivateEndpointConnectionListResult, err error) +} + +var _ PrivateEndpointConnectionsClientAPI = (*machinelearningservices.PrivateEndpointConnectionsClient)(nil) + +// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. +type PrivateLinkResourcesClientAPI interface { + List(ctx context.Context, resourceGroupName string, workspaceName string) (result machinelearningservices.PrivateLinkResourceListResult, err error) +} + +var _ PrivateLinkResourcesClientAPI = (*machinelearningservices.PrivateLinkResourcesClient)(nil) + +// WorkspaceConnectionsClientAPI contains the set of methods on the WorkspaceConnectionsClient type. +type WorkspaceConnectionsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, workspaceName string, connectionName string, parameters machinelearningservices.WorkspaceConnection) (result machinelearningservices.WorkspaceConnection, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, connectionName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, connectionName string) (result machinelearningservices.WorkspaceConnection, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, target string, category string) (result machinelearningservices.PaginatedWorkspaceConnectionsList, err error) +} + +var _ WorkspaceConnectionsClientAPI = (*machinelearningservices.WorkspaceConnectionsClient)(nil) + +// BatchEndpointsClientAPI contains the set of methods on the BatchEndpointsClient type. +type BatchEndpointsClientAPI interface { + CreateOrUpdate(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, body machinelearningservices.BatchEndpointTrackedResource) (result machinelearningservices.BatchEndpointTrackedResource, err error) + Delete(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) + Get(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (result machinelearningservices.BatchEndpointTrackedResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, count *int32, skip string) (result machinelearningservices.BatchEndpointTrackedResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, count *int32, skip string) (result machinelearningservices.BatchEndpointTrackedResourceArmPaginatedResultIterator, err error) + ListKeys(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (result machinelearningservices.EndpointAuthKeys, err error) + Update(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, body machinelearningservices.PartialBatchEndpointPartialTrackedResource) (result machinelearningservices.BatchEndpointTrackedResource, err error) +} + +var _ BatchEndpointsClientAPI = (*machinelearningservices.BatchEndpointsClient)(nil) + +// BatchDeploymentsClientAPI contains the set of methods on the BatchDeploymentsClient type. +type BatchDeploymentsClientAPI interface { + CreateOrUpdate(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string, body machinelearningservices.BatchDeploymentTrackedResource) (result machinelearningservices.BatchDeploymentTrackedResource, err error) + Delete(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) + Get(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string) (result machinelearningservices.BatchDeploymentTrackedResource, err error) + List(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (result machinelearningservices.BatchDeploymentTrackedResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (result machinelearningservices.BatchDeploymentTrackedResourceArmPaginatedResultIterator, err error) + Update(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string, body machinelearningservices.PartialBatchDeploymentPartialTrackedResource) (result machinelearningservices.BatchDeploymentTrackedResource, err error) +} + +var _ BatchDeploymentsClientAPI = (*machinelearningservices.BatchDeploymentsClient)(nil) + +// CodeContainersClientAPI contains the set of methods on the CodeContainersClient type. +type CodeContainersClientAPI interface { + CreateOrUpdate(ctx context.Context, name string, resourceGroupName string, workspaceName string, body machinelearningservices.CodeContainerResource) (result machinelearningservices.CodeContainerResource, err error) + Delete(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) + Get(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result machinelearningservices.CodeContainerResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (result machinelearningservices.CodeContainerResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (result machinelearningservices.CodeContainerResourceArmPaginatedResultIterator, err error) +} + +var _ CodeContainersClientAPI = (*machinelearningservices.CodeContainersClient)(nil) + +// CodeVersionsClientAPI contains the set of methods on the CodeVersionsClient type. +type CodeVersionsClientAPI interface { + CreateOrUpdate(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string, body machinelearningservices.CodeVersionResource) (result machinelearningservices.CodeVersionResource, err error) + Delete(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) + Get(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (result machinelearningservices.CodeVersionResource, err error) + List(ctx context.Context, name string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (result machinelearningservices.CodeVersionResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, name string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (result machinelearningservices.CodeVersionResourceArmPaginatedResultIterator, err error) +} + +var _ CodeVersionsClientAPI = (*machinelearningservices.CodeVersionsClient)(nil) + +// DataContainersClientAPI contains the set of methods on the DataContainersClient type. +type DataContainersClientAPI interface { + CreateOrUpdate(ctx context.Context, name string, resourceGroupName string, workspaceName string, body machinelearningservices.DataContainerResource) (result machinelearningservices.DataContainerResource, err error) + Delete(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) + Get(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result machinelearningservices.DataContainerResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (result machinelearningservices.DataContainerResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (result machinelearningservices.DataContainerResourceArmPaginatedResultIterator, err error) +} + +var _ DataContainersClientAPI = (*machinelearningservices.DataContainersClient)(nil) + +// DataVersionsClientAPI contains the set of methods on the DataVersionsClient type. +type DataVersionsClientAPI interface { + CreateOrUpdate(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string, body machinelearningservices.DataVersionResource) (result machinelearningservices.DataVersionResource, err error) + Delete(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) + Get(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (result machinelearningservices.DataVersionResource, err error) + List(ctx context.Context, name string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string, tags string) (result machinelearningservices.DataVersionResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, name string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string, tags string) (result machinelearningservices.DataVersionResourceArmPaginatedResultIterator, err error) +} + +var _ DataVersionsClientAPI = (*machinelearningservices.DataVersionsClient)(nil) + +// DatastoresClientAPI contains the set of methods on the DatastoresClient type. +type DatastoresClientAPI interface { + CreateOrUpdate(ctx context.Context, name string, resourceGroupName string, workspaceName string, body machinelearningservices.DatastorePropertiesResource, skipValidation *bool) (result machinelearningservices.DatastorePropertiesResource, err error) + Delete(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) + Get(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result machinelearningservices.DatastorePropertiesResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32, isDefault *bool, names []string, searchText string, orderBy string, orderByAsc *bool) (result machinelearningservices.DatastorePropertiesResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32, isDefault *bool, names []string, searchText string, orderBy string, orderByAsc *bool) (result machinelearningservices.DatastorePropertiesResourceArmPaginatedResultIterator, err error) + ListSecrets(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result machinelearningservices.DatastoreSecretsModel, err error) +} + +var _ DatastoresClientAPI = (*machinelearningservices.DatastoresClient)(nil) + +// EnvironmentContainersClientAPI contains the set of methods on the EnvironmentContainersClient type. +type EnvironmentContainersClientAPI interface { + CreateOrUpdate(ctx context.Context, name string, resourceGroupName string, workspaceName string, body machinelearningservices.EnvironmentContainerResource) (result machinelearningservices.EnvironmentContainerResource, err error) + Delete(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) + Get(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result machinelearningservices.EnvironmentContainerResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (result machinelearningservices.EnvironmentContainerResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string) (result machinelearningservices.EnvironmentContainerResourceArmPaginatedResultIterator, err error) +} + +var _ EnvironmentContainersClientAPI = (*machinelearningservices.EnvironmentContainersClient)(nil) + +// EnvironmentSpecificationVersionsClientAPI contains the set of methods on the EnvironmentSpecificationVersionsClient type. +type EnvironmentSpecificationVersionsClientAPI interface { + CreateOrUpdate(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string, body machinelearningservices.EnvironmentSpecificationVersionResource) (result machinelearningservices.EnvironmentSpecificationVersionResource, err error) + Delete(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) + Get(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (result machinelearningservices.EnvironmentSpecificationVersionResource, err error) + List(ctx context.Context, name string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (result machinelearningservices.EnvironmentSpecificationVersionResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, name string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (result machinelearningservices.EnvironmentSpecificationVersionResourceArmPaginatedResultIterator, err error) +} + +var _ EnvironmentSpecificationVersionsClientAPI = (*machinelearningservices.EnvironmentSpecificationVersionsClient)(nil) + +// JobsClientAPI contains the set of methods on the JobsClient type. +type JobsClientAPI interface { + Cancel(ctx context.Context, ID string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) + CreateOrUpdate(ctx context.Context, ID string, resourceGroupName string, workspaceName string, body machinelearningservices.JobBaseResource) (result machinelearningservices.JobBaseResource, err error) + Delete(ctx context.Context, ID string, resourceGroupName string, workspaceName string) (result machinelearningservices.JobsDeleteFuture, err error) + Get(ctx context.Context, ID string, resourceGroupName string, workspaceName string) (result machinelearningservices.JobBaseResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, jobType string, tags string, tag string) (result machinelearningservices.JobBaseResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, jobType string, tags string, tag string) (result machinelearningservices.JobBaseResourceArmPaginatedResultIterator, err error) +} + +var _ JobsClientAPI = (*machinelearningservices.JobsClient)(nil) + +// LabelingJobsClientAPI contains the set of methods on the LabelingJobsClient type. +type LabelingJobsClientAPI interface { + CreateOrUpdate(ctx context.Context, ID string, resourceGroupName string, workspaceName string, body machinelearningservices.LabelingJobResource) (result machinelearningservices.LabelingJobsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, ID string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) + ExportLabels(ctx context.Context, ID string, resourceGroupName string, workspaceName string, body machinelearningservices.BasicExportSummary) (result machinelearningservices.LabelingJobsExportLabelsFuture, err error) + Get(ctx context.Context, ID string, resourceGroupName string, workspaceName string, includeJobInstructions *bool, includeLabelCategories *bool) (result machinelearningservices.LabelingJobResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32) (result machinelearningservices.LabelingJobResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32) (result machinelearningservices.LabelingJobResourceArmPaginatedResultIterator, err error) + Pause(ctx context.Context, ID string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) + Resume(ctx context.Context, ID string, resourceGroupName string, workspaceName string) (result machinelearningservices.LabelingJobsResumeFuture, err error) +} + +var _ LabelingJobsClientAPI = (*machinelearningservices.LabelingJobsClient)(nil) + +// ModelContainersClientAPI contains the set of methods on the ModelContainersClient type. +type ModelContainersClientAPI interface { + CreateOrUpdate(ctx context.Context, name string, resourceGroupName string, workspaceName string, body machinelearningservices.ModelContainerResource) (result machinelearningservices.ModelContainerResource, err error) + Delete(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) + Get(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result machinelearningservices.ModelContainerResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32) (result machinelearningservices.ModelContainerResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32) (result machinelearningservices.ModelContainerResourceArmPaginatedResultIterator, err error) +} + +var _ ModelContainersClientAPI = (*machinelearningservices.ModelContainersClient)(nil) + +// ModelVersionsClientAPI contains the set of methods on the ModelVersionsClient type. +type ModelVersionsClientAPI interface { + CreateOrUpdate(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string, body machinelearningservices.ModelVersionResource) (result machinelearningservices.ModelVersionResource, err error) + Delete(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) + Get(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (result machinelearningservices.ModelVersionResource, err error) + List(ctx context.Context, name string, resourceGroupName string, workspaceName string, skip string, orderBy string, top *int32, version string, description string, offset *int32, tags string, properties string) (result machinelearningservices.ModelVersionResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, name string, resourceGroupName string, workspaceName string, skip string, orderBy string, top *int32, version string, description string, offset *int32, tags string, properties string) (result machinelearningservices.ModelVersionResourceArmPaginatedResultIterator, err error) +} + +var _ ModelVersionsClientAPI = (*machinelearningservices.ModelVersionsClient)(nil) + +// OnlineEndpointsClientAPI contains the set of methods on the OnlineEndpointsClient type. +type OnlineEndpointsClientAPI interface { + CreateOrUpdate(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, body machinelearningservices.OnlineEndpointTrackedResource) (result machinelearningservices.OnlineEndpointsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (result machinelearningservices.OnlineEndpointsDeleteFuture, err error) + Get(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (result machinelearningservices.OnlineEndpointTrackedResource, err error) + GetToken(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (result machinelearningservices.EndpointAuthToken, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, name string, count *int32, computeType machinelearningservices.EndpointComputeType, skip string, tags string, properties string, orderBy machinelearningservices.OrderString) (result machinelearningservices.OnlineEndpointTrackedResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, name string, count *int32, computeType machinelearningservices.EndpointComputeType, skip string, tags string, properties string, orderBy machinelearningservices.OrderString) (result machinelearningservices.OnlineEndpointTrackedResourceArmPaginatedResultIterator, err error) + ListKeys(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (result machinelearningservices.EndpointAuthKeys, err error) + RegenerateKeys(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, body machinelearningservices.RegenerateEndpointKeysRequest) (result machinelearningservices.OnlineEndpointsRegenerateKeysFuture, err error) + Update(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, body machinelearningservices.PartialOnlineEndpointPartialTrackedResource) (result machinelearningservices.OnlineEndpointsUpdateFuture, err error) +} + +var _ OnlineEndpointsClientAPI = (*machinelearningservices.OnlineEndpointsClient)(nil) + +// OnlineDeploymentsClientAPI contains the set of methods on the OnlineDeploymentsClient type. +type OnlineDeploymentsClientAPI interface { + CreateOrUpdate(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string, body machinelearningservices.OnlineDeploymentTrackedResource) (result machinelearningservices.OnlineDeploymentsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string) (result machinelearningservices.OnlineDeploymentsDeleteFuture, err error) + Get(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string) (result machinelearningservices.OnlineDeploymentTrackedResource, err error) + GetLogs(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string, body machinelearningservices.DeploymentLogsRequest) (result machinelearningservices.DeploymentLogs, err error) + List(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (result machinelearningservices.OnlineDeploymentTrackedResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (result machinelearningservices.OnlineDeploymentTrackedResourceArmPaginatedResultIterator, err error) + Update(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string, body machinelearningservices.PartialOnlineDeploymentPartialTrackedResource) (result machinelearningservices.OnlineDeploymentsUpdateFuture, err error) +} + +var _ OnlineDeploymentsClientAPI = (*machinelearningservices.OnlineDeploymentsClient)(nil) + +// WorkspaceFeaturesClientAPI contains the set of methods on the WorkspaceFeaturesClient type. +type WorkspaceFeaturesClientAPI interface { + List(ctx context.Context, resourceGroupName string, workspaceName string) (result machinelearningservices.ListAmlUserFeatureResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result machinelearningservices.ListAmlUserFeatureResultIterator, err error) +} + +var _ WorkspaceFeaturesClientAPI = (*machinelearningservices.WorkspaceFeaturesClient)(nil) + +// WorkspaceSkusClientAPI contains the set of methods on the WorkspaceSkusClient type. +type WorkspaceSkusClientAPI interface { + List(ctx context.Context) (result machinelearningservices.SkuListResultPage, err error) + ListComplete(ctx context.Context) (result machinelearningservices.SkuListResultIterator, err error) +} + +var _ WorkspaceSkusClientAPI = (*machinelearningservices.WorkspaceSkusClient)(nil) diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/modelcontainers.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/modelcontainers.go new file mode 100644 index 000000000000..4cfea5547b61 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/modelcontainers.go @@ -0,0 +1,435 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ModelContainersClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type ModelContainersClient struct { + BaseClient +} + +// NewModelContainersClient creates an instance of the ModelContainersClient client. +func NewModelContainersClient(subscriptionID string) ModelContainersClient { + return NewModelContainersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewModelContainersClientWithBaseURI creates an instance of the ModelContainersClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewModelContainersClientWithBaseURI(baseURI string, subscriptionID string) ModelContainersClient { + return ModelContainersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// name - container name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - container entity to create or update. +func (client ModelContainersClient) CreateOrUpdate(ctx context.Context, name string, resourceGroupName string, workspaceName string, body ModelContainerResource) (result ModelContainerResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelContainersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ModelContainersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, name, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelContainersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelContainersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelContainersClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ModelContainersClient) CreateOrUpdatePreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string, body ModelContainerResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ModelContainersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ModelContainersClient) CreateOrUpdateResponder(resp *http.Response) (result ModelContainerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// name - container name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client ModelContainersClient) Delete(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelContainersClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ModelContainersClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, name, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelContainersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelContainersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelContainersClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ModelContainersClient) DeletePreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ModelContainersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ModelContainersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// name - container name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client ModelContainersClient) Get(ctx context.Context, name string, resourceGroupName string, workspaceName string) (result ModelContainerResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelContainersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ModelContainersClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, name, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelContainersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelContainersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelContainersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ModelContainersClient) GetPreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ModelContainersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ModelContainersClient) GetResponder(resp *http.Response) (result ModelContainerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// skip - continuation token for pagination. +// count - maximum number of results to return. +func (client ModelContainersClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32) (result ModelContainerResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelContainersClient.List") + defer func() { + sc := -1 + if result.mcrapr.Response.Response != nil { + sc = result.mcrapr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ModelContainersClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, skip, count) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelContainersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mcrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelContainersClient", "List", resp, "Failure sending request") + return + } + + result.mcrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelContainersClient", "List", resp, "Failure responding to request") + return + } + if result.mcrapr.hasNextLink() && result.mcrapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ModelContainersClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + if count != nil { + queryParameters["count"] = autorest.Encode("query", *count) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ModelContainersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ModelContainersClient) ListResponder(resp *http.Response) (result ModelContainerResourceArmPaginatedResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ModelContainersClient) listNextResults(ctx context.Context, lastResults ModelContainerResourceArmPaginatedResult) (result ModelContainerResourceArmPaginatedResult, err error) { + req, err := lastResults.modelContainerResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.ModelContainersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.ModelContainersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelContainersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ModelContainersClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32) (result ModelContainerResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelContainersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, skip, count) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/models.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/models.go new file mode 100644 index 000000000000..3d26d84827ca --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/models.go @@ -0,0 +1,16072 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices" + +// AccountKeyDatastoreCredentials account key datastore credentials configuration. +type AccountKeyDatastoreCredentials struct { + // Secrets - Storage account secrets. + Secrets *AccountKeyDatastoreSecrets `json:"secrets,omitempty"` + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey', 'CredentialsTypeCertificate', 'CredentialsTypeNone', 'CredentialsTypeSas', 'CredentialsTypeServicePrincipal', 'CredentialsTypeSQLAdmin' + CredentialsType CredentialsTypeBasicDatastoreCredentials `json:"credentialsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountKeyDatastoreCredentials. +func (akdc AccountKeyDatastoreCredentials) MarshalJSON() ([]byte, error) { + akdc.CredentialsType = CredentialsTypeAccountKey + objectMap := make(map[string]interface{}) + if akdc.Secrets != nil { + objectMap["secrets"] = akdc.Secrets + } + if akdc.CredentialsType != "" { + objectMap["credentialsType"] = akdc.CredentialsType + } + return json.Marshal(objectMap) +} + +// AsAccountKeyDatastoreCredentials is the BasicDatastoreCredentials implementation for AccountKeyDatastoreCredentials. +func (akdc AccountKeyDatastoreCredentials) AsAccountKeyDatastoreCredentials() (*AccountKeyDatastoreCredentials, bool) { + return &akdc, true +} + +// AsCertificateDatastoreCredentials is the BasicDatastoreCredentials implementation for AccountKeyDatastoreCredentials. +func (akdc AccountKeyDatastoreCredentials) AsCertificateDatastoreCredentials() (*CertificateDatastoreCredentials, bool) { + return nil, false +} + +// AsNoneDatastoreCredentials is the BasicDatastoreCredentials implementation for AccountKeyDatastoreCredentials. +func (akdc AccountKeyDatastoreCredentials) AsNoneDatastoreCredentials() (*NoneDatastoreCredentials, bool) { + return nil, false +} + +// AsSasDatastoreCredentials is the BasicDatastoreCredentials implementation for AccountKeyDatastoreCredentials. +func (akdc AccountKeyDatastoreCredentials) AsSasDatastoreCredentials() (*SasDatastoreCredentials, bool) { + return nil, false +} + +// AsServicePrincipalDatastoreCredentials is the BasicDatastoreCredentials implementation for AccountKeyDatastoreCredentials. +func (akdc AccountKeyDatastoreCredentials) AsServicePrincipalDatastoreCredentials() (*ServicePrincipalDatastoreCredentials, bool) { + return nil, false +} + +// AsSQLAdminDatastoreCredentials is the BasicDatastoreCredentials implementation for AccountKeyDatastoreCredentials. +func (akdc AccountKeyDatastoreCredentials) AsSQLAdminDatastoreCredentials() (*SQLAdminDatastoreCredentials, bool) { + return nil, false +} + +// AsDatastoreCredentials is the BasicDatastoreCredentials implementation for AccountKeyDatastoreCredentials. +func (akdc AccountKeyDatastoreCredentials) AsDatastoreCredentials() (*DatastoreCredentials, bool) { + return nil, false +} + +// AsBasicDatastoreCredentials is the BasicDatastoreCredentials implementation for AccountKeyDatastoreCredentials. +func (akdc AccountKeyDatastoreCredentials) AsBasicDatastoreCredentials() (BasicDatastoreCredentials, bool) { + return &akdc, true +} + +// AccountKeyDatastoreSecrets datastore account key secrets. +type AccountKeyDatastoreSecrets struct { + // Key - Storage account key. + Key *string `json:"key,omitempty"` + // SecretsType - Possible values include: 'SecretsTypeDatastoreSecrets', 'SecretsTypeAccountKey1', 'SecretsTypeCertificate1', 'SecretsTypeNone1', 'SecretsTypeSas1', 'SecretsTypeServicePrincipal1', 'SecretsTypeSQLAdmin1' + SecretsType SecretsTypeBasicDatastoreSecrets `json:"secretsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountKeyDatastoreSecrets. +func (akds AccountKeyDatastoreSecrets) MarshalJSON() ([]byte, error) { + akds.SecretsType = SecretsTypeAccountKey1 + objectMap := make(map[string]interface{}) + if akds.Key != nil { + objectMap["key"] = akds.Key + } + if akds.SecretsType != "" { + objectMap["secretsType"] = akds.SecretsType + } + return json.Marshal(objectMap) +} + +// AsAccountKeyDatastoreSecrets is the BasicDatastoreSecrets implementation for AccountKeyDatastoreSecrets. +func (akds AccountKeyDatastoreSecrets) AsAccountKeyDatastoreSecrets() (*AccountKeyDatastoreSecrets, bool) { + return &akds, true +} + +// AsCertificateDatastoreSecrets is the BasicDatastoreSecrets implementation for AccountKeyDatastoreSecrets. +func (akds AccountKeyDatastoreSecrets) AsCertificateDatastoreSecrets() (*CertificateDatastoreSecrets, bool) { + return nil, false +} + +// AsNoneDatastoreSecrets is the BasicDatastoreSecrets implementation for AccountKeyDatastoreSecrets. +func (akds AccountKeyDatastoreSecrets) AsNoneDatastoreSecrets() (*NoneDatastoreSecrets, bool) { + return nil, false +} + +// AsSasDatastoreSecrets is the BasicDatastoreSecrets implementation for AccountKeyDatastoreSecrets. +func (akds AccountKeyDatastoreSecrets) AsSasDatastoreSecrets() (*SasDatastoreSecrets, bool) { + return nil, false +} + +// AsServicePrincipalDatastoreSecrets is the BasicDatastoreSecrets implementation for AccountKeyDatastoreSecrets. +func (akds AccountKeyDatastoreSecrets) AsServicePrincipalDatastoreSecrets() (*ServicePrincipalDatastoreSecrets, bool) { + return nil, false +} + +// AsSQLAdminDatastoreSecrets is the BasicDatastoreSecrets implementation for AccountKeyDatastoreSecrets. +func (akds AccountKeyDatastoreSecrets) AsSQLAdminDatastoreSecrets() (*SQLAdminDatastoreSecrets, bool) { + return nil, false +} + +// AsDatastoreSecrets is the BasicDatastoreSecrets implementation for AccountKeyDatastoreSecrets. +func (akds AccountKeyDatastoreSecrets) AsDatastoreSecrets() (*DatastoreSecrets, bool) { + return nil, false +} + +// AsBasicDatastoreSecrets is the BasicDatastoreSecrets implementation for AccountKeyDatastoreSecrets. +func (akds AccountKeyDatastoreSecrets) AsBasicDatastoreSecrets() (BasicDatastoreSecrets, bool) { + return &akds, true +} + +// AKS a Machine Learning compute based on AKS. +type AKS struct { + // Properties - AKS properties + Properties *AKSProperties `json:"properties,omitempty"` + // ComputeLocation - Location for the underlying compute + ComputeLocation *string `json:"computeLocation,omitempty"` + // ProvisioningState - READ-ONLY; The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Possible values include: 'ProvisioningStateUnknown', 'ProvisioningStateUpdating', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Description - The description of the Machine Learning compute. + Description *string `json:"description,omitempty"` + // CreatedOn - READ-ONLY; The time at which the compute was created. + CreatedOn *date.Time `json:"createdOn,omitempty"` + // ModifiedOn - READ-ONLY; The time at which the compute was last modified. + ModifiedOn *date.Time `json:"modifiedOn,omitempty"` + // ResourceID - ARM resource id of the underlying compute + ResourceID *string `json:"resourceId,omitempty"` + // ProvisioningErrors - READ-ONLY; Errors during provisioning + ProvisioningErrors *[]ErrorResponse `json:"provisioningErrors,omitempty"` + // 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. + IsAttachedCompute *bool `json:"isAttachedCompute,omitempty"` + // DisableLocalAuth - Opt-out of local authentication and ensure customers can use only MSI and AAD exclusively for authentication. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + // ComputeType - Possible values include: 'ComputeTypeCompute', 'ComputeTypeAKS1', 'ComputeTypeAmlCompute1', 'ComputeTypeComputeInstance1', 'ComputeTypeVirtualMachine1', 'ComputeTypeHDInsight1', 'ComputeTypeDataFactory1', 'ComputeTypeDatabricks1', 'ComputeTypeDataLakeAnalytics1' + ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AKS. +func (a AKS) MarshalJSON() ([]byte, error) { + a.ComputeType = ComputeTypeAKS1 + objectMap := make(map[string]interface{}) + if a.Properties != nil { + objectMap["properties"] = a.Properties + } + if a.ComputeLocation != nil { + objectMap["computeLocation"] = a.ComputeLocation + } + if a.Description != nil { + objectMap["description"] = a.Description + } + if a.ResourceID != nil { + objectMap["resourceId"] = a.ResourceID + } + if a.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = a.DisableLocalAuth + } + if a.ComputeType != "" { + objectMap["computeType"] = a.ComputeType + } + return json.Marshal(objectMap) +} + +// AsAKS is the BasicCompute implementation for AKS. +func (a AKS) AsAKS() (*AKS, bool) { + return &a, true +} + +// AsAmlCompute is the BasicCompute implementation for AKS. +func (a AKS) AsAmlCompute() (*AmlCompute, bool) { + return nil, false +} + +// AsComputeInstance is the BasicCompute implementation for AKS. +func (a AKS) AsComputeInstance() (*ComputeInstance, bool) { + return nil, false +} + +// AsVirtualMachine is the BasicCompute implementation for AKS. +func (a AKS) AsVirtualMachine() (*VirtualMachine, bool) { + return nil, false +} + +// AsHDInsight is the BasicCompute implementation for AKS. +func (a AKS) AsHDInsight() (*HDInsight, bool) { + return nil, false +} + +// AsDataFactory is the BasicCompute implementation for AKS. +func (a AKS) AsDataFactory() (*DataFactory, bool) { + return nil, false +} + +// AsDatabricks is the BasicCompute implementation for AKS. +func (a AKS) AsDatabricks() (*Databricks, bool) { + return nil, false +} + +// AsDataLakeAnalytics is the BasicCompute implementation for AKS. +func (a AKS) AsDataLakeAnalytics() (*DataLakeAnalytics, bool) { + return nil, false +} + +// AsCompute is the BasicCompute implementation for AKS. +func (a AKS) AsCompute() (*Compute, bool) { + return nil, false +} + +// AsBasicCompute is the BasicCompute implementation for AKS. +func (a AKS) AsBasicCompute() (BasicCompute, bool) { + return &a, true +} + +// AksComputeSecrets secrets related to a Machine Learning compute based on AKS. +type AksComputeSecrets struct { + // UserKubeConfig - Content of kubeconfig file that can be used to connect to the Kubernetes cluster. + UserKubeConfig *string `json:"userKubeConfig,omitempty"` + // AdminKubeConfig - Content of kubeconfig file that can be used to connect to the Kubernetes cluster. + AdminKubeConfig *string `json:"adminKubeConfig,omitempty"` + // ImagePullSecretName - Image registry pull secret. + ImagePullSecretName *string `json:"imagePullSecretName,omitempty"` + // ComputeType - Possible values include: 'ComputeTypeBasicComputeSecretsComputeTypeComputeSecrets', 'ComputeTypeBasicComputeSecretsComputeTypeAKS', 'ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine', 'ComputeTypeBasicComputeSecretsComputeTypeDatabricks' + ComputeType ComputeTypeBasicComputeSecrets `json:"computeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AksComputeSecrets. +func (acs AksComputeSecrets) MarshalJSON() ([]byte, error) { + acs.ComputeType = ComputeTypeBasicComputeSecretsComputeTypeAKS + objectMap := make(map[string]interface{}) + if acs.UserKubeConfig != nil { + objectMap["userKubeConfig"] = acs.UserKubeConfig + } + if acs.AdminKubeConfig != nil { + objectMap["adminKubeConfig"] = acs.AdminKubeConfig + } + if acs.ImagePullSecretName != nil { + objectMap["imagePullSecretName"] = acs.ImagePullSecretName + } + if acs.ComputeType != "" { + objectMap["computeType"] = acs.ComputeType + } + return json.Marshal(objectMap) +} + +// AsAksComputeSecrets is the BasicComputeSecrets implementation for AksComputeSecrets. +func (acs AksComputeSecrets) AsAksComputeSecrets() (*AksComputeSecrets, bool) { + return &acs, true +} + +// AsVirtualMachineSecrets is the BasicComputeSecrets implementation for AksComputeSecrets. +func (acs AksComputeSecrets) AsVirtualMachineSecrets() (*VirtualMachineSecrets, bool) { + return nil, false +} + +// AsDatabricksComputeSecrets is the BasicComputeSecrets implementation for AksComputeSecrets. +func (acs AksComputeSecrets) AsDatabricksComputeSecrets() (*DatabricksComputeSecrets, bool) { + return nil, false +} + +// AsComputeSecrets is the BasicComputeSecrets implementation for AksComputeSecrets. +func (acs AksComputeSecrets) AsComputeSecrets() (*ComputeSecrets, bool) { + return nil, false +} + +// AsBasicComputeSecrets is the BasicComputeSecrets implementation for AksComputeSecrets. +func (acs AksComputeSecrets) AsBasicComputeSecrets() (BasicComputeSecrets, bool) { + return &acs, true +} + +// AksNetworkingConfiguration advance configuration for AKS networking +type AksNetworkingConfiguration struct { + // SubnetID - Virtual network subnet resource ID the compute nodes belong to + SubnetID *string `json:"subnetId,omitempty"` + // ServiceCidr - A CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges. + ServiceCidr *string `json:"serviceCidr,omitempty"` + // DNSServiceIP - An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr. + DNSServiceIP *string `json:"dnsServiceIP,omitempty"` + // 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. + DockerBridgeCidr *string `json:"dockerBridgeCidr,omitempty"` +} + +// AKSProperties AKS properties +type AKSProperties struct { + // ClusterFqdn - Cluster full qualified domain name + ClusterFqdn *string `json:"clusterFqdn,omitempty"` + // SystemServices - READ-ONLY; System services + SystemServices *[]SystemService `json:"systemServices,omitempty"` + // AgentCount - Number of agents + AgentCount *int32 `json:"agentCount,omitempty"` + // AgentVMSize - Agent virtual machine size + AgentVMSize *string `json:"agentVmSize,omitempty"` + // ClusterPurpose - Intended usage of the cluster. Possible values include: 'FastProd', 'DenseProd', 'DevTest' + ClusterPurpose ClusterPurpose `json:"clusterPurpose,omitempty"` + // SslConfiguration - SSL configuration + SslConfiguration *SslConfiguration `json:"sslConfiguration,omitempty"` + // AksNetworkingConfiguration - AKS networking configuration for vnet + AksNetworkingConfiguration *AksNetworkingConfiguration `json:"aksNetworkingConfiguration,omitempty"` + // LoadBalancerType - Load Balancer Type. Possible values include: 'PublicIP', 'InternalLoadBalancer' + LoadBalancerType LoadBalancerType `json:"loadBalancerType,omitempty"` + // LoadBalancerSubnet - Load Balancer Subnet + LoadBalancerSubnet *string `json:"loadBalancerSubnet,omitempty"` +} + +// MarshalJSON is the custom marshaler for AKSProperties. +func (a AKSProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.ClusterFqdn != nil { + objectMap["clusterFqdn"] = a.ClusterFqdn + } + if a.AgentCount != nil { + objectMap["agentCount"] = a.AgentCount + } + if a.AgentVMSize != nil { + objectMap["agentVmSize"] = a.AgentVMSize + } + if a.ClusterPurpose != "" { + objectMap["clusterPurpose"] = a.ClusterPurpose + } + if a.SslConfiguration != nil { + objectMap["sslConfiguration"] = a.SslConfiguration + } + if a.AksNetworkingConfiguration != nil { + objectMap["aksNetworkingConfiguration"] = a.AksNetworkingConfiguration + } + if a.LoadBalancerType != "" { + objectMap["loadBalancerType"] = a.LoadBalancerType + } + if a.LoadBalancerSubnet != nil { + objectMap["loadBalancerSubnet"] = a.LoadBalancerSubnet + } + return json.Marshal(objectMap) +} + +// AmlCompute an Azure Machine Learning compute. +type AmlCompute struct { + // Properties - AML Compute properties + Properties *AmlComputeProperties `json:"properties,omitempty"` + // ComputeLocation - Location for the underlying compute + ComputeLocation *string `json:"computeLocation,omitempty"` + // ProvisioningState - READ-ONLY; The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Possible values include: 'ProvisioningStateUnknown', 'ProvisioningStateUpdating', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Description - The description of the Machine Learning compute. + Description *string `json:"description,omitempty"` + // CreatedOn - READ-ONLY; The time at which the compute was created. + CreatedOn *date.Time `json:"createdOn,omitempty"` + // ModifiedOn - READ-ONLY; The time at which the compute was last modified. + ModifiedOn *date.Time `json:"modifiedOn,omitempty"` + // ResourceID - ARM resource id of the underlying compute + ResourceID *string `json:"resourceId,omitempty"` + // ProvisioningErrors - READ-ONLY; Errors during provisioning + ProvisioningErrors *[]ErrorResponse `json:"provisioningErrors,omitempty"` + // 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. + IsAttachedCompute *bool `json:"isAttachedCompute,omitempty"` + // DisableLocalAuth - Opt-out of local authentication and ensure customers can use only MSI and AAD exclusively for authentication. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + // ComputeType - Possible values include: 'ComputeTypeCompute', 'ComputeTypeAKS1', 'ComputeTypeAmlCompute1', 'ComputeTypeComputeInstance1', 'ComputeTypeVirtualMachine1', 'ComputeTypeHDInsight1', 'ComputeTypeDataFactory1', 'ComputeTypeDatabricks1', 'ComputeTypeDataLakeAnalytics1' + ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AmlCompute. +func (ac AmlCompute) MarshalJSON() ([]byte, error) { + ac.ComputeType = ComputeTypeAmlCompute1 + objectMap := make(map[string]interface{}) + if ac.Properties != nil { + objectMap["properties"] = ac.Properties + } + if ac.ComputeLocation != nil { + objectMap["computeLocation"] = ac.ComputeLocation + } + if ac.Description != nil { + objectMap["description"] = ac.Description + } + if ac.ResourceID != nil { + objectMap["resourceId"] = ac.ResourceID + } + if ac.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = ac.DisableLocalAuth + } + if ac.ComputeType != "" { + objectMap["computeType"] = ac.ComputeType + } + return json.Marshal(objectMap) +} + +// AsAKS is the BasicCompute implementation for AmlCompute. +func (ac AmlCompute) AsAKS() (*AKS, bool) { + return nil, false +} + +// AsAmlCompute is the BasicCompute implementation for AmlCompute. +func (ac AmlCompute) AsAmlCompute() (*AmlCompute, bool) { + return &ac, true +} + +// AsComputeInstance is the BasicCompute implementation for AmlCompute. +func (ac AmlCompute) AsComputeInstance() (*ComputeInstance, bool) { + return nil, false +} + +// AsVirtualMachine is the BasicCompute implementation for AmlCompute. +func (ac AmlCompute) AsVirtualMachine() (*VirtualMachine, bool) { + return nil, false +} + +// AsHDInsight is the BasicCompute implementation for AmlCompute. +func (ac AmlCompute) AsHDInsight() (*HDInsight, bool) { + return nil, false +} + +// AsDataFactory is the BasicCompute implementation for AmlCompute. +func (ac AmlCompute) AsDataFactory() (*DataFactory, bool) { + return nil, false +} + +// AsDatabricks is the BasicCompute implementation for AmlCompute. +func (ac AmlCompute) AsDatabricks() (*Databricks, bool) { + return nil, false +} + +// AsDataLakeAnalytics is the BasicCompute implementation for AmlCompute. +func (ac AmlCompute) AsDataLakeAnalytics() (*DataLakeAnalytics, bool) { + return nil, false +} + +// AsCompute is the BasicCompute implementation for AmlCompute. +func (ac AmlCompute) AsCompute() (*Compute, bool) { + return nil, false +} + +// AsBasicCompute is the BasicCompute implementation for AmlCompute. +func (ac AmlCompute) AsBasicCompute() (BasicCompute, bool) { + return &ac, true +} + +// AmlComputeNodeInformation compute node information related to a AmlCompute. +type AmlComputeNodeInformation struct { + // NodeID - READ-ONLY; ID of the compute node. + NodeID *string `json:"nodeId,omitempty"` + // PrivateIPAddress - READ-ONLY; Private IP address of the compute node. + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` + // PublicIPAddress - READ-ONLY; Public IP address of the compute node. + PublicIPAddress *string `json:"publicIpAddress,omitempty"` + // Port - READ-ONLY; SSH port number of the node. + Port *float64 `json:"port,omitempty"` + // NodeState - READ-ONLY; State of the compute node. Values are idle, running, preparing, unusable, leaving and preempted. Possible values include: 'NodeStateIdle', 'NodeStateRunning', 'NodeStatePreparing', 'NodeStateUnusable', 'NodeStateLeaving', 'NodeStatePreempted' + NodeState NodeState `json:"nodeState,omitempty"` + // RunID - READ-ONLY; ID of the Experiment running on the node, if any else null. + RunID *string `json:"runId,omitempty"` +} + +// MarshalJSON is the custom marshaler for AmlComputeNodeInformation. +func (acni AmlComputeNodeInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AmlComputeNodesInformation compute node information related to a AmlCompute. +type AmlComputeNodesInformation struct { + autorest.Response `json:"-"` + // Nodes - READ-ONLY; The collection of returned AmlCompute nodes details. + Nodes *[]AmlComputeNodeInformation `json:"nodes,omitempty"` + // NextLink - READ-ONLY; The continuation token. + NextLink *string `json:"nextLink,omitempty"` + // ComputeType - Possible values include: 'ComputeTypeBasicComputeNodesInformationComputeTypeComputeNodesInformation', 'ComputeTypeBasicComputeNodesInformationComputeTypeAmlCompute' + ComputeType ComputeTypeBasicComputeNodesInformation `json:"computeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AmlComputeNodesInformation. +func (acni AmlComputeNodesInformation) MarshalJSON() ([]byte, error) { + acni.ComputeType = ComputeTypeBasicComputeNodesInformationComputeTypeAmlCompute + objectMap := make(map[string]interface{}) + if acni.ComputeType != "" { + objectMap["computeType"] = acni.ComputeType + } + return json.Marshal(objectMap) +} + +// AsAmlComputeNodesInformation is the BasicComputeNodesInformation implementation for AmlComputeNodesInformation. +func (acni AmlComputeNodesInformation) AsAmlComputeNodesInformation() (*AmlComputeNodesInformation, bool) { + return &acni, true +} + +// AsComputeNodesInformation is the BasicComputeNodesInformation implementation for AmlComputeNodesInformation. +func (acni AmlComputeNodesInformation) AsComputeNodesInformation() (*ComputeNodesInformation, bool) { + return nil, false +} + +// AsBasicComputeNodesInformation is the BasicComputeNodesInformation implementation for AmlComputeNodesInformation. +func (acni AmlComputeNodesInformation) AsBasicComputeNodesInformation() (BasicComputeNodesInformation, bool) { + return &acni, true +} + +// AmlComputeNodesInformationIterator provides access to a complete listing of AmlComputeNodeInformation +// values. +type AmlComputeNodesInformationIterator struct { + i int + page AmlComputeNodesInformationPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AmlComputeNodesInformationIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AmlComputeNodesInformationIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AmlComputeNodesInformationIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AmlComputeNodesInformationIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AmlComputeNodesInformationIterator) Response() AmlComputeNodesInformation { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AmlComputeNodesInformationIterator) Value() AmlComputeNodeInformation { + if !iter.page.NotDone() { + return AmlComputeNodeInformation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AmlComputeNodesInformationIterator type. +func NewAmlComputeNodesInformationIterator(page AmlComputeNodesInformationPage) AmlComputeNodesInformationIterator { + return AmlComputeNodesInformationIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (acni AmlComputeNodesInformation) IsEmpty() bool { + return acni.Nodes == nil || len(*acni.Nodes) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (acni AmlComputeNodesInformation) hasNextLink() bool { + return acni.NextLink != nil && len(*acni.NextLink) != 0 +} + +// amlComputeNodesInformationPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (acni AmlComputeNodesInformation) amlComputeNodesInformationPreparer(ctx context.Context) (*http.Request, error) { + if !acni.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(acni.NextLink))) +} + +// AmlComputeNodesInformationPage contains a page of AmlComputeNodeInformation values. +type AmlComputeNodesInformationPage struct { + fn func(context.Context, AmlComputeNodesInformation) (AmlComputeNodesInformation, error) + acni AmlComputeNodesInformation +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AmlComputeNodesInformationPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AmlComputeNodesInformationPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.acni) + if err != nil { + return err + } + page.acni = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AmlComputeNodesInformationPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AmlComputeNodesInformationPage) NotDone() bool { + return !page.acni.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AmlComputeNodesInformationPage) Response() AmlComputeNodesInformation { + return page.acni +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AmlComputeNodesInformationPage) Values() []AmlComputeNodeInformation { + if page.acni.IsEmpty() { + return nil + } + return *page.acni.Nodes +} + +// Creates a new instance of the AmlComputeNodesInformationPage type. +func NewAmlComputeNodesInformationPage(cur AmlComputeNodesInformation, getNextPage func(context.Context, AmlComputeNodesInformation) (AmlComputeNodesInformation, error)) AmlComputeNodesInformationPage { + return AmlComputeNodesInformationPage{ + fn: getNextPage, + acni: cur, + } +} + +// AmlComputeProperties AML Compute properties +type AmlComputeProperties struct { + // OsType - Compute OS Type. Possible values include: 'OsTypeLinux', 'OsTypeWindows' + OsType OsType `json:"osType,omitempty"` + // VMSize - Virtual Machine Size + VMSize *string `json:"vmSize,omitempty"` + // VMPriority - Virtual Machine priority. Possible values include: 'Dedicated', 'LowPriority' + VMPriority VMPriority `json:"vmPriority,omitempty"` + // VirtualMachineImage - Virtual Machine image for AML Compute - windows only + VirtualMachineImage *VirtualMachineImage `json:"virtualMachineImage,omitempty"` + // IsolatedNetwork - Network is isolated or not + IsolatedNetwork *bool `json:"isolatedNetwork,omitempty"` + // ScaleSettings - Scale settings for AML Compute + ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` + // UserAccountCredentials - Credentials for an administrator user account that will be created on each compute node. + UserAccountCredentials *UserAccountCredentials `json:"userAccountCredentials,omitempty"` + // Subnet - Virtual network subnet resource ID the compute nodes belong to. + Subnet *ResourceID `json:"subnet,omitempty"` + // RemoteLoginPortPublicAccess - State of the public SSH port. Possible values are: Disabled - Indicates that the public ssh port is closed on all nodes of the cluster. Enabled - Indicates that the public ssh port is open on all nodes of the cluster. NotSpecified - Indicates that the public ssh port is closed on all nodes of the cluster if VNet is defined, else is open all public nodes. It can be default only during cluster creation time, after creation it will be either enabled or disabled. Possible values include: 'RemoteLoginPortPublicAccessEnabled', 'RemoteLoginPortPublicAccessDisabled', 'RemoteLoginPortPublicAccessNotSpecified' + RemoteLoginPortPublicAccess RemoteLoginPortPublicAccess `json:"remoteLoginPortPublicAccess,omitempty"` + // 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' + AllocationState AllocationState `json:"allocationState,omitempty"` + // AllocationStateTransitionTime - READ-ONLY; The time at which the compute entered its current allocation state. + AllocationStateTransitionTime *date.Time `json:"allocationStateTransitionTime,omitempty"` + // Errors - READ-ONLY; Collection of errors encountered by various compute nodes during node setup. + Errors *[]ErrorResponse `json:"errors,omitempty"` + // CurrentNodeCount - READ-ONLY; The number of compute nodes currently assigned to the compute. + CurrentNodeCount *int32 `json:"currentNodeCount,omitempty"` + // 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. + TargetNodeCount *int32 `json:"targetNodeCount,omitempty"` + // NodeStateCounts - READ-ONLY; Counts of various node states on the compute. + NodeStateCounts *NodeStateCounts `json:"nodeStateCounts,omitempty"` + // EnableNodePublicIP - Enable or disable node public IP address provisioning. Possible values are: Possible values are: true - Indicates that the compute nodes will have public IPs provisioned. false - Indicates that the compute nodes will have a private endpoint and no public IPs. + EnableNodePublicIP *bool `json:"enableNodePublicIp,omitempty"` +} + +// MarshalJSON is the custom marshaler for AmlComputeProperties. +func (ac AmlComputeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ac.OsType != "" { + objectMap["osType"] = ac.OsType + } + if ac.VMSize != nil { + objectMap["vmSize"] = ac.VMSize + } + if ac.VMPriority != "" { + objectMap["vmPriority"] = ac.VMPriority + } + if ac.VirtualMachineImage != nil { + objectMap["virtualMachineImage"] = ac.VirtualMachineImage + } + if ac.IsolatedNetwork != nil { + objectMap["isolatedNetwork"] = ac.IsolatedNetwork + } + if ac.ScaleSettings != nil { + objectMap["scaleSettings"] = ac.ScaleSettings + } + if ac.UserAccountCredentials != nil { + objectMap["userAccountCredentials"] = ac.UserAccountCredentials + } + if ac.Subnet != nil { + objectMap["subnet"] = ac.Subnet + } + if ac.RemoteLoginPortPublicAccess != "" { + objectMap["remoteLoginPortPublicAccess"] = ac.RemoteLoginPortPublicAccess + } + if ac.EnableNodePublicIP != nil { + objectMap["enableNodePublicIp"] = ac.EnableNodePublicIP + } + return json.Marshal(objectMap) +} + +// AmlToken AML Token identity configuration. +type AmlToken struct { + // IdentityType - Possible values include: 'IdentityTypeIdentityConfiguration', 'IdentityTypeAMLToken', 'IdentityTypeManaged' + IdentityType IdentityType `json:"identityType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AmlToken. +func (at AmlToken) MarshalJSON() ([]byte, error) { + at.IdentityType = IdentityTypeAMLToken + objectMap := make(map[string]interface{}) + if at.IdentityType != "" { + objectMap["identityType"] = at.IdentityType + } + return json.Marshal(objectMap) +} + +// AsAmlToken is the BasicIdentityConfiguration implementation for AmlToken. +func (at AmlToken) AsAmlToken() (*AmlToken, bool) { + return &at, true +} + +// AsManagedIdentity is the BasicIdentityConfiguration implementation for AmlToken. +func (at AmlToken) AsManagedIdentity() (*ManagedIdentity, bool) { + return nil, false +} + +// AsIdentityConfiguration is the BasicIdentityConfiguration implementation for AmlToken. +func (at AmlToken) AsIdentityConfiguration() (*IdentityConfiguration, bool) { + return nil, false +} + +// AsBasicIdentityConfiguration is the BasicIdentityConfiguration implementation for AmlToken. +func (at AmlToken) AsBasicIdentityConfiguration() (BasicIdentityConfiguration, bool) { + return &at, true +} + +// AmlUserFeature features enabled for a workspace +type AmlUserFeature struct { + // ID - Specifies the feature ID + ID *string `json:"id,omitempty"` + // DisplayName - Specifies the feature name + DisplayName *string `json:"displayName,omitempty"` + // Description - Describes the feature for user experience + Description *string `json:"description,omitempty"` +} + +// BasicAssetReferenceBase base definition for asset references. +type BasicAssetReferenceBase interface { + AsDataPathAssetReference() (*DataPathAssetReference, bool) + AsIDAssetReference() (*IDAssetReference, bool) + AsOutputPathAssetReference() (*OutputPathAssetReference, bool) + AsAssetReferenceBase() (*AssetReferenceBase, bool) +} + +// AssetReferenceBase base definition for asset references. +type AssetReferenceBase struct { + // ReferenceType - Possible values include: 'ReferenceTypeAssetReferenceBase', 'ReferenceTypeDataPath', 'ReferenceTypeID', 'ReferenceTypeOutputPath' + ReferenceType ReferenceTypeBasicAssetReferenceBase `json:"referenceType,omitempty"` +} + +func unmarshalBasicAssetReferenceBase(body []byte) (BasicAssetReferenceBase, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["referenceType"] { + case string(ReferenceTypeDataPath): + var dpar DataPathAssetReference + err := json.Unmarshal(body, &dpar) + return dpar, err + case string(ReferenceTypeID): + var iar IDAssetReference + err := json.Unmarshal(body, &iar) + return iar, err + case string(ReferenceTypeOutputPath): + var opar OutputPathAssetReference + err := json.Unmarshal(body, &opar) + return opar, err + default: + var arb AssetReferenceBase + err := json.Unmarshal(body, &arb) + return arb, err + } +} +func unmarshalBasicAssetReferenceBaseArray(body []byte) ([]BasicAssetReferenceBase, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + arbArray := make([]BasicAssetReferenceBase, len(rawMessages)) + + for index, rawMessage := range rawMessages { + arb, err := unmarshalBasicAssetReferenceBase(*rawMessage) + if err != nil { + return nil, err + } + arbArray[index] = arb + } + return arbArray, nil +} + +// MarshalJSON is the custom marshaler for AssetReferenceBase. +func (arb AssetReferenceBase) MarshalJSON() ([]byte, error) { + arb.ReferenceType = ReferenceTypeAssetReferenceBase + objectMap := make(map[string]interface{}) + if arb.ReferenceType != "" { + objectMap["referenceType"] = arb.ReferenceType + } + return json.Marshal(objectMap) +} + +// AsDataPathAssetReference is the BasicAssetReferenceBase implementation for AssetReferenceBase. +func (arb AssetReferenceBase) AsDataPathAssetReference() (*DataPathAssetReference, bool) { + return nil, false +} + +// AsIDAssetReference is the BasicAssetReferenceBase implementation for AssetReferenceBase. +func (arb AssetReferenceBase) AsIDAssetReference() (*IDAssetReference, bool) { + return nil, false +} + +// AsOutputPathAssetReference is the BasicAssetReferenceBase implementation for AssetReferenceBase. +func (arb AssetReferenceBase) AsOutputPathAssetReference() (*OutputPathAssetReference, bool) { + return nil, false +} + +// AsAssetReferenceBase is the BasicAssetReferenceBase implementation for AssetReferenceBase. +func (arb AssetReferenceBase) AsAssetReferenceBase() (*AssetReferenceBase, bool) { + return &arb, true +} + +// AsBasicAssetReferenceBase is the BasicAssetReferenceBase implementation for AssetReferenceBase. +func (arb AssetReferenceBase) AsBasicAssetReferenceBase() (BasicAssetReferenceBase, bool) { + return &arb, true +} + +// AssignedUser a user that can be assigned to a compute instance. +type AssignedUser struct { + // ObjectID - User’s AAD Object Id. + ObjectID *string `json:"objectId,omitempty"` + // TenantID - User’s AAD Tenant Id. + TenantID *string `json:"tenantId,omitempty"` +} + +// AutoPauseProperties auto pause properties +type AutoPauseProperties struct { + DelayInMinutes *int32 `json:"delayInMinutes,omitempty"` + Enabled *bool `json:"enabled,omitempty"` +} + +// AutoScaleProperties auto scale properties +type AutoScaleProperties struct { + MinNodeCount *int32 `json:"minNodeCount,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + MaxNodeCount *int32 `json:"maxNodeCount,omitempty"` +} + +// AutoScaleSettings ... +type AutoScaleSettings struct { + // PollingInterval - The polling interval in ISO 8691 format. Only supports duration with precision as low as Seconds. + PollingInterval *string `json:"pollingInterval,omitempty"` + TargetUtilizationPercentage *int32 `json:"targetUtilizationPercentage,omitempty"` + MaxInstances *int32 `json:"maxInstances,omitempty"` + MinInstances *int32 `json:"minInstances,omitempty"` + // ScaleType - Possible values include: 'ScaleTypeOnlineScaleSettings', 'ScaleTypeAuto', 'ScaleTypeManual' + ScaleType ScaleTypeBasicOnlineScaleSettings `json:"scaleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutoScaleSettings. +func (ass AutoScaleSettings) MarshalJSON() ([]byte, error) { + ass.ScaleType = ScaleTypeAuto + objectMap := make(map[string]interface{}) + if ass.PollingInterval != nil { + objectMap["pollingInterval"] = ass.PollingInterval + } + if ass.TargetUtilizationPercentage != nil { + objectMap["targetUtilizationPercentage"] = ass.TargetUtilizationPercentage + } + if ass.MaxInstances != nil { + objectMap["maxInstances"] = ass.MaxInstances + } + if ass.MinInstances != nil { + objectMap["minInstances"] = ass.MinInstances + } + if ass.ScaleType != "" { + objectMap["scaleType"] = ass.ScaleType + } + return json.Marshal(objectMap) +} + +// AsAutoScaleSettings is the BasicOnlineScaleSettings implementation for AutoScaleSettings. +func (ass AutoScaleSettings) AsAutoScaleSettings() (*AutoScaleSettings, bool) { + return &ass, true +} + +// AsManualScaleSettings is the BasicOnlineScaleSettings implementation for AutoScaleSettings. +func (ass AutoScaleSettings) AsManualScaleSettings() (*ManualScaleSettings, bool) { + return nil, false +} + +// AsOnlineScaleSettings is the BasicOnlineScaleSettings implementation for AutoScaleSettings. +func (ass AutoScaleSettings) AsOnlineScaleSettings() (*OnlineScaleSettings, bool) { + return nil, false +} + +// AsBasicOnlineScaleSettings is the BasicOnlineScaleSettings implementation for AutoScaleSettings. +func (ass AutoScaleSettings) AsBasicOnlineScaleSettings() (BasicOnlineScaleSettings, bool) { + return &ass, true +} + +// AzureBlobContents azure Blob datastore configuration. +type AzureBlobContents struct { + // AccountName - Storage account name. + AccountName *string `json:"accountName,omitempty"` + // ContainerName - Storage account container name. + ContainerName *string `json:"containerName,omitempty"` + // Credentials - Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // Endpoint - Azure cloud endpoint for the storage account. + Endpoint *string `json:"endpoint,omitempty"` + // Protocol - Protocol used to communicate with the storage account. + Protocol *string `json:"protocol,omitempty"` + // ContentsType - Possible values include: 'ContentsTypeDatastoreContents', 'ContentsTypeAzureBlob', 'ContentsTypeAzureDataLakeGen1', 'ContentsTypeAzureDataLakeGen2', 'ContentsTypeAzureFile', 'ContentsTypeAzurePostgreSQL', 'ContentsTypeAzureSQLDatabase', 'ContentsTypeGlusterFs' + ContentsType ContentsTypeBasicDatastoreContents `json:"contentsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureBlobContents. +func (abc AzureBlobContents) MarshalJSON() ([]byte, error) { + abc.ContentsType = ContentsTypeAzureBlob + objectMap := make(map[string]interface{}) + if abc.AccountName != nil { + objectMap["accountName"] = abc.AccountName + } + if abc.ContainerName != nil { + objectMap["containerName"] = abc.ContainerName + } + objectMap["credentials"] = abc.Credentials + if abc.Endpoint != nil { + objectMap["endpoint"] = abc.Endpoint + } + if abc.Protocol != nil { + objectMap["protocol"] = abc.Protocol + } + if abc.ContentsType != "" { + objectMap["contentsType"] = abc.ContentsType + } + return json.Marshal(objectMap) +} + +// AsAzureBlobContents is the BasicDatastoreContents implementation for AzureBlobContents. +func (abc AzureBlobContents) AsAzureBlobContents() (*AzureBlobContents, bool) { + return &abc, true +} + +// AsAzureDataLakeGen1Contents is the BasicDatastoreContents implementation for AzureBlobContents. +func (abc AzureBlobContents) AsAzureDataLakeGen1Contents() (*AzureDataLakeGen1Contents, bool) { + return nil, false +} + +// AsAzureDataLakeGen2Contents is the BasicDatastoreContents implementation for AzureBlobContents. +func (abc AzureBlobContents) AsAzureDataLakeGen2Contents() (*AzureDataLakeGen2Contents, bool) { + return nil, false +} + +// AsAzureFileContents is the BasicDatastoreContents implementation for AzureBlobContents. +func (abc AzureBlobContents) AsAzureFileContents() (*AzureFileContents, bool) { + return nil, false +} + +// AsAzurePostgreSQLContents is the BasicDatastoreContents implementation for AzureBlobContents. +func (abc AzureBlobContents) AsAzurePostgreSQLContents() (*AzurePostgreSQLContents, bool) { + return nil, false +} + +// AsAzureSQLDatabaseContents is the BasicDatastoreContents implementation for AzureBlobContents. +func (abc AzureBlobContents) AsAzureSQLDatabaseContents() (*AzureSQLDatabaseContents, bool) { + return nil, false +} + +// AsGlusterFsContents is the BasicDatastoreContents implementation for AzureBlobContents. +func (abc AzureBlobContents) AsGlusterFsContents() (*GlusterFsContents, bool) { + return nil, false +} + +// AsDatastoreContents is the BasicDatastoreContents implementation for AzureBlobContents. +func (abc AzureBlobContents) AsDatastoreContents() (*DatastoreContents, bool) { + return nil, false +} + +// AsBasicDatastoreContents is the BasicDatastoreContents implementation for AzureBlobContents. +func (abc AzureBlobContents) AsBasicDatastoreContents() (BasicDatastoreContents, bool) { + return &abc, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureBlobContents struct. +func (abc *AzureBlobContents) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "accountName": + if v != nil { + var accountName string + err = json.Unmarshal(*v, &accountName) + if err != nil { + return err + } + abc.AccountName = &accountName + } + case "containerName": + if v != nil { + var containerName string + err = json.Unmarshal(*v, &containerName) + if err != nil { + return err + } + abc.ContainerName = &containerName + } + case "credentials": + if v != nil { + credentials, err := unmarshalBasicDatastoreCredentials(*v) + if err != nil { + return err + } + abc.Credentials = credentials + } + case "endpoint": + if v != nil { + var endpoint string + err = json.Unmarshal(*v, &endpoint) + if err != nil { + return err + } + abc.Endpoint = &endpoint + } + case "protocol": + if v != nil { + var protocol string + err = json.Unmarshal(*v, &protocol) + if err != nil { + return err + } + abc.Protocol = &protocol + } + case "contentsType": + if v != nil { + var contentsType ContentsTypeBasicDatastoreContents + err = json.Unmarshal(*v, &contentsType) + if err != nil { + return err + } + abc.ContentsType = contentsType + } + } + } + + return nil +} + +// AzureDataLakeGen1Contents azure Data Lake Gen1 datastore configuration. +type AzureDataLakeGen1Contents struct { + // Credentials - Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // StoreName - Azure Data Lake store name. + StoreName *string `json:"storeName,omitempty"` + // ContentsType - Possible values include: 'ContentsTypeDatastoreContents', 'ContentsTypeAzureBlob', 'ContentsTypeAzureDataLakeGen1', 'ContentsTypeAzureDataLakeGen2', 'ContentsTypeAzureFile', 'ContentsTypeAzurePostgreSQL', 'ContentsTypeAzureSQLDatabase', 'ContentsTypeGlusterFs' + ContentsType ContentsTypeBasicDatastoreContents `json:"contentsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureDataLakeGen1Contents. +func (adlg1c AzureDataLakeGen1Contents) MarshalJSON() ([]byte, error) { + adlg1c.ContentsType = ContentsTypeAzureDataLakeGen1 + objectMap := make(map[string]interface{}) + objectMap["credentials"] = adlg1c.Credentials + if adlg1c.StoreName != nil { + objectMap["storeName"] = adlg1c.StoreName + } + if adlg1c.ContentsType != "" { + objectMap["contentsType"] = adlg1c.ContentsType + } + return json.Marshal(objectMap) +} + +// AsAzureBlobContents is the BasicDatastoreContents implementation for AzureDataLakeGen1Contents. +func (adlg1c AzureDataLakeGen1Contents) AsAzureBlobContents() (*AzureBlobContents, bool) { + return nil, false +} + +// AsAzureDataLakeGen1Contents is the BasicDatastoreContents implementation for AzureDataLakeGen1Contents. +func (adlg1c AzureDataLakeGen1Contents) AsAzureDataLakeGen1Contents() (*AzureDataLakeGen1Contents, bool) { + return &adlg1c, true +} + +// AsAzureDataLakeGen2Contents is the BasicDatastoreContents implementation for AzureDataLakeGen1Contents. +func (adlg1c AzureDataLakeGen1Contents) AsAzureDataLakeGen2Contents() (*AzureDataLakeGen2Contents, bool) { + return nil, false +} + +// AsAzureFileContents is the BasicDatastoreContents implementation for AzureDataLakeGen1Contents. +func (adlg1c AzureDataLakeGen1Contents) AsAzureFileContents() (*AzureFileContents, bool) { + return nil, false +} + +// AsAzurePostgreSQLContents is the BasicDatastoreContents implementation for AzureDataLakeGen1Contents. +func (adlg1c AzureDataLakeGen1Contents) AsAzurePostgreSQLContents() (*AzurePostgreSQLContents, bool) { + return nil, false +} + +// AsAzureSQLDatabaseContents is the BasicDatastoreContents implementation for AzureDataLakeGen1Contents. +func (adlg1c AzureDataLakeGen1Contents) AsAzureSQLDatabaseContents() (*AzureSQLDatabaseContents, bool) { + return nil, false +} + +// AsGlusterFsContents is the BasicDatastoreContents implementation for AzureDataLakeGen1Contents. +func (adlg1c AzureDataLakeGen1Contents) AsGlusterFsContents() (*GlusterFsContents, bool) { + return nil, false +} + +// AsDatastoreContents is the BasicDatastoreContents implementation for AzureDataLakeGen1Contents. +func (adlg1c AzureDataLakeGen1Contents) AsDatastoreContents() (*DatastoreContents, bool) { + return nil, false +} + +// AsBasicDatastoreContents is the BasicDatastoreContents implementation for AzureDataLakeGen1Contents. +func (adlg1c AzureDataLakeGen1Contents) AsBasicDatastoreContents() (BasicDatastoreContents, bool) { + return &adlg1c, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureDataLakeGen1Contents struct. +func (adlg1c *AzureDataLakeGen1Contents) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "credentials": + if v != nil { + credentials, err := unmarshalBasicDatastoreCredentials(*v) + if err != nil { + return err + } + adlg1c.Credentials = credentials + } + case "storeName": + if v != nil { + var storeName string + err = json.Unmarshal(*v, &storeName) + if err != nil { + return err + } + adlg1c.StoreName = &storeName + } + case "contentsType": + if v != nil { + var contentsType ContentsTypeBasicDatastoreContents + err = json.Unmarshal(*v, &contentsType) + if err != nil { + return err + } + adlg1c.ContentsType = contentsType + } + } + } + + return nil +} + +// AzureDataLakeGen2Contents azure Data Lake Gen2 datastore configuration. +type AzureDataLakeGen2Contents struct { + // AccountName - Storage account name. + AccountName *string `json:"accountName,omitempty"` + // ContainerName - Storage account container name. + ContainerName *string `json:"containerName,omitempty"` + // Credentials - Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // Endpoint - Azure cloud endpoint for the storage account. + Endpoint *string `json:"endpoint,omitempty"` + // Protocol - Protocol used to communicate with the storage account. + Protocol *string `json:"protocol,omitempty"` + // ContentsType - Possible values include: 'ContentsTypeDatastoreContents', 'ContentsTypeAzureBlob', 'ContentsTypeAzureDataLakeGen1', 'ContentsTypeAzureDataLakeGen2', 'ContentsTypeAzureFile', 'ContentsTypeAzurePostgreSQL', 'ContentsTypeAzureSQLDatabase', 'ContentsTypeGlusterFs' + ContentsType ContentsTypeBasicDatastoreContents `json:"contentsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureDataLakeGen2Contents. +func (adlg2c AzureDataLakeGen2Contents) MarshalJSON() ([]byte, error) { + adlg2c.ContentsType = ContentsTypeAzureDataLakeGen2 + objectMap := make(map[string]interface{}) + if adlg2c.AccountName != nil { + objectMap["accountName"] = adlg2c.AccountName + } + if adlg2c.ContainerName != nil { + objectMap["containerName"] = adlg2c.ContainerName + } + objectMap["credentials"] = adlg2c.Credentials + if adlg2c.Endpoint != nil { + objectMap["endpoint"] = adlg2c.Endpoint + } + if adlg2c.Protocol != nil { + objectMap["protocol"] = adlg2c.Protocol + } + if adlg2c.ContentsType != "" { + objectMap["contentsType"] = adlg2c.ContentsType + } + return json.Marshal(objectMap) +} + +// AsAzureBlobContents is the BasicDatastoreContents implementation for AzureDataLakeGen2Contents. +func (adlg2c AzureDataLakeGen2Contents) AsAzureBlobContents() (*AzureBlobContents, bool) { + return nil, false +} + +// AsAzureDataLakeGen1Contents is the BasicDatastoreContents implementation for AzureDataLakeGen2Contents. +func (adlg2c AzureDataLakeGen2Contents) AsAzureDataLakeGen1Contents() (*AzureDataLakeGen1Contents, bool) { + return nil, false +} + +// AsAzureDataLakeGen2Contents is the BasicDatastoreContents implementation for AzureDataLakeGen2Contents. +func (adlg2c AzureDataLakeGen2Contents) AsAzureDataLakeGen2Contents() (*AzureDataLakeGen2Contents, bool) { + return &adlg2c, true +} + +// AsAzureFileContents is the BasicDatastoreContents implementation for AzureDataLakeGen2Contents. +func (adlg2c AzureDataLakeGen2Contents) AsAzureFileContents() (*AzureFileContents, bool) { + return nil, false +} + +// AsAzurePostgreSQLContents is the BasicDatastoreContents implementation for AzureDataLakeGen2Contents. +func (adlg2c AzureDataLakeGen2Contents) AsAzurePostgreSQLContents() (*AzurePostgreSQLContents, bool) { + return nil, false +} + +// AsAzureSQLDatabaseContents is the BasicDatastoreContents implementation for AzureDataLakeGen2Contents. +func (adlg2c AzureDataLakeGen2Contents) AsAzureSQLDatabaseContents() (*AzureSQLDatabaseContents, bool) { + return nil, false +} + +// AsGlusterFsContents is the BasicDatastoreContents implementation for AzureDataLakeGen2Contents. +func (adlg2c AzureDataLakeGen2Contents) AsGlusterFsContents() (*GlusterFsContents, bool) { + return nil, false +} + +// AsDatastoreContents is the BasicDatastoreContents implementation for AzureDataLakeGen2Contents. +func (adlg2c AzureDataLakeGen2Contents) AsDatastoreContents() (*DatastoreContents, bool) { + return nil, false +} + +// AsBasicDatastoreContents is the BasicDatastoreContents implementation for AzureDataLakeGen2Contents. +func (adlg2c AzureDataLakeGen2Contents) AsBasicDatastoreContents() (BasicDatastoreContents, bool) { + return &adlg2c, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureDataLakeGen2Contents struct. +func (adlg2c *AzureDataLakeGen2Contents) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "accountName": + if v != nil { + var accountName string + err = json.Unmarshal(*v, &accountName) + if err != nil { + return err + } + adlg2c.AccountName = &accountName + } + case "containerName": + if v != nil { + var containerName string + err = json.Unmarshal(*v, &containerName) + if err != nil { + return err + } + adlg2c.ContainerName = &containerName + } + case "credentials": + if v != nil { + credentials, err := unmarshalBasicDatastoreCredentials(*v) + if err != nil { + return err + } + adlg2c.Credentials = credentials + } + case "endpoint": + if v != nil { + var endpoint string + err = json.Unmarshal(*v, &endpoint) + if err != nil { + return err + } + adlg2c.Endpoint = &endpoint + } + case "protocol": + if v != nil { + var protocol string + err = json.Unmarshal(*v, &protocol) + if err != nil { + return err + } + adlg2c.Protocol = &protocol + } + case "contentsType": + if v != nil { + var contentsType ContentsTypeBasicDatastoreContents + err = json.Unmarshal(*v, &contentsType) + if err != nil { + return err + } + adlg2c.ContentsType = contentsType + } + } + } + + return nil +} + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureFileContents azure File datastore configuration. +type AzureFileContents struct { + // AccountName - Storage account name. + AccountName *string `json:"accountName,omitempty"` + // ContainerName - Storage account container name. + ContainerName *string `json:"containerName,omitempty"` + // Credentials - Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // Endpoint - Azure cloud endpoint for the storage account. + Endpoint *string `json:"endpoint,omitempty"` + // Protocol - Protocol used to communicate with the storage account. + Protocol *string `json:"protocol,omitempty"` + // ContentsType - Possible values include: 'ContentsTypeDatastoreContents', 'ContentsTypeAzureBlob', 'ContentsTypeAzureDataLakeGen1', 'ContentsTypeAzureDataLakeGen2', 'ContentsTypeAzureFile', 'ContentsTypeAzurePostgreSQL', 'ContentsTypeAzureSQLDatabase', 'ContentsTypeGlusterFs' + ContentsType ContentsTypeBasicDatastoreContents `json:"contentsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFileContents. +func (afc AzureFileContents) MarshalJSON() ([]byte, error) { + afc.ContentsType = ContentsTypeAzureFile + objectMap := make(map[string]interface{}) + if afc.AccountName != nil { + objectMap["accountName"] = afc.AccountName + } + if afc.ContainerName != nil { + objectMap["containerName"] = afc.ContainerName + } + objectMap["credentials"] = afc.Credentials + if afc.Endpoint != nil { + objectMap["endpoint"] = afc.Endpoint + } + if afc.Protocol != nil { + objectMap["protocol"] = afc.Protocol + } + if afc.ContentsType != "" { + objectMap["contentsType"] = afc.ContentsType + } + return json.Marshal(objectMap) +} + +// AsAzureBlobContents is the BasicDatastoreContents implementation for AzureFileContents. +func (afc AzureFileContents) AsAzureBlobContents() (*AzureBlobContents, bool) { + return nil, false +} + +// AsAzureDataLakeGen1Contents is the BasicDatastoreContents implementation for AzureFileContents. +func (afc AzureFileContents) AsAzureDataLakeGen1Contents() (*AzureDataLakeGen1Contents, bool) { + return nil, false +} + +// AsAzureDataLakeGen2Contents is the BasicDatastoreContents implementation for AzureFileContents. +func (afc AzureFileContents) AsAzureDataLakeGen2Contents() (*AzureDataLakeGen2Contents, bool) { + return nil, false +} + +// AsAzureFileContents is the BasicDatastoreContents implementation for AzureFileContents. +func (afc AzureFileContents) AsAzureFileContents() (*AzureFileContents, bool) { + return &afc, true +} + +// AsAzurePostgreSQLContents is the BasicDatastoreContents implementation for AzureFileContents. +func (afc AzureFileContents) AsAzurePostgreSQLContents() (*AzurePostgreSQLContents, bool) { + return nil, false +} + +// AsAzureSQLDatabaseContents is the BasicDatastoreContents implementation for AzureFileContents. +func (afc AzureFileContents) AsAzureSQLDatabaseContents() (*AzureSQLDatabaseContents, bool) { + return nil, false +} + +// AsGlusterFsContents is the BasicDatastoreContents implementation for AzureFileContents. +func (afc AzureFileContents) AsGlusterFsContents() (*GlusterFsContents, bool) { + return nil, false +} + +// AsDatastoreContents is the BasicDatastoreContents implementation for AzureFileContents. +func (afc AzureFileContents) AsDatastoreContents() (*DatastoreContents, bool) { + return nil, false +} + +// AsBasicDatastoreContents is the BasicDatastoreContents implementation for AzureFileContents. +func (afc AzureFileContents) AsBasicDatastoreContents() (BasicDatastoreContents, bool) { + return &afc, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureFileContents struct. +func (afc *AzureFileContents) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "accountName": + if v != nil { + var accountName string + err = json.Unmarshal(*v, &accountName) + if err != nil { + return err + } + afc.AccountName = &accountName + } + case "containerName": + if v != nil { + var containerName string + err = json.Unmarshal(*v, &containerName) + if err != nil { + return err + } + afc.ContainerName = &containerName + } + case "credentials": + if v != nil { + credentials, err := unmarshalBasicDatastoreCredentials(*v) + if err != nil { + return err + } + afc.Credentials = credentials + } + case "endpoint": + if v != nil { + var endpoint string + err = json.Unmarshal(*v, &endpoint) + if err != nil { + return err + } + afc.Endpoint = &endpoint + } + case "protocol": + if v != nil { + var protocol string + err = json.Unmarshal(*v, &protocol) + if err != nil { + return err + } + afc.Protocol = &protocol + } + case "contentsType": + if v != nil { + var contentsType ContentsTypeBasicDatastoreContents + err = json.Unmarshal(*v, &contentsType) + if err != nil { + return err + } + afc.ContentsType = contentsType + } + } + } + + return nil +} + +// AzurePostgreSQLContents azure Postgre SQL datastore configuration. +type AzurePostgreSQLContents struct { + // Credentials - Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // DatabaseName - Azure SQL database name. + DatabaseName *string `json:"databaseName,omitempty"` + // EnableSSL - Whether the Azure PostgreSQL server requires SSL. + EnableSSL *bool `json:"enableSSL,omitempty"` + // Endpoint - Azure cloud endpoint for the database. + Endpoint *string `json:"endpoint,omitempty"` + // PortNumber - Azure SQL server port. + PortNumber *int32 `json:"portNumber,omitempty"` + // ServerName - Azure SQL server name. + ServerName *string `json:"serverName,omitempty"` + // ContentsType - Possible values include: 'ContentsTypeDatastoreContents', 'ContentsTypeAzureBlob', 'ContentsTypeAzureDataLakeGen1', 'ContentsTypeAzureDataLakeGen2', 'ContentsTypeAzureFile', 'ContentsTypeAzurePostgreSQL', 'ContentsTypeAzureSQLDatabase', 'ContentsTypeGlusterFs' + ContentsType ContentsTypeBasicDatastoreContents `json:"contentsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzurePostgreSQLContents. +func (apsc AzurePostgreSQLContents) MarshalJSON() ([]byte, error) { + apsc.ContentsType = ContentsTypeAzurePostgreSQL + objectMap := make(map[string]interface{}) + objectMap["credentials"] = apsc.Credentials + if apsc.DatabaseName != nil { + objectMap["databaseName"] = apsc.DatabaseName + } + if apsc.EnableSSL != nil { + objectMap["enableSSL"] = apsc.EnableSSL + } + if apsc.Endpoint != nil { + objectMap["endpoint"] = apsc.Endpoint + } + if apsc.PortNumber != nil { + objectMap["portNumber"] = apsc.PortNumber + } + if apsc.ServerName != nil { + objectMap["serverName"] = apsc.ServerName + } + if apsc.ContentsType != "" { + objectMap["contentsType"] = apsc.ContentsType + } + return json.Marshal(objectMap) +} + +// AsAzureBlobContents is the BasicDatastoreContents implementation for AzurePostgreSQLContents. +func (apsc AzurePostgreSQLContents) AsAzureBlobContents() (*AzureBlobContents, bool) { + return nil, false +} + +// AsAzureDataLakeGen1Contents is the BasicDatastoreContents implementation for AzurePostgreSQLContents. +func (apsc AzurePostgreSQLContents) AsAzureDataLakeGen1Contents() (*AzureDataLakeGen1Contents, bool) { + return nil, false +} + +// AsAzureDataLakeGen2Contents is the BasicDatastoreContents implementation for AzurePostgreSQLContents. +func (apsc AzurePostgreSQLContents) AsAzureDataLakeGen2Contents() (*AzureDataLakeGen2Contents, bool) { + return nil, false +} + +// AsAzureFileContents is the BasicDatastoreContents implementation for AzurePostgreSQLContents. +func (apsc AzurePostgreSQLContents) AsAzureFileContents() (*AzureFileContents, bool) { + return nil, false +} + +// AsAzurePostgreSQLContents is the BasicDatastoreContents implementation for AzurePostgreSQLContents. +func (apsc AzurePostgreSQLContents) AsAzurePostgreSQLContents() (*AzurePostgreSQLContents, bool) { + return &apsc, true +} + +// AsAzureSQLDatabaseContents is the BasicDatastoreContents implementation for AzurePostgreSQLContents. +func (apsc AzurePostgreSQLContents) AsAzureSQLDatabaseContents() (*AzureSQLDatabaseContents, bool) { + return nil, false +} + +// AsGlusterFsContents is the BasicDatastoreContents implementation for AzurePostgreSQLContents. +func (apsc AzurePostgreSQLContents) AsGlusterFsContents() (*GlusterFsContents, bool) { + return nil, false +} + +// AsDatastoreContents is the BasicDatastoreContents implementation for AzurePostgreSQLContents. +func (apsc AzurePostgreSQLContents) AsDatastoreContents() (*DatastoreContents, bool) { + return nil, false +} + +// AsBasicDatastoreContents is the BasicDatastoreContents implementation for AzurePostgreSQLContents. +func (apsc AzurePostgreSQLContents) AsBasicDatastoreContents() (BasicDatastoreContents, bool) { + return &apsc, true +} + +// UnmarshalJSON is the custom unmarshaler for AzurePostgreSQLContents struct. +func (apsc *AzurePostgreSQLContents) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "credentials": + if v != nil { + credentials, err := unmarshalBasicDatastoreCredentials(*v) + if err != nil { + return err + } + apsc.Credentials = credentials + } + case "databaseName": + if v != nil { + var databaseName string + err = json.Unmarshal(*v, &databaseName) + if err != nil { + return err + } + apsc.DatabaseName = &databaseName + } + case "enableSSL": + if v != nil { + var enableSSL bool + err = json.Unmarshal(*v, &enableSSL) + if err != nil { + return err + } + apsc.EnableSSL = &enableSSL + } + case "endpoint": + if v != nil { + var endpoint string + err = json.Unmarshal(*v, &endpoint) + if err != nil { + return err + } + apsc.Endpoint = &endpoint + } + case "portNumber": + if v != nil { + var portNumber int32 + err = json.Unmarshal(*v, &portNumber) + if err != nil { + return err + } + apsc.PortNumber = &portNumber + } + case "serverName": + if v != nil { + var serverName string + err = json.Unmarshal(*v, &serverName) + if err != nil { + return err + } + apsc.ServerName = &serverName + } + case "contentsType": + if v != nil { + var contentsType ContentsTypeBasicDatastoreContents + err = json.Unmarshal(*v, &contentsType) + if err != nil { + return err + } + apsc.ContentsType = contentsType + } + } + } + + return nil +} + +// AzureSQLDatabaseContents azure SQL Database datastore configuration. +type AzureSQLDatabaseContents struct { + // Credentials - Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // DatabaseName - Azure SQL database name. + DatabaseName *string `json:"databaseName,omitempty"` + // Endpoint - Azure cloud endpoint for the database. + Endpoint *string `json:"endpoint,omitempty"` + // PortNumber - Azure SQL server port. + PortNumber *int32 `json:"portNumber,omitempty"` + // ServerName - Azure SQL server name. + ServerName *string `json:"serverName,omitempty"` + // ContentsType - Possible values include: 'ContentsTypeDatastoreContents', 'ContentsTypeAzureBlob', 'ContentsTypeAzureDataLakeGen1', 'ContentsTypeAzureDataLakeGen2', 'ContentsTypeAzureFile', 'ContentsTypeAzurePostgreSQL', 'ContentsTypeAzureSQLDatabase', 'ContentsTypeGlusterFs' + ContentsType ContentsTypeBasicDatastoreContents `json:"contentsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureSQLDatabaseContents. +func (asdc AzureSQLDatabaseContents) MarshalJSON() ([]byte, error) { + asdc.ContentsType = ContentsTypeAzureSQLDatabase + objectMap := make(map[string]interface{}) + objectMap["credentials"] = asdc.Credentials + if asdc.DatabaseName != nil { + objectMap["databaseName"] = asdc.DatabaseName + } + if asdc.Endpoint != nil { + objectMap["endpoint"] = asdc.Endpoint + } + if asdc.PortNumber != nil { + objectMap["portNumber"] = asdc.PortNumber + } + if asdc.ServerName != nil { + objectMap["serverName"] = asdc.ServerName + } + if asdc.ContentsType != "" { + objectMap["contentsType"] = asdc.ContentsType + } + return json.Marshal(objectMap) +} + +// AsAzureBlobContents is the BasicDatastoreContents implementation for AzureSQLDatabaseContents. +func (asdc AzureSQLDatabaseContents) AsAzureBlobContents() (*AzureBlobContents, bool) { + return nil, false +} + +// AsAzureDataLakeGen1Contents is the BasicDatastoreContents implementation for AzureSQLDatabaseContents. +func (asdc AzureSQLDatabaseContents) AsAzureDataLakeGen1Contents() (*AzureDataLakeGen1Contents, bool) { + return nil, false +} + +// AsAzureDataLakeGen2Contents is the BasicDatastoreContents implementation for AzureSQLDatabaseContents. +func (asdc AzureSQLDatabaseContents) AsAzureDataLakeGen2Contents() (*AzureDataLakeGen2Contents, bool) { + return nil, false +} + +// AsAzureFileContents is the BasicDatastoreContents implementation for AzureSQLDatabaseContents. +func (asdc AzureSQLDatabaseContents) AsAzureFileContents() (*AzureFileContents, bool) { + return nil, false +} + +// AsAzurePostgreSQLContents is the BasicDatastoreContents implementation for AzureSQLDatabaseContents. +func (asdc AzureSQLDatabaseContents) AsAzurePostgreSQLContents() (*AzurePostgreSQLContents, bool) { + return nil, false +} + +// AsAzureSQLDatabaseContents is the BasicDatastoreContents implementation for AzureSQLDatabaseContents. +func (asdc AzureSQLDatabaseContents) AsAzureSQLDatabaseContents() (*AzureSQLDatabaseContents, bool) { + return &asdc, true +} + +// AsGlusterFsContents is the BasicDatastoreContents implementation for AzureSQLDatabaseContents. +func (asdc AzureSQLDatabaseContents) AsGlusterFsContents() (*GlusterFsContents, bool) { + return nil, false +} + +// AsDatastoreContents is the BasicDatastoreContents implementation for AzureSQLDatabaseContents. +func (asdc AzureSQLDatabaseContents) AsDatastoreContents() (*DatastoreContents, bool) { + return nil, false +} + +// AsBasicDatastoreContents is the BasicDatastoreContents implementation for AzureSQLDatabaseContents. +func (asdc AzureSQLDatabaseContents) AsBasicDatastoreContents() (BasicDatastoreContents, bool) { + return &asdc, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureSQLDatabaseContents struct. +func (asdc *AzureSQLDatabaseContents) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "credentials": + if v != nil { + credentials, err := unmarshalBasicDatastoreCredentials(*v) + if err != nil { + return err + } + asdc.Credentials = credentials + } + case "databaseName": + if v != nil { + var databaseName string + err = json.Unmarshal(*v, &databaseName) + if err != nil { + return err + } + asdc.DatabaseName = &databaseName + } + case "endpoint": + if v != nil { + var endpoint string + err = json.Unmarshal(*v, &endpoint) + if err != nil { + return err + } + asdc.Endpoint = &endpoint + } + case "portNumber": + if v != nil { + var portNumber int32 + err = json.Unmarshal(*v, &portNumber) + if err != nil { + return err + } + asdc.PortNumber = &portNumber + } + case "serverName": + if v != nil { + var serverName string + err = json.Unmarshal(*v, &serverName) + if err != nil { + return err + } + asdc.ServerName = &serverName + } + case "contentsType": + if v != nil { + var contentsType ContentsTypeBasicDatastoreContents + err = json.Unmarshal(*v, &contentsType) + if err != nil { + return err + } + asdc.ContentsType = contentsType + } + } + } + + return nil +} + +// BanditPolicy defines an early termination policy based on slack criteria, and a frequency and delay +// interval for evaluation +type BanditPolicy struct { + SlackAmount *float64 `json:"slackAmount,omitempty"` + SlackFactor *float64 `json:"slackFactor,omitempty"` + DelayEvaluation *int32 `json:"delayEvaluation,omitempty"` + EvaluationInterval *int32 `json:"evaluationInterval,omitempty"` + // PolicyType - Possible values include: 'PolicyTypeEarlyTerminationPolicy', 'PolicyTypeBandit', 'PolicyTypeMedianStopping', 'PolicyTypeTruncationSelection' + PolicyType PolicyType `json:"policyType,omitempty"` +} + +// MarshalJSON is the custom marshaler for BanditPolicy. +func (bp BanditPolicy) MarshalJSON() ([]byte, error) { + bp.PolicyType = PolicyTypeBandit + objectMap := make(map[string]interface{}) + if bp.SlackAmount != nil { + objectMap["slackAmount"] = bp.SlackAmount + } + if bp.SlackFactor != nil { + objectMap["slackFactor"] = bp.SlackFactor + } + if bp.DelayEvaluation != nil { + objectMap["delayEvaluation"] = bp.DelayEvaluation + } + if bp.EvaluationInterval != nil { + objectMap["evaluationInterval"] = bp.EvaluationInterval + } + if bp.PolicyType != "" { + objectMap["policyType"] = bp.PolicyType + } + return json.Marshal(objectMap) +} + +// AsBanditPolicy is the BasicEarlyTerminationPolicy implementation for BanditPolicy. +func (bp BanditPolicy) AsBanditPolicy() (*BanditPolicy, bool) { + return &bp, true +} + +// AsMedianStoppingPolicy is the BasicEarlyTerminationPolicy implementation for BanditPolicy. +func (bp BanditPolicy) AsMedianStoppingPolicy() (*MedianStoppingPolicy, bool) { + return nil, false +} + +// AsTruncationSelectionPolicy is the BasicEarlyTerminationPolicy implementation for BanditPolicy. +func (bp BanditPolicy) AsTruncationSelectionPolicy() (*TruncationSelectionPolicy, bool) { + return nil, false +} + +// AsEarlyTerminationPolicy is the BasicEarlyTerminationPolicy implementation for BanditPolicy. +func (bp BanditPolicy) AsEarlyTerminationPolicy() (*EarlyTerminationPolicy, bool) { + return nil, false +} + +// AsBasicEarlyTerminationPolicy is the BasicEarlyTerminationPolicy implementation for BanditPolicy. +func (bp BanditPolicy) AsBasicEarlyTerminationPolicy() (BasicEarlyTerminationPolicy, bool) { + return &bp, true +} + +// BatchDeployment batch inference settings per deployment. +type BatchDeployment struct { + // CodeConfiguration - Code configuration for the endpoint deployment. + CodeConfiguration *CodeConfiguration `json:"codeConfiguration,omitempty"` + // Compute - Configuration for compute binding. + Compute *ComputeConfiguration `json:"compute,omitempty"` + // Description - Description of the endpoint deployment. + Description *string `json:"description,omitempty"` + // EnvironmentID - ARM resource ID of the environment specification for the endpoint deployment. + EnvironmentID *string `json:"environmentId,omitempty"` + // EnvironmentVariables - Environment variables configuration for the deployment. + EnvironmentVariables map[string]*string `json:"environmentVariables"` + // ErrorThreshold - Error threshold, if the error count for the entire input goes above this value, + // the batch inference will be aborted. Range is [-1, int.MaxValue]. + // For FileDataset, this value is the count of file failures. + // For TabularDataset, this value is the count of record failures. + // If set to -1 (the lower bound), all failures during batch inference will be ignored. + ErrorThreshold *int32 `json:"errorThreshold,omitempty"` + // LoggingLevel - Logging level for batch inference operation. Possible values include: 'Info', 'Warning', 'Debug' + LoggingLevel BatchLoggingLevel `json:"loggingLevel,omitempty"` + // MiniBatchSize - Size of the mini-batch passed to each batch invocation. + // For FileDataset, this is the number of files per mini-batch. + // For TabularDataset, this is the size of the records in bytes, per mini-batch. + MiniBatchSize *int64 `json:"miniBatchSize,omitempty"` + // Model - Reference to the model asset for the endpoint deployment. + Model BasicAssetReferenceBase `json:"model,omitempty"` + // OutputConfiguration - Output configuration for the batch inference operation. + OutputConfiguration *BatchOutputConfiguration `json:"outputConfiguration,omitempty"` + // PartitionKeys - Partition keys list used for Named partitioning. + PartitionKeys *[]string `json:"partitionKeys,omitempty"` + // Properties - Property dictionary. Properties can be added, but not removed or altered. + Properties map[string]*string `json:"properties"` + // RetrySettings - Retry Settings for the batch inference operation. + RetrySettings *BatchRetrySettings `json:"retrySettings,omitempty"` +} + +// MarshalJSON is the custom marshaler for BatchDeployment. +func (bd BatchDeployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bd.CodeConfiguration != nil { + objectMap["codeConfiguration"] = bd.CodeConfiguration + } + if bd.Compute != nil { + objectMap["compute"] = bd.Compute + } + if bd.Description != nil { + objectMap["description"] = bd.Description + } + if bd.EnvironmentID != nil { + objectMap["environmentId"] = bd.EnvironmentID + } + if bd.EnvironmentVariables != nil { + objectMap["environmentVariables"] = bd.EnvironmentVariables + } + if bd.ErrorThreshold != nil { + objectMap["errorThreshold"] = bd.ErrorThreshold + } + if bd.LoggingLevel != "" { + objectMap["loggingLevel"] = bd.LoggingLevel + } + if bd.MiniBatchSize != nil { + objectMap["miniBatchSize"] = bd.MiniBatchSize + } + objectMap["model"] = bd.Model + if bd.OutputConfiguration != nil { + objectMap["outputConfiguration"] = bd.OutputConfiguration + } + if bd.PartitionKeys != nil { + objectMap["partitionKeys"] = bd.PartitionKeys + } + if bd.Properties != nil { + objectMap["properties"] = bd.Properties + } + if bd.RetrySettings != nil { + objectMap["retrySettings"] = bd.RetrySettings + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BatchDeployment struct. +func (bd *BatchDeployment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "codeConfiguration": + if v != nil { + var codeConfiguration CodeConfiguration + err = json.Unmarshal(*v, &codeConfiguration) + if err != nil { + return err + } + bd.CodeConfiguration = &codeConfiguration + } + case "compute": + if v != nil { + var compute ComputeConfiguration + err = json.Unmarshal(*v, &compute) + if err != nil { + return err + } + bd.Compute = &compute + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + bd.Description = &description + } + case "environmentId": + if v != nil { + var environmentID string + err = json.Unmarshal(*v, &environmentID) + if err != nil { + return err + } + bd.EnvironmentID = &environmentID + } + case "environmentVariables": + if v != nil { + var environmentVariables map[string]*string + err = json.Unmarshal(*v, &environmentVariables) + if err != nil { + return err + } + bd.EnvironmentVariables = environmentVariables + } + case "errorThreshold": + if v != nil { + var errorThreshold int32 + err = json.Unmarshal(*v, &errorThreshold) + if err != nil { + return err + } + bd.ErrorThreshold = &errorThreshold + } + case "loggingLevel": + if v != nil { + var loggingLevel BatchLoggingLevel + err = json.Unmarshal(*v, &loggingLevel) + if err != nil { + return err + } + bd.LoggingLevel = loggingLevel + } + case "miniBatchSize": + if v != nil { + var miniBatchSize int64 + err = json.Unmarshal(*v, &miniBatchSize) + if err != nil { + return err + } + bd.MiniBatchSize = &miniBatchSize + } + case "model": + if v != nil { + model, err := unmarshalBasicAssetReferenceBase(*v) + if err != nil { + return err + } + bd.Model = model + } + case "outputConfiguration": + if v != nil { + var outputConfiguration BatchOutputConfiguration + err = json.Unmarshal(*v, &outputConfiguration) + if err != nil { + return err + } + bd.OutputConfiguration = &outputConfiguration + } + case "partitionKeys": + if v != nil { + var partitionKeys []string + err = json.Unmarshal(*v, &partitionKeys) + if err != nil { + return err + } + bd.PartitionKeys = &partitionKeys + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + bd.Properties = properties + } + case "retrySettings": + if v != nil { + var retrySettings BatchRetrySettings + err = json.Unmarshal(*v, &retrySettings) + if err != nil { + return err + } + bd.RetrySettings = &retrySettings + } + } + } + + return nil +} + +// BatchDeploymentTrackedResource ... +type BatchDeploymentTrackedResource struct { + autorest.Response `json:"-"` + // Identity - Service identity associated with a resource. + Identity *ResourceIdentity `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + // Properties - Additional attributes of the entity. + Properties *BatchDeployment `json:"properties,omitempty"` + // SystemData - READ-ONLY; System data associated with resource provider + SystemData *SystemData `json:"systemData,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for BatchDeploymentTrackedResource. +func (bdtr BatchDeploymentTrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bdtr.Identity != nil { + objectMap["identity"] = bdtr.Identity + } + if bdtr.Kind != nil { + objectMap["kind"] = bdtr.Kind + } + if bdtr.Properties != nil { + objectMap["properties"] = bdtr.Properties + } + if bdtr.Tags != nil { + objectMap["tags"] = bdtr.Tags + } + if bdtr.Location != nil { + objectMap["location"] = bdtr.Location + } + return json.Marshal(objectMap) +} + +// BatchDeploymentTrackedResourceArmPaginatedResult a paginated list of BatchDeployment entities. +type BatchDeploymentTrackedResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type BatchDeployment. + Value *[]BatchDeploymentTrackedResource `json:"value,omitempty"` +} + +// BatchDeploymentTrackedResourceArmPaginatedResultIterator provides access to a complete listing of +// BatchDeploymentTrackedResource values. +type BatchDeploymentTrackedResourceArmPaginatedResultIterator struct { + i int + page BatchDeploymentTrackedResourceArmPaginatedResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BatchDeploymentTrackedResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchDeploymentTrackedResourceArmPaginatedResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BatchDeploymentTrackedResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BatchDeploymentTrackedResourceArmPaginatedResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BatchDeploymentTrackedResourceArmPaginatedResultIterator) Response() BatchDeploymentTrackedResourceArmPaginatedResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BatchDeploymentTrackedResourceArmPaginatedResultIterator) Value() BatchDeploymentTrackedResource { + if !iter.page.NotDone() { + return BatchDeploymentTrackedResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BatchDeploymentTrackedResourceArmPaginatedResultIterator type. +func NewBatchDeploymentTrackedResourceArmPaginatedResultIterator(page BatchDeploymentTrackedResourceArmPaginatedResultPage) BatchDeploymentTrackedResourceArmPaginatedResultIterator { + return BatchDeploymentTrackedResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bdtrapr BatchDeploymentTrackedResourceArmPaginatedResult) IsEmpty() bool { + return bdtrapr.Value == nil || len(*bdtrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bdtrapr BatchDeploymentTrackedResourceArmPaginatedResult) hasNextLink() bool { + return bdtrapr.NextLink != nil && len(*bdtrapr.NextLink) != 0 +} + +// batchDeploymentTrackedResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bdtrapr BatchDeploymentTrackedResourceArmPaginatedResult) batchDeploymentTrackedResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !bdtrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bdtrapr.NextLink))) +} + +// BatchDeploymentTrackedResourceArmPaginatedResultPage contains a page of BatchDeploymentTrackedResource +// values. +type BatchDeploymentTrackedResourceArmPaginatedResultPage struct { + fn func(context.Context, BatchDeploymentTrackedResourceArmPaginatedResult) (BatchDeploymentTrackedResourceArmPaginatedResult, error) + bdtrapr BatchDeploymentTrackedResourceArmPaginatedResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BatchDeploymentTrackedResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchDeploymentTrackedResourceArmPaginatedResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.bdtrapr) + if err != nil { + return err + } + page.bdtrapr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BatchDeploymentTrackedResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BatchDeploymentTrackedResourceArmPaginatedResultPage) NotDone() bool { + return !page.bdtrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BatchDeploymentTrackedResourceArmPaginatedResultPage) Response() BatchDeploymentTrackedResourceArmPaginatedResult { + return page.bdtrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BatchDeploymentTrackedResourceArmPaginatedResultPage) Values() []BatchDeploymentTrackedResource { + if page.bdtrapr.IsEmpty() { + return nil + } + return *page.bdtrapr.Value +} + +// Creates a new instance of the BatchDeploymentTrackedResourceArmPaginatedResultPage type. +func NewBatchDeploymentTrackedResourceArmPaginatedResultPage(cur BatchDeploymentTrackedResourceArmPaginatedResult, getNextPage func(context.Context, BatchDeploymentTrackedResourceArmPaginatedResult) (BatchDeploymentTrackedResourceArmPaginatedResult, error)) BatchDeploymentTrackedResourceArmPaginatedResultPage { + return BatchDeploymentTrackedResourceArmPaginatedResultPage{ + fn: getNextPage, + bdtrapr: cur, + } +} + +// BatchEndpoint batch endpoint configuration. +type BatchEndpoint struct { + // AuthMode - Enum to determine endpoint authentication mode. Possible values include: 'AMLToken', 'Key', 'AADToken' + AuthMode EndpointAuthMode `json:"authMode,omitempty"` + // Description - Description of the inference endpoint. + Description *string `json:"description,omitempty"` + // Keys - EndpointAuthKeys to set initially on an Endpoint. + // This property will always be returned as null. AuthKey values must be retrieved using the ListKeys API. + Keys *EndpointAuthKeys `json:"keys,omitempty"` + // Properties - Property dictionary. Properties can be added, but not removed or altered. + Properties map[string]*string `json:"properties"` + // ScoringURI - READ-ONLY; Endpoint URI. + ScoringURI *string `json:"scoringUri,omitempty"` + // SwaggerURI - READ-ONLY; Endpoint Swagger URI. + SwaggerURI *string `json:"swaggerUri,omitempty"` + // Traffic - Traffic rules on how the traffic will be routed across deployments. + Traffic map[string]*int32 `json:"traffic"` +} + +// MarshalJSON is the custom marshaler for BatchEndpoint. +func (be BatchEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if be.AuthMode != "" { + objectMap["authMode"] = be.AuthMode + } + if be.Description != nil { + objectMap["description"] = be.Description + } + if be.Keys != nil { + objectMap["keys"] = be.Keys + } + if be.Properties != nil { + objectMap["properties"] = be.Properties + } + if be.Traffic != nil { + objectMap["traffic"] = be.Traffic + } + return json.Marshal(objectMap) +} + +// BatchEndpointTrackedResource ... +type BatchEndpointTrackedResource struct { + autorest.Response `json:"-"` + // Identity - Service identity associated with a resource. + Identity *ResourceIdentity `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + // Properties - Additional attributes of the entity. + Properties *BatchEndpoint `json:"properties,omitempty"` + // SystemData - READ-ONLY; System data associated with resource provider + SystemData *SystemData `json:"systemData,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for BatchEndpointTrackedResource. +func (betr BatchEndpointTrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if betr.Identity != nil { + objectMap["identity"] = betr.Identity + } + if betr.Kind != nil { + objectMap["kind"] = betr.Kind + } + if betr.Properties != nil { + objectMap["properties"] = betr.Properties + } + if betr.Tags != nil { + objectMap["tags"] = betr.Tags + } + if betr.Location != nil { + objectMap["location"] = betr.Location + } + return json.Marshal(objectMap) +} + +// BatchEndpointTrackedResourceArmPaginatedResult a paginated list of BatchEndpoint entities. +type BatchEndpointTrackedResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type BatchEndpoint. + Value *[]BatchEndpointTrackedResource `json:"value,omitempty"` +} + +// BatchEndpointTrackedResourceArmPaginatedResultIterator provides access to a complete listing of +// BatchEndpointTrackedResource values. +type BatchEndpointTrackedResourceArmPaginatedResultIterator struct { + i int + page BatchEndpointTrackedResourceArmPaginatedResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BatchEndpointTrackedResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchEndpointTrackedResourceArmPaginatedResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BatchEndpointTrackedResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BatchEndpointTrackedResourceArmPaginatedResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BatchEndpointTrackedResourceArmPaginatedResultIterator) Response() BatchEndpointTrackedResourceArmPaginatedResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BatchEndpointTrackedResourceArmPaginatedResultIterator) Value() BatchEndpointTrackedResource { + if !iter.page.NotDone() { + return BatchEndpointTrackedResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BatchEndpointTrackedResourceArmPaginatedResultIterator type. +func NewBatchEndpointTrackedResourceArmPaginatedResultIterator(page BatchEndpointTrackedResourceArmPaginatedResultPage) BatchEndpointTrackedResourceArmPaginatedResultIterator { + return BatchEndpointTrackedResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (betrapr BatchEndpointTrackedResourceArmPaginatedResult) IsEmpty() bool { + return betrapr.Value == nil || len(*betrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (betrapr BatchEndpointTrackedResourceArmPaginatedResult) hasNextLink() bool { + return betrapr.NextLink != nil && len(*betrapr.NextLink) != 0 +} + +// batchEndpointTrackedResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (betrapr BatchEndpointTrackedResourceArmPaginatedResult) batchEndpointTrackedResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !betrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(betrapr.NextLink))) +} + +// BatchEndpointTrackedResourceArmPaginatedResultPage contains a page of BatchEndpointTrackedResource +// values. +type BatchEndpointTrackedResourceArmPaginatedResultPage struct { + fn func(context.Context, BatchEndpointTrackedResourceArmPaginatedResult) (BatchEndpointTrackedResourceArmPaginatedResult, error) + betrapr BatchEndpointTrackedResourceArmPaginatedResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BatchEndpointTrackedResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchEndpointTrackedResourceArmPaginatedResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.betrapr) + if err != nil { + return err + } + page.betrapr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BatchEndpointTrackedResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BatchEndpointTrackedResourceArmPaginatedResultPage) NotDone() bool { + return !page.betrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BatchEndpointTrackedResourceArmPaginatedResultPage) Response() BatchEndpointTrackedResourceArmPaginatedResult { + return page.betrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BatchEndpointTrackedResourceArmPaginatedResultPage) Values() []BatchEndpointTrackedResource { + if page.betrapr.IsEmpty() { + return nil + } + return *page.betrapr.Value +} + +// Creates a new instance of the BatchEndpointTrackedResourceArmPaginatedResultPage type. +func NewBatchEndpointTrackedResourceArmPaginatedResultPage(cur BatchEndpointTrackedResourceArmPaginatedResult, getNextPage func(context.Context, BatchEndpointTrackedResourceArmPaginatedResult) (BatchEndpointTrackedResourceArmPaginatedResult, error)) BatchEndpointTrackedResourceArmPaginatedResultPage { + return BatchEndpointTrackedResourceArmPaginatedResultPage{ + fn: getNextPage, + betrapr: cur, + } +} + +// BatchOutputConfiguration batch inference output configuration. +type BatchOutputConfiguration struct { + // AppendRowFileName - Customized output file name for append_row output action. + AppendRowFileName *string `json:"appendRowFileName,omitempty"` + // OutputAction - Indicates how the output will be organized. Possible values include: 'SummaryOnly', 'AppendRow' + OutputAction BatchOutputAction `json:"outputAction,omitempty"` +} + +// BatchRetrySettings retry settings for a batch inference operation. +type BatchRetrySettings struct { + // MaxRetries - Maximum retry count for a mini-batch + MaxRetries *int32 `json:"maxRetries,omitempty"` + // Timeout - Invocation timeout for a mini-batch, in ISO 8601 format. + Timeout *string `json:"timeout,omitempty"` +} + +// CertificateDatastoreCredentials certificate datastore credentials configuration. +type CertificateDatastoreCredentials struct { + // AuthorityURL - Authority URL used for authentication. + AuthorityURL *string `json:"authorityUrl,omitempty"` + // ClientID - Service principal client ID. + ClientID *uuid.UUID `json:"clientId,omitempty"` + // ResourceURI - Resource the service principal has access to. + ResourceURI *string `json:"resourceUri,omitempty"` + // Secrets - Service principal secrets. + Secrets *CertificateDatastoreSecrets `json:"secrets,omitempty"` + // TenantID - ID of the tenant to which the service principal belongs. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // Thumbprint - Thumbprint of the certificate used for authentication. + Thumbprint *string `json:"thumbprint,omitempty"` + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey', 'CredentialsTypeCertificate', 'CredentialsTypeNone', 'CredentialsTypeSas', 'CredentialsTypeServicePrincipal', 'CredentialsTypeSQLAdmin' + CredentialsType CredentialsTypeBasicDatastoreCredentials `json:"credentialsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateDatastoreCredentials. +func (cdc CertificateDatastoreCredentials) MarshalJSON() ([]byte, error) { + cdc.CredentialsType = CredentialsTypeCertificate + objectMap := make(map[string]interface{}) + if cdc.AuthorityURL != nil { + objectMap["authorityUrl"] = cdc.AuthorityURL + } + if cdc.ClientID != nil { + objectMap["clientId"] = cdc.ClientID + } + if cdc.ResourceURI != nil { + objectMap["resourceUri"] = cdc.ResourceURI + } + if cdc.Secrets != nil { + objectMap["secrets"] = cdc.Secrets + } + if cdc.TenantID != nil { + objectMap["tenantId"] = cdc.TenantID + } + if cdc.Thumbprint != nil { + objectMap["thumbprint"] = cdc.Thumbprint + } + if cdc.CredentialsType != "" { + objectMap["credentialsType"] = cdc.CredentialsType + } + return json.Marshal(objectMap) +} + +// AsAccountKeyDatastoreCredentials is the BasicDatastoreCredentials implementation for CertificateDatastoreCredentials. +func (cdc CertificateDatastoreCredentials) AsAccountKeyDatastoreCredentials() (*AccountKeyDatastoreCredentials, bool) { + return nil, false +} + +// AsCertificateDatastoreCredentials is the BasicDatastoreCredentials implementation for CertificateDatastoreCredentials. +func (cdc CertificateDatastoreCredentials) AsCertificateDatastoreCredentials() (*CertificateDatastoreCredentials, bool) { + return &cdc, true +} + +// AsNoneDatastoreCredentials is the BasicDatastoreCredentials implementation for CertificateDatastoreCredentials. +func (cdc CertificateDatastoreCredentials) AsNoneDatastoreCredentials() (*NoneDatastoreCredentials, bool) { + return nil, false +} + +// AsSasDatastoreCredentials is the BasicDatastoreCredentials implementation for CertificateDatastoreCredentials. +func (cdc CertificateDatastoreCredentials) AsSasDatastoreCredentials() (*SasDatastoreCredentials, bool) { + return nil, false +} + +// AsServicePrincipalDatastoreCredentials is the BasicDatastoreCredentials implementation for CertificateDatastoreCredentials. +func (cdc CertificateDatastoreCredentials) AsServicePrincipalDatastoreCredentials() (*ServicePrincipalDatastoreCredentials, bool) { + return nil, false +} + +// AsSQLAdminDatastoreCredentials is the BasicDatastoreCredentials implementation for CertificateDatastoreCredentials. +func (cdc CertificateDatastoreCredentials) AsSQLAdminDatastoreCredentials() (*SQLAdminDatastoreCredentials, bool) { + return nil, false +} + +// AsDatastoreCredentials is the BasicDatastoreCredentials implementation for CertificateDatastoreCredentials. +func (cdc CertificateDatastoreCredentials) AsDatastoreCredentials() (*DatastoreCredentials, bool) { + return nil, false +} + +// AsBasicDatastoreCredentials is the BasicDatastoreCredentials implementation for CertificateDatastoreCredentials. +func (cdc CertificateDatastoreCredentials) AsBasicDatastoreCredentials() (BasicDatastoreCredentials, bool) { + return &cdc, true +} + +// CertificateDatastoreSecrets datastore certificate secrets. +type CertificateDatastoreSecrets struct { + // Certificate - Service principal certificate. + Certificate *string `json:"certificate,omitempty"` + // SecretsType - Possible values include: 'SecretsTypeDatastoreSecrets', 'SecretsTypeAccountKey1', 'SecretsTypeCertificate1', 'SecretsTypeNone1', 'SecretsTypeSas1', 'SecretsTypeServicePrincipal1', 'SecretsTypeSQLAdmin1' + SecretsType SecretsTypeBasicDatastoreSecrets `json:"secretsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateDatastoreSecrets. +func (cds CertificateDatastoreSecrets) MarshalJSON() ([]byte, error) { + cds.SecretsType = SecretsTypeCertificate1 + objectMap := make(map[string]interface{}) + if cds.Certificate != nil { + objectMap["certificate"] = cds.Certificate + } + if cds.SecretsType != "" { + objectMap["secretsType"] = cds.SecretsType + } + return json.Marshal(objectMap) +} + +// AsAccountKeyDatastoreSecrets is the BasicDatastoreSecrets implementation for CertificateDatastoreSecrets. +func (cds CertificateDatastoreSecrets) AsAccountKeyDatastoreSecrets() (*AccountKeyDatastoreSecrets, bool) { + return nil, false +} + +// AsCertificateDatastoreSecrets is the BasicDatastoreSecrets implementation for CertificateDatastoreSecrets. +func (cds CertificateDatastoreSecrets) AsCertificateDatastoreSecrets() (*CertificateDatastoreSecrets, bool) { + return &cds, true +} + +// AsNoneDatastoreSecrets is the BasicDatastoreSecrets implementation for CertificateDatastoreSecrets. +func (cds CertificateDatastoreSecrets) AsNoneDatastoreSecrets() (*NoneDatastoreSecrets, bool) { + return nil, false +} + +// AsSasDatastoreSecrets is the BasicDatastoreSecrets implementation for CertificateDatastoreSecrets. +func (cds CertificateDatastoreSecrets) AsSasDatastoreSecrets() (*SasDatastoreSecrets, bool) { + return nil, false +} + +// AsServicePrincipalDatastoreSecrets is the BasicDatastoreSecrets implementation for CertificateDatastoreSecrets. +func (cds CertificateDatastoreSecrets) AsServicePrincipalDatastoreSecrets() (*ServicePrincipalDatastoreSecrets, bool) { + return nil, false +} + +// AsSQLAdminDatastoreSecrets is the BasicDatastoreSecrets implementation for CertificateDatastoreSecrets. +func (cds CertificateDatastoreSecrets) AsSQLAdminDatastoreSecrets() (*SQLAdminDatastoreSecrets, bool) { + return nil, false +} + +// AsDatastoreSecrets is the BasicDatastoreSecrets implementation for CertificateDatastoreSecrets. +func (cds CertificateDatastoreSecrets) AsDatastoreSecrets() (*DatastoreSecrets, bool) { + return nil, false +} + +// AsBasicDatastoreSecrets is the BasicDatastoreSecrets implementation for CertificateDatastoreSecrets. +func (cds CertificateDatastoreSecrets) AsBasicDatastoreSecrets() (BasicDatastoreSecrets, bool) { + return &cds, true +} + +// ClusterUpdateParameters amlCompute update parameters. +type ClusterUpdateParameters struct { + // ClusterUpdateProperties - The properties of the amlCompute. + *ClusterUpdateProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterUpdateParameters. +func (cup ClusterUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cup.ClusterUpdateProperties != nil { + objectMap["properties"] = cup.ClusterUpdateProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ClusterUpdateParameters struct. +func (cup *ClusterUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var clusterUpdateProperties ClusterUpdateProperties + err = json.Unmarshal(*v, &clusterUpdateProperties) + if err != nil { + return err + } + cup.ClusterUpdateProperties = &clusterUpdateProperties + } + } + } + + return nil +} + +// ClusterUpdateProperties the properties of a amlCompute that need to be updated. +type ClusterUpdateProperties struct { + // ScaleSettings - Desired scale settings for the amlCompute. + ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` +} + +// CocoExportSummary ... +type CocoExportSummary struct { + // ContainerName - READ-ONLY; The container name to which the labels will be exported. + ContainerName *string `json:"containerName,omitempty"` + // SnapshotPath - READ-ONLY; The output path where the labels will be exported. + SnapshotPath *string `json:"snapshotPath,omitempty"` + // EndTimeUtc - READ-ONLY; The time when the export was completed. + EndTimeUtc *date.Time `json:"endTimeUtc,omitempty"` + // ExportedRowCount - READ-ONLY; The total number of labeled datapoints exported. + ExportedRowCount *int64 `json:"exportedRowCount,omitempty"` + // LabelingJobID - READ-ONLY; Name and identifier of the job containing exported labels. + LabelingJobID *string `json:"labelingJobId,omitempty"` + // StartTimeUtc - READ-ONLY; The time when the export was requested. + StartTimeUtc *date.Time `json:"startTimeUtc,omitempty"` + // Format - Possible values include: 'FormatExportSummary', 'FormatCoco', 'FormatCSV', 'FormatDataset' + Format Format `json:"format,omitempty"` +} + +// MarshalJSON is the custom marshaler for CocoExportSummary. +func (ces CocoExportSummary) MarshalJSON() ([]byte, error) { + ces.Format = FormatCoco + objectMap := make(map[string]interface{}) + if ces.Format != "" { + objectMap["format"] = ces.Format + } + return json.Marshal(objectMap) +} + +// AsCocoExportSummary is the BasicExportSummary implementation for CocoExportSummary. +func (ces CocoExportSummary) AsCocoExportSummary() (*CocoExportSummary, bool) { + return &ces, true +} + +// AsCsvExportSummary is the BasicExportSummary implementation for CocoExportSummary. +func (ces CocoExportSummary) AsCsvExportSummary() (*CsvExportSummary, bool) { + return nil, false +} + +// AsDatasetExportSummary is the BasicExportSummary implementation for CocoExportSummary. +func (ces CocoExportSummary) AsDatasetExportSummary() (*DatasetExportSummary, bool) { + return nil, false +} + +// AsExportSummary is the BasicExportSummary implementation for CocoExportSummary. +func (ces CocoExportSummary) AsExportSummary() (*ExportSummary, bool) { + return nil, false +} + +// AsBasicExportSummary is the BasicExportSummary implementation for CocoExportSummary. +func (ces CocoExportSummary) AsBasicExportSummary() (BasicExportSummary, bool) { + return &ces, true +} + +// CodeConfiguration configuration for a scoring code asset. +type CodeConfiguration struct { + // CodeID - ARM resource ID of the code asset. + CodeID *string `json:"codeId,omitempty"` + // ScoringScript - The script to execute on startup. eg. "score.py" + ScoringScript *string `json:"scoringScript,omitempty"` +} + +// CodeContainer container for code asset versions. +type CodeContainer struct { + // Description - The asset description text. + Description *string `json:"description,omitempty"` + // Properties - The asset property dictionary. + Properties map[string]*string `json:"properties"` + // Tags - Tag dictionary. Tags can be added, removed, and updated. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for CodeContainer. +func (cc CodeContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cc.Description != nil { + objectMap["description"] = cc.Description + } + if cc.Properties != nil { + objectMap["properties"] = cc.Properties + } + if cc.Tags != nil { + objectMap["tags"] = cc.Tags + } + return json.Marshal(objectMap) +} + +// CodeContainerResource azure Resource Manager resource envelope. +type CodeContainerResource struct { + autorest.Response `json:"-"` + // Properties - Additional attributes of the entity. + Properties *CodeContainer `json:"properties,omitempty"` + // SystemData - READ-ONLY; System data associated with resource provider + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for CodeContainerResource. +func (ccr CodeContainerResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ccr.Properties != nil { + objectMap["properties"] = ccr.Properties + } + return json.Marshal(objectMap) +} + +// CodeContainerResourceArmPaginatedResult a paginated list of CodeContainer entities. +type CodeContainerResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type CodeContainer. + Value *[]CodeContainerResource `json:"value,omitempty"` +} + +// CodeContainerResourceArmPaginatedResultIterator provides access to a complete listing of +// CodeContainerResource values. +type CodeContainerResourceArmPaginatedResultIterator struct { + i int + page CodeContainerResourceArmPaginatedResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CodeContainerResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CodeContainerResourceArmPaginatedResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CodeContainerResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CodeContainerResourceArmPaginatedResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CodeContainerResourceArmPaginatedResultIterator) Response() CodeContainerResourceArmPaginatedResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CodeContainerResourceArmPaginatedResultIterator) Value() CodeContainerResource { + if !iter.page.NotDone() { + return CodeContainerResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CodeContainerResourceArmPaginatedResultIterator type. +func NewCodeContainerResourceArmPaginatedResultIterator(page CodeContainerResourceArmPaginatedResultPage) CodeContainerResourceArmPaginatedResultIterator { + return CodeContainerResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ccrapr CodeContainerResourceArmPaginatedResult) IsEmpty() bool { + return ccrapr.Value == nil || len(*ccrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ccrapr CodeContainerResourceArmPaginatedResult) hasNextLink() bool { + return ccrapr.NextLink != nil && len(*ccrapr.NextLink) != 0 +} + +// codeContainerResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ccrapr CodeContainerResourceArmPaginatedResult) codeContainerResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !ccrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ccrapr.NextLink))) +} + +// CodeContainerResourceArmPaginatedResultPage contains a page of CodeContainerResource values. +type CodeContainerResourceArmPaginatedResultPage struct { + fn func(context.Context, CodeContainerResourceArmPaginatedResult) (CodeContainerResourceArmPaginatedResult, error) + ccrapr CodeContainerResourceArmPaginatedResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CodeContainerResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CodeContainerResourceArmPaginatedResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ccrapr) + if err != nil { + return err + } + page.ccrapr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CodeContainerResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CodeContainerResourceArmPaginatedResultPage) NotDone() bool { + return !page.ccrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CodeContainerResourceArmPaginatedResultPage) Response() CodeContainerResourceArmPaginatedResult { + return page.ccrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CodeContainerResourceArmPaginatedResultPage) Values() []CodeContainerResource { + if page.ccrapr.IsEmpty() { + return nil + } + return *page.ccrapr.Value +} + +// Creates a new instance of the CodeContainerResourceArmPaginatedResultPage type. +func NewCodeContainerResourceArmPaginatedResultPage(cur CodeContainerResourceArmPaginatedResult, getNextPage func(context.Context, CodeContainerResourceArmPaginatedResult) (CodeContainerResourceArmPaginatedResult, error)) CodeContainerResourceArmPaginatedResultPage { + return CodeContainerResourceArmPaginatedResultPage{ + fn: getNextPage, + ccrapr: cur, + } +} + +// CodeVersion code asset version details. +type CodeVersion struct { + // DatastoreID - ARM resource ID of the datastore where the asset is located. + DatastoreID *string `json:"datastoreId,omitempty"` + // Description - The asset description text. + Description *string `json:"description,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // Path - The path of the file/directory in the datastore. + Path *string `json:"path,omitempty"` + // Properties - The asset property dictionary. + Properties map[string]*string `json:"properties"` + // Tags - Tag dictionary. Tags can be added, removed, and updated. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for CodeVersion. +func (cv CodeVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cv.DatastoreID != nil { + objectMap["datastoreId"] = cv.DatastoreID + } + if cv.Description != nil { + objectMap["description"] = cv.Description + } + if cv.IsAnonymous != nil { + objectMap["isAnonymous"] = cv.IsAnonymous + } + if cv.Path != nil { + objectMap["path"] = cv.Path + } + if cv.Properties != nil { + objectMap["properties"] = cv.Properties + } + if cv.Tags != nil { + objectMap["tags"] = cv.Tags + } + return json.Marshal(objectMap) +} + +// CodeVersionResource azure Resource Manager resource envelope. +type CodeVersionResource struct { + autorest.Response `json:"-"` + // Properties - Additional attributes of the entity. + Properties *CodeVersion `json:"properties,omitempty"` + // SystemData - READ-ONLY; System data associated with resource provider + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for CodeVersionResource. +func (cvr CodeVersionResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cvr.Properties != nil { + objectMap["properties"] = cvr.Properties + } + return json.Marshal(objectMap) +} + +// CodeVersionResourceArmPaginatedResult a paginated list of CodeVersion entities. +type CodeVersionResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type CodeVersion. + Value *[]CodeVersionResource `json:"value,omitempty"` +} + +// CodeVersionResourceArmPaginatedResultIterator provides access to a complete listing of +// CodeVersionResource values. +type CodeVersionResourceArmPaginatedResultIterator struct { + i int + page CodeVersionResourceArmPaginatedResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CodeVersionResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CodeVersionResourceArmPaginatedResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CodeVersionResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CodeVersionResourceArmPaginatedResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CodeVersionResourceArmPaginatedResultIterator) Response() CodeVersionResourceArmPaginatedResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CodeVersionResourceArmPaginatedResultIterator) Value() CodeVersionResource { + if !iter.page.NotDone() { + return CodeVersionResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CodeVersionResourceArmPaginatedResultIterator type. +func NewCodeVersionResourceArmPaginatedResultIterator(page CodeVersionResourceArmPaginatedResultPage) CodeVersionResourceArmPaginatedResultIterator { + return CodeVersionResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cvrapr CodeVersionResourceArmPaginatedResult) IsEmpty() bool { + return cvrapr.Value == nil || len(*cvrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cvrapr CodeVersionResourceArmPaginatedResult) hasNextLink() bool { + return cvrapr.NextLink != nil && len(*cvrapr.NextLink) != 0 +} + +// codeVersionResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cvrapr CodeVersionResourceArmPaginatedResult) codeVersionResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !cvrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cvrapr.NextLink))) +} + +// CodeVersionResourceArmPaginatedResultPage contains a page of CodeVersionResource values. +type CodeVersionResourceArmPaginatedResultPage struct { + fn func(context.Context, CodeVersionResourceArmPaginatedResult) (CodeVersionResourceArmPaginatedResult, error) + cvrapr CodeVersionResourceArmPaginatedResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CodeVersionResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CodeVersionResourceArmPaginatedResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cvrapr) + if err != nil { + return err + } + page.cvrapr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CodeVersionResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CodeVersionResourceArmPaginatedResultPage) NotDone() bool { + return !page.cvrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CodeVersionResourceArmPaginatedResultPage) Response() CodeVersionResourceArmPaginatedResult { + return page.cvrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CodeVersionResourceArmPaginatedResultPage) Values() []CodeVersionResource { + if page.cvrapr.IsEmpty() { + return nil + } + return *page.cvrapr.Value +} + +// Creates a new instance of the CodeVersionResourceArmPaginatedResultPage type. +func NewCodeVersionResourceArmPaginatedResultPage(cur CodeVersionResourceArmPaginatedResult, getNextPage func(context.Context, CodeVersionResourceArmPaginatedResult) (CodeVersionResourceArmPaginatedResult, error)) CodeVersionResourceArmPaginatedResultPage { + return CodeVersionResourceArmPaginatedResultPage{ + fn: getNextPage, + cvrapr: cur, + } +} + +// CommandJob command job definition. +type CommandJob struct { + // CodeID - ARM resource ID of the code asset. + CodeID *string `json:"codeId,omitempty"` + // Command - The command to execute on startup of the job. eg. "python train.py" + Command *string `json:"command,omitempty"` + // Compute - Compute binding for the job. + Compute *ComputeConfiguration `json:"compute,omitempty"` + // Distribution - Distribution configuration of the job. If set, this should be one of Mpi, Tensorflow, PyTorch, or null. + Distribution BasicDistributionConfiguration `json:"distribution,omitempty"` + // EnvironmentID - The ARM resource ID of the Environment specification for the job. + EnvironmentID *string `json:"environmentId,omitempty"` + // EnvironmentVariables - Environment variables included in the job. + EnvironmentVariables map[string]*string `json:"environmentVariables"` + // ExperimentName - The name of the experiment the job belongs to. If not set, the job is placed in the "Default" experiment. + ExperimentName *string `json:"experimentName,omitempty"` + // Identity - Identity configuration. If set, this should be one of AmlToken, ManagedIdentity, or null. + // Defaults to AmlToken if null. + Identity BasicIdentityConfiguration `json:"identity,omitempty"` + // InputDataBindings - Mapping of input data bindings used in the job. + InputDataBindings map[string]*InputDataBinding `json:"inputDataBindings"` + // Output - READ-ONLY; Location of the job output logs and artifacts. + Output *JobOutput `json:"output,omitempty"` + // OutputDataBindings - Mapping of output data bindings used in the job. + OutputDataBindings map[string]*OutputDataBinding `json:"outputDataBindings"` + // Parameters - READ-ONLY; Input parameters. + Parameters map[string]interface{} `json:"parameters"` + // Priority - Job priority for scheduling policy. Only applies to AMLCompute. + // Private preview feature and only available to users on the allow list. + Priority *int32 `json:"priority,omitempty"` + // Status - READ-ONLY; Status of the job. Possible values include: 'JobStatusNotStarted', 'JobStatusStarting', 'JobStatusProvisioning', 'JobStatusPreparing', 'JobStatusQueued', 'JobStatusRunning', 'JobStatusFinalizing', 'JobStatusCancelRequested', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusCanceled', 'JobStatusNotResponding', 'JobStatusPaused', 'JobStatusUnknown' + Status JobStatus `json:"status,omitempty"` + // Timeout - The max run duration in ISO 8601 format, after which the job will be cancelled. Only supports duration with precision as low as Seconds. + Timeout *string `json:"timeout,omitempty"` + // Description - The asset description text. + Description *string `json:"description,omitempty"` + // InteractionEndpoints - READ-ONLY; List of JobEndpoints. + // For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + InteractionEndpoints map[string]*JobEndpoint `json:"interactionEndpoints"` + // Properties - The asset property dictionary. + Properties map[string]*string `json:"properties"` + // ProvisioningState - READ-ONLY; Possible values include: 'Succeeded', 'Failed', 'Canceled', 'InProgress' + ProvisioningState JobProvisioningState `json:"provisioningState,omitempty"` + // Tags - Tag dictionary. Tags can be added, removed, and updated. + Tags map[string]*string `json:"tags"` + // JobType - Possible values include: 'JobTypeJobBase', 'JobTypeCommand', 'JobTypeSweep' + JobType JobTypeBasicJobBase `json:"jobType,omitempty"` +} + +// MarshalJSON is the custom marshaler for CommandJob. +func (cj CommandJob) MarshalJSON() ([]byte, error) { + cj.JobType = JobTypeCommand + objectMap := make(map[string]interface{}) + if cj.CodeID != nil { + objectMap["codeId"] = cj.CodeID + } + if cj.Command != nil { + objectMap["command"] = cj.Command + } + if cj.Compute != nil { + objectMap["compute"] = cj.Compute + } + objectMap["distribution"] = cj.Distribution + if cj.EnvironmentID != nil { + objectMap["environmentId"] = cj.EnvironmentID + } + if cj.EnvironmentVariables != nil { + objectMap["environmentVariables"] = cj.EnvironmentVariables + } + if cj.ExperimentName != nil { + objectMap["experimentName"] = cj.ExperimentName + } + objectMap["identity"] = cj.Identity + if cj.InputDataBindings != nil { + objectMap["inputDataBindings"] = cj.InputDataBindings + } + if cj.OutputDataBindings != nil { + objectMap["outputDataBindings"] = cj.OutputDataBindings + } + if cj.Priority != nil { + objectMap["priority"] = cj.Priority + } + if cj.Timeout != nil { + objectMap["timeout"] = cj.Timeout + } + if cj.Description != nil { + objectMap["description"] = cj.Description + } + if cj.Properties != nil { + objectMap["properties"] = cj.Properties + } + if cj.Tags != nil { + objectMap["tags"] = cj.Tags + } + if cj.JobType != "" { + objectMap["jobType"] = cj.JobType + } + return json.Marshal(objectMap) +} + +// AsCommandJob is the BasicJobBase implementation for CommandJob. +func (cj CommandJob) AsCommandJob() (*CommandJob, bool) { + return &cj, true +} + +// AsSweepJob is the BasicJobBase implementation for CommandJob. +func (cj CommandJob) AsSweepJob() (*SweepJob, bool) { + return nil, false +} + +// AsJobBase is the BasicJobBase implementation for CommandJob. +func (cj CommandJob) AsJobBase() (*JobBase, bool) { + return nil, false +} + +// AsBasicJobBase is the BasicJobBase implementation for CommandJob. +func (cj CommandJob) AsBasicJobBase() (BasicJobBase, bool) { + return &cj, true +} + +// UnmarshalJSON is the custom unmarshaler for CommandJob struct. +func (cj *CommandJob) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "codeId": + if v != nil { + var codeID string + err = json.Unmarshal(*v, &codeID) + if err != nil { + return err + } + cj.CodeID = &codeID + } + case "command": + if v != nil { + var command string + err = json.Unmarshal(*v, &command) + if err != nil { + return err + } + cj.Command = &command + } + case "compute": + if v != nil { + var compute ComputeConfiguration + err = json.Unmarshal(*v, &compute) + if err != nil { + return err + } + cj.Compute = &compute + } + case "distribution": + if v != nil { + distribution, err := unmarshalBasicDistributionConfiguration(*v) + if err != nil { + return err + } + cj.Distribution = distribution + } + case "environmentId": + if v != nil { + var environmentID string + err = json.Unmarshal(*v, &environmentID) + if err != nil { + return err + } + cj.EnvironmentID = &environmentID + } + case "environmentVariables": + if v != nil { + var environmentVariables map[string]*string + err = json.Unmarshal(*v, &environmentVariables) + if err != nil { + return err + } + cj.EnvironmentVariables = environmentVariables + } + case "experimentName": + if v != nil { + var experimentName string + err = json.Unmarshal(*v, &experimentName) + if err != nil { + return err + } + cj.ExperimentName = &experimentName + } + case "identity": + if v != nil { + identity, err := unmarshalBasicIdentityConfiguration(*v) + if err != nil { + return err + } + cj.Identity = identity + } + case "inputDataBindings": + if v != nil { + var inputDataBindings map[string]*InputDataBinding + err = json.Unmarshal(*v, &inputDataBindings) + if err != nil { + return err + } + cj.InputDataBindings = inputDataBindings + } + case "output": + if v != nil { + var output JobOutput + err = json.Unmarshal(*v, &output) + if err != nil { + return err + } + cj.Output = &output + } + case "outputDataBindings": + if v != nil { + var outputDataBindings map[string]*OutputDataBinding + err = json.Unmarshal(*v, &outputDataBindings) + if err != nil { + return err + } + cj.OutputDataBindings = outputDataBindings + } + case "parameters": + if v != nil { + var parameters map[string]interface{} + err = json.Unmarshal(*v, ¶meters) + if err != nil { + return err + } + cj.Parameters = parameters + } + case "priority": + if v != nil { + var priority int32 + err = json.Unmarshal(*v, &priority) + if err != nil { + return err + } + cj.Priority = &priority + } + case "status": + if v != nil { + var status JobStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + cj.Status = status + } + case "timeout": + if v != nil { + var timeout string + err = json.Unmarshal(*v, &timeout) + if err != nil { + return err + } + cj.Timeout = &timeout + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + cj.Description = &description + } + case "interactionEndpoints": + if v != nil { + var interactionEndpoints map[string]*JobEndpoint + err = json.Unmarshal(*v, &interactionEndpoints) + if err != nil { + return err + } + cj.InteractionEndpoints = interactionEndpoints + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + cj.Properties = properties + } + case "provisioningState": + if v != nil { + var provisioningState JobProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + cj.ProvisioningState = provisioningState + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cj.Tags = tags + } + case "jobType": + if v != nil { + var jobType JobTypeBasicJobBase + err = json.Unmarshal(*v, &jobType) + if err != nil { + return err + } + cj.JobType = jobType + } + } + } + + return nil +} + +// BasicCompute machine Learning compute object. +type BasicCompute interface { + AsAKS() (*AKS, bool) + AsAmlCompute() (*AmlCompute, bool) + AsComputeInstance() (*ComputeInstance, bool) + AsVirtualMachine() (*VirtualMachine, bool) + AsHDInsight() (*HDInsight, bool) + AsDataFactory() (*DataFactory, bool) + AsDatabricks() (*Databricks, bool) + AsDataLakeAnalytics() (*DataLakeAnalytics, bool) + AsCompute() (*Compute, bool) +} + +// Compute machine Learning compute object. +type Compute struct { + // ComputeLocation - Location for the underlying compute + ComputeLocation *string `json:"computeLocation,omitempty"` + // ProvisioningState - READ-ONLY; The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Possible values include: 'ProvisioningStateUnknown', 'ProvisioningStateUpdating', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Description - The description of the Machine Learning compute. + Description *string `json:"description,omitempty"` + // CreatedOn - READ-ONLY; The time at which the compute was created. + CreatedOn *date.Time `json:"createdOn,omitempty"` + // ModifiedOn - READ-ONLY; The time at which the compute was last modified. + ModifiedOn *date.Time `json:"modifiedOn,omitempty"` + // ResourceID - ARM resource id of the underlying compute + ResourceID *string `json:"resourceId,omitempty"` + // ProvisioningErrors - READ-ONLY; Errors during provisioning + ProvisioningErrors *[]ErrorResponse `json:"provisioningErrors,omitempty"` + // 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. + IsAttachedCompute *bool `json:"isAttachedCompute,omitempty"` + // DisableLocalAuth - Opt-out of local authentication and ensure customers can use only MSI and AAD exclusively for authentication. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + // ComputeType - Possible values include: 'ComputeTypeCompute', 'ComputeTypeAKS1', 'ComputeTypeAmlCompute1', 'ComputeTypeComputeInstance1', 'ComputeTypeVirtualMachine1', 'ComputeTypeHDInsight1', 'ComputeTypeDataFactory1', 'ComputeTypeDatabricks1', 'ComputeTypeDataLakeAnalytics1' + ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` +} + +func unmarshalBasicCompute(body []byte) (BasicCompute, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["computeType"] { + case string(ComputeTypeAKS1): + var a AKS + err := json.Unmarshal(body, &a) + return a, err + case string(ComputeTypeAmlCompute1): + var ac AmlCompute + err := json.Unmarshal(body, &ac) + return ac, err + case string(ComputeTypeComputeInstance1): + var ci ComputeInstance + err := json.Unmarshal(body, &ci) + return ci, err + case string(ComputeTypeVirtualMachine1): + var VM VirtualMachine + err := json.Unmarshal(body, &VM) + return VM, err + case string(ComputeTypeHDInsight1): + var hi HDInsight + err := json.Unmarshal(body, &hi) + return hi, err + case string(ComputeTypeDataFactory1): + var df DataFactory + err := json.Unmarshal(body, &df) + return df, err + case string(ComputeTypeDatabricks1): + var d Databricks + err := json.Unmarshal(body, &d) + return d, err + case string(ComputeTypeDataLakeAnalytics1): + var dla DataLakeAnalytics + err := json.Unmarshal(body, &dla) + return dla, err + default: + var c Compute + err := json.Unmarshal(body, &c) + return c, err + } +} +func unmarshalBasicComputeArray(body []byte) ([]BasicCompute, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + cArray := make([]BasicCompute, len(rawMessages)) + + for index, rawMessage := range rawMessages { + c, err := unmarshalBasicCompute(*rawMessage) + if err != nil { + return nil, err + } + cArray[index] = c + } + return cArray, nil +} + +// MarshalJSON is the custom marshaler for Compute. +func (c Compute) MarshalJSON() ([]byte, error) { + c.ComputeType = ComputeTypeCompute + objectMap := make(map[string]interface{}) + if c.ComputeLocation != nil { + objectMap["computeLocation"] = c.ComputeLocation + } + if c.Description != nil { + objectMap["description"] = c.Description + } + if c.ResourceID != nil { + objectMap["resourceId"] = c.ResourceID + } + if c.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = c.DisableLocalAuth + } + if c.ComputeType != "" { + objectMap["computeType"] = c.ComputeType + } + return json.Marshal(objectMap) +} + +// AsAKS is the BasicCompute implementation for Compute. +func (c Compute) AsAKS() (*AKS, bool) { + return nil, false +} + +// AsAmlCompute is the BasicCompute implementation for Compute. +func (c Compute) AsAmlCompute() (*AmlCompute, bool) { + return nil, false +} + +// AsComputeInstance is the BasicCompute implementation for Compute. +func (c Compute) AsComputeInstance() (*ComputeInstance, bool) { + return nil, false +} + +// AsVirtualMachine is the BasicCompute implementation for Compute. +func (c Compute) AsVirtualMachine() (*VirtualMachine, bool) { + return nil, false +} + +// AsHDInsight is the BasicCompute implementation for Compute. +func (c Compute) AsHDInsight() (*HDInsight, bool) { + return nil, false +} + +// AsDataFactory is the BasicCompute implementation for Compute. +func (c Compute) AsDataFactory() (*DataFactory, bool) { + return nil, false +} + +// AsDatabricks is the BasicCompute implementation for Compute. +func (c Compute) AsDatabricks() (*Databricks, bool) { + return nil, false +} + +// AsDataLakeAnalytics is the BasicCompute implementation for Compute. +func (c Compute) AsDataLakeAnalytics() (*DataLakeAnalytics, bool) { + return nil, false +} + +// AsCompute is the BasicCompute implementation for Compute. +func (c Compute) AsCompute() (*Compute, bool) { + return &c, true +} + +// AsBasicCompute is the BasicCompute implementation for Compute. +func (c Compute) AsBasicCompute() (BasicCompute, bool) { + return &c, true +} + +// ComputeConfiguration configuration for compute binding. +type ComputeConfiguration struct { + // InstanceCount - Number of instances or nodes. + InstanceCount *int32 `json:"instanceCount,omitempty"` + // InstanceType - SKU type to run on. + InstanceType *string `json:"instanceType,omitempty"` + // IsLocal - Set to true for jobs running on local compute. + IsLocal *bool `json:"isLocal,omitempty"` + // Location - Location for virtual cluster run. + Location *string `json:"location,omitempty"` + // Properties - Additional properties. + Properties map[string]*string `json:"properties"` + // Target - ARM resource ID of the compute resource. + Target *string `json:"target,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComputeConfiguration. +func (cc ComputeConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cc.InstanceCount != nil { + objectMap["instanceCount"] = cc.InstanceCount + } + if cc.InstanceType != nil { + objectMap["instanceType"] = cc.InstanceType + } + if cc.IsLocal != nil { + objectMap["isLocal"] = cc.IsLocal + } + if cc.Location != nil { + objectMap["location"] = cc.Location + } + if cc.Properties != nil { + objectMap["properties"] = cc.Properties + } + if cc.Target != nil { + objectMap["target"] = cc.Target + } + return json.Marshal(objectMap) +} + +// ComputeCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ComputeCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ComputeClient) (ComputeResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ComputeCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ComputeCreateOrUpdateFuture.Result. +func (future *ComputeCreateOrUpdateFuture) result(client ComputeClient) (cr ComputeResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.ComputeCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { + cr, err = client.CreateOrUpdateResponder(cr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeCreateOrUpdateFuture", "Result", cr.Response.Response, "Failure responding to request") + } + } + return +} + +// ComputeDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ComputeDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ComputeClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ComputeDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ComputeDeleteFuture.Result. +func (future *ComputeDeleteFuture) result(client ComputeClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.ComputeDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ComputeInstance an Azure Machine Learning compute instance. +type ComputeInstance struct { + // Properties - Compute Instance properties + Properties *ComputeInstanceProperties `json:"properties,omitempty"` + // ComputeLocation - Location for the underlying compute + ComputeLocation *string `json:"computeLocation,omitempty"` + // ProvisioningState - READ-ONLY; The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Possible values include: 'ProvisioningStateUnknown', 'ProvisioningStateUpdating', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Description - The description of the Machine Learning compute. + Description *string `json:"description,omitempty"` + // CreatedOn - READ-ONLY; The time at which the compute was created. + CreatedOn *date.Time `json:"createdOn,omitempty"` + // ModifiedOn - READ-ONLY; The time at which the compute was last modified. + ModifiedOn *date.Time `json:"modifiedOn,omitempty"` + // ResourceID - ARM resource id of the underlying compute + ResourceID *string `json:"resourceId,omitempty"` + // ProvisioningErrors - READ-ONLY; Errors during provisioning + ProvisioningErrors *[]ErrorResponse `json:"provisioningErrors,omitempty"` + // 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. + IsAttachedCompute *bool `json:"isAttachedCompute,omitempty"` + // DisableLocalAuth - Opt-out of local authentication and ensure customers can use only MSI and AAD exclusively for authentication. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + // ComputeType - Possible values include: 'ComputeTypeCompute', 'ComputeTypeAKS1', 'ComputeTypeAmlCompute1', 'ComputeTypeComputeInstance1', 'ComputeTypeVirtualMachine1', 'ComputeTypeHDInsight1', 'ComputeTypeDataFactory1', 'ComputeTypeDatabricks1', 'ComputeTypeDataLakeAnalytics1' + ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComputeInstance. +func (ci ComputeInstance) MarshalJSON() ([]byte, error) { + ci.ComputeType = ComputeTypeComputeInstance1 + objectMap := make(map[string]interface{}) + if ci.Properties != nil { + objectMap["properties"] = ci.Properties + } + if ci.ComputeLocation != nil { + objectMap["computeLocation"] = ci.ComputeLocation + } + if ci.Description != nil { + objectMap["description"] = ci.Description + } + if ci.ResourceID != nil { + objectMap["resourceId"] = ci.ResourceID + } + if ci.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = ci.DisableLocalAuth + } + if ci.ComputeType != "" { + objectMap["computeType"] = ci.ComputeType + } + return json.Marshal(objectMap) +} + +// AsAKS is the BasicCompute implementation for ComputeInstance. +func (ci ComputeInstance) AsAKS() (*AKS, bool) { + return nil, false +} + +// AsAmlCompute is the BasicCompute implementation for ComputeInstance. +func (ci ComputeInstance) AsAmlCompute() (*AmlCompute, bool) { + return nil, false +} + +// AsComputeInstance is the BasicCompute implementation for ComputeInstance. +func (ci ComputeInstance) AsComputeInstance() (*ComputeInstance, bool) { + return &ci, true +} + +// AsVirtualMachine is the BasicCompute implementation for ComputeInstance. +func (ci ComputeInstance) AsVirtualMachine() (*VirtualMachine, bool) { + return nil, false +} + +// AsHDInsight is the BasicCompute implementation for ComputeInstance. +func (ci ComputeInstance) AsHDInsight() (*HDInsight, bool) { + return nil, false +} + +// AsDataFactory is the BasicCompute implementation for ComputeInstance. +func (ci ComputeInstance) AsDataFactory() (*DataFactory, bool) { + return nil, false +} + +// AsDatabricks is the BasicCompute implementation for ComputeInstance. +func (ci ComputeInstance) AsDatabricks() (*Databricks, bool) { + return nil, false +} + +// AsDataLakeAnalytics is the BasicCompute implementation for ComputeInstance. +func (ci ComputeInstance) AsDataLakeAnalytics() (*DataLakeAnalytics, bool) { + return nil, false +} + +// AsCompute is the BasicCompute implementation for ComputeInstance. +func (ci ComputeInstance) AsCompute() (*Compute, bool) { + return nil, false +} + +// AsBasicCompute is the BasicCompute implementation for ComputeInstance. +func (ci ComputeInstance) AsBasicCompute() (BasicCompute, bool) { + return &ci, true +} + +// ComputeInstanceApplication defines an Aml Instance application and its connectivity endpoint URI. +type ComputeInstanceApplication struct { + // DisplayName - Name of the ComputeInstance application. + DisplayName *string `json:"displayName,omitempty"` + // EndpointURI - Application' endpoint URI. + EndpointURI *string `json:"endpointUri,omitempty"` +} + +// ComputeInstanceConnectivityEndpoints defines all connectivity endpoints and properties for an +// ComputeInstance. +type ComputeInstanceConnectivityEndpoints struct { + // PublicIPAddress - READ-ONLY; Public IP Address of this ComputeInstance. + PublicIPAddress *string `json:"publicIpAddress,omitempty"` + // PrivateIPAddress - READ-ONLY; Private IP Address of this ComputeInstance (local to the VNET in which the compute instance is deployed). + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComputeInstanceConnectivityEndpoints. +func (cice ComputeInstanceConnectivityEndpoints) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ComputeInstanceCreatedBy describes information on user who created this ComputeInstance. +type ComputeInstanceCreatedBy struct { + // UserName - READ-ONLY; Name of the user. + UserName *string `json:"userName,omitempty"` + // UserOrgID - READ-ONLY; Uniquely identifies user' Azure Active Directory organization. + UserOrgID *string `json:"userOrgId,omitempty"` + // UserID - READ-ONLY; Uniquely identifies the user within his/her organization. + UserID *string `json:"userId,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComputeInstanceCreatedBy. +func (cicb ComputeInstanceCreatedBy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ComputeInstanceLastOperation the last operation on ComputeInstance. +type ComputeInstanceLastOperation struct { + // OperationName - Name of the last operation. Possible values include: 'OperationNameCreate', 'OperationNameStart', 'OperationNameStop', 'OperationNameRestart', 'OperationNameReimage', 'OperationNameDelete' + OperationName OperationName `json:"operationName,omitempty"` + // OperationTime - Time of the last operation. + OperationTime *date.Time `json:"operationTime,omitempty"` + // OperationStatus - Operation status. Possible values include: 'OperationStatusInProgress', 'OperationStatusSucceeded', 'OperationStatusCreateFailed', 'OperationStatusStartFailed', 'OperationStatusStopFailed', 'OperationStatusRestartFailed', 'OperationStatusReimageFailed', 'OperationStatusDeleteFailed' + OperationStatus OperationStatus `json:"operationStatus,omitempty"` +} + +// ComputeInstanceProperties compute Instance properties +type ComputeInstanceProperties struct { + // VMSize - Virtual Machine Size + VMSize *string `json:"vmSize,omitempty"` + // Subnet - Virtual network subnet resource ID the compute nodes belong to. + Subnet *ResourceID `json:"subnet,omitempty"` + // ApplicationSharingPolicy - Policy for sharing applications on this compute instance among users of parent workspace. If Personal, only the creator can access applications on this compute instance. When Shared, any workspace user can access applications on this instance depending on his/her assigned role. Possible values include: 'Personal', 'Shared' + ApplicationSharingPolicy ApplicationSharingPolicy `json:"applicationSharingPolicy,omitempty"` + // SSHSettings - Specifies policy and settings for SSH access. + SSHSettings *ComputeInstanceSSHSettings `json:"sshSettings,omitempty"` + // ConnectivityEndpoints - READ-ONLY; Describes all connectivity endpoints available for this ComputeInstance. + ConnectivityEndpoints *ComputeInstanceConnectivityEndpoints `json:"connectivityEndpoints,omitempty"` + // Applications - READ-ONLY; Describes available applications and their endpoints on this ComputeInstance. + Applications *[]ComputeInstanceApplication `json:"applications,omitempty"` + // CreatedBy - READ-ONLY; Describes information on user who created this ComputeInstance. + CreatedBy *ComputeInstanceCreatedBy `json:"createdBy,omitempty"` + // Errors - READ-ONLY; Collection of errors encountered on this ComputeInstance. + Errors *[]ErrorResponse `json:"errors,omitempty"` + // State - READ-ONLY; The current state of this ComputeInstance. Possible values include: 'Creating', 'CreateFailed', 'Deleting', 'Running', 'Restarting', 'JobRunning', 'SettingUp', 'SetupFailed', 'Starting', 'Stopped', 'Stopping', 'UserSettingUp', 'UserSetupFailed', 'Unknown', 'Unusable' + State ComputeInstanceState `json:"state,omitempty"` + // ComputeInstanceAuthorizationType - The Compute Instance Authorization type. Available values are personal (default). Possible values include: 'ComputeInstanceAuthorizationTypePersonal' + ComputeInstanceAuthorizationType ComputeInstanceAuthorizationType `json:"computeInstanceAuthorizationType,omitempty"` + // PersonalComputeInstanceSettings - Settings for a personal compute instance. + PersonalComputeInstanceSettings *PersonalComputeInstanceSettings `json:"personalComputeInstanceSettings,omitempty"` + // SetupScripts - Details of customized scripts to execute for setting up the cluster. + SetupScripts *SetupScripts `json:"setupScripts,omitempty"` + // LastOperation - READ-ONLY; The last operation on ComputeInstance. + LastOperation *ComputeInstanceLastOperation `json:"lastOperation,omitempty"` + // Schedules - The list of schedules to be applied on the compute instance. + Schedules *ComputeSchedules `json:"schedules,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComputeInstanceProperties. +func (ci ComputeInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ci.VMSize != nil { + objectMap["vmSize"] = ci.VMSize + } + if ci.Subnet != nil { + objectMap["subnet"] = ci.Subnet + } + if ci.ApplicationSharingPolicy != "" { + objectMap["applicationSharingPolicy"] = ci.ApplicationSharingPolicy + } + if ci.SSHSettings != nil { + objectMap["sshSettings"] = ci.SSHSettings + } + if ci.ComputeInstanceAuthorizationType != "" { + objectMap["computeInstanceAuthorizationType"] = ci.ComputeInstanceAuthorizationType + } + if ci.PersonalComputeInstanceSettings != nil { + objectMap["personalComputeInstanceSettings"] = ci.PersonalComputeInstanceSettings + } + if ci.SetupScripts != nil { + objectMap["setupScripts"] = ci.SetupScripts + } + if ci.Schedules != nil { + objectMap["schedules"] = ci.Schedules + } + return json.Marshal(objectMap) +} + +// ComputeInstanceSSHSettings specifies policy and settings for SSH access. +type ComputeInstanceSSHSettings struct { + // SSHPublicAccess - State of the public SSH port. Possible values are: Disabled - Indicates that the public ssh port is closed on this instance. Enabled - Indicates that the public ssh port is open and accessible according to the VNet/subnet policy if applicable. Possible values include: 'SSHPublicAccessEnabled', 'SSHPublicAccessDisabled' + SSHPublicAccess SSHPublicAccess `json:"sshPublicAccess,omitempty"` + // AdminUserName - READ-ONLY; Describes the admin user name. + AdminUserName *string `json:"adminUserName,omitempty"` + // SSHPort - READ-ONLY; Describes the port for connecting through SSH. + SSHPort *int32 `json:"sshPort,omitempty"` + // AdminPublicKey - Specifies the SSH rsa public key file as a string. Use "ssh-keygen -t rsa -b 2048" to generate your SSH key pairs. + AdminPublicKey *string `json:"adminPublicKey,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComputeInstanceSSHSettings. +func (ciss ComputeInstanceSSHSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ciss.SSHPublicAccess != "" { + objectMap["sshPublicAccess"] = ciss.SSHPublicAccess + } + if ciss.AdminPublicKey != nil { + objectMap["adminPublicKey"] = ciss.AdminPublicKey + } + return json.Marshal(objectMap) +} + +// BasicComputeNodesInformation compute nodes information related to a Machine Learning compute. Might differ for every +// type of compute. +type BasicComputeNodesInformation interface { + AsAmlComputeNodesInformation() (*AmlComputeNodesInformation, bool) + AsComputeNodesInformation() (*ComputeNodesInformation, bool) +} + +// ComputeNodesInformation compute nodes information related to a Machine Learning compute. Might differ for +// every type of compute. +type ComputeNodesInformation struct { + // NextLink - READ-ONLY; The continuation token. + NextLink *string `json:"nextLink,omitempty"` + // ComputeType - Possible values include: 'ComputeTypeBasicComputeNodesInformationComputeTypeComputeNodesInformation', 'ComputeTypeBasicComputeNodesInformationComputeTypeAmlCompute' + ComputeType ComputeTypeBasicComputeNodesInformation `json:"computeType,omitempty"` +} + +func unmarshalBasicComputeNodesInformation(body []byte) (BasicComputeNodesInformation, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["computeType"] { + case string(ComputeTypeBasicComputeNodesInformationComputeTypeAmlCompute): + var acni AmlComputeNodesInformation + err := json.Unmarshal(body, &acni) + return acni, err + default: + var cni ComputeNodesInformation + err := json.Unmarshal(body, &cni) + return cni, err + } +} +func unmarshalBasicComputeNodesInformationArray(body []byte) ([]BasicComputeNodesInformation, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + cniArray := make([]BasicComputeNodesInformation, len(rawMessages)) + + for index, rawMessage := range rawMessages { + cni, err := unmarshalBasicComputeNodesInformation(*rawMessage) + if err != nil { + return nil, err + } + cniArray[index] = cni + } + return cniArray, nil +} + +// MarshalJSON is the custom marshaler for ComputeNodesInformation. +func (cni ComputeNodesInformation) MarshalJSON() ([]byte, error) { + cni.ComputeType = ComputeTypeBasicComputeNodesInformationComputeTypeComputeNodesInformation + objectMap := make(map[string]interface{}) + if cni.ComputeType != "" { + objectMap["computeType"] = cni.ComputeType + } + return json.Marshal(objectMap) +} + +// AsAmlComputeNodesInformation is the BasicComputeNodesInformation implementation for ComputeNodesInformation. +func (cni ComputeNodesInformation) AsAmlComputeNodesInformation() (*AmlComputeNodesInformation, bool) { + return nil, false +} + +// AsComputeNodesInformation is the BasicComputeNodesInformation implementation for ComputeNodesInformation. +func (cni ComputeNodesInformation) AsComputeNodesInformation() (*ComputeNodesInformation, bool) { + return &cni, true +} + +// AsBasicComputeNodesInformation is the BasicComputeNodesInformation implementation for ComputeNodesInformation. +func (cni ComputeNodesInformation) AsBasicComputeNodesInformation() (BasicComputeNodesInformation, bool) { + return &cni, true +} + +// ComputeResource machine Learning compute object wrapped into ARM resource envelope. +type ComputeResource struct { + autorest.Response `json:"-"` + // Properties - Compute properties + Properties BasicCompute `json:"properties,omitempty"` + // Identity - The identity of the resource. + Identity *Identity `json:"identity,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Contains resource tags defined as key/value pairs. + Tags map[string]*string `json:"tags"` + // Sku - The sku of the workspace. + Sku *Sku `json:"sku,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComputeResource. +func (cr ComputeResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = cr.Properties + if cr.Identity != nil { + objectMap["identity"] = cr.Identity + } + if cr.Location != nil { + objectMap["location"] = cr.Location + } + if cr.Tags != nil { + objectMap["tags"] = cr.Tags + } + if cr.Sku != nil { + objectMap["sku"] = cr.Sku + } + if cr.SystemData != nil { + objectMap["systemData"] = cr.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ComputeResource struct. +func (cr *ComputeResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + properties, err := unmarshalBasicCompute(*v) + if err != nil { + return err + } + cr.Properties = properties + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + cr.Identity = &identity + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + cr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cr.Tags = tags + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + cr.Sku = &sku + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + cr.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cr.Type = &typeVar + } + } + } + + return nil +} + +// ComputeSchedules the list of schedules to be applied on the computes +type ComputeSchedules struct { + // ComputeStartStop - The list of compute start stop schedules to be applied. + ComputeStartStop *[]ComputeStartStopSchedule `json:"computeStartStop,omitempty"` +} + +// BasicComputeSecrets secrets related to a Machine Learning compute. Might differ for every type of compute. +type BasicComputeSecrets interface { + AsAksComputeSecrets() (*AksComputeSecrets, bool) + AsVirtualMachineSecrets() (*VirtualMachineSecrets, bool) + AsDatabricksComputeSecrets() (*DatabricksComputeSecrets, bool) + AsComputeSecrets() (*ComputeSecrets, bool) +} + +// ComputeSecrets secrets related to a Machine Learning compute. Might differ for every type of compute. +type ComputeSecrets struct { + autorest.Response `json:"-"` + // ComputeType - Possible values include: 'ComputeTypeBasicComputeSecretsComputeTypeComputeSecrets', 'ComputeTypeBasicComputeSecretsComputeTypeAKS', 'ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine', 'ComputeTypeBasicComputeSecretsComputeTypeDatabricks' + ComputeType ComputeTypeBasicComputeSecrets `json:"computeType,omitempty"` +} + +func unmarshalBasicComputeSecrets(body []byte) (BasicComputeSecrets, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["computeType"] { + case string(ComputeTypeBasicComputeSecretsComputeTypeAKS): + var acs AksComputeSecrets + err := json.Unmarshal(body, &acs) + return acs, err + case string(ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine): + var vms VirtualMachineSecrets + err := json.Unmarshal(body, &vms) + return vms, err + case string(ComputeTypeBasicComputeSecretsComputeTypeDatabricks): + var dcs DatabricksComputeSecrets + err := json.Unmarshal(body, &dcs) + return dcs, err + default: + var cs ComputeSecrets + err := json.Unmarshal(body, &cs) + return cs, err + } +} +func unmarshalBasicComputeSecretsArray(body []byte) ([]BasicComputeSecrets, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + csArray := make([]BasicComputeSecrets, len(rawMessages)) + + for index, rawMessage := range rawMessages { + cs, err := unmarshalBasicComputeSecrets(*rawMessage) + if err != nil { + return nil, err + } + csArray[index] = cs + } + return csArray, nil +} + +// MarshalJSON is the custom marshaler for ComputeSecrets. +func (cs ComputeSecrets) MarshalJSON() ([]byte, error) { + cs.ComputeType = ComputeTypeBasicComputeSecretsComputeTypeComputeSecrets + objectMap := make(map[string]interface{}) + if cs.ComputeType != "" { + objectMap["computeType"] = cs.ComputeType + } + return json.Marshal(objectMap) +} + +// AsAksComputeSecrets is the BasicComputeSecrets implementation for ComputeSecrets. +func (cs ComputeSecrets) AsAksComputeSecrets() (*AksComputeSecrets, bool) { + return nil, false +} + +// AsVirtualMachineSecrets is the BasicComputeSecrets implementation for ComputeSecrets. +func (cs ComputeSecrets) AsVirtualMachineSecrets() (*VirtualMachineSecrets, bool) { + return nil, false +} + +// AsDatabricksComputeSecrets is the BasicComputeSecrets implementation for ComputeSecrets. +func (cs ComputeSecrets) AsDatabricksComputeSecrets() (*DatabricksComputeSecrets, bool) { + return nil, false +} + +// AsComputeSecrets is the BasicComputeSecrets implementation for ComputeSecrets. +func (cs ComputeSecrets) AsComputeSecrets() (*ComputeSecrets, bool) { + return &cs, true +} + +// AsBasicComputeSecrets is the BasicComputeSecrets implementation for ComputeSecrets. +func (cs ComputeSecrets) AsBasicComputeSecrets() (BasicComputeSecrets, bool) { + return &cs, true +} + +// ComputeSecretsModel ... +type ComputeSecretsModel struct { + autorest.Response `json:"-"` + Value BasicComputeSecrets `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for ComputeSecretsModel struct. +func (csm *ComputeSecretsModel) UnmarshalJSON(body []byte) error { + cs, err := unmarshalBasicComputeSecrets(body) + if err != nil { + return err + } + csm.Value = cs + + return nil +} + +// ComputeStartFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ComputeStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ComputeClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ComputeStartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ComputeStartFuture.Result. +func (future *ComputeStartFuture) result(client ComputeClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.ComputeStartFuture") + return + } + ar.Response = future.Response() + return +} + +// ComputeStartStopSchedule compute start stop schedule properties +type ComputeStartStopSchedule struct { + // ID - READ-ONLY; Schedule id. + ID *string `json:"id,omitempty"` + // ProvisioningStatus - READ-ONLY; The current deployment state of schedule. Possible values include: 'ProvisioningStatusCompleted', 'ProvisioningStatusProvisioning', 'ProvisioningStatusFailed' + ProvisioningStatus ProvisioningStatus `json:"provisioningStatus,omitempty"` + // Status - Possible values include: 'ScheduleStatusEnabled', 'ScheduleStatusDisabled' + Status ScheduleStatus `json:"status,omitempty"` + // TriggerType - Possible values include: 'TriggerTypeRecurrence', 'TriggerTypeCron' + TriggerType TriggerType `json:"triggerType,omitempty"` + // Action - Possible values include: 'Start', 'Stop' + Action ComputePowerAction `json:"action,omitempty"` + Recurrence *Recurrence `json:"recurrence,omitempty"` + Cron *Cron `json:"cron,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComputeStartStopSchedule. +func (csss ComputeStartStopSchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csss.Status != "" { + objectMap["status"] = csss.Status + } + if csss.TriggerType != "" { + objectMap["triggerType"] = csss.TriggerType + } + if csss.Action != "" { + objectMap["action"] = csss.Action + } + if csss.Recurrence != nil { + objectMap["recurrence"] = csss.Recurrence + } + if csss.Cron != nil { + objectMap["cron"] = csss.Cron + } + return json.Marshal(objectMap) +} + +// ComputeStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ComputeStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ComputeClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ComputeStopFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ComputeStopFuture.Result. +func (future *ComputeStopFuture) result(client ComputeClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.ComputeStopFuture") + return + } + ar.Response = future.Response() + return +} + +// ComputeUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ComputeUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ComputeClient) (ComputeResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ComputeUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ComputeUpdateFuture.Result. +func (future *ComputeUpdateFuture) result(client ComputeClient) (cr ComputeResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.ComputeUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { + cr, err = client.UpdateResponder(cr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeUpdateFuture", "Result", cr.Response.Response, "Failure responding to request") + } + } + return +} + +// ContainerResourceRequirements the resource requirements for the container (cpu and memory). +type ContainerResourceRequirements struct { + // CPU - The minimum amount of CPU cores to be used by the container. More info: + // https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + CPU *float64 `json:"cpu,omitempty"` + // CPULimit - The maximum amount of CPU cores allowed to be used by the container. More info: + // https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + CPULimit *float64 `json:"cpuLimit,omitempty"` + // MemoryInGB - The minimum amount of memory (in GB) to be used by the container. More info: + // https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + MemoryInGB *float64 `json:"memoryInGB,omitempty"` + // MemoryInGBLimit - The maximum amount of memory (in GB) allowed to be used by the container. More info: + // https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + MemoryInGBLimit *float64 `json:"memoryInGBLimit,omitempty"` + // Gpu - The number of GPU cores in the container. + Gpu *int32 `json:"gpu,omitempty"` + // Fpga - The number of FPGA PCIE devices exposed to the container. Must be multiple of 2. + Fpga *int32 `json:"fpga,omitempty"` +} + +// CosmosDbSettings ... +type CosmosDbSettings struct { + // CollectionsThroughput - The throughput of the collections in cosmosdb database + CollectionsThroughput *int32 `json:"collectionsThroughput,omitempty"` +} + +// Cron the workflow trigger cron for ComputeStartStop schedule type. +type Cron struct { + // StartTime - The start time. + StartTime *string `json:"startTime,omitempty"` + // TimeZone - The time zone. + TimeZone *string `json:"timeZone,omitempty"` + // Expression - The cron expression. + Expression *string `json:"expression,omitempty"` +} + +// CsvExportSummary ... +type CsvExportSummary struct { + // ContainerName - READ-ONLY; The container name to which the labels will be exported. + ContainerName *string `json:"containerName,omitempty"` + // SnapshotPath - READ-ONLY; The output path where the labels will be exported. + SnapshotPath *string `json:"snapshotPath,omitempty"` + // EndTimeUtc - READ-ONLY; The time when the export was completed. + EndTimeUtc *date.Time `json:"endTimeUtc,omitempty"` + // ExportedRowCount - READ-ONLY; The total number of labeled datapoints exported. + ExportedRowCount *int64 `json:"exportedRowCount,omitempty"` + // LabelingJobID - READ-ONLY; Name and identifier of the job containing exported labels. + LabelingJobID *string `json:"labelingJobId,omitempty"` + // StartTimeUtc - READ-ONLY; The time when the export was requested. + StartTimeUtc *date.Time `json:"startTimeUtc,omitempty"` + // Format - Possible values include: 'FormatExportSummary', 'FormatCoco', 'FormatCSV', 'FormatDataset' + Format Format `json:"format,omitempty"` +} + +// MarshalJSON is the custom marshaler for CsvExportSummary. +func (ces CsvExportSummary) MarshalJSON() ([]byte, error) { + ces.Format = FormatCSV + objectMap := make(map[string]interface{}) + if ces.Format != "" { + objectMap["format"] = ces.Format + } + return json.Marshal(objectMap) +} + +// AsCocoExportSummary is the BasicExportSummary implementation for CsvExportSummary. +func (ces CsvExportSummary) AsCocoExportSummary() (*CocoExportSummary, bool) { + return nil, false +} + +// AsCsvExportSummary is the BasicExportSummary implementation for CsvExportSummary. +func (ces CsvExportSummary) AsCsvExportSummary() (*CsvExportSummary, bool) { + return &ces, true +} + +// AsDatasetExportSummary is the BasicExportSummary implementation for CsvExportSummary. +func (ces CsvExportSummary) AsDatasetExportSummary() (*DatasetExportSummary, bool) { + return nil, false +} + +// AsExportSummary is the BasicExportSummary implementation for CsvExportSummary. +func (ces CsvExportSummary) AsExportSummary() (*ExportSummary, bool) { + return nil, false +} + +// AsBasicExportSummary is the BasicExportSummary implementation for CsvExportSummary. +func (ces CsvExportSummary) AsBasicExportSummary() (BasicExportSummary, bool) { + return &ces, true +} + +// Databricks a DataFactory compute. +type Databricks struct { + Properties *DatabricksProperties `json:"properties,omitempty"` + // ComputeLocation - Location for the underlying compute + ComputeLocation *string `json:"computeLocation,omitempty"` + // ProvisioningState - READ-ONLY; The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Possible values include: 'ProvisioningStateUnknown', 'ProvisioningStateUpdating', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Description - The description of the Machine Learning compute. + Description *string `json:"description,omitempty"` + // CreatedOn - READ-ONLY; The time at which the compute was created. + CreatedOn *date.Time `json:"createdOn,omitempty"` + // ModifiedOn - READ-ONLY; The time at which the compute was last modified. + ModifiedOn *date.Time `json:"modifiedOn,omitempty"` + // ResourceID - ARM resource id of the underlying compute + ResourceID *string `json:"resourceId,omitempty"` + // ProvisioningErrors - READ-ONLY; Errors during provisioning + ProvisioningErrors *[]ErrorResponse `json:"provisioningErrors,omitempty"` + // 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. + IsAttachedCompute *bool `json:"isAttachedCompute,omitempty"` + // DisableLocalAuth - Opt-out of local authentication and ensure customers can use only MSI and AAD exclusively for authentication. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + // ComputeType - Possible values include: 'ComputeTypeCompute', 'ComputeTypeAKS1', 'ComputeTypeAmlCompute1', 'ComputeTypeComputeInstance1', 'ComputeTypeVirtualMachine1', 'ComputeTypeHDInsight1', 'ComputeTypeDataFactory1', 'ComputeTypeDatabricks1', 'ComputeTypeDataLakeAnalytics1' + ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for Databricks. +func (d Databricks) MarshalJSON() ([]byte, error) { + d.ComputeType = ComputeTypeDatabricks1 + objectMap := make(map[string]interface{}) + if d.Properties != nil { + objectMap["properties"] = d.Properties + } + if d.ComputeLocation != nil { + objectMap["computeLocation"] = d.ComputeLocation + } + if d.Description != nil { + objectMap["description"] = d.Description + } + if d.ResourceID != nil { + objectMap["resourceId"] = d.ResourceID + } + if d.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = d.DisableLocalAuth + } + if d.ComputeType != "" { + objectMap["computeType"] = d.ComputeType + } + return json.Marshal(objectMap) +} + +// AsAKS is the BasicCompute implementation for Databricks. +func (d Databricks) AsAKS() (*AKS, bool) { + return nil, false +} + +// AsAmlCompute is the BasicCompute implementation for Databricks. +func (d Databricks) AsAmlCompute() (*AmlCompute, bool) { + return nil, false +} + +// AsComputeInstance is the BasicCompute implementation for Databricks. +func (d Databricks) AsComputeInstance() (*ComputeInstance, bool) { + return nil, false +} + +// AsVirtualMachine is the BasicCompute implementation for Databricks. +func (d Databricks) AsVirtualMachine() (*VirtualMachine, bool) { + return nil, false +} + +// AsHDInsight is the BasicCompute implementation for Databricks. +func (d Databricks) AsHDInsight() (*HDInsight, bool) { + return nil, false +} + +// AsDataFactory is the BasicCompute implementation for Databricks. +func (d Databricks) AsDataFactory() (*DataFactory, bool) { + return nil, false +} + +// AsDatabricks is the BasicCompute implementation for Databricks. +func (d Databricks) AsDatabricks() (*Databricks, bool) { + return &d, true +} + +// AsDataLakeAnalytics is the BasicCompute implementation for Databricks. +func (d Databricks) AsDataLakeAnalytics() (*DataLakeAnalytics, bool) { + return nil, false +} + +// AsCompute is the BasicCompute implementation for Databricks. +func (d Databricks) AsCompute() (*Compute, bool) { + return nil, false +} + +// AsBasicCompute is the BasicCompute implementation for Databricks. +func (d Databricks) AsBasicCompute() (BasicCompute, bool) { + return &d, true +} + +// DatabricksComputeSecrets secrets related to a Machine Learning compute based on Databricks. +type DatabricksComputeSecrets struct { + // DatabricksAccessToken - access token for databricks account. + DatabricksAccessToken *string `json:"databricksAccessToken,omitempty"` + // ComputeType - Possible values include: 'ComputeTypeBasicComputeSecretsComputeTypeComputeSecrets', 'ComputeTypeBasicComputeSecretsComputeTypeAKS', 'ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine', 'ComputeTypeBasicComputeSecretsComputeTypeDatabricks' + ComputeType ComputeTypeBasicComputeSecrets `json:"computeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for DatabricksComputeSecrets. +func (dcs DatabricksComputeSecrets) MarshalJSON() ([]byte, error) { + dcs.ComputeType = ComputeTypeBasicComputeSecretsComputeTypeDatabricks + objectMap := make(map[string]interface{}) + if dcs.DatabricksAccessToken != nil { + objectMap["databricksAccessToken"] = dcs.DatabricksAccessToken + } + if dcs.ComputeType != "" { + objectMap["computeType"] = dcs.ComputeType + } + return json.Marshal(objectMap) +} + +// AsAksComputeSecrets is the BasicComputeSecrets implementation for DatabricksComputeSecrets. +func (dcs DatabricksComputeSecrets) AsAksComputeSecrets() (*AksComputeSecrets, bool) { + return nil, false +} + +// AsVirtualMachineSecrets is the BasicComputeSecrets implementation for DatabricksComputeSecrets. +func (dcs DatabricksComputeSecrets) AsVirtualMachineSecrets() (*VirtualMachineSecrets, bool) { + return nil, false +} + +// AsDatabricksComputeSecrets is the BasicComputeSecrets implementation for DatabricksComputeSecrets. +func (dcs DatabricksComputeSecrets) AsDatabricksComputeSecrets() (*DatabricksComputeSecrets, bool) { + return &dcs, true +} + +// AsComputeSecrets is the BasicComputeSecrets implementation for DatabricksComputeSecrets. +func (dcs DatabricksComputeSecrets) AsComputeSecrets() (*ComputeSecrets, bool) { + return nil, false +} + +// AsBasicComputeSecrets is the BasicComputeSecrets implementation for DatabricksComputeSecrets. +func (dcs DatabricksComputeSecrets) AsBasicComputeSecrets() (BasicComputeSecrets, bool) { + return &dcs, true +} + +// DatabricksProperties ... +type DatabricksProperties struct { + // DatabricksAccessToken - Databricks access token + DatabricksAccessToken *string `json:"databricksAccessToken,omitempty"` + // WorkspaceURL - Workspace Url + WorkspaceURL *string `json:"workspaceUrl,omitempty"` +} + +// DataContainer container for data asset versions. +type DataContainer struct { + // Description - The asset description text. + Description *string `json:"description,omitempty"` + // Properties - The asset property dictionary. + Properties map[string]*string `json:"properties"` + // Tags - Tag dictionary. Tags can be added, removed, and updated. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for DataContainer. +func (dc DataContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dc.Description != nil { + objectMap["description"] = dc.Description + } + if dc.Properties != nil { + objectMap["properties"] = dc.Properties + } + if dc.Tags != nil { + objectMap["tags"] = dc.Tags + } + return json.Marshal(objectMap) +} + +// DataContainerResource azure Resource Manager resource envelope. +type DataContainerResource struct { + autorest.Response `json:"-"` + // Properties - Additional attributes of the entity. + Properties *DataContainer `json:"properties,omitempty"` + // SystemData - READ-ONLY; System data associated with resource provider + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataContainerResource. +func (dcr DataContainerResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcr.Properties != nil { + objectMap["properties"] = dcr.Properties + } + return json.Marshal(objectMap) +} + +// DataContainerResourceArmPaginatedResult a paginated list of DataContainer entities. +type DataContainerResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type DataContainer. + Value *[]DataContainerResource `json:"value,omitempty"` +} + +// DataContainerResourceArmPaginatedResultIterator provides access to a complete listing of +// DataContainerResource values. +type DataContainerResourceArmPaginatedResultIterator struct { + i int + page DataContainerResourceArmPaginatedResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DataContainerResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataContainerResourceArmPaginatedResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DataContainerResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DataContainerResourceArmPaginatedResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DataContainerResourceArmPaginatedResultIterator) Response() DataContainerResourceArmPaginatedResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DataContainerResourceArmPaginatedResultIterator) Value() DataContainerResource { + if !iter.page.NotDone() { + return DataContainerResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DataContainerResourceArmPaginatedResultIterator type. +func NewDataContainerResourceArmPaginatedResultIterator(page DataContainerResourceArmPaginatedResultPage) DataContainerResourceArmPaginatedResultIterator { + return DataContainerResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dcrapr DataContainerResourceArmPaginatedResult) IsEmpty() bool { + return dcrapr.Value == nil || len(*dcrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dcrapr DataContainerResourceArmPaginatedResult) hasNextLink() bool { + return dcrapr.NextLink != nil && len(*dcrapr.NextLink) != 0 +} + +// dataContainerResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dcrapr DataContainerResourceArmPaginatedResult) dataContainerResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !dcrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dcrapr.NextLink))) +} + +// DataContainerResourceArmPaginatedResultPage contains a page of DataContainerResource values. +type DataContainerResourceArmPaginatedResultPage struct { + fn func(context.Context, DataContainerResourceArmPaginatedResult) (DataContainerResourceArmPaginatedResult, error) + dcrapr DataContainerResourceArmPaginatedResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DataContainerResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataContainerResourceArmPaginatedResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dcrapr) + if err != nil { + return err + } + page.dcrapr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DataContainerResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DataContainerResourceArmPaginatedResultPage) NotDone() bool { + return !page.dcrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DataContainerResourceArmPaginatedResultPage) Response() DataContainerResourceArmPaginatedResult { + return page.dcrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DataContainerResourceArmPaginatedResultPage) Values() []DataContainerResource { + if page.dcrapr.IsEmpty() { + return nil + } + return *page.dcrapr.Value +} + +// Creates a new instance of the DataContainerResourceArmPaginatedResultPage type. +func NewDataContainerResourceArmPaginatedResultPage(cur DataContainerResourceArmPaginatedResult, getNextPage func(context.Context, DataContainerResourceArmPaginatedResult) (DataContainerResourceArmPaginatedResult, error)) DataContainerResourceArmPaginatedResultPage { + return DataContainerResourceArmPaginatedResultPage{ + fn: getNextPage, + dcrapr: cur, + } +} + +// DataFactory a DataFactory compute. +type DataFactory struct { + // ComputeLocation - Location for the underlying compute + ComputeLocation *string `json:"computeLocation,omitempty"` + // ProvisioningState - READ-ONLY; The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Possible values include: 'ProvisioningStateUnknown', 'ProvisioningStateUpdating', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Description - The description of the Machine Learning compute. + Description *string `json:"description,omitempty"` + // CreatedOn - READ-ONLY; The time at which the compute was created. + CreatedOn *date.Time `json:"createdOn,omitempty"` + // ModifiedOn - READ-ONLY; The time at which the compute was last modified. + ModifiedOn *date.Time `json:"modifiedOn,omitempty"` + // ResourceID - ARM resource id of the underlying compute + ResourceID *string `json:"resourceId,omitempty"` + // ProvisioningErrors - READ-ONLY; Errors during provisioning + ProvisioningErrors *[]ErrorResponse `json:"provisioningErrors,omitempty"` + // 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. + IsAttachedCompute *bool `json:"isAttachedCompute,omitempty"` + // DisableLocalAuth - Opt-out of local authentication and ensure customers can use only MSI and AAD exclusively for authentication. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + // ComputeType - Possible values include: 'ComputeTypeCompute', 'ComputeTypeAKS1', 'ComputeTypeAmlCompute1', 'ComputeTypeComputeInstance1', 'ComputeTypeVirtualMachine1', 'ComputeTypeHDInsight1', 'ComputeTypeDataFactory1', 'ComputeTypeDatabricks1', 'ComputeTypeDataLakeAnalytics1' + ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataFactory. +func (df DataFactory) MarshalJSON() ([]byte, error) { + df.ComputeType = ComputeTypeDataFactory1 + objectMap := make(map[string]interface{}) + if df.ComputeLocation != nil { + objectMap["computeLocation"] = df.ComputeLocation + } + if df.Description != nil { + objectMap["description"] = df.Description + } + if df.ResourceID != nil { + objectMap["resourceId"] = df.ResourceID + } + if df.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = df.DisableLocalAuth + } + if df.ComputeType != "" { + objectMap["computeType"] = df.ComputeType + } + return json.Marshal(objectMap) +} + +// AsAKS is the BasicCompute implementation for DataFactory. +func (df DataFactory) AsAKS() (*AKS, bool) { + return nil, false +} + +// AsAmlCompute is the BasicCompute implementation for DataFactory. +func (df DataFactory) AsAmlCompute() (*AmlCompute, bool) { + return nil, false +} + +// AsComputeInstance is the BasicCompute implementation for DataFactory. +func (df DataFactory) AsComputeInstance() (*ComputeInstance, bool) { + return nil, false +} + +// AsVirtualMachine is the BasicCompute implementation for DataFactory. +func (df DataFactory) AsVirtualMachine() (*VirtualMachine, bool) { + return nil, false +} + +// AsHDInsight is the BasicCompute implementation for DataFactory. +func (df DataFactory) AsHDInsight() (*HDInsight, bool) { + return nil, false +} + +// AsDataFactory is the BasicCompute implementation for DataFactory. +func (df DataFactory) AsDataFactory() (*DataFactory, bool) { + return &df, true +} + +// AsDatabricks is the BasicCompute implementation for DataFactory. +func (df DataFactory) AsDatabricks() (*Databricks, bool) { + return nil, false +} + +// AsDataLakeAnalytics is the BasicCompute implementation for DataFactory. +func (df DataFactory) AsDataLakeAnalytics() (*DataLakeAnalytics, bool) { + return nil, false +} + +// AsCompute is the BasicCompute implementation for DataFactory. +func (df DataFactory) AsCompute() (*Compute, bool) { + return nil, false +} + +// AsBasicCompute is the BasicCompute implementation for DataFactory. +func (df DataFactory) AsBasicCompute() (BasicCompute, bool) { + return &df, true +} + +// DataLakeAnalytics a DataLakeAnalytics compute. +type DataLakeAnalytics struct { + Properties *DataLakeAnalyticsProperties `json:"properties,omitempty"` + // ComputeLocation - Location for the underlying compute + ComputeLocation *string `json:"computeLocation,omitempty"` + // ProvisioningState - READ-ONLY; The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Possible values include: 'ProvisioningStateUnknown', 'ProvisioningStateUpdating', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Description - The description of the Machine Learning compute. + Description *string `json:"description,omitempty"` + // CreatedOn - READ-ONLY; The time at which the compute was created. + CreatedOn *date.Time `json:"createdOn,omitempty"` + // ModifiedOn - READ-ONLY; The time at which the compute was last modified. + ModifiedOn *date.Time `json:"modifiedOn,omitempty"` + // ResourceID - ARM resource id of the underlying compute + ResourceID *string `json:"resourceId,omitempty"` + // ProvisioningErrors - READ-ONLY; Errors during provisioning + ProvisioningErrors *[]ErrorResponse `json:"provisioningErrors,omitempty"` + // 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. + IsAttachedCompute *bool `json:"isAttachedCompute,omitempty"` + // DisableLocalAuth - Opt-out of local authentication and ensure customers can use only MSI and AAD exclusively for authentication. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + // ComputeType - Possible values include: 'ComputeTypeCompute', 'ComputeTypeAKS1', 'ComputeTypeAmlCompute1', 'ComputeTypeComputeInstance1', 'ComputeTypeVirtualMachine1', 'ComputeTypeHDInsight1', 'ComputeTypeDataFactory1', 'ComputeTypeDatabricks1', 'ComputeTypeDataLakeAnalytics1' + ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataLakeAnalytics. +func (dla DataLakeAnalytics) MarshalJSON() ([]byte, error) { + dla.ComputeType = ComputeTypeDataLakeAnalytics1 + objectMap := make(map[string]interface{}) + if dla.Properties != nil { + objectMap["properties"] = dla.Properties + } + if dla.ComputeLocation != nil { + objectMap["computeLocation"] = dla.ComputeLocation + } + if dla.Description != nil { + objectMap["description"] = dla.Description + } + if dla.ResourceID != nil { + objectMap["resourceId"] = dla.ResourceID + } + if dla.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = dla.DisableLocalAuth + } + if dla.ComputeType != "" { + objectMap["computeType"] = dla.ComputeType + } + return json.Marshal(objectMap) +} + +// AsAKS is the BasicCompute implementation for DataLakeAnalytics. +func (dla DataLakeAnalytics) AsAKS() (*AKS, bool) { + return nil, false +} + +// AsAmlCompute is the BasicCompute implementation for DataLakeAnalytics. +func (dla DataLakeAnalytics) AsAmlCompute() (*AmlCompute, bool) { + return nil, false +} + +// AsComputeInstance is the BasicCompute implementation for DataLakeAnalytics. +func (dla DataLakeAnalytics) AsComputeInstance() (*ComputeInstance, bool) { + return nil, false +} + +// AsVirtualMachine is the BasicCompute implementation for DataLakeAnalytics. +func (dla DataLakeAnalytics) AsVirtualMachine() (*VirtualMachine, bool) { + return nil, false +} + +// AsHDInsight is the BasicCompute implementation for DataLakeAnalytics. +func (dla DataLakeAnalytics) AsHDInsight() (*HDInsight, bool) { + return nil, false +} + +// AsDataFactory is the BasicCompute implementation for DataLakeAnalytics. +func (dla DataLakeAnalytics) AsDataFactory() (*DataFactory, bool) { + return nil, false +} + +// AsDatabricks is the BasicCompute implementation for DataLakeAnalytics. +func (dla DataLakeAnalytics) AsDatabricks() (*Databricks, bool) { + return nil, false +} + +// AsDataLakeAnalytics is the BasicCompute implementation for DataLakeAnalytics. +func (dla DataLakeAnalytics) AsDataLakeAnalytics() (*DataLakeAnalytics, bool) { + return &dla, true +} + +// AsCompute is the BasicCompute implementation for DataLakeAnalytics. +func (dla DataLakeAnalytics) AsCompute() (*Compute, bool) { + return nil, false +} + +// AsBasicCompute is the BasicCompute implementation for DataLakeAnalytics. +func (dla DataLakeAnalytics) AsBasicCompute() (BasicCompute, bool) { + return &dla, true +} + +// DataLakeAnalyticsProperties ... +type DataLakeAnalyticsProperties struct { + // DataLakeStoreAccountName - DataLake Store Account Name + DataLakeStoreAccountName *string `json:"dataLakeStoreAccountName,omitempty"` +} + +// DataPathAssetReference reference to an asset via its path in a datastore. +type DataPathAssetReference struct { + // DatastoreID - ARM resource ID of the datastore where the asset is located. + DatastoreID *string `json:"datastoreId,omitempty"` + // Path - The path of the file/directory in the datastore. + Path *string `json:"path,omitempty"` + // ReferenceType - Possible values include: 'ReferenceTypeAssetReferenceBase', 'ReferenceTypeDataPath', 'ReferenceTypeID', 'ReferenceTypeOutputPath' + ReferenceType ReferenceTypeBasicAssetReferenceBase `json:"referenceType,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataPathAssetReference. +func (dpar DataPathAssetReference) MarshalJSON() ([]byte, error) { + dpar.ReferenceType = ReferenceTypeDataPath + objectMap := make(map[string]interface{}) + if dpar.DatastoreID != nil { + objectMap["datastoreId"] = dpar.DatastoreID + } + if dpar.Path != nil { + objectMap["path"] = dpar.Path + } + if dpar.ReferenceType != "" { + objectMap["referenceType"] = dpar.ReferenceType + } + return json.Marshal(objectMap) +} + +// AsDataPathAssetReference is the BasicAssetReferenceBase implementation for DataPathAssetReference. +func (dpar DataPathAssetReference) AsDataPathAssetReference() (*DataPathAssetReference, bool) { + return &dpar, true +} + +// AsIDAssetReference is the BasicAssetReferenceBase implementation for DataPathAssetReference. +func (dpar DataPathAssetReference) AsIDAssetReference() (*IDAssetReference, bool) { + return nil, false +} + +// AsOutputPathAssetReference is the BasicAssetReferenceBase implementation for DataPathAssetReference. +func (dpar DataPathAssetReference) AsOutputPathAssetReference() (*OutputPathAssetReference, bool) { + return nil, false +} + +// AsAssetReferenceBase is the BasicAssetReferenceBase implementation for DataPathAssetReference. +func (dpar DataPathAssetReference) AsAssetReferenceBase() (*AssetReferenceBase, bool) { + return nil, false +} + +// AsBasicAssetReferenceBase is the BasicAssetReferenceBase implementation for DataPathAssetReference. +func (dpar DataPathAssetReference) AsBasicAssetReferenceBase() (BasicAssetReferenceBase, bool) { + return &dpar, true +} + +// DatasetExportSummary ... +type DatasetExportSummary struct { + // LabeledAssetName - READ-ONLY; The unique name of the labeled data asset. + LabeledAssetName *string `json:"labeledAssetName,omitempty"` + // EndTimeUtc - READ-ONLY; The time when the export was completed. + EndTimeUtc *date.Time `json:"endTimeUtc,omitempty"` + // ExportedRowCount - READ-ONLY; The total number of labeled datapoints exported. + ExportedRowCount *int64 `json:"exportedRowCount,omitempty"` + // LabelingJobID - READ-ONLY; Name and identifier of the job containing exported labels. + LabelingJobID *string `json:"labelingJobId,omitempty"` + // StartTimeUtc - READ-ONLY; The time when the export was requested. + StartTimeUtc *date.Time `json:"startTimeUtc,omitempty"` + // Format - Possible values include: 'FormatExportSummary', 'FormatCoco', 'FormatCSV', 'FormatDataset' + Format Format `json:"format,omitempty"` +} + +// MarshalJSON is the custom marshaler for DatasetExportSummary. +func (desVar DatasetExportSummary) MarshalJSON() ([]byte, error) { + desVar.Format = FormatDataset + objectMap := make(map[string]interface{}) + if desVar.Format != "" { + objectMap["format"] = desVar.Format + } + return json.Marshal(objectMap) +} + +// AsCocoExportSummary is the BasicExportSummary implementation for DatasetExportSummary. +func (desVar DatasetExportSummary) AsCocoExportSummary() (*CocoExportSummary, bool) { + return nil, false +} + +// AsCsvExportSummary is the BasicExportSummary implementation for DatasetExportSummary. +func (desVar DatasetExportSummary) AsCsvExportSummary() (*CsvExportSummary, bool) { + return nil, false +} + +// AsDatasetExportSummary is the BasicExportSummary implementation for DatasetExportSummary. +func (desVar DatasetExportSummary) AsDatasetExportSummary() (*DatasetExportSummary, bool) { + return &desVar, true +} + +// AsExportSummary is the BasicExportSummary implementation for DatasetExportSummary. +func (desVar DatasetExportSummary) AsExportSummary() (*ExportSummary, bool) { + return nil, false +} + +// AsBasicExportSummary is the BasicExportSummary implementation for DatasetExportSummary. +func (desVar DatasetExportSummary) AsBasicExportSummary() (BasicExportSummary, bool) { + return &desVar, true +} + +// BasicDatastoreContents base definition for datastore contents configuration. +type BasicDatastoreContents interface { + AsAzureBlobContents() (*AzureBlobContents, bool) + AsAzureDataLakeGen1Contents() (*AzureDataLakeGen1Contents, bool) + AsAzureDataLakeGen2Contents() (*AzureDataLakeGen2Contents, bool) + AsAzureFileContents() (*AzureFileContents, bool) + AsAzurePostgreSQLContents() (*AzurePostgreSQLContents, bool) + AsAzureSQLDatabaseContents() (*AzureSQLDatabaseContents, bool) + AsGlusterFsContents() (*GlusterFsContents, bool) + AsDatastoreContents() (*DatastoreContents, bool) +} + +// DatastoreContents base definition for datastore contents configuration. +type DatastoreContents struct { + // ContentsType - Possible values include: 'ContentsTypeDatastoreContents', 'ContentsTypeAzureBlob', 'ContentsTypeAzureDataLakeGen1', 'ContentsTypeAzureDataLakeGen2', 'ContentsTypeAzureFile', 'ContentsTypeAzurePostgreSQL', 'ContentsTypeAzureSQLDatabase', 'ContentsTypeGlusterFs' + ContentsType ContentsTypeBasicDatastoreContents `json:"contentsType,omitempty"` +} + +func unmarshalBasicDatastoreContents(body []byte) (BasicDatastoreContents, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["contentsType"] { + case string(ContentsTypeAzureBlob): + var abc AzureBlobContents + err := json.Unmarshal(body, &abc) + return abc, err + case string(ContentsTypeAzureDataLakeGen1): + var adlg1c AzureDataLakeGen1Contents + err := json.Unmarshal(body, &adlg1c) + return adlg1c, err + case string(ContentsTypeAzureDataLakeGen2): + var adlg2c AzureDataLakeGen2Contents + err := json.Unmarshal(body, &adlg2c) + return adlg2c, err + case string(ContentsTypeAzureFile): + var afc AzureFileContents + err := json.Unmarshal(body, &afc) + return afc, err + case string(ContentsTypeAzurePostgreSQL): + var apsc AzurePostgreSQLContents + err := json.Unmarshal(body, &apsc) + return apsc, err + case string(ContentsTypeAzureSQLDatabase): + var asdc AzureSQLDatabaseContents + err := json.Unmarshal(body, &asdc) + return asdc, err + case string(ContentsTypeGlusterFs): + var gfc GlusterFsContents + err := json.Unmarshal(body, &gfc) + return gfc, err + default: + var dc DatastoreContents + err := json.Unmarshal(body, &dc) + return dc, err + } +} +func unmarshalBasicDatastoreContentsArray(body []byte) ([]BasicDatastoreContents, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + dcArray := make([]BasicDatastoreContents, len(rawMessages)) + + for index, rawMessage := range rawMessages { + dc, err := unmarshalBasicDatastoreContents(*rawMessage) + if err != nil { + return nil, err + } + dcArray[index] = dc + } + return dcArray, nil +} + +// MarshalJSON is the custom marshaler for DatastoreContents. +func (dc DatastoreContents) MarshalJSON() ([]byte, error) { + dc.ContentsType = ContentsTypeDatastoreContents + objectMap := make(map[string]interface{}) + if dc.ContentsType != "" { + objectMap["contentsType"] = dc.ContentsType + } + return json.Marshal(objectMap) +} + +// AsAzureBlobContents is the BasicDatastoreContents implementation for DatastoreContents. +func (dc DatastoreContents) AsAzureBlobContents() (*AzureBlobContents, bool) { + return nil, false +} + +// AsAzureDataLakeGen1Contents is the BasicDatastoreContents implementation for DatastoreContents. +func (dc DatastoreContents) AsAzureDataLakeGen1Contents() (*AzureDataLakeGen1Contents, bool) { + return nil, false +} + +// AsAzureDataLakeGen2Contents is the BasicDatastoreContents implementation for DatastoreContents. +func (dc DatastoreContents) AsAzureDataLakeGen2Contents() (*AzureDataLakeGen2Contents, bool) { + return nil, false +} + +// AsAzureFileContents is the BasicDatastoreContents implementation for DatastoreContents. +func (dc DatastoreContents) AsAzureFileContents() (*AzureFileContents, bool) { + return nil, false +} + +// AsAzurePostgreSQLContents is the BasicDatastoreContents implementation for DatastoreContents. +func (dc DatastoreContents) AsAzurePostgreSQLContents() (*AzurePostgreSQLContents, bool) { + return nil, false +} + +// AsAzureSQLDatabaseContents is the BasicDatastoreContents implementation for DatastoreContents. +func (dc DatastoreContents) AsAzureSQLDatabaseContents() (*AzureSQLDatabaseContents, bool) { + return nil, false +} + +// AsGlusterFsContents is the BasicDatastoreContents implementation for DatastoreContents. +func (dc DatastoreContents) AsGlusterFsContents() (*GlusterFsContents, bool) { + return nil, false +} + +// AsDatastoreContents is the BasicDatastoreContents implementation for DatastoreContents. +func (dc DatastoreContents) AsDatastoreContents() (*DatastoreContents, bool) { + return &dc, true +} + +// AsBasicDatastoreContents is the BasicDatastoreContents implementation for DatastoreContents. +func (dc DatastoreContents) AsBasicDatastoreContents() (BasicDatastoreContents, bool) { + return &dc, true +} + +// BasicDatastoreCredentials base definition for datastore credentials. +type BasicDatastoreCredentials interface { + AsAccountKeyDatastoreCredentials() (*AccountKeyDatastoreCredentials, bool) + AsCertificateDatastoreCredentials() (*CertificateDatastoreCredentials, bool) + AsNoneDatastoreCredentials() (*NoneDatastoreCredentials, bool) + AsSasDatastoreCredentials() (*SasDatastoreCredentials, bool) + AsServicePrincipalDatastoreCredentials() (*ServicePrincipalDatastoreCredentials, bool) + AsSQLAdminDatastoreCredentials() (*SQLAdminDatastoreCredentials, bool) + AsDatastoreCredentials() (*DatastoreCredentials, bool) +} + +// DatastoreCredentials base definition for datastore credentials. +type DatastoreCredentials struct { + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey', 'CredentialsTypeCertificate', 'CredentialsTypeNone', 'CredentialsTypeSas', 'CredentialsTypeServicePrincipal', 'CredentialsTypeSQLAdmin' + CredentialsType CredentialsTypeBasicDatastoreCredentials `json:"credentialsType,omitempty"` +} + +func unmarshalBasicDatastoreCredentials(body []byte) (BasicDatastoreCredentials, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["credentialsType"] { + case string(CredentialsTypeAccountKey): + var akdc AccountKeyDatastoreCredentials + err := json.Unmarshal(body, &akdc) + return akdc, err + case string(CredentialsTypeCertificate): + var cdc CertificateDatastoreCredentials + err := json.Unmarshal(body, &cdc) + return cdc, err + case string(CredentialsTypeNone): + var ndc NoneDatastoreCredentials + err := json.Unmarshal(body, &ndc) + return ndc, err + case string(CredentialsTypeSas): + var sdc SasDatastoreCredentials + err := json.Unmarshal(body, &sdc) + return sdc, err + case string(CredentialsTypeServicePrincipal): + var spdc ServicePrincipalDatastoreCredentials + err := json.Unmarshal(body, &spdc) + return spdc, err + case string(CredentialsTypeSQLAdmin): + var sadc SQLAdminDatastoreCredentials + err := json.Unmarshal(body, &sadc) + return sadc, err + default: + var dc DatastoreCredentials + err := json.Unmarshal(body, &dc) + return dc, err + } +} +func unmarshalBasicDatastoreCredentialsArray(body []byte) ([]BasicDatastoreCredentials, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + dcArray := make([]BasicDatastoreCredentials, len(rawMessages)) + + for index, rawMessage := range rawMessages { + dc, err := unmarshalBasicDatastoreCredentials(*rawMessage) + if err != nil { + return nil, err + } + dcArray[index] = dc + } + return dcArray, nil +} + +// MarshalJSON is the custom marshaler for DatastoreCredentials. +func (dc DatastoreCredentials) MarshalJSON() ([]byte, error) { + dc.CredentialsType = CredentialsTypeDatastoreCredentials + objectMap := make(map[string]interface{}) + if dc.CredentialsType != "" { + objectMap["credentialsType"] = dc.CredentialsType + } + return json.Marshal(objectMap) +} + +// AsAccountKeyDatastoreCredentials is the BasicDatastoreCredentials implementation for DatastoreCredentials. +func (dc DatastoreCredentials) AsAccountKeyDatastoreCredentials() (*AccountKeyDatastoreCredentials, bool) { + return nil, false +} + +// AsCertificateDatastoreCredentials is the BasicDatastoreCredentials implementation for DatastoreCredentials. +func (dc DatastoreCredentials) AsCertificateDatastoreCredentials() (*CertificateDatastoreCredentials, bool) { + return nil, false +} + +// AsNoneDatastoreCredentials is the BasicDatastoreCredentials implementation for DatastoreCredentials. +func (dc DatastoreCredentials) AsNoneDatastoreCredentials() (*NoneDatastoreCredentials, bool) { + return nil, false +} + +// AsSasDatastoreCredentials is the BasicDatastoreCredentials implementation for DatastoreCredentials. +func (dc DatastoreCredentials) AsSasDatastoreCredentials() (*SasDatastoreCredentials, bool) { + return nil, false +} + +// AsServicePrincipalDatastoreCredentials is the BasicDatastoreCredentials implementation for DatastoreCredentials. +func (dc DatastoreCredentials) AsServicePrincipalDatastoreCredentials() (*ServicePrincipalDatastoreCredentials, bool) { + return nil, false +} + +// AsSQLAdminDatastoreCredentials is the BasicDatastoreCredentials implementation for DatastoreCredentials. +func (dc DatastoreCredentials) AsSQLAdminDatastoreCredentials() (*SQLAdminDatastoreCredentials, bool) { + return nil, false +} + +// AsDatastoreCredentials is the BasicDatastoreCredentials implementation for DatastoreCredentials. +func (dc DatastoreCredentials) AsDatastoreCredentials() (*DatastoreCredentials, bool) { + return &dc, true +} + +// AsBasicDatastoreCredentials is the BasicDatastoreCredentials implementation for DatastoreCredentials. +func (dc DatastoreCredentials) AsBasicDatastoreCredentials() (BasicDatastoreCredentials, bool) { + return &dc, true +} + +// DatastoreProperties datastore definition. +type DatastoreProperties struct { + // Contents - Reference to the datastore storage contents. + Contents BasicDatastoreContents `json:"contents,omitempty"` + // Description - The asset description text. + Description *string `json:"description,omitempty"` + // HasBeenValidated - READ-ONLY; Whether the service has validated access to the datastore with the provided credentials. + HasBeenValidated *bool `json:"hasBeenValidated,omitempty"` + // IsDefault - Whether this datastore is the default for the workspace. + IsDefault *bool `json:"isDefault,omitempty"` + // LinkedInfo - Information about the datastore origin, if linked. + LinkedInfo *LinkedInfo `json:"linkedInfo,omitempty"` + // Properties - The asset property dictionary. + Properties map[string]*string `json:"properties"` + // Tags - Tag dictionary. Tags can be added, removed, and updated. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for DatastoreProperties. +func (dp DatastoreProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["contents"] = dp.Contents + if dp.Description != nil { + objectMap["description"] = dp.Description + } + if dp.IsDefault != nil { + objectMap["isDefault"] = dp.IsDefault + } + if dp.LinkedInfo != nil { + objectMap["linkedInfo"] = dp.LinkedInfo + } + if dp.Properties != nil { + objectMap["properties"] = dp.Properties + } + if dp.Tags != nil { + objectMap["tags"] = dp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DatastoreProperties struct. +func (dp *DatastoreProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "contents": + if v != nil { + contents, err := unmarshalBasicDatastoreContents(*v) + if err != nil { + return err + } + dp.Contents = contents + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + dp.Description = &description + } + case "hasBeenValidated": + if v != nil { + var hasBeenValidated bool + err = json.Unmarshal(*v, &hasBeenValidated) + if err != nil { + return err + } + dp.HasBeenValidated = &hasBeenValidated + } + case "isDefault": + if v != nil { + var isDefault bool + err = json.Unmarshal(*v, &isDefault) + if err != nil { + return err + } + dp.IsDefault = &isDefault + } + case "linkedInfo": + if v != nil { + var linkedInfo LinkedInfo + err = json.Unmarshal(*v, &linkedInfo) + if err != nil { + return err + } + dp.LinkedInfo = &linkedInfo + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + dp.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + dp.Tags = tags + } + } + } + + return nil +} + +// DatastorePropertiesResource azure Resource Manager resource envelope. +type DatastorePropertiesResource struct { + autorest.Response `json:"-"` + // Properties - Additional attributes of the entity. + Properties *DatastoreProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; System data associated with resource provider + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DatastorePropertiesResource. +func (dpr DatastorePropertiesResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dpr.Properties != nil { + objectMap["properties"] = dpr.Properties + } + return json.Marshal(objectMap) +} + +// DatastorePropertiesResourceArmPaginatedResult a paginated list of DatastoreProperties entities. +type DatastorePropertiesResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type DatastoreProperties. + Value *[]DatastorePropertiesResource `json:"value,omitempty"` +} + +// DatastorePropertiesResourceArmPaginatedResultIterator provides access to a complete listing of +// DatastorePropertiesResource values. +type DatastorePropertiesResourceArmPaginatedResultIterator struct { + i int + page DatastorePropertiesResourceArmPaginatedResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DatastorePropertiesResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatastorePropertiesResourceArmPaginatedResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DatastorePropertiesResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DatastorePropertiesResourceArmPaginatedResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DatastorePropertiesResourceArmPaginatedResultIterator) Response() DatastorePropertiesResourceArmPaginatedResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DatastorePropertiesResourceArmPaginatedResultIterator) Value() DatastorePropertiesResource { + if !iter.page.NotDone() { + return DatastorePropertiesResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DatastorePropertiesResourceArmPaginatedResultIterator type. +func NewDatastorePropertiesResourceArmPaginatedResultIterator(page DatastorePropertiesResourceArmPaginatedResultPage) DatastorePropertiesResourceArmPaginatedResultIterator { + return DatastorePropertiesResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dprapr DatastorePropertiesResourceArmPaginatedResult) IsEmpty() bool { + return dprapr.Value == nil || len(*dprapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dprapr DatastorePropertiesResourceArmPaginatedResult) hasNextLink() bool { + return dprapr.NextLink != nil && len(*dprapr.NextLink) != 0 +} + +// datastorePropertiesResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dprapr DatastorePropertiesResourceArmPaginatedResult) datastorePropertiesResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !dprapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dprapr.NextLink))) +} + +// DatastorePropertiesResourceArmPaginatedResultPage contains a page of DatastorePropertiesResource values. +type DatastorePropertiesResourceArmPaginatedResultPage struct { + fn func(context.Context, DatastorePropertiesResourceArmPaginatedResult) (DatastorePropertiesResourceArmPaginatedResult, error) + dprapr DatastorePropertiesResourceArmPaginatedResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DatastorePropertiesResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatastorePropertiesResourceArmPaginatedResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dprapr) + if err != nil { + return err + } + page.dprapr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DatastorePropertiesResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DatastorePropertiesResourceArmPaginatedResultPage) NotDone() bool { + return !page.dprapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DatastorePropertiesResourceArmPaginatedResultPage) Response() DatastorePropertiesResourceArmPaginatedResult { + return page.dprapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DatastorePropertiesResourceArmPaginatedResultPage) Values() []DatastorePropertiesResource { + if page.dprapr.IsEmpty() { + return nil + } + return *page.dprapr.Value +} + +// Creates a new instance of the DatastorePropertiesResourceArmPaginatedResultPage type. +func NewDatastorePropertiesResourceArmPaginatedResultPage(cur DatastorePropertiesResourceArmPaginatedResult, getNextPage func(context.Context, DatastorePropertiesResourceArmPaginatedResult) (DatastorePropertiesResourceArmPaginatedResult, error)) DatastorePropertiesResourceArmPaginatedResultPage { + return DatastorePropertiesResourceArmPaginatedResultPage{ + fn: getNextPage, + dprapr: cur, + } +} + +// BasicDatastoreSecrets base definition for datastore secrets. +type BasicDatastoreSecrets interface { + AsAccountKeyDatastoreSecrets() (*AccountKeyDatastoreSecrets, bool) + AsCertificateDatastoreSecrets() (*CertificateDatastoreSecrets, bool) + AsNoneDatastoreSecrets() (*NoneDatastoreSecrets, bool) + AsSasDatastoreSecrets() (*SasDatastoreSecrets, bool) + AsServicePrincipalDatastoreSecrets() (*ServicePrincipalDatastoreSecrets, bool) + AsSQLAdminDatastoreSecrets() (*SQLAdminDatastoreSecrets, bool) + AsDatastoreSecrets() (*DatastoreSecrets, bool) +} + +// DatastoreSecrets base definition for datastore secrets. +type DatastoreSecrets struct { + autorest.Response `json:"-"` + // SecretsType - Possible values include: 'SecretsTypeDatastoreSecrets', 'SecretsTypeAccountKey1', 'SecretsTypeCertificate1', 'SecretsTypeNone1', 'SecretsTypeSas1', 'SecretsTypeServicePrincipal1', 'SecretsTypeSQLAdmin1' + SecretsType SecretsTypeBasicDatastoreSecrets `json:"secretsType,omitempty"` +} + +func unmarshalBasicDatastoreSecrets(body []byte) (BasicDatastoreSecrets, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["secretsType"] { + case string(SecretsTypeAccountKey1): + var akds AccountKeyDatastoreSecrets + err := json.Unmarshal(body, &akds) + return akds, err + case string(SecretsTypeCertificate1): + var cds CertificateDatastoreSecrets + err := json.Unmarshal(body, &cds) + return cds, err + case string(SecretsTypeNone1): + var nds NoneDatastoreSecrets + err := json.Unmarshal(body, &nds) + return nds, err + case string(SecretsTypeSas1): + var sds SasDatastoreSecrets + err := json.Unmarshal(body, &sds) + return sds, err + case string(SecretsTypeServicePrincipal1): + var spds ServicePrincipalDatastoreSecrets + err := json.Unmarshal(body, &spds) + return spds, err + case string(SecretsTypeSQLAdmin1): + var sads SQLAdminDatastoreSecrets + err := json.Unmarshal(body, &sads) + return sads, err + default: + var ds DatastoreSecrets + err := json.Unmarshal(body, &ds) + return ds, err + } +} +func unmarshalBasicDatastoreSecretsArray(body []byte) ([]BasicDatastoreSecrets, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + dsArray := make([]BasicDatastoreSecrets, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ds, err := unmarshalBasicDatastoreSecrets(*rawMessage) + if err != nil { + return nil, err + } + dsArray[index] = ds + } + return dsArray, nil +} + +// MarshalJSON is the custom marshaler for DatastoreSecrets. +func (ds DatastoreSecrets) MarshalJSON() ([]byte, error) { + ds.SecretsType = SecretsTypeDatastoreSecrets + objectMap := make(map[string]interface{}) + if ds.SecretsType != "" { + objectMap["secretsType"] = ds.SecretsType + } + return json.Marshal(objectMap) +} + +// AsAccountKeyDatastoreSecrets is the BasicDatastoreSecrets implementation for DatastoreSecrets. +func (ds DatastoreSecrets) AsAccountKeyDatastoreSecrets() (*AccountKeyDatastoreSecrets, bool) { + return nil, false +} + +// AsCertificateDatastoreSecrets is the BasicDatastoreSecrets implementation for DatastoreSecrets. +func (ds DatastoreSecrets) AsCertificateDatastoreSecrets() (*CertificateDatastoreSecrets, bool) { + return nil, false +} + +// AsNoneDatastoreSecrets is the BasicDatastoreSecrets implementation for DatastoreSecrets. +func (ds DatastoreSecrets) AsNoneDatastoreSecrets() (*NoneDatastoreSecrets, bool) { + return nil, false +} + +// AsSasDatastoreSecrets is the BasicDatastoreSecrets implementation for DatastoreSecrets. +func (ds DatastoreSecrets) AsSasDatastoreSecrets() (*SasDatastoreSecrets, bool) { + return nil, false +} + +// AsServicePrincipalDatastoreSecrets is the BasicDatastoreSecrets implementation for DatastoreSecrets. +func (ds DatastoreSecrets) AsServicePrincipalDatastoreSecrets() (*ServicePrincipalDatastoreSecrets, bool) { + return nil, false +} + +// AsSQLAdminDatastoreSecrets is the BasicDatastoreSecrets implementation for DatastoreSecrets. +func (ds DatastoreSecrets) AsSQLAdminDatastoreSecrets() (*SQLAdminDatastoreSecrets, bool) { + return nil, false +} + +// AsDatastoreSecrets is the BasicDatastoreSecrets implementation for DatastoreSecrets. +func (ds DatastoreSecrets) AsDatastoreSecrets() (*DatastoreSecrets, bool) { + return &ds, true +} + +// AsBasicDatastoreSecrets is the BasicDatastoreSecrets implementation for DatastoreSecrets. +func (ds DatastoreSecrets) AsBasicDatastoreSecrets() (BasicDatastoreSecrets, bool) { + return &ds, true +} + +// DatastoreSecretsModel ... +type DatastoreSecretsModel struct { + autorest.Response `json:"-"` + Value BasicDatastoreSecrets `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for DatastoreSecretsModel struct. +func (dsm *DatastoreSecretsModel) UnmarshalJSON(body []byte) error { + ds, err := unmarshalBasicDatastoreSecrets(body) + if err != nil { + return err + } + dsm.Value = ds + + return nil +} + +// DataVersion data asset version details. +type DataVersion struct { + // DatasetType - The Format of dataset. Possible values include: 'Simple', 'Dataflow' + DatasetType DatasetType `json:"datasetType,omitempty"` + // DatastoreID - ARM resource ID of the datastore where the asset is located. + DatastoreID *string `json:"datastoreId,omitempty"` + // Description - The asset description text. + Description *string `json:"description,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // Path - The path of the file/directory in the datastore. + Path *string `json:"path,omitempty"` + // Properties - The asset property dictionary. + Properties map[string]*string `json:"properties"` + // Tags - Tag dictionary. Tags can be added, removed, and updated. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for DataVersion. +func (dv DataVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dv.DatasetType != "" { + objectMap["datasetType"] = dv.DatasetType + } + if dv.DatastoreID != nil { + objectMap["datastoreId"] = dv.DatastoreID + } + if dv.Description != nil { + objectMap["description"] = dv.Description + } + if dv.IsAnonymous != nil { + objectMap["isAnonymous"] = dv.IsAnonymous + } + if dv.Path != nil { + objectMap["path"] = dv.Path + } + if dv.Properties != nil { + objectMap["properties"] = dv.Properties + } + if dv.Tags != nil { + objectMap["tags"] = dv.Tags + } + return json.Marshal(objectMap) +} + +// DataVersionResource azure Resource Manager resource envelope. +type DataVersionResource struct { + autorest.Response `json:"-"` + // Properties - Additional attributes of the entity. + Properties *DataVersion `json:"properties,omitempty"` + // SystemData - READ-ONLY; System data associated with resource provider + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataVersionResource. +func (dvr DataVersionResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dvr.Properties != nil { + objectMap["properties"] = dvr.Properties + } + return json.Marshal(objectMap) +} + +// DataVersionResourceArmPaginatedResult a paginated list of DataVersion entities. +type DataVersionResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type DataVersion. + Value *[]DataVersionResource `json:"value,omitempty"` +} + +// DataVersionResourceArmPaginatedResultIterator provides access to a complete listing of +// DataVersionResource values. +type DataVersionResourceArmPaginatedResultIterator struct { + i int + page DataVersionResourceArmPaginatedResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DataVersionResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataVersionResourceArmPaginatedResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DataVersionResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DataVersionResourceArmPaginatedResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DataVersionResourceArmPaginatedResultIterator) Response() DataVersionResourceArmPaginatedResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DataVersionResourceArmPaginatedResultIterator) Value() DataVersionResource { + if !iter.page.NotDone() { + return DataVersionResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DataVersionResourceArmPaginatedResultIterator type. +func NewDataVersionResourceArmPaginatedResultIterator(page DataVersionResourceArmPaginatedResultPage) DataVersionResourceArmPaginatedResultIterator { + return DataVersionResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dvrapr DataVersionResourceArmPaginatedResult) IsEmpty() bool { + return dvrapr.Value == nil || len(*dvrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dvrapr DataVersionResourceArmPaginatedResult) hasNextLink() bool { + return dvrapr.NextLink != nil && len(*dvrapr.NextLink) != 0 +} + +// dataVersionResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dvrapr DataVersionResourceArmPaginatedResult) dataVersionResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !dvrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dvrapr.NextLink))) +} + +// DataVersionResourceArmPaginatedResultPage contains a page of DataVersionResource values. +type DataVersionResourceArmPaginatedResultPage struct { + fn func(context.Context, DataVersionResourceArmPaginatedResult) (DataVersionResourceArmPaginatedResult, error) + dvrapr DataVersionResourceArmPaginatedResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DataVersionResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataVersionResourceArmPaginatedResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dvrapr) + if err != nil { + return err + } + page.dvrapr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DataVersionResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DataVersionResourceArmPaginatedResultPage) NotDone() bool { + return !page.dvrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DataVersionResourceArmPaginatedResultPage) Response() DataVersionResourceArmPaginatedResult { + return page.dvrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DataVersionResourceArmPaginatedResultPage) Values() []DataVersionResource { + if page.dvrapr.IsEmpty() { + return nil + } + return *page.dvrapr.Value +} + +// Creates a new instance of the DataVersionResourceArmPaginatedResultPage type. +func NewDataVersionResourceArmPaginatedResultPage(cur DataVersionResourceArmPaginatedResult, getNextPage func(context.Context, DataVersionResourceArmPaginatedResult) (DataVersionResourceArmPaginatedResult, error)) DataVersionResourceArmPaginatedResultPage { + return DataVersionResourceArmPaginatedResultPage{ + fn: getNextPage, + dvrapr: cur, + } +} + +// DeploymentLogs ... +type DeploymentLogs struct { + autorest.Response `json:"-"` + Content *string `json:"content,omitempty"` +} + +// DeploymentLogsRequest ... +type DeploymentLogsRequest struct { + // ContainerType - The type of container to retrieve logs from. Possible values include: 'StorageInitializer', 'InferenceServer' + ContainerType ContainerType `json:"containerType,omitempty"` + // Tail - The maximum number of lines to tail. + Tail *int32 `json:"tail,omitempty"` +} + +// BasicDistributionConfiguration base definition for job distribution configuration. +type BasicDistributionConfiguration interface { + AsMpi() (*Mpi, bool) + AsPyTorch() (*PyTorch, bool) + AsTensorFlow() (*TensorFlow, bool) + AsDistributionConfiguration() (*DistributionConfiguration, bool) +} + +// DistributionConfiguration base definition for job distribution configuration. +type DistributionConfiguration struct { + // DistributionType - Possible values include: 'DistributionTypeDistributionConfiguration', 'DistributionTypeMpi1', 'DistributionTypePyTorch1', 'DistributionTypeTensorFlow1' + DistributionType DistributionTypeBasicDistributionConfiguration `json:"distributionType,omitempty"` +} + +func unmarshalBasicDistributionConfiguration(body []byte) (BasicDistributionConfiguration, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["distributionType"] { + case string(DistributionTypeMpi1): + var mVar Mpi + err := json.Unmarshal(body, &mVar) + return mVar, err + case string(DistributionTypePyTorch1): + var pt PyTorch + err := json.Unmarshal(body, &pt) + return pt, err + case string(DistributionTypeTensorFlow1): + var tf TensorFlow + err := json.Unmarshal(body, &tf) + return tf, err + default: + var dc DistributionConfiguration + err := json.Unmarshal(body, &dc) + return dc, err + } +} +func unmarshalBasicDistributionConfigurationArray(body []byte) ([]BasicDistributionConfiguration, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + dcArray := make([]BasicDistributionConfiguration, len(rawMessages)) + + for index, rawMessage := range rawMessages { + dc, err := unmarshalBasicDistributionConfiguration(*rawMessage) + if err != nil { + return nil, err + } + dcArray[index] = dc + } + return dcArray, nil +} + +// MarshalJSON is the custom marshaler for DistributionConfiguration. +func (dc DistributionConfiguration) MarshalJSON() ([]byte, error) { + dc.DistributionType = DistributionTypeDistributionConfiguration + objectMap := make(map[string]interface{}) + if dc.DistributionType != "" { + objectMap["distributionType"] = dc.DistributionType + } + return json.Marshal(objectMap) +} + +// AsMpi is the BasicDistributionConfiguration implementation for DistributionConfiguration. +func (dc DistributionConfiguration) AsMpi() (*Mpi, bool) { + return nil, false +} + +// AsPyTorch is the BasicDistributionConfiguration implementation for DistributionConfiguration. +func (dc DistributionConfiguration) AsPyTorch() (*PyTorch, bool) { + return nil, false +} + +// AsTensorFlow is the BasicDistributionConfiguration implementation for DistributionConfiguration. +func (dc DistributionConfiguration) AsTensorFlow() (*TensorFlow, bool) { + return nil, false +} + +// AsDistributionConfiguration is the BasicDistributionConfiguration implementation for DistributionConfiguration. +func (dc DistributionConfiguration) AsDistributionConfiguration() (*DistributionConfiguration, bool) { + return &dc, true +} + +// AsBasicDistributionConfiguration is the BasicDistributionConfiguration implementation for DistributionConfiguration. +func (dc DistributionConfiguration) AsBasicDistributionConfiguration() (BasicDistributionConfiguration, bool) { + return &dc, true +} + +// DockerBuild class to represent configuration settings for Docker Build +type DockerBuild struct { + // Context - Path to a snapshot of the Docker Context. This property is only valid if Dockerfile is specified. + // The path is relative to the asset path which must contain a single Blob URI value. + // + Context *string `json:"context,omitempty"` + // Dockerfile - Docker command line instructions to assemble an image. + // + Dockerfile *string `json:"dockerfile,omitempty"` + // Platform - The platform information of the docker image. + Platform *DockerImagePlatform `json:"platform,omitempty"` + // DockerSpecificationType - Possible values include: 'DockerSpecificationTypeDockerSpecification', 'DockerSpecificationTypeBuild', 'DockerSpecificationTypeImage' + DockerSpecificationType DockerSpecificationTypeBasicDockerSpecification `json:"dockerSpecificationType,omitempty"` +} + +// MarshalJSON is the custom marshaler for DockerBuild. +func (db DockerBuild) MarshalJSON() ([]byte, error) { + db.DockerSpecificationType = DockerSpecificationTypeBuild + objectMap := make(map[string]interface{}) + if db.Context != nil { + objectMap["context"] = db.Context + } + if db.Dockerfile != nil { + objectMap["dockerfile"] = db.Dockerfile + } + if db.Platform != nil { + objectMap["platform"] = db.Platform + } + if db.DockerSpecificationType != "" { + objectMap["dockerSpecificationType"] = db.DockerSpecificationType + } + return json.Marshal(objectMap) +} + +// AsDockerBuild is the BasicDockerSpecification implementation for DockerBuild. +func (db DockerBuild) AsDockerBuild() (*DockerBuild, bool) { + return &db, true +} + +// AsDockerImage is the BasicDockerSpecification implementation for DockerBuild. +func (db DockerBuild) AsDockerImage() (*DockerImage, bool) { + return nil, false +} + +// AsDockerSpecification is the BasicDockerSpecification implementation for DockerBuild. +func (db DockerBuild) AsDockerSpecification() (*DockerSpecification, bool) { + return nil, false +} + +// AsBasicDockerSpecification is the BasicDockerSpecification implementation for DockerBuild. +func (db DockerBuild) AsBasicDockerSpecification() (BasicDockerSpecification, bool) { + return &db, true +} + +// DockerImage class to represent configuration settings for Docker Build +type DockerImage struct { + // DockerImageURI - Image name of a custom base image. + // + DockerImageURI *string `json:"dockerImageUri,omitempty"` + // Platform - The platform information of the docker image. + Platform *DockerImagePlatform `json:"platform,omitempty"` + // DockerSpecificationType - Possible values include: 'DockerSpecificationTypeDockerSpecification', 'DockerSpecificationTypeBuild', 'DockerSpecificationTypeImage' + DockerSpecificationType DockerSpecificationTypeBasicDockerSpecification `json:"dockerSpecificationType,omitempty"` +} + +// MarshalJSON is the custom marshaler for DockerImage. +func (di DockerImage) MarshalJSON() ([]byte, error) { + di.DockerSpecificationType = DockerSpecificationTypeImage + objectMap := make(map[string]interface{}) + if di.DockerImageURI != nil { + objectMap["dockerImageUri"] = di.DockerImageURI + } + if di.Platform != nil { + objectMap["platform"] = di.Platform + } + if di.DockerSpecificationType != "" { + objectMap["dockerSpecificationType"] = di.DockerSpecificationType + } + return json.Marshal(objectMap) +} + +// AsDockerBuild is the BasicDockerSpecification implementation for DockerImage. +func (di DockerImage) AsDockerBuild() (*DockerBuild, bool) { + return nil, false +} + +// AsDockerImage is the BasicDockerSpecification implementation for DockerImage. +func (di DockerImage) AsDockerImage() (*DockerImage, bool) { + return &di, true +} + +// AsDockerSpecification is the BasicDockerSpecification implementation for DockerImage. +func (di DockerImage) AsDockerSpecification() (*DockerSpecification, bool) { + return nil, false +} + +// AsBasicDockerSpecification is the BasicDockerSpecification implementation for DockerImage. +func (di DockerImage) AsBasicDockerSpecification() (BasicDockerSpecification, bool) { + return &di, true +} + +// DockerImagePlatform ... +type DockerImagePlatform struct { + // OperatingSystemType - The OS type the Environment. Possible values include: 'Linux', 'Windows' + OperatingSystemType OperatingSystemType `json:"operatingSystemType,omitempty"` +} + +// BasicDockerSpecification configuration settings for Docker +type BasicDockerSpecification interface { + AsDockerBuild() (*DockerBuild, bool) + AsDockerImage() (*DockerImage, bool) + AsDockerSpecification() (*DockerSpecification, bool) +} + +// DockerSpecification configuration settings for Docker +type DockerSpecification struct { + // Platform - The platform information of the docker image. + Platform *DockerImagePlatform `json:"platform,omitempty"` + // DockerSpecificationType - Possible values include: 'DockerSpecificationTypeDockerSpecification', 'DockerSpecificationTypeBuild', 'DockerSpecificationTypeImage' + DockerSpecificationType DockerSpecificationTypeBasicDockerSpecification `json:"dockerSpecificationType,omitempty"` +} + +func unmarshalBasicDockerSpecification(body []byte) (BasicDockerSpecification, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["dockerSpecificationType"] { + case string(DockerSpecificationTypeBuild): + var db DockerBuild + err := json.Unmarshal(body, &db) + return db, err + case string(DockerSpecificationTypeImage): + var di DockerImage + err := json.Unmarshal(body, &di) + return di, err + default: + var ds DockerSpecification + err := json.Unmarshal(body, &ds) + return ds, err + } +} +func unmarshalBasicDockerSpecificationArray(body []byte) ([]BasicDockerSpecification, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + dsArray := make([]BasicDockerSpecification, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ds, err := unmarshalBasicDockerSpecification(*rawMessage) + if err != nil { + return nil, err + } + dsArray[index] = ds + } + return dsArray, nil +} + +// MarshalJSON is the custom marshaler for DockerSpecification. +func (ds DockerSpecification) MarshalJSON() ([]byte, error) { + ds.DockerSpecificationType = DockerSpecificationTypeDockerSpecification + objectMap := make(map[string]interface{}) + if ds.Platform != nil { + objectMap["platform"] = ds.Platform + } + if ds.DockerSpecificationType != "" { + objectMap["dockerSpecificationType"] = ds.DockerSpecificationType + } + return json.Marshal(objectMap) +} + +// AsDockerBuild is the BasicDockerSpecification implementation for DockerSpecification. +func (ds DockerSpecification) AsDockerBuild() (*DockerBuild, bool) { + return nil, false +} + +// AsDockerImage is the BasicDockerSpecification implementation for DockerSpecification. +func (ds DockerSpecification) AsDockerImage() (*DockerImage, bool) { + return nil, false +} + +// AsDockerSpecification is the BasicDockerSpecification implementation for DockerSpecification. +func (ds DockerSpecification) AsDockerSpecification() (*DockerSpecification, bool) { + return &ds, true +} + +// AsBasicDockerSpecification is the BasicDockerSpecification implementation for DockerSpecification. +func (ds DockerSpecification) AsBasicDockerSpecification() (BasicDockerSpecification, bool) { + return &ds, true +} + +// BasicEarlyTerminationPolicy early termination policies enable canceling poor-performing runs before they complete +type BasicEarlyTerminationPolicy interface { + AsBanditPolicy() (*BanditPolicy, bool) + AsMedianStoppingPolicy() (*MedianStoppingPolicy, bool) + AsTruncationSelectionPolicy() (*TruncationSelectionPolicy, bool) + AsEarlyTerminationPolicy() (*EarlyTerminationPolicy, bool) +} + +// EarlyTerminationPolicy early termination policies enable canceling poor-performing runs before they complete +type EarlyTerminationPolicy struct { + DelayEvaluation *int32 `json:"delayEvaluation,omitempty"` + EvaluationInterval *int32 `json:"evaluationInterval,omitempty"` + // PolicyType - Possible values include: 'PolicyTypeEarlyTerminationPolicy', 'PolicyTypeBandit', 'PolicyTypeMedianStopping', 'PolicyTypeTruncationSelection' + PolicyType PolicyType `json:"policyType,omitempty"` +} + +func unmarshalBasicEarlyTerminationPolicy(body []byte) (BasicEarlyTerminationPolicy, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["policyType"] { + case string(PolicyTypeBandit): + var bp BanditPolicy + err := json.Unmarshal(body, &bp) + return bp, err + case string(PolicyTypeMedianStopping): + var msp MedianStoppingPolicy + err := json.Unmarshal(body, &msp) + return msp, err + case string(PolicyTypeTruncationSelection): + var tsp TruncationSelectionPolicy + err := json.Unmarshal(body, &tsp) + return tsp, err + default: + var etp EarlyTerminationPolicy + err := json.Unmarshal(body, &etp) + return etp, err + } +} +func unmarshalBasicEarlyTerminationPolicyArray(body []byte) ([]BasicEarlyTerminationPolicy, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + etpArray := make([]BasicEarlyTerminationPolicy, len(rawMessages)) + + for index, rawMessage := range rawMessages { + etp, err := unmarshalBasicEarlyTerminationPolicy(*rawMessage) + if err != nil { + return nil, err + } + etpArray[index] = etp + } + return etpArray, nil +} + +// MarshalJSON is the custom marshaler for EarlyTerminationPolicy. +func (etp EarlyTerminationPolicy) MarshalJSON() ([]byte, error) { + etp.PolicyType = PolicyTypeEarlyTerminationPolicy + objectMap := make(map[string]interface{}) + if etp.DelayEvaluation != nil { + objectMap["delayEvaluation"] = etp.DelayEvaluation + } + if etp.EvaluationInterval != nil { + objectMap["evaluationInterval"] = etp.EvaluationInterval + } + if etp.PolicyType != "" { + objectMap["policyType"] = etp.PolicyType + } + return json.Marshal(objectMap) +} + +// AsBanditPolicy is the BasicEarlyTerminationPolicy implementation for EarlyTerminationPolicy. +func (etp EarlyTerminationPolicy) AsBanditPolicy() (*BanditPolicy, bool) { + return nil, false +} + +// AsMedianStoppingPolicy is the BasicEarlyTerminationPolicy implementation for EarlyTerminationPolicy. +func (etp EarlyTerminationPolicy) AsMedianStoppingPolicy() (*MedianStoppingPolicy, bool) { + return nil, false +} + +// AsTruncationSelectionPolicy is the BasicEarlyTerminationPolicy implementation for EarlyTerminationPolicy. +func (etp EarlyTerminationPolicy) AsTruncationSelectionPolicy() (*TruncationSelectionPolicy, bool) { + return nil, false +} + +// AsEarlyTerminationPolicy is the BasicEarlyTerminationPolicy implementation for EarlyTerminationPolicy. +func (etp EarlyTerminationPolicy) AsEarlyTerminationPolicy() (*EarlyTerminationPolicy, bool) { + return &etp, true +} + +// AsBasicEarlyTerminationPolicy is the BasicEarlyTerminationPolicy implementation for EarlyTerminationPolicy. +func (etp EarlyTerminationPolicy) AsBasicEarlyTerminationPolicy() (BasicEarlyTerminationPolicy, bool) { + return &etp, true +} + +// EncryptionProperty ... +type EncryptionProperty struct { + // Status - Indicates whether or not the encryption is enabled for the workspace. Possible values include: 'Enabled', 'Disabled' + Status EncryptionStatus `json:"status,omitempty"` + // Identity - The identity that will be used to access the key vault for encryption at rest. + Identity *IdentityForCmk `json:"identity,omitempty"` + // KeyVaultProperties - Customer Key vault properties. + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` +} + +// EndpointAuthKeys keys for endpoint authentication. +type EndpointAuthKeys struct { + autorest.Response `json:"-"` + // PrimaryKey - The primary key. + PrimaryKey *string `json:"primaryKey,omitempty"` + // SecondaryKey - The secondary key. + SecondaryKey *string `json:"secondaryKey,omitempty"` +} + +// EndpointAuthToken service Token +type EndpointAuthToken struct { + autorest.Response `json:"-"` + // AccessToken - Access token. + AccessToken *string `json:"accessToken,omitempty"` + // ExpiryTimeUtc - Access token expiry time (UTC). + ExpiryTimeUtc *int64 `json:"expiryTimeUtc,omitempty"` + // RefreshAfterTimeUtc - Refresh access token after time (UTC). + RefreshAfterTimeUtc *int64 `json:"refreshAfterTimeUtc,omitempty"` + // TokenType - Access token type. + TokenType *string `json:"tokenType,omitempty"` +} + +// EnvironmentContainer container for environment specification versions. +type EnvironmentContainer struct { + // Description - The asset description text. + Description *string `json:"description,omitempty"` + // Properties - The asset property dictionary. + Properties map[string]*string `json:"properties"` + // Tags - Tag dictionary. Tags can be added, removed, and updated. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for EnvironmentContainer. +func (ec EnvironmentContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ec.Description != nil { + objectMap["description"] = ec.Description + } + if ec.Properties != nil { + objectMap["properties"] = ec.Properties + } + if ec.Tags != nil { + objectMap["tags"] = ec.Tags + } + return json.Marshal(objectMap) +} + +// EnvironmentContainerResource azure Resource Manager resource envelope. +type EnvironmentContainerResource struct { + autorest.Response `json:"-"` + // Properties - Additional attributes of the entity. + Properties *EnvironmentContainer `json:"properties,omitempty"` + // SystemData - READ-ONLY; System data associated with resource provider + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EnvironmentContainerResource. +func (ecr EnvironmentContainerResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ecr.Properties != nil { + objectMap["properties"] = ecr.Properties + } + return json.Marshal(objectMap) +} + +// EnvironmentContainerResourceArmPaginatedResult a paginated list of EnvironmentContainer entities. +type EnvironmentContainerResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type EnvironmentContainer. + Value *[]EnvironmentContainerResource `json:"value,omitempty"` +} + +// EnvironmentContainerResourceArmPaginatedResultIterator provides access to a complete listing of +// EnvironmentContainerResource values. +type EnvironmentContainerResourceArmPaginatedResultIterator struct { + i int + page EnvironmentContainerResourceArmPaginatedResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EnvironmentContainerResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentContainerResourceArmPaginatedResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EnvironmentContainerResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EnvironmentContainerResourceArmPaginatedResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EnvironmentContainerResourceArmPaginatedResultIterator) Response() EnvironmentContainerResourceArmPaginatedResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EnvironmentContainerResourceArmPaginatedResultIterator) Value() EnvironmentContainerResource { + if !iter.page.NotDone() { + return EnvironmentContainerResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EnvironmentContainerResourceArmPaginatedResultIterator type. +func NewEnvironmentContainerResourceArmPaginatedResultIterator(page EnvironmentContainerResourceArmPaginatedResultPage) EnvironmentContainerResourceArmPaginatedResultIterator { + return EnvironmentContainerResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ecrapr EnvironmentContainerResourceArmPaginatedResult) IsEmpty() bool { + return ecrapr.Value == nil || len(*ecrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ecrapr EnvironmentContainerResourceArmPaginatedResult) hasNextLink() bool { + return ecrapr.NextLink != nil && len(*ecrapr.NextLink) != 0 +} + +// environmentContainerResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ecrapr EnvironmentContainerResourceArmPaginatedResult) environmentContainerResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !ecrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ecrapr.NextLink))) +} + +// EnvironmentContainerResourceArmPaginatedResultPage contains a page of EnvironmentContainerResource +// values. +type EnvironmentContainerResourceArmPaginatedResultPage struct { + fn func(context.Context, EnvironmentContainerResourceArmPaginatedResult) (EnvironmentContainerResourceArmPaginatedResult, error) + ecrapr EnvironmentContainerResourceArmPaginatedResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EnvironmentContainerResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentContainerResourceArmPaginatedResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ecrapr) + if err != nil { + return err + } + page.ecrapr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EnvironmentContainerResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EnvironmentContainerResourceArmPaginatedResultPage) NotDone() bool { + return !page.ecrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EnvironmentContainerResourceArmPaginatedResultPage) Response() EnvironmentContainerResourceArmPaginatedResult { + return page.ecrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EnvironmentContainerResourceArmPaginatedResultPage) Values() []EnvironmentContainerResource { + if page.ecrapr.IsEmpty() { + return nil + } + return *page.ecrapr.Value +} + +// Creates a new instance of the EnvironmentContainerResourceArmPaginatedResultPage type. +func NewEnvironmentContainerResourceArmPaginatedResultPage(cur EnvironmentContainerResourceArmPaginatedResult, getNextPage func(context.Context, EnvironmentContainerResourceArmPaginatedResult) (EnvironmentContainerResourceArmPaginatedResult, error)) EnvironmentContainerResourceArmPaginatedResultPage { + return EnvironmentContainerResourceArmPaginatedResultPage{ + fn: getNextPage, + ecrapr: cur, + } +} + +// EnvironmentSpecificationVersion environment specification version details. +// +type EnvironmentSpecificationVersion struct { + // CondaFile - Standard configuration file used by Conda that lets you install any kind of package, including Python, R, and C/C++ packages. + // + CondaFile *string `json:"condaFile,omitempty"` + // Description - The asset description text. + Description *string `json:"description,omitempty"` + // Docker - Configuration settings for Docker. + Docker BasicDockerSpecification `json:"docker,omitempty"` + // EnvironmentSpecificationType - READ-ONLY; Environment specification is either user managed or curated by the Azure ML service + // . Possible values include: 'Curated', 'UserCreated' + EnvironmentSpecificationType EnvironmentSpecificationType `json:"environmentSpecificationType,omitempty"` + // InferenceContainerProperties - Defines configuration specific to inference. + InferenceContainerProperties *InferenceContainerProperties `json:"inferenceContainerProperties,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // Properties - The asset property dictionary. + Properties map[string]*string `json:"properties"` + // Tags - Tag dictionary. Tags can be added, removed, and updated. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for EnvironmentSpecificationVersion. +func (esv EnvironmentSpecificationVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if esv.CondaFile != nil { + objectMap["condaFile"] = esv.CondaFile + } + if esv.Description != nil { + objectMap["description"] = esv.Description + } + objectMap["docker"] = esv.Docker + if esv.InferenceContainerProperties != nil { + objectMap["inferenceContainerProperties"] = esv.InferenceContainerProperties + } + if esv.IsAnonymous != nil { + objectMap["isAnonymous"] = esv.IsAnonymous + } + if esv.Properties != nil { + objectMap["properties"] = esv.Properties + } + if esv.Tags != nil { + objectMap["tags"] = esv.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EnvironmentSpecificationVersion struct. +func (esv *EnvironmentSpecificationVersion) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "condaFile": + if v != nil { + var condaFile string + err = json.Unmarshal(*v, &condaFile) + if err != nil { + return err + } + esv.CondaFile = &condaFile + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + esv.Description = &description + } + case "docker": + if v != nil { + docker, err := unmarshalBasicDockerSpecification(*v) + if err != nil { + return err + } + esv.Docker = docker + } + case "environmentSpecificationType": + if v != nil { + var environmentSpecificationType EnvironmentSpecificationType + err = json.Unmarshal(*v, &environmentSpecificationType) + if err != nil { + return err + } + esv.EnvironmentSpecificationType = environmentSpecificationType + } + case "inferenceContainerProperties": + if v != nil { + var inferenceContainerProperties InferenceContainerProperties + err = json.Unmarshal(*v, &inferenceContainerProperties) + if err != nil { + return err + } + esv.InferenceContainerProperties = &inferenceContainerProperties + } + case "isAnonymous": + if v != nil { + var isAnonymous bool + err = json.Unmarshal(*v, &isAnonymous) + if err != nil { + return err + } + esv.IsAnonymous = &isAnonymous + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + esv.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + esv.Tags = tags + } + } + } + + return nil +} + +// EnvironmentSpecificationVersionResource azure Resource Manager resource envelope. +type EnvironmentSpecificationVersionResource struct { + autorest.Response `json:"-"` + // Properties - Additional attributes of the entity. + Properties *EnvironmentSpecificationVersion `json:"properties,omitempty"` + // SystemData - READ-ONLY; System data associated with resource provider + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EnvironmentSpecificationVersionResource. +func (esvr EnvironmentSpecificationVersionResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if esvr.Properties != nil { + objectMap["properties"] = esvr.Properties + } + return json.Marshal(objectMap) +} + +// EnvironmentSpecificationVersionResourceArmPaginatedResult a paginated list of +// EnvironmentSpecificationVersion entities. +type EnvironmentSpecificationVersionResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type EnvironmentSpecificationVersion. + Value *[]EnvironmentSpecificationVersionResource `json:"value,omitempty"` +} + +// EnvironmentSpecificationVersionResourceArmPaginatedResultIterator provides access to a complete listing +// of EnvironmentSpecificationVersionResource values. +type EnvironmentSpecificationVersionResourceArmPaginatedResultIterator struct { + i int + page EnvironmentSpecificationVersionResourceArmPaginatedResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EnvironmentSpecificationVersionResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentSpecificationVersionResourceArmPaginatedResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EnvironmentSpecificationVersionResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EnvironmentSpecificationVersionResourceArmPaginatedResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EnvironmentSpecificationVersionResourceArmPaginatedResultIterator) Response() EnvironmentSpecificationVersionResourceArmPaginatedResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EnvironmentSpecificationVersionResourceArmPaginatedResultIterator) Value() EnvironmentSpecificationVersionResource { + if !iter.page.NotDone() { + return EnvironmentSpecificationVersionResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EnvironmentSpecificationVersionResourceArmPaginatedResultIterator type. +func NewEnvironmentSpecificationVersionResourceArmPaginatedResultIterator(page EnvironmentSpecificationVersionResourceArmPaginatedResultPage) EnvironmentSpecificationVersionResourceArmPaginatedResultIterator { + return EnvironmentSpecificationVersionResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (esvrapr EnvironmentSpecificationVersionResourceArmPaginatedResult) IsEmpty() bool { + return esvrapr.Value == nil || len(*esvrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (esvrapr EnvironmentSpecificationVersionResourceArmPaginatedResult) hasNextLink() bool { + return esvrapr.NextLink != nil && len(*esvrapr.NextLink) != 0 +} + +// environmentSpecificationVersionResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (esvrapr EnvironmentSpecificationVersionResourceArmPaginatedResult) environmentSpecificationVersionResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !esvrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(esvrapr.NextLink))) +} + +// EnvironmentSpecificationVersionResourceArmPaginatedResultPage contains a page of +// EnvironmentSpecificationVersionResource values. +type EnvironmentSpecificationVersionResourceArmPaginatedResultPage struct { + fn func(context.Context, EnvironmentSpecificationVersionResourceArmPaginatedResult) (EnvironmentSpecificationVersionResourceArmPaginatedResult, error) + esvrapr EnvironmentSpecificationVersionResourceArmPaginatedResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EnvironmentSpecificationVersionResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentSpecificationVersionResourceArmPaginatedResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.esvrapr) + if err != nil { + return err + } + page.esvrapr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EnvironmentSpecificationVersionResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EnvironmentSpecificationVersionResourceArmPaginatedResultPage) NotDone() bool { + return !page.esvrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EnvironmentSpecificationVersionResourceArmPaginatedResultPage) Response() EnvironmentSpecificationVersionResourceArmPaginatedResult { + return page.esvrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EnvironmentSpecificationVersionResourceArmPaginatedResultPage) Values() []EnvironmentSpecificationVersionResource { + if page.esvrapr.IsEmpty() { + return nil + } + return *page.esvrapr.Value +} + +// Creates a new instance of the EnvironmentSpecificationVersionResourceArmPaginatedResultPage type. +func NewEnvironmentSpecificationVersionResourceArmPaginatedResultPage(cur EnvironmentSpecificationVersionResourceArmPaginatedResult, getNextPage func(context.Context, EnvironmentSpecificationVersionResourceArmPaginatedResult) (EnvironmentSpecificationVersionResourceArmPaginatedResult, error)) EnvironmentSpecificationVersionResourceArmPaginatedResultPage { + return EnvironmentSpecificationVersionResourceArmPaginatedResultPage{ + fn: getNextPage, + esvrapr: cur, + } +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// EstimatedVMPrice the estimated price info for using a VM of a particular OS type, tier, etc. +type EstimatedVMPrice struct { + // RetailPrice - The price charged for using the VM. + RetailPrice *float64 `json:"retailPrice,omitempty"` + // OsType - Operating system type used by the VM. Possible values include: 'VMPriceOSTypeLinux', 'VMPriceOSTypeWindows' + OsType VMPriceOSType `json:"osType,omitempty"` + // VMTier - The type of the VM. Possible values include: 'VMTierStandard', 'VMTierLowPriority', 'VMTierSpot' + VMTier VMTier `json:"vmTier,omitempty"` +} + +// EstimatedVMPrices the estimated price info for using a VM. +type EstimatedVMPrices struct { + // BillingCurrency - Three lettered code specifying the currency of the VM price. Example: USD + BillingCurrency *string `json:"billingCurrency,omitempty"` + // UnitOfMeasure - The unit of time measurement for the specified VM price. Example: OneHour + UnitOfMeasure *string `json:"unitOfMeasure,omitempty"` + // Values - The list of estimated prices for using a VM of a particular OS type, tier, etc. + Values *[]EstimatedVMPrice `json:"values,omitempty"` +} + +// BasicExportSummary ... +type BasicExportSummary interface { + AsCocoExportSummary() (*CocoExportSummary, bool) + AsCsvExportSummary() (*CsvExportSummary, bool) + AsDatasetExportSummary() (*DatasetExportSummary, bool) + AsExportSummary() (*ExportSummary, bool) +} + +// ExportSummary ... +type ExportSummary struct { + autorest.Response `json:"-"` + // EndTimeUtc - READ-ONLY; The time when the export was completed. + EndTimeUtc *date.Time `json:"endTimeUtc,omitempty"` + // ExportedRowCount - READ-ONLY; The total number of labeled datapoints exported. + ExportedRowCount *int64 `json:"exportedRowCount,omitempty"` + // LabelingJobID - READ-ONLY; Name and identifier of the job containing exported labels. + LabelingJobID *string `json:"labelingJobId,omitempty"` + // StartTimeUtc - READ-ONLY; The time when the export was requested. + StartTimeUtc *date.Time `json:"startTimeUtc,omitempty"` + // Format - Possible values include: 'FormatExportSummary', 'FormatCoco', 'FormatCSV', 'FormatDataset' + Format Format `json:"format,omitempty"` +} + +func unmarshalBasicExportSummary(body []byte) (BasicExportSummary, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["format"] { + case string(FormatCoco): + var ces CocoExportSummary + err := json.Unmarshal(body, &ces) + return ces, err + case string(FormatCSV): + var ces CsvExportSummary + err := json.Unmarshal(body, &ces) + return ces, err + case string(FormatDataset): + var desVar DatasetExportSummary + err := json.Unmarshal(body, &desVar) + return desVar, err + default: + var es ExportSummary + err := json.Unmarshal(body, &es) + return es, err + } +} +func unmarshalBasicExportSummaryArray(body []byte) ([]BasicExportSummary, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + esArray := make([]BasicExportSummary, len(rawMessages)) + + for index, rawMessage := range rawMessages { + es, err := unmarshalBasicExportSummary(*rawMessage) + if err != nil { + return nil, err + } + esArray[index] = es + } + return esArray, nil +} + +// MarshalJSON is the custom marshaler for ExportSummary. +func (es ExportSummary) MarshalJSON() ([]byte, error) { + es.Format = FormatExportSummary + objectMap := make(map[string]interface{}) + if es.Format != "" { + objectMap["format"] = es.Format + } + return json.Marshal(objectMap) +} + +// AsCocoExportSummary is the BasicExportSummary implementation for ExportSummary. +func (es ExportSummary) AsCocoExportSummary() (*CocoExportSummary, bool) { + return nil, false +} + +// AsCsvExportSummary is the BasicExportSummary implementation for ExportSummary. +func (es ExportSummary) AsCsvExportSummary() (*CsvExportSummary, bool) { + return nil, false +} + +// AsDatasetExportSummary is the BasicExportSummary implementation for ExportSummary. +func (es ExportSummary) AsDatasetExportSummary() (*DatasetExportSummary, bool) { + return nil, false +} + +// AsExportSummary is the BasicExportSummary implementation for ExportSummary. +func (es ExportSummary) AsExportSummary() (*ExportSummary, bool) { + return &es, true +} + +// AsBasicExportSummary is the BasicExportSummary implementation for ExportSummary. +func (es ExportSummary) AsBasicExportSummary() (BasicExportSummary, bool) { + return &es, true +} + +// ExportSummaryModel ... +type ExportSummaryModel struct { + autorest.Response `json:"-"` + Value BasicExportSummary `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for ExportSummaryModel struct. +func (esm *ExportSummaryModel) UnmarshalJSON(body []byte) error { + es, err := unmarshalBasicExportSummary(body) + if err != nil { + return err + } + esm.Value = es + + return nil +} + +// FlavorData ... +type FlavorData struct { + Data map[string]*string `json:"data"` +} + +// MarshalJSON is the custom marshaler for FlavorData. +func (fd FlavorData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fd.Data != nil { + objectMap["data"] = fd.Data + } + return json.Marshal(objectMap) +} + +// GlusterFsContents glusterFs datastore configuration. +type GlusterFsContents struct { + // ServerAddress - GlusterFS server address (can be the IP address or server name). + ServerAddress *string `json:"serverAddress,omitempty"` + // VolumeName - GlusterFS volume name. + VolumeName *string `json:"volumeName,omitempty"` + // ContentsType - Possible values include: 'ContentsTypeDatastoreContents', 'ContentsTypeAzureBlob', 'ContentsTypeAzureDataLakeGen1', 'ContentsTypeAzureDataLakeGen2', 'ContentsTypeAzureFile', 'ContentsTypeAzurePostgreSQL', 'ContentsTypeAzureSQLDatabase', 'ContentsTypeGlusterFs' + ContentsType ContentsTypeBasicDatastoreContents `json:"contentsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for GlusterFsContents. +func (gfc GlusterFsContents) MarshalJSON() ([]byte, error) { + gfc.ContentsType = ContentsTypeGlusterFs + objectMap := make(map[string]interface{}) + if gfc.ServerAddress != nil { + objectMap["serverAddress"] = gfc.ServerAddress + } + if gfc.VolumeName != nil { + objectMap["volumeName"] = gfc.VolumeName + } + if gfc.ContentsType != "" { + objectMap["contentsType"] = gfc.ContentsType + } + return json.Marshal(objectMap) +} + +// AsAzureBlobContents is the BasicDatastoreContents implementation for GlusterFsContents. +func (gfc GlusterFsContents) AsAzureBlobContents() (*AzureBlobContents, bool) { + return nil, false +} + +// AsAzureDataLakeGen1Contents is the BasicDatastoreContents implementation for GlusterFsContents. +func (gfc GlusterFsContents) AsAzureDataLakeGen1Contents() (*AzureDataLakeGen1Contents, bool) { + return nil, false +} + +// AsAzureDataLakeGen2Contents is the BasicDatastoreContents implementation for GlusterFsContents. +func (gfc GlusterFsContents) AsAzureDataLakeGen2Contents() (*AzureDataLakeGen2Contents, bool) { + return nil, false +} + +// AsAzureFileContents is the BasicDatastoreContents implementation for GlusterFsContents. +func (gfc GlusterFsContents) AsAzureFileContents() (*AzureFileContents, bool) { + return nil, false +} + +// AsAzurePostgreSQLContents is the BasicDatastoreContents implementation for GlusterFsContents. +func (gfc GlusterFsContents) AsAzurePostgreSQLContents() (*AzurePostgreSQLContents, bool) { + return nil, false +} + +// AsAzureSQLDatabaseContents is the BasicDatastoreContents implementation for GlusterFsContents. +func (gfc GlusterFsContents) AsAzureSQLDatabaseContents() (*AzureSQLDatabaseContents, bool) { + return nil, false +} + +// AsGlusterFsContents is the BasicDatastoreContents implementation for GlusterFsContents. +func (gfc GlusterFsContents) AsGlusterFsContents() (*GlusterFsContents, bool) { + return &gfc, true +} + +// AsDatastoreContents is the BasicDatastoreContents implementation for GlusterFsContents. +func (gfc GlusterFsContents) AsDatastoreContents() (*DatastoreContents, bool) { + return nil, false +} + +// AsBasicDatastoreContents is the BasicDatastoreContents implementation for GlusterFsContents. +func (gfc GlusterFsContents) AsBasicDatastoreContents() (BasicDatastoreContents, bool) { + return &gfc, true +} + +// HDInsight a HDInsight compute. +type HDInsight struct { + Properties *HDInsightProperties `json:"properties,omitempty"` + // ComputeLocation - Location for the underlying compute + ComputeLocation *string `json:"computeLocation,omitempty"` + // ProvisioningState - READ-ONLY; The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Possible values include: 'ProvisioningStateUnknown', 'ProvisioningStateUpdating', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Description - The description of the Machine Learning compute. + Description *string `json:"description,omitempty"` + // CreatedOn - READ-ONLY; The time at which the compute was created. + CreatedOn *date.Time `json:"createdOn,omitempty"` + // ModifiedOn - READ-ONLY; The time at which the compute was last modified. + ModifiedOn *date.Time `json:"modifiedOn,omitempty"` + // ResourceID - ARM resource id of the underlying compute + ResourceID *string `json:"resourceId,omitempty"` + // ProvisioningErrors - READ-ONLY; Errors during provisioning + ProvisioningErrors *[]ErrorResponse `json:"provisioningErrors,omitempty"` + // 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. + IsAttachedCompute *bool `json:"isAttachedCompute,omitempty"` + // DisableLocalAuth - Opt-out of local authentication and ensure customers can use only MSI and AAD exclusively for authentication. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + // ComputeType - Possible values include: 'ComputeTypeCompute', 'ComputeTypeAKS1', 'ComputeTypeAmlCompute1', 'ComputeTypeComputeInstance1', 'ComputeTypeVirtualMachine1', 'ComputeTypeHDInsight1', 'ComputeTypeDataFactory1', 'ComputeTypeDatabricks1', 'ComputeTypeDataLakeAnalytics1' + ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for HDInsight. +func (hi HDInsight) MarshalJSON() ([]byte, error) { + hi.ComputeType = ComputeTypeHDInsight1 + objectMap := make(map[string]interface{}) + if hi.Properties != nil { + objectMap["properties"] = hi.Properties + } + if hi.ComputeLocation != nil { + objectMap["computeLocation"] = hi.ComputeLocation + } + if hi.Description != nil { + objectMap["description"] = hi.Description + } + if hi.ResourceID != nil { + objectMap["resourceId"] = hi.ResourceID + } + if hi.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = hi.DisableLocalAuth + } + if hi.ComputeType != "" { + objectMap["computeType"] = hi.ComputeType + } + return json.Marshal(objectMap) +} + +// AsAKS is the BasicCompute implementation for HDInsight. +func (hi HDInsight) AsAKS() (*AKS, bool) { + return nil, false +} + +// AsAmlCompute is the BasicCompute implementation for HDInsight. +func (hi HDInsight) AsAmlCompute() (*AmlCompute, bool) { + return nil, false +} + +// AsComputeInstance is the BasicCompute implementation for HDInsight. +func (hi HDInsight) AsComputeInstance() (*ComputeInstance, bool) { + return nil, false +} + +// AsVirtualMachine is the BasicCompute implementation for HDInsight. +func (hi HDInsight) AsVirtualMachine() (*VirtualMachine, bool) { + return nil, false +} + +// AsHDInsight is the BasicCompute implementation for HDInsight. +func (hi HDInsight) AsHDInsight() (*HDInsight, bool) { + return &hi, true +} + +// AsDataFactory is the BasicCompute implementation for HDInsight. +func (hi HDInsight) AsDataFactory() (*DataFactory, bool) { + return nil, false +} + +// AsDatabricks is the BasicCompute implementation for HDInsight. +func (hi HDInsight) AsDatabricks() (*Databricks, bool) { + return nil, false +} + +// AsDataLakeAnalytics is the BasicCompute implementation for HDInsight. +func (hi HDInsight) AsDataLakeAnalytics() (*DataLakeAnalytics, bool) { + return nil, false +} + +// AsCompute is the BasicCompute implementation for HDInsight. +func (hi HDInsight) AsCompute() (*Compute, bool) { + return nil, false +} + +// AsBasicCompute is the BasicCompute implementation for HDInsight. +func (hi HDInsight) AsBasicCompute() (BasicCompute, bool) { + return &hi, true +} + +// HDInsightProperties ... +type HDInsightProperties struct { + // SSHPort - Port open for ssh connections on the master node of the cluster. + SSHPort *int32 `json:"sshPort,omitempty"` + // Address - Public IP address of the master node of the cluster. + Address *string `json:"address,omitempty"` + // AdministratorAccount - Admin credentials for master node of the cluster + AdministratorAccount *VirtualMachineSSHCredentials `json:"administratorAccount,omitempty"` +} + +// IDAssetReference reference to an asset via its ARM resource ID. +type IDAssetReference struct { + // AssetID - ARM resource ID of the asset. + AssetID *string `json:"assetId,omitempty"` + // ReferenceType - Possible values include: 'ReferenceTypeAssetReferenceBase', 'ReferenceTypeDataPath', 'ReferenceTypeID', 'ReferenceTypeOutputPath' + ReferenceType ReferenceTypeBasicAssetReferenceBase `json:"referenceType,omitempty"` +} + +// MarshalJSON is the custom marshaler for IDAssetReference. +func (iar IDAssetReference) MarshalJSON() ([]byte, error) { + iar.ReferenceType = ReferenceTypeID + objectMap := make(map[string]interface{}) + if iar.AssetID != nil { + objectMap["assetId"] = iar.AssetID + } + if iar.ReferenceType != "" { + objectMap["referenceType"] = iar.ReferenceType + } + return json.Marshal(objectMap) +} + +// AsDataPathAssetReference is the BasicAssetReferenceBase implementation for IDAssetReference. +func (iar IDAssetReference) AsDataPathAssetReference() (*DataPathAssetReference, bool) { + return nil, false +} + +// AsIDAssetReference is the BasicAssetReferenceBase implementation for IDAssetReference. +func (iar IDAssetReference) AsIDAssetReference() (*IDAssetReference, bool) { + return &iar, true +} + +// AsOutputPathAssetReference is the BasicAssetReferenceBase implementation for IDAssetReference. +func (iar IDAssetReference) AsOutputPathAssetReference() (*OutputPathAssetReference, bool) { + return nil, false +} + +// AsAssetReferenceBase is the BasicAssetReferenceBase implementation for IDAssetReference. +func (iar IDAssetReference) AsAssetReferenceBase() (*AssetReferenceBase, bool) { + return nil, false +} + +// AsBasicAssetReferenceBase is the BasicAssetReferenceBase implementation for IDAssetReference. +func (iar IDAssetReference) AsBasicAssetReferenceBase() (BasicAssetReferenceBase, bool) { + return &iar, true +} + +// Identity identity for the resource. +type Identity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeNone' + Type ResourceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The user assigned identities associated with the resource. + UserAssignedIdentities map[string]*UserAssignedIdentity `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.Type != "" { + objectMap["type"] = i.Type + } + if i.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = i.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// BasicIdentityConfiguration base definition for identity configuration. +type BasicIdentityConfiguration interface { + AsAmlToken() (*AmlToken, bool) + AsManagedIdentity() (*ManagedIdentity, bool) + AsIdentityConfiguration() (*IdentityConfiguration, bool) +} + +// IdentityConfiguration base definition for identity configuration. +type IdentityConfiguration struct { + // IdentityType - Possible values include: 'IdentityTypeIdentityConfiguration', 'IdentityTypeAMLToken', 'IdentityTypeManaged' + IdentityType IdentityType `json:"identityType,omitempty"` +} + +func unmarshalBasicIdentityConfiguration(body []byte) (BasicIdentityConfiguration, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["identityType"] { + case string(IdentityTypeAMLToken): + var at AmlToken + err := json.Unmarshal(body, &at) + return at, err + case string(IdentityTypeManaged): + var mi ManagedIdentity + err := json.Unmarshal(body, &mi) + return mi, err + default: + var ic IdentityConfiguration + err := json.Unmarshal(body, &ic) + return ic, err + } +} +func unmarshalBasicIdentityConfigurationArray(body []byte) ([]BasicIdentityConfiguration, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + icArray := make([]BasicIdentityConfiguration, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ic, err := unmarshalBasicIdentityConfiguration(*rawMessage) + if err != nil { + return nil, err + } + icArray[index] = ic + } + return icArray, nil +} + +// MarshalJSON is the custom marshaler for IdentityConfiguration. +func (ic IdentityConfiguration) MarshalJSON() ([]byte, error) { + ic.IdentityType = IdentityTypeIdentityConfiguration + objectMap := make(map[string]interface{}) + if ic.IdentityType != "" { + objectMap["identityType"] = ic.IdentityType + } + return json.Marshal(objectMap) +} + +// AsAmlToken is the BasicIdentityConfiguration implementation for IdentityConfiguration. +func (ic IdentityConfiguration) AsAmlToken() (*AmlToken, bool) { + return nil, false +} + +// AsManagedIdentity is the BasicIdentityConfiguration implementation for IdentityConfiguration. +func (ic IdentityConfiguration) AsManagedIdentity() (*ManagedIdentity, bool) { + return nil, false +} + +// AsIdentityConfiguration is the BasicIdentityConfiguration implementation for IdentityConfiguration. +func (ic IdentityConfiguration) AsIdentityConfiguration() (*IdentityConfiguration, bool) { + return &ic, true +} + +// AsBasicIdentityConfiguration is the BasicIdentityConfiguration implementation for IdentityConfiguration. +func (ic IdentityConfiguration) AsBasicIdentityConfiguration() (BasicIdentityConfiguration, bool) { + return &ic, true +} + +// IdentityForCmk identity that will be used to access key vault for encryption at rest +type IdentityForCmk struct { + // UserAssignedIdentity - The ArmId of the user assigned identity that will be used to access the customer managed key vault + UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` +} + +// InferenceContainerProperties ... +type InferenceContainerProperties struct { + // LivenessRoute - The route to check the liveness of the inference server container. + LivenessRoute *Route `json:"livenessRoute,omitempty"` + // ReadinessRoute - The route to check the readiness of the inference server container. + ReadinessRoute *Route `json:"readinessRoute,omitempty"` + // ScoringRoute - The port to send the scoring requests to, within the inference server container. + ScoringRoute *Route `json:"scoringRoute,omitempty"` +} + +// InputDataBinding ... +type InputDataBinding struct { + // DataID - ARM resource ID of the registered dataVersion. + DataID *string `json:"dataId,omitempty"` + // Mode - Mechanism for accessing the data artifact. Possible values include: 'Mount', 'Download', 'Upload' + Mode DataBindingMode `json:"mode,omitempty"` + // PathOnCompute - Location of data inside the container process. + PathOnCompute *string `json:"pathOnCompute,omitempty"` +} + +// BasicJobBase base definition for a job. +type BasicJobBase interface { + AsCommandJob() (*CommandJob, bool) + AsSweepJob() (*SweepJob, bool) + AsJobBase() (*JobBase, bool) +} + +// JobBase base definition for a job. +type JobBase struct { + // Description - The asset description text. + Description *string `json:"description,omitempty"` + // InteractionEndpoints - READ-ONLY; List of JobEndpoints. + // For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + InteractionEndpoints map[string]*JobEndpoint `json:"interactionEndpoints"` + // Properties - The asset property dictionary. + Properties map[string]*string `json:"properties"` + // ProvisioningState - READ-ONLY; Possible values include: 'Succeeded', 'Failed', 'Canceled', 'InProgress' + ProvisioningState JobProvisioningState `json:"provisioningState,omitempty"` + // Tags - Tag dictionary. Tags can be added, removed, and updated. + Tags map[string]*string `json:"tags"` + // JobType - Possible values include: 'JobTypeJobBase', 'JobTypeCommand', 'JobTypeSweep' + JobType JobTypeBasicJobBase `json:"jobType,omitempty"` +} + +func unmarshalBasicJobBase(body []byte) (BasicJobBase, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["jobType"] { + case string(JobTypeCommand): + var cj CommandJob + err := json.Unmarshal(body, &cj) + return cj, err + case string(JobTypeSweep): + var sj SweepJob + err := json.Unmarshal(body, &sj) + return sj, err + default: + var jb JobBase + err := json.Unmarshal(body, &jb) + return jb, err + } +} +func unmarshalBasicJobBaseArray(body []byte) ([]BasicJobBase, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + jbArray := make([]BasicJobBase, len(rawMessages)) + + for index, rawMessage := range rawMessages { + jb, err := unmarshalBasicJobBase(*rawMessage) + if err != nil { + return nil, err + } + jbArray[index] = jb + } + return jbArray, nil +} + +// MarshalJSON is the custom marshaler for JobBase. +func (jb JobBase) MarshalJSON() ([]byte, error) { + jb.JobType = JobTypeJobBase + objectMap := make(map[string]interface{}) + if jb.Description != nil { + objectMap["description"] = jb.Description + } + if jb.Properties != nil { + objectMap["properties"] = jb.Properties + } + if jb.Tags != nil { + objectMap["tags"] = jb.Tags + } + if jb.JobType != "" { + objectMap["jobType"] = jb.JobType + } + return json.Marshal(objectMap) +} + +// AsCommandJob is the BasicJobBase implementation for JobBase. +func (jb JobBase) AsCommandJob() (*CommandJob, bool) { + return nil, false +} + +// AsSweepJob is the BasicJobBase implementation for JobBase. +func (jb JobBase) AsSweepJob() (*SweepJob, bool) { + return nil, false +} + +// AsJobBase is the BasicJobBase implementation for JobBase. +func (jb JobBase) AsJobBase() (*JobBase, bool) { + return &jb, true +} + +// AsBasicJobBase is the BasicJobBase implementation for JobBase. +func (jb JobBase) AsBasicJobBase() (BasicJobBase, bool) { + return &jb, true +} + +// JobBaseResource azure Resource Manager resource envelope. +type JobBaseResource struct { + autorest.Response `json:"-"` + // Properties - Additional attributes of the entity. + Properties BasicJobBase `json:"properties,omitempty"` + // SystemData - READ-ONLY; System data associated with resource provider + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for JobBaseResource. +func (jbr JobBaseResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = jbr.Properties + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for JobBaseResource struct. +func (jbr *JobBaseResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + properties, err := unmarshalBasicJobBase(*v) + if err != nil { + return err + } + jbr.Properties = properties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + jbr.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + jbr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + jbr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + jbr.Type = &typeVar + } + } + } + + return nil +} + +// JobBaseResourceArmPaginatedResult a paginated list of JobBase entities. +type JobBaseResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type JobBase. + Value *[]JobBaseResource `json:"value,omitempty"` +} + +// JobBaseResourceArmPaginatedResultIterator provides access to a complete listing of JobBaseResource +// values. +type JobBaseResourceArmPaginatedResultIterator struct { + i int + page JobBaseResourceArmPaginatedResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *JobBaseResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobBaseResourceArmPaginatedResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *JobBaseResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter JobBaseResourceArmPaginatedResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter JobBaseResourceArmPaginatedResultIterator) Response() JobBaseResourceArmPaginatedResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter JobBaseResourceArmPaginatedResultIterator) Value() JobBaseResource { + if !iter.page.NotDone() { + return JobBaseResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the JobBaseResourceArmPaginatedResultIterator type. +func NewJobBaseResourceArmPaginatedResultIterator(page JobBaseResourceArmPaginatedResultPage) JobBaseResourceArmPaginatedResultIterator { + return JobBaseResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (jbrapr JobBaseResourceArmPaginatedResult) IsEmpty() bool { + return jbrapr.Value == nil || len(*jbrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (jbrapr JobBaseResourceArmPaginatedResult) hasNextLink() bool { + return jbrapr.NextLink != nil && len(*jbrapr.NextLink) != 0 +} + +// jobBaseResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (jbrapr JobBaseResourceArmPaginatedResult) jobBaseResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !jbrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(jbrapr.NextLink))) +} + +// JobBaseResourceArmPaginatedResultPage contains a page of JobBaseResource values. +type JobBaseResourceArmPaginatedResultPage struct { + fn func(context.Context, JobBaseResourceArmPaginatedResult) (JobBaseResourceArmPaginatedResult, error) + jbrapr JobBaseResourceArmPaginatedResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *JobBaseResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobBaseResourceArmPaginatedResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.jbrapr) + if err != nil { + return err + } + page.jbrapr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *JobBaseResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page JobBaseResourceArmPaginatedResultPage) NotDone() bool { + return !page.jbrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page JobBaseResourceArmPaginatedResultPage) Response() JobBaseResourceArmPaginatedResult { + return page.jbrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page JobBaseResourceArmPaginatedResultPage) Values() []JobBaseResource { + if page.jbrapr.IsEmpty() { + return nil + } + return *page.jbrapr.Value +} + +// Creates a new instance of the JobBaseResourceArmPaginatedResultPage type. +func NewJobBaseResourceArmPaginatedResultPage(cur JobBaseResourceArmPaginatedResult, getNextPage func(context.Context, JobBaseResourceArmPaginatedResult) (JobBaseResourceArmPaginatedResult, error)) JobBaseResourceArmPaginatedResultPage { + return JobBaseResourceArmPaginatedResultPage{ + fn: getNextPage, + jbrapr: cur, + } +} + +// JobEndpoint job endpoint definition +type JobEndpoint struct { + // Endpoint - Url for endpoint. + Endpoint *string `json:"endpoint,omitempty"` + // JobEndpointType - Endpoint type. + JobEndpointType *string `json:"jobEndpointType,omitempty"` + // Port - Port for endpoint. + Port *int32 `json:"port,omitempty"` + Properties map[string]*string `json:"properties"` +} + +// MarshalJSON is the custom marshaler for JobEndpoint. +func (je JobEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if je.Endpoint != nil { + objectMap["endpoint"] = je.Endpoint + } + if je.JobEndpointType != nil { + objectMap["jobEndpointType"] = je.JobEndpointType + } + if je.Port != nil { + objectMap["port"] = je.Port + } + if je.Properties != nil { + objectMap["properties"] = je.Properties + } + return json.Marshal(objectMap) +} + +// JobOutput job output definition container information on where to find job output/logs. +type JobOutput struct { + // DatastoreID - READ-ONLY; ARM ID of the datastore where the job logs and artifacts are stored, or null for the default container ("azureml") in the workspace's storage account. + DatastoreID *string `json:"datastoreId,omitempty"` + // Path - READ-ONLY; Path within the datastore to the job logs and artifacts. + Path *string `json:"path,omitempty"` +} + +// MarshalJSON is the custom marshaler for JobOutput. +func (jo JobOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// JobsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type JobsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(JobsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *JobsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for JobsDeleteFuture.Result. +func (future *JobsDeleteFuture) result(client JobsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.JobsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.JobsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// K8sOnlineDeployment ... +type K8sOnlineDeployment struct { + ContainerResourceRequirements *ContainerResourceRequirements `json:"containerResourceRequirements,omitempty"` + // AppInsightsEnabled - If true, enables Application Insights logging. + AppInsightsEnabled *bool `json:"appInsightsEnabled,omitempty"` + // CodeConfiguration - Code configuration for the endpoint deployment. + CodeConfiguration *CodeConfiguration `json:"codeConfiguration,omitempty"` + // Description - Description of the endpoint deployment. + Description *string `json:"description,omitempty"` + // EnvironmentID - ARM resource ID of the environment specification for the endpoint deployment. + EnvironmentID *string `json:"environmentId,omitempty"` + // EnvironmentVariables - Environment variables configuration for the deployment. + EnvironmentVariables map[string]*string `json:"environmentVariables"` + LivenessProbe *ProbeSettings `json:"livenessProbe,omitempty"` + // Model - Reference to the model asset for the endpoint deployment. + Model BasicAssetReferenceBase `json:"model,omitempty"` + // Properties - Property dictionary. Properties can be added, but not removed or altered. + Properties map[string]*string `json:"properties"` + // ProvisioningState - READ-ONLY; Provisioning state for the endpoint deployment. Possible values include: 'DeploymentProvisioningStateCreating', 'DeploymentProvisioningStateDeleting', 'DeploymentProvisioningStateScaling', 'DeploymentProvisioningStateUpdating', 'DeploymentProvisioningStateSucceeded', 'DeploymentProvisioningStateFailed', 'DeploymentProvisioningStateCanceled' + ProvisioningState DeploymentProvisioningState `json:"provisioningState,omitempty"` + RequestSettings *OnlineRequestSettings `json:"requestSettings,omitempty"` + ScaleSettings BasicOnlineScaleSettings `json:"scaleSettings,omitempty"` + // EndpointComputeType - Possible values include: 'EndpointComputeTypeOnlineDeployment', 'EndpointComputeTypeK8S', 'EndpointComputeTypeManaged' + EndpointComputeType EndpointComputeTypeBasicOnlineDeployment `json:"endpointComputeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for K8sOnlineDeployment. +func (kod K8sOnlineDeployment) MarshalJSON() ([]byte, error) { + kod.EndpointComputeType = EndpointComputeTypeK8S + objectMap := make(map[string]interface{}) + if kod.ContainerResourceRequirements != nil { + objectMap["containerResourceRequirements"] = kod.ContainerResourceRequirements + } + if kod.AppInsightsEnabled != nil { + objectMap["appInsightsEnabled"] = kod.AppInsightsEnabled + } + if kod.CodeConfiguration != nil { + objectMap["codeConfiguration"] = kod.CodeConfiguration + } + if kod.Description != nil { + objectMap["description"] = kod.Description + } + if kod.EnvironmentID != nil { + objectMap["environmentId"] = kod.EnvironmentID + } + if kod.EnvironmentVariables != nil { + objectMap["environmentVariables"] = kod.EnvironmentVariables + } + if kod.LivenessProbe != nil { + objectMap["livenessProbe"] = kod.LivenessProbe + } + objectMap["model"] = kod.Model + if kod.Properties != nil { + objectMap["properties"] = kod.Properties + } + if kod.RequestSettings != nil { + objectMap["requestSettings"] = kod.RequestSettings + } + objectMap["scaleSettings"] = kod.ScaleSettings + if kod.EndpointComputeType != "" { + objectMap["endpointComputeType"] = kod.EndpointComputeType + } + return json.Marshal(objectMap) +} + +// AsK8sOnlineDeployment is the BasicOnlineDeployment implementation for K8sOnlineDeployment. +func (kod K8sOnlineDeployment) AsK8sOnlineDeployment() (*K8sOnlineDeployment, bool) { + return &kod, true +} + +// AsManagedOnlineDeployment is the BasicOnlineDeployment implementation for K8sOnlineDeployment. +func (kod K8sOnlineDeployment) AsManagedOnlineDeployment() (*ManagedOnlineDeployment, bool) { + return nil, false +} + +// AsOnlineDeployment is the BasicOnlineDeployment implementation for K8sOnlineDeployment. +func (kod K8sOnlineDeployment) AsOnlineDeployment() (*OnlineDeployment, bool) { + return nil, false +} + +// AsBasicOnlineDeployment is the BasicOnlineDeployment implementation for K8sOnlineDeployment. +func (kod K8sOnlineDeployment) AsBasicOnlineDeployment() (BasicOnlineDeployment, bool) { + return &kod, true +} + +// UnmarshalJSON is the custom unmarshaler for K8sOnlineDeployment struct. +func (kod *K8sOnlineDeployment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "containerResourceRequirements": + if v != nil { + var containerResourceRequirements ContainerResourceRequirements + err = json.Unmarshal(*v, &containerResourceRequirements) + if err != nil { + return err + } + kod.ContainerResourceRequirements = &containerResourceRequirements + } + case "appInsightsEnabled": + if v != nil { + var appInsightsEnabled bool + err = json.Unmarshal(*v, &appInsightsEnabled) + if err != nil { + return err + } + kod.AppInsightsEnabled = &appInsightsEnabled + } + case "codeConfiguration": + if v != nil { + var codeConfiguration CodeConfiguration + err = json.Unmarshal(*v, &codeConfiguration) + if err != nil { + return err + } + kod.CodeConfiguration = &codeConfiguration + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + kod.Description = &description + } + case "environmentId": + if v != nil { + var environmentID string + err = json.Unmarshal(*v, &environmentID) + if err != nil { + return err + } + kod.EnvironmentID = &environmentID + } + case "environmentVariables": + if v != nil { + var environmentVariables map[string]*string + err = json.Unmarshal(*v, &environmentVariables) + if err != nil { + return err + } + kod.EnvironmentVariables = environmentVariables + } + case "livenessProbe": + if v != nil { + var livenessProbe ProbeSettings + err = json.Unmarshal(*v, &livenessProbe) + if err != nil { + return err + } + kod.LivenessProbe = &livenessProbe + } + case "model": + if v != nil { + model, err := unmarshalBasicAssetReferenceBase(*v) + if err != nil { + return err + } + kod.Model = model + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + kod.Properties = properties + } + case "provisioningState": + if v != nil { + var provisioningState DeploymentProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + kod.ProvisioningState = provisioningState + } + case "requestSettings": + if v != nil { + var requestSettings OnlineRequestSettings + err = json.Unmarshal(*v, &requestSettings) + if err != nil { + return err + } + kod.RequestSettings = &requestSettings + } + case "scaleSettings": + if v != nil { + scaleSettings, err := unmarshalBasicOnlineScaleSettings(*v) + if err != nil { + return err + } + kod.ScaleSettings = scaleSettings + } + case "endpointComputeType": + if v != nil { + var endpointComputeType EndpointComputeTypeBasicOnlineDeployment + err = json.Unmarshal(*v, &endpointComputeType) + if err != nil { + return err + } + kod.EndpointComputeType = endpointComputeType + } + } + } + + return nil +} + +// KeyVaultProperties ... +type KeyVaultProperties struct { + // KeyVaultArmID - The ArmId of the keyVault where the customer owned encryption key is present. + KeyVaultArmID *string `json:"keyVaultArmId,omitempty"` + // KeyIdentifier - Key vault uri to access the encryption key. + KeyIdentifier *string `json:"keyIdentifier,omitempty"` + // IdentityClientID - For future use - The client id of the identity which will be used to access key vault. + IdentityClientID *string `json:"identityClientId,omitempty"` +} + +// LabelCategory label category definition +type LabelCategory struct { + // AllowMultiSelect - Indicates whether it is allowed to select multiple classes in this category. + AllowMultiSelect *bool `json:"allowMultiSelect,omitempty"` + // Classes - Dictionary of label classes in this category. + Classes map[string]*LabelClass `json:"classes"` + // DisplayName - Display name of the label category. + DisplayName *string `json:"displayName,omitempty"` +} + +// MarshalJSON is the custom marshaler for LabelCategory. +func (lc LabelCategory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lc.AllowMultiSelect != nil { + objectMap["allowMultiSelect"] = lc.AllowMultiSelect + } + if lc.Classes != nil { + objectMap["classes"] = lc.Classes + } + if lc.DisplayName != nil { + objectMap["displayName"] = lc.DisplayName + } + return json.Marshal(objectMap) +} + +// LabelClass label class definition +type LabelClass struct { + // DisplayName - Display name of the label class. + DisplayName *string `json:"displayName,omitempty"` + // Subclasses - Dictionary of subclasses of the label class. + Subclasses map[string]*LabelClass `json:"subclasses"` +} + +// MarshalJSON is the custom marshaler for LabelClass. +func (lc LabelClass) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lc.DisplayName != nil { + objectMap["displayName"] = lc.DisplayName + } + if lc.Subclasses != nil { + objectMap["subclasses"] = lc.Subclasses + } + return json.Marshal(objectMap) +} + +// LabelingDatasetConfiguration labeling dataset configuration definition +type LabelingDatasetConfiguration struct { + // AssetName - Name of the data asset to perform labeling. + AssetName *string `json:"assetName,omitempty"` + // DatasetVersion - AML dataset version. + DatasetVersion *string `json:"datasetVersion,omitempty"` + // IncrementalDatasetRefreshEnabled - Indicates whether to enable incremental dataset refresh. + IncrementalDatasetRefreshEnabled *bool `json:"incrementalDatasetRefreshEnabled,omitempty"` +} + +// LabelingJob labeling job definition +type LabelingJob struct { + // CreatedTimeUtc - READ-ONLY; Created time of the job in UTC timezone. + CreatedTimeUtc *date.Time `json:"createdTimeUtc,omitempty"` + // DatasetConfiguration - Configuration of dataset used in the job. + DatasetConfiguration *LabelingDatasetConfiguration `json:"datasetConfiguration,omitempty"` + // Description - The asset description text. + Description *string `json:"description,omitempty"` + // InteractionEndpoints - READ-ONLY; List of JobEndpoints. + // For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + InteractionEndpoints map[string]*JobEndpoint `json:"interactionEndpoints"` + // JobInstructions - Labeling instructions of the job. + JobInstructions *LabelingJobInstructions `json:"jobInstructions,omitempty"` + // JobType - Specifies the type of job. This field should always be set to "Labeling". Possible values include: 'Command', 'Sweep', 'Labeling' + JobType JobType `json:"jobType,omitempty"` + // LabelCategories - Label categories of the job. + LabelCategories map[string]*LabelCategory `json:"labelCategories"` + // LabelingJobMediaProperties - Media type specific properties in the job. + LabelingJobMediaProperties BasicLabelingJobMediaProperties `json:"labelingJobMediaProperties,omitempty"` + // MlAssistConfiguration - Configuration of MLAssist feature in the job. + MlAssistConfiguration *MLAssistConfiguration `json:"mlAssistConfiguration,omitempty"` + // ProgressMetrics - READ-ONLY; Progress metrics of the job. + ProgressMetrics *ProgressMetrics `json:"progressMetrics,omitempty"` + // ProjectID - READ-ONLY; Internal id of the job(Previously called project). + ProjectID *uuid.UUID `json:"projectId,omitempty"` + // Properties - The asset property dictionary. + Properties map[string]*string `json:"properties"` + // ProvisioningState - READ-ONLY; Possible values include: 'Succeeded', 'Failed', 'Canceled', 'InProgress' + ProvisioningState JobProvisioningState `json:"provisioningState,omitempty"` + // Status - READ-ONLY; Status of the job. Possible values include: 'JobStatusNotStarted', 'JobStatusStarting', 'JobStatusProvisioning', 'JobStatusPreparing', 'JobStatusQueued', 'JobStatusRunning', 'JobStatusFinalizing', 'JobStatusCancelRequested', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusCanceled', 'JobStatusNotResponding', 'JobStatusPaused', 'JobStatusUnknown' + Status JobStatus `json:"status,omitempty"` + // StatusMessages - READ-ONLY; Status messages of the job. + StatusMessages *[]StatusMessage `json:"statusMessages,omitempty"` + // Tags - Tag dictionary. Tags can be added, removed, and updated. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for LabelingJob. +func (lj LabelingJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lj.DatasetConfiguration != nil { + objectMap["datasetConfiguration"] = lj.DatasetConfiguration + } + if lj.Description != nil { + objectMap["description"] = lj.Description + } + if lj.JobInstructions != nil { + objectMap["jobInstructions"] = lj.JobInstructions + } + if lj.JobType != "" { + objectMap["jobType"] = lj.JobType + } + if lj.LabelCategories != nil { + objectMap["labelCategories"] = lj.LabelCategories + } + objectMap["labelingJobMediaProperties"] = lj.LabelingJobMediaProperties + if lj.MlAssistConfiguration != nil { + objectMap["mlAssistConfiguration"] = lj.MlAssistConfiguration + } + if lj.Properties != nil { + objectMap["properties"] = lj.Properties + } + if lj.Tags != nil { + objectMap["tags"] = lj.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LabelingJob struct. +func (lj *LabelingJob) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "createdTimeUtc": + if v != nil { + var createdTimeUtc date.Time + err = json.Unmarshal(*v, &createdTimeUtc) + if err != nil { + return err + } + lj.CreatedTimeUtc = &createdTimeUtc + } + case "datasetConfiguration": + if v != nil { + var datasetConfiguration LabelingDatasetConfiguration + err = json.Unmarshal(*v, &datasetConfiguration) + if err != nil { + return err + } + lj.DatasetConfiguration = &datasetConfiguration + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + lj.Description = &description + } + case "interactionEndpoints": + if v != nil { + var interactionEndpoints map[string]*JobEndpoint + err = json.Unmarshal(*v, &interactionEndpoints) + if err != nil { + return err + } + lj.InteractionEndpoints = interactionEndpoints + } + case "jobInstructions": + if v != nil { + var jobInstructions LabelingJobInstructions + err = json.Unmarshal(*v, &jobInstructions) + if err != nil { + return err + } + lj.JobInstructions = &jobInstructions + } + case "jobType": + if v != nil { + var jobType JobType + err = json.Unmarshal(*v, &jobType) + if err != nil { + return err + } + lj.JobType = jobType + } + case "labelCategories": + if v != nil { + var labelCategories map[string]*LabelCategory + err = json.Unmarshal(*v, &labelCategories) + if err != nil { + return err + } + lj.LabelCategories = labelCategories + } + case "labelingJobMediaProperties": + if v != nil { + labelingJobMediaProperties, err := unmarshalBasicLabelingJobMediaProperties(*v) + if err != nil { + return err + } + lj.LabelingJobMediaProperties = labelingJobMediaProperties + } + case "mlAssistConfiguration": + if v != nil { + var mlAssistConfiguration MLAssistConfiguration + err = json.Unmarshal(*v, &mlAssistConfiguration) + if err != nil { + return err + } + lj.MlAssistConfiguration = &mlAssistConfiguration + } + case "progressMetrics": + if v != nil { + var progressMetrics ProgressMetrics + err = json.Unmarshal(*v, &progressMetrics) + if err != nil { + return err + } + lj.ProgressMetrics = &progressMetrics + } + case "projectId": + if v != nil { + var projectID uuid.UUID + err = json.Unmarshal(*v, &projectID) + if err != nil { + return err + } + lj.ProjectID = &projectID + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + lj.Properties = properties + } + case "provisioningState": + if v != nil { + var provisioningState JobProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + lj.ProvisioningState = provisioningState + } + case "status": + if v != nil { + var status JobStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + lj.Status = status + } + case "statusMessages": + if v != nil { + var statusMessages []StatusMessage + err = json.Unmarshal(*v, &statusMessages) + if err != nil { + return err + } + lj.StatusMessages = &statusMessages + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lj.Tags = tags + } + } + } + + return nil +} + +// LabelingJobImageProperties properties of a labeling job for image data +type LabelingJobImageProperties struct { + // AnnotationType - Annotation type of image labeling job. Possible values include: 'Classification', 'BoundingBox', 'InstanceSegmentation' + AnnotationType ImageAnnotationType `json:"annotationType,omitempty"` + // MediaType - Possible values include: 'MediaTypeLabelingJobMediaProperties', 'MediaTypeImage1', 'MediaTypeText1' + MediaType MediaTypeBasicLabelingJobMediaProperties `json:"mediaType,omitempty"` +} + +// MarshalJSON is the custom marshaler for LabelingJobImageProperties. +func (ljip LabelingJobImageProperties) MarshalJSON() ([]byte, error) { + ljip.MediaType = MediaTypeImage1 + objectMap := make(map[string]interface{}) + if ljip.AnnotationType != "" { + objectMap["annotationType"] = ljip.AnnotationType + } + if ljip.MediaType != "" { + objectMap["mediaType"] = ljip.MediaType + } + return json.Marshal(objectMap) +} + +// AsLabelingJobImageProperties is the BasicLabelingJobMediaProperties implementation for LabelingJobImageProperties. +func (ljip LabelingJobImageProperties) AsLabelingJobImageProperties() (*LabelingJobImageProperties, bool) { + return &ljip, true +} + +// AsLabelingJobTextProperties is the BasicLabelingJobMediaProperties implementation for LabelingJobImageProperties. +func (ljip LabelingJobImageProperties) AsLabelingJobTextProperties() (*LabelingJobTextProperties, bool) { + return nil, false +} + +// AsLabelingJobMediaProperties is the BasicLabelingJobMediaProperties implementation for LabelingJobImageProperties. +func (ljip LabelingJobImageProperties) AsLabelingJobMediaProperties() (*LabelingJobMediaProperties, bool) { + return nil, false +} + +// AsBasicLabelingJobMediaProperties is the BasicLabelingJobMediaProperties implementation for LabelingJobImageProperties. +func (ljip LabelingJobImageProperties) AsBasicLabelingJobMediaProperties() (BasicLabelingJobMediaProperties, bool) { + return &ljip, true +} + +// LabelingJobInstructions instructions for labeling job +type LabelingJobInstructions struct { + // URI - The link to a page with detailed labeling instructions for labelers. + URI *string `json:"uri,omitempty"` +} + +// BasicLabelingJobMediaProperties properties of a labeling job +type BasicLabelingJobMediaProperties interface { + AsLabelingJobImageProperties() (*LabelingJobImageProperties, bool) + AsLabelingJobTextProperties() (*LabelingJobTextProperties, bool) + AsLabelingJobMediaProperties() (*LabelingJobMediaProperties, bool) +} + +// LabelingJobMediaProperties properties of a labeling job +type LabelingJobMediaProperties struct { + // MediaType - Possible values include: 'MediaTypeLabelingJobMediaProperties', 'MediaTypeImage1', 'MediaTypeText1' + MediaType MediaTypeBasicLabelingJobMediaProperties `json:"mediaType,omitempty"` +} + +func unmarshalBasicLabelingJobMediaProperties(body []byte) (BasicLabelingJobMediaProperties, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["mediaType"] { + case string(MediaTypeImage1): + var ljip LabelingJobImageProperties + err := json.Unmarshal(body, &ljip) + return ljip, err + case string(MediaTypeText1): + var ljtp LabelingJobTextProperties + err := json.Unmarshal(body, &ljtp) + return ljtp, err + default: + var ljmp LabelingJobMediaProperties + err := json.Unmarshal(body, &ljmp) + return ljmp, err + } +} +func unmarshalBasicLabelingJobMediaPropertiesArray(body []byte) ([]BasicLabelingJobMediaProperties, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + ljmpArray := make([]BasicLabelingJobMediaProperties, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ljmp, err := unmarshalBasicLabelingJobMediaProperties(*rawMessage) + if err != nil { + return nil, err + } + ljmpArray[index] = ljmp + } + return ljmpArray, nil +} + +// MarshalJSON is the custom marshaler for LabelingJobMediaProperties. +func (ljmp LabelingJobMediaProperties) MarshalJSON() ([]byte, error) { + ljmp.MediaType = MediaTypeLabelingJobMediaProperties + objectMap := make(map[string]interface{}) + if ljmp.MediaType != "" { + objectMap["mediaType"] = ljmp.MediaType + } + return json.Marshal(objectMap) +} + +// AsLabelingJobImageProperties is the BasicLabelingJobMediaProperties implementation for LabelingJobMediaProperties. +func (ljmp LabelingJobMediaProperties) AsLabelingJobImageProperties() (*LabelingJobImageProperties, bool) { + return nil, false +} + +// AsLabelingJobTextProperties is the BasicLabelingJobMediaProperties implementation for LabelingJobMediaProperties. +func (ljmp LabelingJobMediaProperties) AsLabelingJobTextProperties() (*LabelingJobTextProperties, bool) { + return nil, false +} + +// AsLabelingJobMediaProperties is the BasicLabelingJobMediaProperties implementation for LabelingJobMediaProperties. +func (ljmp LabelingJobMediaProperties) AsLabelingJobMediaProperties() (*LabelingJobMediaProperties, bool) { + return &ljmp, true +} + +// AsBasicLabelingJobMediaProperties is the BasicLabelingJobMediaProperties implementation for LabelingJobMediaProperties. +func (ljmp LabelingJobMediaProperties) AsBasicLabelingJobMediaProperties() (BasicLabelingJobMediaProperties, bool) { + return &ljmp, true +} + +// LabelingJobResource azure Resource Manager resource envelope. +type LabelingJobResource struct { + autorest.Response `json:"-"` + // Properties - Additional attributes of the entity. + Properties *LabelingJob `json:"properties,omitempty"` + // SystemData - READ-ONLY; System data associated with resource provider + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for LabelingJobResource. +func (ljr LabelingJobResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ljr.Properties != nil { + objectMap["properties"] = ljr.Properties + } + return json.Marshal(objectMap) +} + +// LabelingJobResourceArmPaginatedResult a paginated list of LabelingJob entities. +type LabelingJobResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type LabelingJob. + Value *[]LabelingJobResource `json:"value,omitempty"` +} + +// LabelingJobResourceArmPaginatedResultIterator provides access to a complete listing of +// LabelingJobResource values. +type LabelingJobResourceArmPaginatedResultIterator struct { + i int + page LabelingJobResourceArmPaginatedResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LabelingJobResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabelingJobResourceArmPaginatedResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LabelingJobResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LabelingJobResourceArmPaginatedResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter LabelingJobResourceArmPaginatedResultIterator) Response() LabelingJobResourceArmPaginatedResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LabelingJobResourceArmPaginatedResultIterator) Value() LabelingJobResource { + if !iter.page.NotDone() { + return LabelingJobResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LabelingJobResourceArmPaginatedResultIterator type. +func NewLabelingJobResourceArmPaginatedResultIterator(page LabelingJobResourceArmPaginatedResultPage) LabelingJobResourceArmPaginatedResultIterator { + return LabelingJobResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ljrapr LabelingJobResourceArmPaginatedResult) IsEmpty() bool { + return ljrapr.Value == nil || len(*ljrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ljrapr LabelingJobResourceArmPaginatedResult) hasNextLink() bool { + return ljrapr.NextLink != nil && len(*ljrapr.NextLink) != 0 +} + +// labelingJobResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ljrapr LabelingJobResourceArmPaginatedResult) labelingJobResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !ljrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ljrapr.NextLink))) +} + +// LabelingJobResourceArmPaginatedResultPage contains a page of LabelingJobResource values. +type LabelingJobResourceArmPaginatedResultPage struct { + fn func(context.Context, LabelingJobResourceArmPaginatedResult) (LabelingJobResourceArmPaginatedResult, error) + ljrapr LabelingJobResourceArmPaginatedResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LabelingJobResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabelingJobResourceArmPaginatedResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ljrapr) + if err != nil { + return err + } + page.ljrapr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LabelingJobResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LabelingJobResourceArmPaginatedResultPage) NotDone() bool { + return !page.ljrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LabelingJobResourceArmPaginatedResultPage) Response() LabelingJobResourceArmPaginatedResult { + return page.ljrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LabelingJobResourceArmPaginatedResultPage) Values() []LabelingJobResource { + if page.ljrapr.IsEmpty() { + return nil + } + return *page.ljrapr.Value +} + +// Creates a new instance of the LabelingJobResourceArmPaginatedResultPage type. +func NewLabelingJobResourceArmPaginatedResultPage(cur LabelingJobResourceArmPaginatedResult, getNextPage func(context.Context, LabelingJobResourceArmPaginatedResult) (LabelingJobResourceArmPaginatedResult, error)) LabelingJobResourceArmPaginatedResultPage { + return LabelingJobResourceArmPaginatedResultPage{ + fn: getNextPage, + ljrapr: cur, + } +} + +// LabelingJobsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type LabelingJobsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LabelingJobsClient) (LabelingJobResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LabelingJobsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LabelingJobsCreateOrUpdateFuture.Result. +func (future *LabelingJobsCreateOrUpdateFuture) result(client LabelingJobsClient) (ljr LabelingJobResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ljr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.LabelingJobsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ljr.Response.Response, err = future.GetResult(sender); err == nil && ljr.Response.Response.StatusCode != http.StatusNoContent { + ljr, err = client.CreateOrUpdateResponder(ljr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsCreateOrUpdateFuture", "Result", ljr.Response.Response, "Failure responding to request") + } + } + return +} + +// LabelingJobsExportLabelsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type LabelingJobsExportLabelsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LabelingJobsClient) (ExportSummaryModel, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LabelingJobsExportLabelsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LabelingJobsExportLabelsFuture.Result. +func (future *LabelingJobsExportLabelsFuture) result(client LabelingJobsClient) (esm ExportSummaryModel, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsExportLabelsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + esm.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.LabelingJobsExportLabelsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if esm.Response.Response, err = future.GetResult(sender); err == nil && esm.Response.Response.StatusCode != http.StatusNoContent { + esm, err = client.ExportLabelsResponder(esm.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsExportLabelsFuture", "Result", esm.Response.Response, "Failure responding to request") + } + } + return +} + +// LabelingJobsResumeFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type LabelingJobsResumeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LabelingJobsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LabelingJobsResumeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LabelingJobsResumeFuture.Result. +func (future *LabelingJobsResumeFuture) result(client LabelingJobsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.LabelingJobsResumeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.LabelingJobsResumeFuture") + return + } + ar.Response = future.Response() + return +} + +// LabelingJobTextProperties properties of a labeling job for text data +type LabelingJobTextProperties struct { + // AnnotationType - Annotation type of text labeling job. Possible values include: 'TextAnnotationTypeClassification' + AnnotationType TextAnnotationType `json:"annotationType,omitempty"` + // MediaType - Possible values include: 'MediaTypeLabelingJobMediaProperties', 'MediaTypeImage1', 'MediaTypeText1' + MediaType MediaTypeBasicLabelingJobMediaProperties `json:"mediaType,omitempty"` +} + +// MarshalJSON is the custom marshaler for LabelingJobTextProperties. +func (ljtp LabelingJobTextProperties) MarshalJSON() ([]byte, error) { + ljtp.MediaType = MediaTypeText1 + objectMap := make(map[string]interface{}) + if ljtp.AnnotationType != "" { + objectMap["annotationType"] = ljtp.AnnotationType + } + if ljtp.MediaType != "" { + objectMap["mediaType"] = ljtp.MediaType + } + return json.Marshal(objectMap) +} + +// AsLabelingJobImageProperties is the BasicLabelingJobMediaProperties implementation for LabelingJobTextProperties. +func (ljtp LabelingJobTextProperties) AsLabelingJobImageProperties() (*LabelingJobImageProperties, bool) { + return nil, false +} + +// AsLabelingJobTextProperties is the BasicLabelingJobMediaProperties implementation for LabelingJobTextProperties. +func (ljtp LabelingJobTextProperties) AsLabelingJobTextProperties() (*LabelingJobTextProperties, bool) { + return &ljtp, true +} + +// AsLabelingJobMediaProperties is the BasicLabelingJobMediaProperties implementation for LabelingJobTextProperties. +func (ljtp LabelingJobTextProperties) AsLabelingJobMediaProperties() (*LabelingJobMediaProperties, bool) { + return nil, false +} + +// AsBasicLabelingJobMediaProperties is the BasicLabelingJobMediaProperties implementation for LabelingJobTextProperties. +func (ljtp LabelingJobTextProperties) AsBasicLabelingJobMediaProperties() (BasicLabelingJobMediaProperties, bool) { + return &ljtp, true +} + +// LinkedInfo information about a datastore origin, if linked. +type LinkedInfo struct { + // LinkedID - Linked service ID. + LinkedID *string `json:"linkedId,omitempty"` + // LinkedResourceName - Linked service resource name. + LinkedResourceName *string `json:"linkedResourceName,omitempty"` + // Origin - Type of the linked service. Possible values include: 'Synapse' + Origin OriginType `json:"origin,omitempty"` +} + +// ListAmlUserFeatureResult the List Aml user feature operation response. +type ListAmlUserFeatureResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of AML user facing features. + Value *[]AmlUserFeature `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page of AML user features information. Call ListNext() with this to fetch the next page of AML user features information. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListAmlUserFeatureResult. +func (laufr ListAmlUserFeatureResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ListAmlUserFeatureResultIterator provides access to a complete listing of AmlUserFeature values. +type ListAmlUserFeatureResultIterator struct { + i int + page ListAmlUserFeatureResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListAmlUserFeatureResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListAmlUserFeatureResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListAmlUserFeatureResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListAmlUserFeatureResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListAmlUserFeatureResultIterator) Response() ListAmlUserFeatureResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListAmlUserFeatureResultIterator) Value() AmlUserFeature { + if !iter.page.NotDone() { + return AmlUserFeature{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListAmlUserFeatureResultIterator type. +func NewListAmlUserFeatureResultIterator(page ListAmlUserFeatureResultPage) ListAmlUserFeatureResultIterator { + return ListAmlUserFeatureResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (laufr ListAmlUserFeatureResult) IsEmpty() bool { + return laufr.Value == nil || len(*laufr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (laufr ListAmlUserFeatureResult) hasNextLink() bool { + return laufr.NextLink != nil && len(*laufr.NextLink) != 0 +} + +// listAmlUserFeatureResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (laufr ListAmlUserFeatureResult) listAmlUserFeatureResultPreparer(ctx context.Context) (*http.Request, error) { + if !laufr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(laufr.NextLink))) +} + +// ListAmlUserFeatureResultPage contains a page of AmlUserFeature values. +type ListAmlUserFeatureResultPage struct { + fn func(context.Context, ListAmlUserFeatureResult) (ListAmlUserFeatureResult, error) + laufr ListAmlUserFeatureResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListAmlUserFeatureResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListAmlUserFeatureResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.laufr) + if err != nil { + return err + } + page.laufr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListAmlUserFeatureResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListAmlUserFeatureResultPage) NotDone() bool { + return !page.laufr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListAmlUserFeatureResultPage) Response() ListAmlUserFeatureResult { + return page.laufr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListAmlUserFeatureResultPage) Values() []AmlUserFeature { + if page.laufr.IsEmpty() { + return nil + } + return *page.laufr.Value +} + +// Creates a new instance of the ListAmlUserFeatureResultPage type. +func NewListAmlUserFeatureResultPage(cur ListAmlUserFeatureResult, getNextPage func(context.Context, ListAmlUserFeatureResult) (ListAmlUserFeatureResult, error)) ListAmlUserFeatureResultPage { + return ListAmlUserFeatureResultPage{ + fn: getNextPage, + laufr: cur, + } +} + +// ListNotebookKeysResult ... +type ListNotebookKeysResult struct { + autorest.Response `json:"-"` + // PrimaryAccessKey - READ-ONLY + PrimaryAccessKey *string `json:"primaryAccessKey,omitempty"` + // SecondaryAccessKey - READ-ONLY + SecondaryAccessKey *string `json:"secondaryAccessKey,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListNotebookKeysResult. +func (lnkr ListNotebookKeysResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ListStorageAccountKeysResult ... +type ListStorageAccountKeysResult struct { + autorest.Response `json:"-"` + // UserStorageKey - READ-ONLY + UserStorageKey *string `json:"userStorageKey,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListStorageAccountKeysResult. +func (lsakr ListStorageAccountKeysResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ListUsagesResult the List Usages operation response. +type ListUsagesResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of AML resource usages. + Value *[]Usage `json:"value,omitempty"` + // 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. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListUsagesResult. +func (lur ListUsagesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ListUsagesResultIterator provides access to a complete listing of Usage values. +type ListUsagesResultIterator struct { + i int + page ListUsagesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListUsagesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListUsagesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListUsagesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListUsagesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListUsagesResultIterator) Response() ListUsagesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListUsagesResultIterator) Value() Usage { + if !iter.page.NotDone() { + return Usage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListUsagesResultIterator type. +func NewListUsagesResultIterator(page ListUsagesResultPage) ListUsagesResultIterator { + return ListUsagesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lur ListUsagesResult) IsEmpty() bool { + return lur.Value == nil || len(*lur.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lur ListUsagesResult) hasNextLink() bool { + return lur.NextLink != nil && len(*lur.NextLink) != 0 +} + +// listUsagesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lur ListUsagesResult) listUsagesResultPreparer(ctx context.Context) (*http.Request, error) { + if !lur.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lur.NextLink))) +} + +// ListUsagesResultPage contains a page of Usage values. +type ListUsagesResultPage struct { + fn func(context.Context, ListUsagesResult) (ListUsagesResult, error) + lur ListUsagesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListUsagesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListUsagesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lur) + if err != nil { + return err + } + page.lur = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListUsagesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListUsagesResultPage) NotDone() bool { + return !page.lur.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListUsagesResultPage) Response() ListUsagesResult { + return page.lur +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListUsagesResultPage) Values() []Usage { + if page.lur.IsEmpty() { + return nil + } + return *page.lur.Value +} + +// Creates a new instance of the ListUsagesResultPage type. +func NewListUsagesResultPage(cur ListUsagesResult, getNextPage func(context.Context, ListUsagesResult) (ListUsagesResult, error)) ListUsagesResultPage { + return ListUsagesResultPage{ + fn: getNextPage, + lur: cur, + } +} + +// ListWorkspaceKeysResult ... +type ListWorkspaceKeysResult struct { + autorest.Response `json:"-"` + // UserStorageKey - READ-ONLY + UserStorageKey *string `json:"userStorageKey,omitempty"` + // UserStorageResourceID - READ-ONLY + UserStorageResourceID *string `json:"userStorageResourceId,omitempty"` + // AppInsightsInstrumentationKey - READ-ONLY + AppInsightsInstrumentationKey *string `json:"appInsightsInstrumentationKey,omitempty"` + // ContainerRegistryCredentials - READ-ONLY + ContainerRegistryCredentials *RegistryListCredentialsResult `json:"containerRegistryCredentials,omitempty"` + // NotebookAccessKeys - READ-ONLY + NotebookAccessKeys *ListNotebookKeysResult `json:"notebookAccessKeys,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListWorkspaceKeysResult. +func (lwkr ListWorkspaceKeysResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ListWorkspaceQuotas the List WorkspaceQuotasByVMFamily operation response. +type ListWorkspaceQuotas struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of Workspace Quotas by VM Family + Value *[]ResourceQuota `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page of workspace quota information by VM Family. Call ListNext() with this to fetch the next page of Workspace Quota information. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListWorkspaceQuotas. +func (lwq ListWorkspaceQuotas) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ListWorkspaceQuotasIterator provides access to a complete listing of ResourceQuota values. +type ListWorkspaceQuotasIterator struct { + i int + page ListWorkspaceQuotasPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListWorkspaceQuotasIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListWorkspaceQuotasIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListWorkspaceQuotasIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListWorkspaceQuotasIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListWorkspaceQuotasIterator) Response() ListWorkspaceQuotas { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListWorkspaceQuotasIterator) Value() ResourceQuota { + if !iter.page.NotDone() { + return ResourceQuota{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListWorkspaceQuotasIterator type. +func NewListWorkspaceQuotasIterator(page ListWorkspaceQuotasPage) ListWorkspaceQuotasIterator { + return ListWorkspaceQuotasIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lwq ListWorkspaceQuotas) IsEmpty() bool { + return lwq.Value == nil || len(*lwq.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lwq ListWorkspaceQuotas) hasNextLink() bool { + return lwq.NextLink != nil && len(*lwq.NextLink) != 0 +} + +// listWorkspaceQuotasPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lwq ListWorkspaceQuotas) listWorkspaceQuotasPreparer(ctx context.Context) (*http.Request, error) { + if !lwq.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lwq.NextLink))) +} + +// ListWorkspaceQuotasPage contains a page of ResourceQuota values. +type ListWorkspaceQuotasPage struct { + fn func(context.Context, ListWorkspaceQuotas) (ListWorkspaceQuotas, error) + lwq ListWorkspaceQuotas +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListWorkspaceQuotasPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListWorkspaceQuotasPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lwq) + if err != nil { + return err + } + page.lwq = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListWorkspaceQuotasPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListWorkspaceQuotasPage) NotDone() bool { + return !page.lwq.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListWorkspaceQuotasPage) Response() ListWorkspaceQuotas { + return page.lwq +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListWorkspaceQuotasPage) Values() []ResourceQuota { + if page.lwq.IsEmpty() { + return nil + } + return *page.lwq.Value +} + +// Creates a new instance of the ListWorkspaceQuotasPage type. +func NewListWorkspaceQuotasPage(cur ListWorkspaceQuotas, getNextPage func(context.Context, ListWorkspaceQuotas) (ListWorkspaceQuotas, error)) ListWorkspaceQuotasPage { + return ListWorkspaceQuotasPage{ + fn: getNextPage, + lwq: cur, + } +} + +// ManagedIdentity managed identity configuration. +type ManagedIdentity struct { + // ClientID - Specifies a user-assigned identity by client ID. For system-assigned, do not set this field. + ClientID *uuid.UUID `json:"clientId,omitempty"` + // ObjectID - Specifies a user-assigned identity by object ID. For system-assigned, do not set this field. + ObjectID *uuid.UUID `json:"objectId,omitempty"` + // ResourceID - Specifies a user-assigned identity by ARM resource ID. For system-assigned, do not set this field. + ResourceID *string `json:"resourceId,omitempty"` + // IdentityType - Possible values include: 'IdentityTypeIdentityConfiguration', 'IdentityTypeAMLToken', 'IdentityTypeManaged' + IdentityType IdentityType `json:"identityType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedIdentity. +func (mi ManagedIdentity) MarshalJSON() ([]byte, error) { + mi.IdentityType = IdentityTypeManaged + objectMap := make(map[string]interface{}) + if mi.ClientID != nil { + objectMap["clientId"] = mi.ClientID + } + if mi.ObjectID != nil { + objectMap["objectId"] = mi.ObjectID + } + if mi.ResourceID != nil { + objectMap["resourceId"] = mi.ResourceID + } + if mi.IdentityType != "" { + objectMap["identityType"] = mi.IdentityType + } + return json.Marshal(objectMap) +} + +// AsAmlToken is the BasicIdentityConfiguration implementation for ManagedIdentity. +func (mi ManagedIdentity) AsAmlToken() (*AmlToken, bool) { + return nil, false +} + +// AsManagedIdentity is the BasicIdentityConfiguration implementation for ManagedIdentity. +func (mi ManagedIdentity) AsManagedIdentity() (*ManagedIdentity, bool) { + return &mi, true +} + +// AsIdentityConfiguration is the BasicIdentityConfiguration implementation for ManagedIdentity. +func (mi ManagedIdentity) AsIdentityConfiguration() (*IdentityConfiguration, bool) { + return nil, false +} + +// AsBasicIdentityConfiguration is the BasicIdentityConfiguration implementation for ManagedIdentity. +func (mi ManagedIdentity) AsBasicIdentityConfiguration() (BasicIdentityConfiguration, bool) { + return &mi, true +} + +// ManagedOnlineDeployment ... +type ManagedOnlineDeployment struct { + InstanceType *string `json:"instanceType,omitempty"` + ReadinessProbe *ProbeSettings `json:"readinessProbe,omitempty"` + // AppInsightsEnabled - If true, enables Application Insights logging. + AppInsightsEnabled *bool `json:"appInsightsEnabled,omitempty"` + // CodeConfiguration - Code configuration for the endpoint deployment. + CodeConfiguration *CodeConfiguration `json:"codeConfiguration,omitempty"` + // Description - Description of the endpoint deployment. + Description *string `json:"description,omitempty"` + // EnvironmentID - ARM resource ID of the environment specification for the endpoint deployment. + EnvironmentID *string `json:"environmentId,omitempty"` + // EnvironmentVariables - Environment variables configuration for the deployment. + EnvironmentVariables map[string]*string `json:"environmentVariables"` + LivenessProbe *ProbeSettings `json:"livenessProbe,omitempty"` + // Model - Reference to the model asset for the endpoint deployment. + Model BasicAssetReferenceBase `json:"model,omitempty"` + // Properties - Property dictionary. Properties can be added, but not removed or altered. + Properties map[string]*string `json:"properties"` + // ProvisioningState - READ-ONLY; Provisioning state for the endpoint deployment. Possible values include: 'DeploymentProvisioningStateCreating', 'DeploymentProvisioningStateDeleting', 'DeploymentProvisioningStateScaling', 'DeploymentProvisioningStateUpdating', 'DeploymentProvisioningStateSucceeded', 'DeploymentProvisioningStateFailed', 'DeploymentProvisioningStateCanceled' + ProvisioningState DeploymentProvisioningState `json:"provisioningState,omitempty"` + RequestSettings *OnlineRequestSettings `json:"requestSettings,omitempty"` + ScaleSettings BasicOnlineScaleSettings `json:"scaleSettings,omitempty"` + // EndpointComputeType - Possible values include: 'EndpointComputeTypeOnlineDeployment', 'EndpointComputeTypeK8S', 'EndpointComputeTypeManaged' + EndpointComputeType EndpointComputeTypeBasicOnlineDeployment `json:"endpointComputeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedOnlineDeployment. +func (mod ManagedOnlineDeployment) MarshalJSON() ([]byte, error) { + mod.EndpointComputeType = EndpointComputeTypeManaged + objectMap := make(map[string]interface{}) + if mod.InstanceType != nil { + objectMap["instanceType"] = mod.InstanceType + } + if mod.ReadinessProbe != nil { + objectMap["readinessProbe"] = mod.ReadinessProbe + } + if mod.AppInsightsEnabled != nil { + objectMap["appInsightsEnabled"] = mod.AppInsightsEnabled + } + if mod.CodeConfiguration != nil { + objectMap["codeConfiguration"] = mod.CodeConfiguration + } + if mod.Description != nil { + objectMap["description"] = mod.Description + } + if mod.EnvironmentID != nil { + objectMap["environmentId"] = mod.EnvironmentID + } + if mod.EnvironmentVariables != nil { + objectMap["environmentVariables"] = mod.EnvironmentVariables + } + if mod.LivenessProbe != nil { + objectMap["livenessProbe"] = mod.LivenessProbe + } + objectMap["model"] = mod.Model + if mod.Properties != nil { + objectMap["properties"] = mod.Properties + } + if mod.RequestSettings != nil { + objectMap["requestSettings"] = mod.RequestSettings + } + objectMap["scaleSettings"] = mod.ScaleSettings + if mod.EndpointComputeType != "" { + objectMap["endpointComputeType"] = mod.EndpointComputeType + } + return json.Marshal(objectMap) +} + +// AsK8sOnlineDeployment is the BasicOnlineDeployment implementation for ManagedOnlineDeployment. +func (mod ManagedOnlineDeployment) AsK8sOnlineDeployment() (*K8sOnlineDeployment, bool) { + return nil, false +} + +// AsManagedOnlineDeployment is the BasicOnlineDeployment implementation for ManagedOnlineDeployment. +func (mod ManagedOnlineDeployment) AsManagedOnlineDeployment() (*ManagedOnlineDeployment, bool) { + return &mod, true +} + +// AsOnlineDeployment is the BasicOnlineDeployment implementation for ManagedOnlineDeployment. +func (mod ManagedOnlineDeployment) AsOnlineDeployment() (*OnlineDeployment, bool) { + return nil, false +} + +// AsBasicOnlineDeployment is the BasicOnlineDeployment implementation for ManagedOnlineDeployment. +func (mod ManagedOnlineDeployment) AsBasicOnlineDeployment() (BasicOnlineDeployment, bool) { + return &mod, true +} + +// UnmarshalJSON is the custom unmarshaler for ManagedOnlineDeployment struct. +func (mod *ManagedOnlineDeployment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "instanceType": + if v != nil { + var instanceType string + err = json.Unmarshal(*v, &instanceType) + if err != nil { + return err + } + mod.InstanceType = &instanceType + } + case "readinessProbe": + if v != nil { + var readinessProbe ProbeSettings + err = json.Unmarshal(*v, &readinessProbe) + if err != nil { + return err + } + mod.ReadinessProbe = &readinessProbe + } + case "appInsightsEnabled": + if v != nil { + var appInsightsEnabled bool + err = json.Unmarshal(*v, &appInsightsEnabled) + if err != nil { + return err + } + mod.AppInsightsEnabled = &appInsightsEnabled + } + case "codeConfiguration": + if v != nil { + var codeConfiguration CodeConfiguration + err = json.Unmarshal(*v, &codeConfiguration) + if err != nil { + return err + } + mod.CodeConfiguration = &codeConfiguration + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + mod.Description = &description + } + case "environmentId": + if v != nil { + var environmentID string + err = json.Unmarshal(*v, &environmentID) + if err != nil { + return err + } + mod.EnvironmentID = &environmentID + } + case "environmentVariables": + if v != nil { + var environmentVariables map[string]*string + err = json.Unmarshal(*v, &environmentVariables) + if err != nil { + return err + } + mod.EnvironmentVariables = environmentVariables + } + case "livenessProbe": + if v != nil { + var livenessProbe ProbeSettings + err = json.Unmarshal(*v, &livenessProbe) + if err != nil { + return err + } + mod.LivenessProbe = &livenessProbe + } + case "model": + if v != nil { + model, err := unmarshalBasicAssetReferenceBase(*v) + if err != nil { + return err + } + mod.Model = model + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + mod.Properties = properties + } + case "provisioningState": + if v != nil { + var provisioningState DeploymentProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + mod.ProvisioningState = provisioningState + } + case "requestSettings": + if v != nil { + var requestSettings OnlineRequestSettings + err = json.Unmarshal(*v, &requestSettings) + if err != nil { + return err + } + mod.RequestSettings = &requestSettings + } + case "scaleSettings": + if v != nil { + scaleSettings, err := unmarshalBasicOnlineScaleSettings(*v) + if err != nil { + return err + } + mod.ScaleSettings = scaleSettings + } + case "endpointComputeType": + if v != nil { + var endpointComputeType EndpointComputeTypeBasicOnlineDeployment + err = json.Unmarshal(*v, &endpointComputeType) + if err != nil { + return err + } + mod.EndpointComputeType = endpointComputeType + } + } + } + + return nil +} + +// ManualScaleSettings ... +type ManualScaleSettings struct { + InstanceCount *int32 `json:"instanceCount,omitempty"` + MaxInstances *int32 `json:"maxInstances,omitempty"` + MinInstances *int32 `json:"minInstances,omitempty"` + // ScaleType - Possible values include: 'ScaleTypeOnlineScaleSettings', 'ScaleTypeAuto', 'ScaleTypeManual' + ScaleType ScaleTypeBasicOnlineScaleSettings `json:"scaleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManualScaleSettings. +func (mss ManualScaleSettings) MarshalJSON() ([]byte, error) { + mss.ScaleType = ScaleTypeManual + objectMap := make(map[string]interface{}) + if mss.InstanceCount != nil { + objectMap["instanceCount"] = mss.InstanceCount + } + if mss.MaxInstances != nil { + objectMap["maxInstances"] = mss.MaxInstances + } + if mss.MinInstances != nil { + objectMap["minInstances"] = mss.MinInstances + } + if mss.ScaleType != "" { + objectMap["scaleType"] = mss.ScaleType + } + return json.Marshal(objectMap) +} + +// AsAutoScaleSettings is the BasicOnlineScaleSettings implementation for ManualScaleSettings. +func (mss ManualScaleSettings) AsAutoScaleSettings() (*AutoScaleSettings, bool) { + return nil, false +} + +// AsManualScaleSettings is the BasicOnlineScaleSettings implementation for ManualScaleSettings. +func (mss ManualScaleSettings) AsManualScaleSettings() (*ManualScaleSettings, bool) { + return &mss, true +} + +// AsOnlineScaleSettings is the BasicOnlineScaleSettings implementation for ManualScaleSettings. +func (mss ManualScaleSettings) AsOnlineScaleSettings() (*OnlineScaleSettings, bool) { + return nil, false +} + +// AsBasicOnlineScaleSettings is the BasicOnlineScaleSettings implementation for ManualScaleSettings. +func (mss ManualScaleSettings) AsBasicOnlineScaleSettings() (BasicOnlineScaleSettings, bool) { + return &mss, true +} + +// MedianStoppingPolicy defines an early termination policy based on running averages of the primary metric +// of all runs +type MedianStoppingPolicy struct { + DelayEvaluation *int32 `json:"delayEvaluation,omitempty"` + EvaluationInterval *int32 `json:"evaluationInterval,omitempty"` + // PolicyType - Possible values include: 'PolicyTypeEarlyTerminationPolicy', 'PolicyTypeBandit', 'PolicyTypeMedianStopping', 'PolicyTypeTruncationSelection' + PolicyType PolicyType `json:"policyType,omitempty"` +} + +// MarshalJSON is the custom marshaler for MedianStoppingPolicy. +func (msp MedianStoppingPolicy) MarshalJSON() ([]byte, error) { + msp.PolicyType = PolicyTypeMedianStopping + objectMap := make(map[string]interface{}) + if msp.DelayEvaluation != nil { + objectMap["delayEvaluation"] = msp.DelayEvaluation + } + if msp.EvaluationInterval != nil { + objectMap["evaluationInterval"] = msp.EvaluationInterval + } + if msp.PolicyType != "" { + objectMap["policyType"] = msp.PolicyType + } + return json.Marshal(objectMap) +} + +// AsBanditPolicy is the BasicEarlyTerminationPolicy implementation for MedianStoppingPolicy. +func (msp MedianStoppingPolicy) AsBanditPolicy() (*BanditPolicy, bool) { + return nil, false +} + +// AsMedianStoppingPolicy is the BasicEarlyTerminationPolicy implementation for MedianStoppingPolicy. +func (msp MedianStoppingPolicy) AsMedianStoppingPolicy() (*MedianStoppingPolicy, bool) { + return &msp, true +} + +// AsTruncationSelectionPolicy is the BasicEarlyTerminationPolicy implementation for MedianStoppingPolicy. +func (msp MedianStoppingPolicy) AsTruncationSelectionPolicy() (*TruncationSelectionPolicy, bool) { + return nil, false +} + +// AsEarlyTerminationPolicy is the BasicEarlyTerminationPolicy implementation for MedianStoppingPolicy. +func (msp MedianStoppingPolicy) AsEarlyTerminationPolicy() (*EarlyTerminationPolicy, bool) { + return nil, false +} + +// AsBasicEarlyTerminationPolicy is the BasicEarlyTerminationPolicy implementation for MedianStoppingPolicy. +func (msp MedianStoppingPolicy) AsBasicEarlyTerminationPolicy() (BasicEarlyTerminationPolicy, bool) { + return &msp, true +} + +// MLAssistConfiguration labeling MLAssist configuration definition +type MLAssistConfiguration struct { + // InferencingComputeBinding - AML compute binding used in inferencing. + InferencingComputeBinding *ComputeConfiguration `json:"inferencingComputeBinding,omitempty"` + // MlAssistEnabled - Indicates whether MLAssist feature is enabled. + MlAssistEnabled *bool `json:"mlAssistEnabled,omitempty"` + // TrainingComputeBinding - AML compute binding used in training. + TrainingComputeBinding *ComputeConfiguration `json:"trainingComputeBinding,omitempty"` +} + +// ModelContainer ... +type ModelContainer struct { + // Description - The asset description text. + Description *string `json:"description,omitempty"` + // Properties - The asset property dictionary. + Properties map[string]*string `json:"properties"` + // Tags - Tag dictionary. Tags can be added, removed, and updated. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ModelContainer. +func (mc ModelContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mc.Description != nil { + objectMap["description"] = mc.Description + } + if mc.Properties != nil { + objectMap["properties"] = mc.Properties + } + if mc.Tags != nil { + objectMap["tags"] = mc.Tags + } + return json.Marshal(objectMap) +} + +// ModelContainerResource azure Resource Manager resource envelope. +type ModelContainerResource struct { + autorest.Response `json:"-"` + // Properties - Additional attributes of the entity. + Properties *ModelContainer `json:"properties,omitempty"` + // SystemData - READ-ONLY; System data associated with resource provider + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ModelContainerResource. +func (mcr ModelContainerResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcr.Properties != nil { + objectMap["properties"] = mcr.Properties + } + return json.Marshal(objectMap) +} + +// ModelContainerResourceArmPaginatedResult a paginated list of ModelContainer entities. +type ModelContainerResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type ModelContainer. + Value *[]ModelContainerResource `json:"value,omitempty"` +} + +// ModelContainerResourceArmPaginatedResultIterator provides access to a complete listing of +// ModelContainerResource values. +type ModelContainerResourceArmPaginatedResultIterator struct { + i int + page ModelContainerResourceArmPaginatedResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ModelContainerResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelContainerResourceArmPaginatedResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ModelContainerResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ModelContainerResourceArmPaginatedResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ModelContainerResourceArmPaginatedResultIterator) Response() ModelContainerResourceArmPaginatedResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ModelContainerResourceArmPaginatedResultIterator) Value() ModelContainerResource { + if !iter.page.NotDone() { + return ModelContainerResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ModelContainerResourceArmPaginatedResultIterator type. +func NewModelContainerResourceArmPaginatedResultIterator(page ModelContainerResourceArmPaginatedResultPage) ModelContainerResourceArmPaginatedResultIterator { + return ModelContainerResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mcrapr ModelContainerResourceArmPaginatedResult) IsEmpty() bool { + return mcrapr.Value == nil || len(*mcrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mcrapr ModelContainerResourceArmPaginatedResult) hasNextLink() bool { + return mcrapr.NextLink != nil && len(*mcrapr.NextLink) != 0 +} + +// modelContainerResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mcrapr ModelContainerResourceArmPaginatedResult) modelContainerResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !mcrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mcrapr.NextLink))) +} + +// ModelContainerResourceArmPaginatedResultPage contains a page of ModelContainerResource values. +type ModelContainerResourceArmPaginatedResultPage struct { + fn func(context.Context, ModelContainerResourceArmPaginatedResult) (ModelContainerResourceArmPaginatedResult, error) + mcrapr ModelContainerResourceArmPaginatedResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ModelContainerResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelContainerResourceArmPaginatedResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mcrapr) + if err != nil { + return err + } + page.mcrapr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ModelContainerResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ModelContainerResourceArmPaginatedResultPage) NotDone() bool { + return !page.mcrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ModelContainerResourceArmPaginatedResultPage) Response() ModelContainerResourceArmPaginatedResult { + return page.mcrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ModelContainerResourceArmPaginatedResultPage) Values() []ModelContainerResource { + if page.mcrapr.IsEmpty() { + return nil + } + return *page.mcrapr.Value +} + +// Creates a new instance of the ModelContainerResourceArmPaginatedResultPage type. +func NewModelContainerResourceArmPaginatedResultPage(cur ModelContainerResourceArmPaginatedResult, getNextPage func(context.Context, ModelContainerResourceArmPaginatedResult) (ModelContainerResourceArmPaginatedResult, error)) ModelContainerResourceArmPaginatedResultPage { + return ModelContainerResourceArmPaginatedResultPage{ + fn: getNextPage, + mcrapr: cur, + } +} + +// ModelVersion model asset version details. +type ModelVersion struct { + // DatastoreID - ARM resource ID of the datastore where the asset is located. + DatastoreID *string `json:"datastoreId,omitempty"` + // Description - The asset description text. + Description *string `json:"description,omitempty"` + // Flavors - Mapping of model flavors to their properties. + Flavors map[string]*FlavorData `json:"flavors"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // Path - The path of the file/directory in the datastore. + Path *string `json:"path,omitempty"` + // Properties - The asset property dictionary. + Properties map[string]*string `json:"properties"` + // Tags - Tag dictionary. Tags can be added, removed, and updated. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ModelVersion. +func (mv ModelVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mv.DatastoreID != nil { + objectMap["datastoreId"] = mv.DatastoreID + } + if mv.Description != nil { + objectMap["description"] = mv.Description + } + if mv.Flavors != nil { + objectMap["flavors"] = mv.Flavors + } + if mv.IsAnonymous != nil { + objectMap["isAnonymous"] = mv.IsAnonymous + } + if mv.Path != nil { + objectMap["path"] = mv.Path + } + if mv.Properties != nil { + objectMap["properties"] = mv.Properties + } + if mv.Tags != nil { + objectMap["tags"] = mv.Tags + } + return json.Marshal(objectMap) +} + +// ModelVersionResource azure Resource Manager resource envelope. +type ModelVersionResource struct { + autorest.Response `json:"-"` + // Properties - Additional attributes of the entity. + Properties *ModelVersion `json:"properties,omitempty"` + // SystemData - READ-ONLY; System data associated with resource provider + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ModelVersionResource. +func (mvr ModelVersionResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mvr.Properties != nil { + objectMap["properties"] = mvr.Properties + } + return json.Marshal(objectMap) +} + +// ModelVersionResourceArmPaginatedResult a paginated list of ModelVersion entities. +type ModelVersionResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type ModelVersion. + Value *[]ModelVersionResource `json:"value,omitempty"` +} + +// ModelVersionResourceArmPaginatedResultIterator provides access to a complete listing of +// ModelVersionResource values. +type ModelVersionResourceArmPaginatedResultIterator struct { + i int + page ModelVersionResourceArmPaginatedResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ModelVersionResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelVersionResourceArmPaginatedResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ModelVersionResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ModelVersionResourceArmPaginatedResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ModelVersionResourceArmPaginatedResultIterator) Response() ModelVersionResourceArmPaginatedResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ModelVersionResourceArmPaginatedResultIterator) Value() ModelVersionResource { + if !iter.page.NotDone() { + return ModelVersionResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ModelVersionResourceArmPaginatedResultIterator type. +func NewModelVersionResourceArmPaginatedResultIterator(page ModelVersionResourceArmPaginatedResultPage) ModelVersionResourceArmPaginatedResultIterator { + return ModelVersionResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mvrapr ModelVersionResourceArmPaginatedResult) IsEmpty() bool { + return mvrapr.Value == nil || len(*mvrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mvrapr ModelVersionResourceArmPaginatedResult) hasNextLink() bool { + return mvrapr.NextLink != nil && len(*mvrapr.NextLink) != 0 +} + +// modelVersionResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mvrapr ModelVersionResourceArmPaginatedResult) modelVersionResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !mvrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mvrapr.NextLink))) +} + +// ModelVersionResourceArmPaginatedResultPage contains a page of ModelVersionResource values. +type ModelVersionResourceArmPaginatedResultPage struct { + fn func(context.Context, ModelVersionResourceArmPaginatedResult) (ModelVersionResourceArmPaginatedResult, error) + mvrapr ModelVersionResourceArmPaginatedResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ModelVersionResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelVersionResourceArmPaginatedResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mvrapr) + if err != nil { + return err + } + page.mvrapr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ModelVersionResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ModelVersionResourceArmPaginatedResultPage) NotDone() bool { + return !page.mvrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ModelVersionResourceArmPaginatedResultPage) Response() ModelVersionResourceArmPaginatedResult { + return page.mvrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ModelVersionResourceArmPaginatedResultPage) Values() []ModelVersionResource { + if page.mvrapr.IsEmpty() { + return nil + } + return *page.mvrapr.Value +} + +// Creates a new instance of the ModelVersionResourceArmPaginatedResultPage type. +func NewModelVersionResourceArmPaginatedResultPage(cur ModelVersionResourceArmPaginatedResult, getNextPage func(context.Context, ModelVersionResourceArmPaginatedResult) (ModelVersionResourceArmPaginatedResult, error)) ModelVersionResourceArmPaginatedResultPage { + return ModelVersionResourceArmPaginatedResultPage{ + fn: getNextPage, + mvrapr: cur, + } +} + +// Mpi MPI distribution configuration. +type Mpi struct { + ProcessCountPerInstance *int32 `json:"processCountPerInstance,omitempty"` + // DistributionType - Possible values include: 'DistributionTypeDistributionConfiguration', 'DistributionTypeMpi1', 'DistributionTypePyTorch1', 'DistributionTypeTensorFlow1' + DistributionType DistributionTypeBasicDistributionConfiguration `json:"distributionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for Mpi. +func (mVar Mpi) MarshalJSON() ([]byte, error) { + mVar.DistributionType = DistributionTypeMpi1 + objectMap := make(map[string]interface{}) + if mVar.ProcessCountPerInstance != nil { + objectMap["processCountPerInstance"] = mVar.ProcessCountPerInstance + } + if mVar.DistributionType != "" { + objectMap["distributionType"] = mVar.DistributionType + } + return json.Marshal(objectMap) +} + +// AsMpi is the BasicDistributionConfiguration implementation for Mpi. +func (mVar Mpi) AsMpi() (*Mpi, bool) { + return &mVar, true +} + +// AsPyTorch is the BasicDistributionConfiguration implementation for Mpi. +func (mVar Mpi) AsPyTorch() (*PyTorch, bool) { + return nil, false +} + +// AsTensorFlow is the BasicDistributionConfiguration implementation for Mpi. +func (mVar Mpi) AsTensorFlow() (*TensorFlow, bool) { + return nil, false +} + +// AsDistributionConfiguration is the BasicDistributionConfiguration implementation for Mpi. +func (mVar Mpi) AsDistributionConfiguration() (*DistributionConfiguration, bool) { + return nil, false +} + +// AsBasicDistributionConfiguration is the BasicDistributionConfiguration implementation for Mpi. +func (mVar Mpi) AsBasicDistributionConfiguration() (BasicDistributionConfiguration, bool) { + return &mVar, true +} + +// NodeStateCounts counts of various compute node states on the amlCompute. +type NodeStateCounts struct { + // IdleNodeCount - READ-ONLY; Number of compute nodes in idle state. + IdleNodeCount *int32 `json:"idleNodeCount,omitempty"` + // RunningNodeCount - READ-ONLY; Number of compute nodes which are running jobs. + RunningNodeCount *int32 `json:"runningNodeCount,omitempty"` + // PreparingNodeCount - READ-ONLY; Number of compute nodes which are being prepared. + PreparingNodeCount *int32 `json:"preparingNodeCount,omitempty"` + // UnusableNodeCount - READ-ONLY; Number of compute nodes which are in unusable state. + UnusableNodeCount *int32 `json:"unusableNodeCount,omitempty"` + // LeavingNodeCount - READ-ONLY; Number of compute nodes which are leaving the amlCompute. + LeavingNodeCount *int32 `json:"leavingNodeCount,omitempty"` + // PreemptedNodeCount - READ-ONLY; Number of compute nodes which are in preempted state. + PreemptedNodeCount *int32 `json:"preemptedNodeCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for NodeStateCounts. +func (nsc NodeStateCounts) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// NoneDatastoreCredentials empty/none datastore credentials. +type NoneDatastoreCredentials struct { + // Secrets - Empty/none datastore secret. + Secrets *NoneDatastoreSecrets `json:"secrets,omitempty"` + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey', 'CredentialsTypeCertificate', 'CredentialsTypeNone', 'CredentialsTypeSas', 'CredentialsTypeServicePrincipal', 'CredentialsTypeSQLAdmin' + CredentialsType CredentialsTypeBasicDatastoreCredentials `json:"credentialsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NoneDatastoreCredentials. +func (ndc NoneDatastoreCredentials) MarshalJSON() ([]byte, error) { + ndc.CredentialsType = CredentialsTypeNone + objectMap := make(map[string]interface{}) + if ndc.Secrets != nil { + objectMap["secrets"] = ndc.Secrets + } + if ndc.CredentialsType != "" { + objectMap["credentialsType"] = ndc.CredentialsType + } + return json.Marshal(objectMap) +} + +// AsAccountKeyDatastoreCredentials is the BasicDatastoreCredentials implementation for NoneDatastoreCredentials. +func (ndc NoneDatastoreCredentials) AsAccountKeyDatastoreCredentials() (*AccountKeyDatastoreCredentials, bool) { + return nil, false +} + +// AsCertificateDatastoreCredentials is the BasicDatastoreCredentials implementation for NoneDatastoreCredentials. +func (ndc NoneDatastoreCredentials) AsCertificateDatastoreCredentials() (*CertificateDatastoreCredentials, bool) { + return nil, false +} + +// AsNoneDatastoreCredentials is the BasicDatastoreCredentials implementation for NoneDatastoreCredentials. +func (ndc NoneDatastoreCredentials) AsNoneDatastoreCredentials() (*NoneDatastoreCredentials, bool) { + return &ndc, true +} + +// AsSasDatastoreCredentials is the BasicDatastoreCredentials implementation for NoneDatastoreCredentials. +func (ndc NoneDatastoreCredentials) AsSasDatastoreCredentials() (*SasDatastoreCredentials, bool) { + return nil, false +} + +// AsServicePrincipalDatastoreCredentials is the BasicDatastoreCredentials implementation for NoneDatastoreCredentials. +func (ndc NoneDatastoreCredentials) AsServicePrincipalDatastoreCredentials() (*ServicePrincipalDatastoreCredentials, bool) { + return nil, false +} + +// AsSQLAdminDatastoreCredentials is the BasicDatastoreCredentials implementation for NoneDatastoreCredentials. +func (ndc NoneDatastoreCredentials) AsSQLAdminDatastoreCredentials() (*SQLAdminDatastoreCredentials, bool) { + return nil, false +} + +// AsDatastoreCredentials is the BasicDatastoreCredentials implementation for NoneDatastoreCredentials. +func (ndc NoneDatastoreCredentials) AsDatastoreCredentials() (*DatastoreCredentials, bool) { + return nil, false +} + +// AsBasicDatastoreCredentials is the BasicDatastoreCredentials implementation for NoneDatastoreCredentials. +func (ndc NoneDatastoreCredentials) AsBasicDatastoreCredentials() (BasicDatastoreCredentials, bool) { + return &ndc, true +} + +// NoneDatastoreSecrets empty/none datastore secret. +type NoneDatastoreSecrets struct { + // SecretsType - Possible values include: 'SecretsTypeDatastoreSecrets', 'SecretsTypeAccountKey1', 'SecretsTypeCertificate1', 'SecretsTypeNone1', 'SecretsTypeSas1', 'SecretsTypeServicePrincipal1', 'SecretsTypeSQLAdmin1' + SecretsType SecretsTypeBasicDatastoreSecrets `json:"secretsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NoneDatastoreSecrets. +func (nds NoneDatastoreSecrets) MarshalJSON() ([]byte, error) { + nds.SecretsType = SecretsTypeNone1 + objectMap := make(map[string]interface{}) + if nds.SecretsType != "" { + objectMap["secretsType"] = nds.SecretsType + } + return json.Marshal(objectMap) +} + +// AsAccountKeyDatastoreSecrets is the BasicDatastoreSecrets implementation for NoneDatastoreSecrets. +func (nds NoneDatastoreSecrets) AsAccountKeyDatastoreSecrets() (*AccountKeyDatastoreSecrets, bool) { + return nil, false +} + +// AsCertificateDatastoreSecrets is the BasicDatastoreSecrets implementation for NoneDatastoreSecrets. +func (nds NoneDatastoreSecrets) AsCertificateDatastoreSecrets() (*CertificateDatastoreSecrets, bool) { + return nil, false +} + +// AsNoneDatastoreSecrets is the BasicDatastoreSecrets implementation for NoneDatastoreSecrets. +func (nds NoneDatastoreSecrets) AsNoneDatastoreSecrets() (*NoneDatastoreSecrets, bool) { + return &nds, true +} + +// AsSasDatastoreSecrets is the BasicDatastoreSecrets implementation for NoneDatastoreSecrets. +func (nds NoneDatastoreSecrets) AsSasDatastoreSecrets() (*SasDatastoreSecrets, bool) { + return nil, false +} + +// AsServicePrincipalDatastoreSecrets is the BasicDatastoreSecrets implementation for NoneDatastoreSecrets. +func (nds NoneDatastoreSecrets) AsServicePrincipalDatastoreSecrets() (*ServicePrincipalDatastoreSecrets, bool) { + return nil, false +} + +// AsSQLAdminDatastoreSecrets is the BasicDatastoreSecrets implementation for NoneDatastoreSecrets. +func (nds NoneDatastoreSecrets) AsSQLAdminDatastoreSecrets() (*SQLAdminDatastoreSecrets, bool) { + return nil, false +} + +// AsDatastoreSecrets is the BasicDatastoreSecrets implementation for NoneDatastoreSecrets. +func (nds NoneDatastoreSecrets) AsDatastoreSecrets() (*DatastoreSecrets, bool) { + return nil, false +} + +// AsBasicDatastoreSecrets is the BasicDatastoreSecrets implementation for NoneDatastoreSecrets. +func (nds NoneDatastoreSecrets) AsBasicDatastoreSecrets() (BasicDatastoreSecrets, bool) { + return &nds, true +} + +// NotebookAccessTokenResult ... +type NotebookAccessTokenResult struct { + autorest.Response `json:"-"` + // NotebookResourceID - READ-ONLY + NotebookResourceID *string `json:"notebookResourceId,omitempty"` + // HostName - READ-ONLY + HostName *string `json:"hostName,omitempty"` + // PublicDNS - READ-ONLY + PublicDNS *string `json:"publicDns,omitempty"` + // AccessToken - READ-ONLY + AccessToken *string `json:"accessToken,omitempty"` + // TokenType - READ-ONLY + TokenType *string `json:"tokenType,omitempty"` + // ExpiresIn - READ-ONLY + ExpiresIn *int32 `json:"expiresIn,omitempty"` + // RefreshToken - READ-ONLY + RefreshToken *string `json:"refreshToken,omitempty"` + // Scope - READ-ONLY + Scope *string `json:"scope,omitempty"` +} + +// MarshalJSON is the custom marshaler for NotebookAccessTokenResult. +func (natr NotebookAccessTokenResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// NotebookPreparationError ... +type NotebookPreparationError struct { + ErrorMessage *string `json:"errorMessage,omitempty"` + StatusCode *int32 `json:"statusCode,omitempty"` +} + +// NotebookResourceInfo ... +type NotebookResourceInfo struct { + autorest.Response `json:"-"` + Fqdn *string `json:"fqdn,omitempty"` + // ResourceID - the data plane resourceId that used to initialize notebook component + ResourceID *string `json:"resourceId,omitempty"` + // NotebookPreparationError - The error that occurs when preparing notebook. + NotebookPreparationError *NotebookPreparationError `json:"notebookPreparationError,omitempty"` +} + +// Objective ... +type Objective struct { + // Goal - Defines supported metric goals for hyperparameter tuning. Possible values include: 'Minimize', 'Maximize' + Goal Goal `json:"goal,omitempty"` + PrimaryMetric *string `json:"primaryMetric,omitempty"` +} + +// BasicOnlineDeployment ... +type BasicOnlineDeployment interface { + AsK8sOnlineDeployment() (*K8sOnlineDeployment, bool) + AsManagedOnlineDeployment() (*ManagedOnlineDeployment, bool) + AsOnlineDeployment() (*OnlineDeployment, bool) +} + +// OnlineDeployment ... +type OnlineDeployment struct { + // AppInsightsEnabled - If true, enables Application Insights logging. + AppInsightsEnabled *bool `json:"appInsightsEnabled,omitempty"` + // CodeConfiguration - Code configuration for the endpoint deployment. + CodeConfiguration *CodeConfiguration `json:"codeConfiguration,omitempty"` + // Description - Description of the endpoint deployment. + Description *string `json:"description,omitempty"` + // EnvironmentID - ARM resource ID of the environment specification for the endpoint deployment. + EnvironmentID *string `json:"environmentId,omitempty"` + // EnvironmentVariables - Environment variables configuration for the deployment. + EnvironmentVariables map[string]*string `json:"environmentVariables"` + LivenessProbe *ProbeSettings `json:"livenessProbe,omitempty"` + // Model - Reference to the model asset for the endpoint deployment. + Model BasicAssetReferenceBase `json:"model,omitempty"` + // Properties - Property dictionary. Properties can be added, but not removed or altered. + Properties map[string]*string `json:"properties"` + // ProvisioningState - READ-ONLY; Provisioning state for the endpoint deployment. Possible values include: 'DeploymentProvisioningStateCreating', 'DeploymentProvisioningStateDeleting', 'DeploymentProvisioningStateScaling', 'DeploymentProvisioningStateUpdating', 'DeploymentProvisioningStateSucceeded', 'DeploymentProvisioningStateFailed', 'DeploymentProvisioningStateCanceled' + ProvisioningState DeploymentProvisioningState `json:"provisioningState,omitempty"` + RequestSettings *OnlineRequestSettings `json:"requestSettings,omitempty"` + ScaleSettings BasicOnlineScaleSettings `json:"scaleSettings,omitempty"` + // EndpointComputeType - Possible values include: 'EndpointComputeTypeOnlineDeployment', 'EndpointComputeTypeK8S', 'EndpointComputeTypeManaged' + EndpointComputeType EndpointComputeTypeBasicOnlineDeployment `json:"endpointComputeType,omitempty"` +} + +func unmarshalBasicOnlineDeployment(body []byte) (BasicOnlineDeployment, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["endpointComputeType"] { + case string(EndpointComputeTypeK8S): + var kod K8sOnlineDeployment + err := json.Unmarshal(body, &kod) + return kod, err + case string(EndpointComputeTypeManaged): + var mod ManagedOnlineDeployment + err := json.Unmarshal(body, &mod) + return mod, err + default: + var od OnlineDeployment + err := json.Unmarshal(body, &od) + return od, err + } +} +func unmarshalBasicOnlineDeploymentArray(body []byte) ([]BasicOnlineDeployment, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + odArray := make([]BasicOnlineDeployment, len(rawMessages)) + + for index, rawMessage := range rawMessages { + od, err := unmarshalBasicOnlineDeployment(*rawMessage) + if err != nil { + return nil, err + } + odArray[index] = od + } + return odArray, nil +} + +// MarshalJSON is the custom marshaler for OnlineDeployment. +func (od OnlineDeployment) MarshalJSON() ([]byte, error) { + od.EndpointComputeType = EndpointComputeTypeOnlineDeployment + objectMap := make(map[string]interface{}) + if od.AppInsightsEnabled != nil { + objectMap["appInsightsEnabled"] = od.AppInsightsEnabled + } + if od.CodeConfiguration != nil { + objectMap["codeConfiguration"] = od.CodeConfiguration + } + if od.Description != nil { + objectMap["description"] = od.Description + } + if od.EnvironmentID != nil { + objectMap["environmentId"] = od.EnvironmentID + } + if od.EnvironmentVariables != nil { + objectMap["environmentVariables"] = od.EnvironmentVariables + } + if od.LivenessProbe != nil { + objectMap["livenessProbe"] = od.LivenessProbe + } + objectMap["model"] = od.Model + if od.Properties != nil { + objectMap["properties"] = od.Properties + } + if od.RequestSettings != nil { + objectMap["requestSettings"] = od.RequestSettings + } + objectMap["scaleSettings"] = od.ScaleSettings + if od.EndpointComputeType != "" { + objectMap["endpointComputeType"] = od.EndpointComputeType + } + return json.Marshal(objectMap) +} + +// AsK8sOnlineDeployment is the BasicOnlineDeployment implementation for OnlineDeployment. +func (od OnlineDeployment) AsK8sOnlineDeployment() (*K8sOnlineDeployment, bool) { + return nil, false +} + +// AsManagedOnlineDeployment is the BasicOnlineDeployment implementation for OnlineDeployment. +func (od OnlineDeployment) AsManagedOnlineDeployment() (*ManagedOnlineDeployment, bool) { + return nil, false +} + +// AsOnlineDeployment is the BasicOnlineDeployment implementation for OnlineDeployment. +func (od OnlineDeployment) AsOnlineDeployment() (*OnlineDeployment, bool) { + return &od, true +} + +// AsBasicOnlineDeployment is the BasicOnlineDeployment implementation for OnlineDeployment. +func (od OnlineDeployment) AsBasicOnlineDeployment() (BasicOnlineDeployment, bool) { + return &od, true +} + +// UnmarshalJSON is the custom unmarshaler for OnlineDeployment struct. +func (od *OnlineDeployment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "appInsightsEnabled": + if v != nil { + var appInsightsEnabled bool + err = json.Unmarshal(*v, &appInsightsEnabled) + if err != nil { + return err + } + od.AppInsightsEnabled = &appInsightsEnabled + } + case "codeConfiguration": + if v != nil { + var codeConfiguration CodeConfiguration + err = json.Unmarshal(*v, &codeConfiguration) + if err != nil { + return err + } + od.CodeConfiguration = &codeConfiguration + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + od.Description = &description + } + case "environmentId": + if v != nil { + var environmentID string + err = json.Unmarshal(*v, &environmentID) + if err != nil { + return err + } + od.EnvironmentID = &environmentID + } + case "environmentVariables": + if v != nil { + var environmentVariables map[string]*string + err = json.Unmarshal(*v, &environmentVariables) + if err != nil { + return err + } + od.EnvironmentVariables = environmentVariables + } + case "livenessProbe": + if v != nil { + var livenessProbe ProbeSettings + err = json.Unmarshal(*v, &livenessProbe) + if err != nil { + return err + } + od.LivenessProbe = &livenessProbe + } + case "model": + if v != nil { + model, err := unmarshalBasicAssetReferenceBase(*v) + if err != nil { + return err + } + od.Model = model + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + od.Properties = properties + } + case "provisioningState": + if v != nil { + var provisioningState DeploymentProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + od.ProvisioningState = provisioningState + } + case "requestSettings": + if v != nil { + var requestSettings OnlineRequestSettings + err = json.Unmarshal(*v, &requestSettings) + if err != nil { + return err + } + od.RequestSettings = &requestSettings + } + case "scaleSettings": + if v != nil { + scaleSettings, err := unmarshalBasicOnlineScaleSettings(*v) + if err != nil { + return err + } + od.ScaleSettings = scaleSettings + } + case "endpointComputeType": + if v != nil { + var endpointComputeType EndpointComputeTypeBasicOnlineDeployment + err = json.Unmarshal(*v, &endpointComputeType) + if err != nil { + return err + } + od.EndpointComputeType = endpointComputeType + } + } + } + + return nil +} + +// OnlineDeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type OnlineDeploymentsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OnlineDeploymentsClient) (OnlineDeploymentTrackedResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OnlineDeploymentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OnlineDeploymentsCreateOrUpdateFuture.Result. +func (future *OnlineDeploymentsCreateOrUpdateFuture) result(client OnlineDeploymentsClient) (odtr OnlineDeploymentTrackedResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + odtr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.OnlineDeploymentsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if odtr.Response.Response, err = future.GetResult(sender); err == nil && odtr.Response.Response.StatusCode != http.StatusNoContent { + odtr, err = client.CreateOrUpdateResponder(odtr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsCreateOrUpdateFuture", "Result", odtr.Response.Response, "Failure responding to request") + } + } + return +} + +// OnlineDeploymentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OnlineDeploymentsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OnlineDeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OnlineDeploymentsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OnlineDeploymentsDeleteFuture.Result. +func (future *OnlineDeploymentsDeleteFuture) result(client OnlineDeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.OnlineDeploymentsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// OnlineDeploymentsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OnlineDeploymentsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OnlineDeploymentsClient) (OnlineDeploymentTrackedResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OnlineDeploymentsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OnlineDeploymentsUpdateFuture.Result. +func (future *OnlineDeploymentsUpdateFuture) result(client OnlineDeploymentsClient) (odtr OnlineDeploymentTrackedResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + odtr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.OnlineDeploymentsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if odtr.Response.Response, err = future.GetResult(sender); err == nil && odtr.Response.Response.StatusCode != http.StatusNoContent { + odtr, err = client.UpdateResponder(odtr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsUpdateFuture", "Result", odtr.Response.Response, "Failure responding to request") + } + } + return +} + +// OnlineDeploymentTrackedResource ... +type OnlineDeploymentTrackedResource struct { + autorest.Response `json:"-"` + // Identity - Service identity associated with a resource. + Identity *ResourceIdentity `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + // Properties - Additional attributes of the entity. + Properties BasicOnlineDeployment `json:"properties,omitempty"` + // SystemData - READ-ONLY; System data associated with resource provider + SystemData *SystemData `json:"systemData,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for OnlineDeploymentTrackedResource. +func (odtr OnlineDeploymentTrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if odtr.Identity != nil { + objectMap["identity"] = odtr.Identity + } + if odtr.Kind != nil { + objectMap["kind"] = odtr.Kind + } + objectMap["properties"] = odtr.Properties + if odtr.Tags != nil { + objectMap["tags"] = odtr.Tags + } + if odtr.Location != nil { + objectMap["location"] = odtr.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OnlineDeploymentTrackedResource struct. +func (odtr *OnlineDeploymentTrackedResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "identity": + if v != nil { + var identity ResourceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + odtr.Identity = &identity + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + odtr.Kind = &kind + } + case "properties": + if v != nil { + properties, err := unmarshalBasicOnlineDeployment(*v) + if err != nil { + return err + } + odtr.Properties = properties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + odtr.SystemData = &systemData + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + odtr.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + odtr.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + odtr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + odtr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + odtr.Type = &typeVar + } + } + } + + return nil +} + +// OnlineDeploymentTrackedResourceArmPaginatedResult a paginated list of OnlineDeployment entities. +type OnlineDeploymentTrackedResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type OnlineDeployment. + Value *[]OnlineDeploymentTrackedResource `json:"value,omitempty"` +} + +// OnlineDeploymentTrackedResourceArmPaginatedResultIterator provides access to a complete listing of +// OnlineDeploymentTrackedResource values. +type OnlineDeploymentTrackedResourceArmPaginatedResultIterator struct { + i int + page OnlineDeploymentTrackedResourceArmPaginatedResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OnlineDeploymentTrackedResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineDeploymentTrackedResourceArmPaginatedResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OnlineDeploymentTrackedResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OnlineDeploymentTrackedResourceArmPaginatedResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OnlineDeploymentTrackedResourceArmPaginatedResultIterator) Response() OnlineDeploymentTrackedResourceArmPaginatedResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OnlineDeploymentTrackedResourceArmPaginatedResultIterator) Value() OnlineDeploymentTrackedResource { + if !iter.page.NotDone() { + return OnlineDeploymentTrackedResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OnlineDeploymentTrackedResourceArmPaginatedResultIterator type. +func NewOnlineDeploymentTrackedResourceArmPaginatedResultIterator(page OnlineDeploymentTrackedResourceArmPaginatedResultPage) OnlineDeploymentTrackedResourceArmPaginatedResultIterator { + return OnlineDeploymentTrackedResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (odtrapr OnlineDeploymentTrackedResourceArmPaginatedResult) IsEmpty() bool { + return odtrapr.Value == nil || len(*odtrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (odtrapr OnlineDeploymentTrackedResourceArmPaginatedResult) hasNextLink() bool { + return odtrapr.NextLink != nil && len(*odtrapr.NextLink) != 0 +} + +// onlineDeploymentTrackedResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (odtrapr OnlineDeploymentTrackedResourceArmPaginatedResult) onlineDeploymentTrackedResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !odtrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(odtrapr.NextLink))) +} + +// OnlineDeploymentTrackedResourceArmPaginatedResultPage contains a page of OnlineDeploymentTrackedResource +// values. +type OnlineDeploymentTrackedResourceArmPaginatedResultPage struct { + fn func(context.Context, OnlineDeploymentTrackedResourceArmPaginatedResult) (OnlineDeploymentTrackedResourceArmPaginatedResult, error) + odtrapr OnlineDeploymentTrackedResourceArmPaginatedResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OnlineDeploymentTrackedResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineDeploymentTrackedResourceArmPaginatedResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.odtrapr) + if err != nil { + return err + } + page.odtrapr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OnlineDeploymentTrackedResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OnlineDeploymentTrackedResourceArmPaginatedResultPage) NotDone() bool { + return !page.odtrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OnlineDeploymentTrackedResourceArmPaginatedResultPage) Response() OnlineDeploymentTrackedResourceArmPaginatedResult { + return page.odtrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OnlineDeploymentTrackedResourceArmPaginatedResultPage) Values() []OnlineDeploymentTrackedResource { + if page.odtrapr.IsEmpty() { + return nil + } + return *page.odtrapr.Value +} + +// Creates a new instance of the OnlineDeploymentTrackedResourceArmPaginatedResultPage type. +func NewOnlineDeploymentTrackedResourceArmPaginatedResultPage(cur OnlineDeploymentTrackedResourceArmPaginatedResult, getNextPage func(context.Context, OnlineDeploymentTrackedResourceArmPaginatedResult) (OnlineDeploymentTrackedResourceArmPaginatedResult, error)) OnlineDeploymentTrackedResourceArmPaginatedResultPage { + return OnlineDeploymentTrackedResourceArmPaginatedResultPage{ + fn: getNextPage, + odtrapr: cur, + } +} + +// OnlineEndpoint online endpoint configuration +type OnlineEndpoint struct { + // AuthMode - Inference endpoint authentication mode type. Possible values include: 'AMLToken', 'Key', 'AADToken' + AuthMode EndpointAuthMode `json:"authMode,omitempty"` + // Description - Description of the inference endpoint. + Description *string `json:"description,omitempty"` + // Keys - EndpointAuthKeys to set initially on an Endpoint. + // This property will always be returned as null. AuthKey values must be retrieved using the ListKeys API. + Keys *EndpointAuthKeys `json:"keys,omitempty"` + // Properties - Property dictionary. Properties can be added, but not removed or altered. + Properties map[string]*string `json:"properties"` + // ProvisioningState - READ-ONLY; State of endpoint provisioning. Possible values include: 'EndpointProvisioningStateCreating', 'EndpointProvisioningStateDeleting', 'EndpointProvisioningStateSucceeded', 'EndpointProvisioningStateFailed', 'EndpointProvisioningStateUpdating', 'EndpointProvisioningStateCanceled' + ProvisioningState EndpointProvisioningState `json:"provisioningState,omitempty"` + // ScoringURI - READ-ONLY; Endpoint URI. + ScoringURI *string `json:"scoringUri,omitempty"` + // SwaggerURI - READ-ONLY; Endpoint Swagger URI. + SwaggerURI *string `json:"swaggerUri,omitempty"` + // Target - ARM resource ID of the compute if it exists. + // optional + Target *string `json:"target,omitempty"` + // Traffic - Traffic rules on how the traffic will be routed across deployments. + Traffic map[string]*int32 `json:"traffic"` +} + +// MarshalJSON is the custom marshaler for OnlineEndpoint. +func (oe OnlineEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oe.AuthMode != "" { + objectMap["authMode"] = oe.AuthMode + } + if oe.Description != nil { + objectMap["description"] = oe.Description + } + if oe.Keys != nil { + objectMap["keys"] = oe.Keys + } + if oe.Properties != nil { + objectMap["properties"] = oe.Properties + } + if oe.Target != nil { + objectMap["target"] = oe.Target + } + if oe.Traffic != nil { + objectMap["traffic"] = oe.Traffic + } + return json.Marshal(objectMap) +} + +// OnlineEndpointsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type OnlineEndpointsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OnlineEndpointsClient) (OnlineEndpointTrackedResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OnlineEndpointsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OnlineEndpointsCreateOrUpdateFuture.Result. +func (future *OnlineEndpointsCreateOrUpdateFuture) result(client OnlineEndpointsClient) (oetr OnlineEndpointTrackedResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + oetr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.OnlineEndpointsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if oetr.Response.Response, err = future.GetResult(sender); err == nil && oetr.Response.Response.StatusCode != http.StatusNoContent { + oetr, err = client.CreateOrUpdateResponder(oetr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsCreateOrUpdateFuture", "Result", oetr.Response.Response, "Failure responding to request") + } + } + return +} + +// OnlineEndpointsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OnlineEndpointsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OnlineEndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OnlineEndpointsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OnlineEndpointsDeleteFuture.Result. +func (future *OnlineEndpointsDeleteFuture) result(client OnlineEndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.OnlineEndpointsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// OnlineEndpointsRegenerateKeysFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type OnlineEndpointsRegenerateKeysFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OnlineEndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OnlineEndpointsRegenerateKeysFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OnlineEndpointsRegenerateKeysFuture.Result. +func (future *OnlineEndpointsRegenerateKeysFuture) result(client OnlineEndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsRegenerateKeysFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.OnlineEndpointsRegenerateKeysFuture") + return + } + ar.Response = future.Response() + return +} + +// OnlineEndpointsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OnlineEndpointsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OnlineEndpointsClient) (OnlineEndpointTrackedResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OnlineEndpointsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OnlineEndpointsUpdateFuture.Result. +func (future *OnlineEndpointsUpdateFuture) result(client OnlineEndpointsClient) (oetr OnlineEndpointTrackedResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + oetr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.OnlineEndpointsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if oetr.Response.Response, err = future.GetResult(sender); err == nil && oetr.Response.Response.StatusCode != http.StatusNoContent { + oetr, err = client.UpdateResponder(oetr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsUpdateFuture", "Result", oetr.Response.Response, "Failure responding to request") + } + } + return +} + +// OnlineEndpointTrackedResource ... +type OnlineEndpointTrackedResource struct { + autorest.Response `json:"-"` + // Identity - Service identity associated with a resource. + Identity *ResourceIdentity `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + // Properties - Additional attributes of the entity. + Properties *OnlineEndpoint `json:"properties,omitempty"` + // SystemData - READ-ONLY; System data associated with resource provider + SystemData *SystemData `json:"systemData,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for OnlineEndpointTrackedResource. +func (oetr OnlineEndpointTrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oetr.Identity != nil { + objectMap["identity"] = oetr.Identity + } + if oetr.Kind != nil { + objectMap["kind"] = oetr.Kind + } + if oetr.Properties != nil { + objectMap["properties"] = oetr.Properties + } + if oetr.Tags != nil { + objectMap["tags"] = oetr.Tags + } + if oetr.Location != nil { + objectMap["location"] = oetr.Location + } + return json.Marshal(objectMap) +} + +// OnlineEndpointTrackedResourceArmPaginatedResult a paginated list of OnlineEndpoint entities. +type OnlineEndpointTrackedResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type OnlineEndpoint. + Value *[]OnlineEndpointTrackedResource `json:"value,omitempty"` +} + +// OnlineEndpointTrackedResourceArmPaginatedResultIterator provides access to a complete listing of +// OnlineEndpointTrackedResource values. +type OnlineEndpointTrackedResourceArmPaginatedResultIterator struct { + i int + page OnlineEndpointTrackedResourceArmPaginatedResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OnlineEndpointTrackedResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineEndpointTrackedResourceArmPaginatedResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OnlineEndpointTrackedResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OnlineEndpointTrackedResourceArmPaginatedResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OnlineEndpointTrackedResourceArmPaginatedResultIterator) Response() OnlineEndpointTrackedResourceArmPaginatedResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OnlineEndpointTrackedResourceArmPaginatedResultIterator) Value() OnlineEndpointTrackedResource { + if !iter.page.NotDone() { + return OnlineEndpointTrackedResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OnlineEndpointTrackedResourceArmPaginatedResultIterator type. +func NewOnlineEndpointTrackedResourceArmPaginatedResultIterator(page OnlineEndpointTrackedResourceArmPaginatedResultPage) OnlineEndpointTrackedResourceArmPaginatedResultIterator { + return OnlineEndpointTrackedResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (oetrapr OnlineEndpointTrackedResourceArmPaginatedResult) IsEmpty() bool { + return oetrapr.Value == nil || len(*oetrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (oetrapr OnlineEndpointTrackedResourceArmPaginatedResult) hasNextLink() bool { + return oetrapr.NextLink != nil && len(*oetrapr.NextLink) != 0 +} + +// onlineEndpointTrackedResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (oetrapr OnlineEndpointTrackedResourceArmPaginatedResult) onlineEndpointTrackedResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !oetrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(oetrapr.NextLink))) +} + +// OnlineEndpointTrackedResourceArmPaginatedResultPage contains a page of OnlineEndpointTrackedResource +// values. +type OnlineEndpointTrackedResourceArmPaginatedResultPage struct { + fn func(context.Context, OnlineEndpointTrackedResourceArmPaginatedResult) (OnlineEndpointTrackedResourceArmPaginatedResult, error) + oetrapr OnlineEndpointTrackedResourceArmPaginatedResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OnlineEndpointTrackedResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineEndpointTrackedResourceArmPaginatedResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.oetrapr) + if err != nil { + return err + } + page.oetrapr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OnlineEndpointTrackedResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OnlineEndpointTrackedResourceArmPaginatedResultPage) NotDone() bool { + return !page.oetrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OnlineEndpointTrackedResourceArmPaginatedResultPage) Response() OnlineEndpointTrackedResourceArmPaginatedResult { + return page.oetrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OnlineEndpointTrackedResourceArmPaginatedResultPage) Values() []OnlineEndpointTrackedResource { + if page.oetrapr.IsEmpty() { + return nil + } + return *page.oetrapr.Value +} + +// Creates a new instance of the OnlineEndpointTrackedResourceArmPaginatedResultPage type. +func NewOnlineEndpointTrackedResourceArmPaginatedResultPage(cur OnlineEndpointTrackedResourceArmPaginatedResult, getNextPage func(context.Context, OnlineEndpointTrackedResourceArmPaginatedResult) (OnlineEndpointTrackedResourceArmPaginatedResult, error)) OnlineEndpointTrackedResourceArmPaginatedResultPage { + return OnlineEndpointTrackedResourceArmPaginatedResultPage{ + fn: getNextPage, + oetrapr: cur, + } +} + +// OnlineRequestSettings ... +type OnlineRequestSettings struct { + MaxConcurrentRequestsPerInstance *int32 `json:"maxConcurrentRequestsPerInstance,omitempty"` + // MaxQueueWait - The maximum queue wait time in ISO 8601 format. Supports millisecond precision. + MaxQueueWait *string `json:"maxQueueWait,omitempty"` + // RequestTimeout - The request timeout in ISO 8601 format. Supports millisecond precision. + RequestTimeout *string `json:"requestTimeout,omitempty"` +} + +// BasicOnlineScaleSettings ... +type BasicOnlineScaleSettings interface { + AsAutoScaleSettings() (*AutoScaleSettings, bool) + AsManualScaleSettings() (*ManualScaleSettings, bool) + AsOnlineScaleSettings() (*OnlineScaleSettings, bool) +} + +// OnlineScaleSettings ... +type OnlineScaleSettings struct { + MaxInstances *int32 `json:"maxInstances,omitempty"` + MinInstances *int32 `json:"minInstances,omitempty"` + // ScaleType - Possible values include: 'ScaleTypeOnlineScaleSettings', 'ScaleTypeAuto', 'ScaleTypeManual' + ScaleType ScaleTypeBasicOnlineScaleSettings `json:"scaleType,omitempty"` +} + +func unmarshalBasicOnlineScaleSettings(body []byte) (BasicOnlineScaleSettings, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["scaleType"] { + case string(ScaleTypeAuto): + var ass AutoScaleSettings + err := json.Unmarshal(body, &ass) + return ass, err + case string(ScaleTypeManual): + var mss ManualScaleSettings + err := json.Unmarshal(body, &mss) + return mss, err + default: + var oss OnlineScaleSettings + err := json.Unmarshal(body, &oss) + return oss, err + } +} +func unmarshalBasicOnlineScaleSettingsArray(body []byte) ([]BasicOnlineScaleSettings, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + ossArray := make([]BasicOnlineScaleSettings, len(rawMessages)) + + for index, rawMessage := range rawMessages { + oss, err := unmarshalBasicOnlineScaleSettings(*rawMessage) + if err != nil { + return nil, err + } + ossArray[index] = oss + } + return ossArray, nil +} + +// MarshalJSON is the custom marshaler for OnlineScaleSettings. +func (oss OnlineScaleSettings) MarshalJSON() ([]byte, error) { + oss.ScaleType = ScaleTypeOnlineScaleSettings + objectMap := make(map[string]interface{}) + if oss.MaxInstances != nil { + objectMap["maxInstances"] = oss.MaxInstances + } + if oss.MinInstances != nil { + objectMap["minInstances"] = oss.MinInstances + } + if oss.ScaleType != "" { + objectMap["scaleType"] = oss.ScaleType + } + return json.Marshal(objectMap) +} + +// AsAutoScaleSettings is the BasicOnlineScaleSettings implementation for OnlineScaleSettings. +func (oss OnlineScaleSettings) AsAutoScaleSettings() (*AutoScaleSettings, bool) { + return nil, false +} + +// AsManualScaleSettings is the BasicOnlineScaleSettings implementation for OnlineScaleSettings. +func (oss OnlineScaleSettings) AsManualScaleSettings() (*ManualScaleSettings, bool) { + return nil, false +} + +// AsOnlineScaleSettings is the BasicOnlineScaleSettings implementation for OnlineScaleSettings. +func (oss OnlineScaleSettings) AsOnlineScaleSettings() (*OnlineScaleSettings, bool) { + return &oss, true +} + +// AsBasicOnlineScaleSettings is the BasicOnlineScaleSettings implementation for OnlineScaleSettings. +func (oss OnlineScaleSettings) AsBasicOnlineScaleSettings() (BasicOnlineScaleSettings, bool) { + return &oss, true +} + +// Operation azure Machine Learning workspace REST API operation +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display name of operation + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay display name of operation +type OperationDisplay struct { + // Provider - The resource provider name: Microsoft.MachineLearningExperimentation + Provider *string `json:"provider,omitempty"` + // Resource - The resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - The operation that users can perform. + Operation *string `json:"operation,omitempty"` + // Description - The description for the operation. + Description *string `json:"description,omitempty"` +} + +// OperationListResult an array of operations supported by the resource provider. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - List of AML workspace operations supported by the AML workspace resource provider. + Value *[]Operation `json:"value,omitempty"` +} + +// OutputDataBinding ... +type OutputDataBinding struct { + // DatastoreID - ARM resource ID of the datastore where the data output will be stored. + DatastoreID *string `json:"datastoreId,omitempty"` + // Mode - Mechanism for data movement to datastore. Possible values include: 'Mount', 'Download', 'Upload' + Mode DataBindingMode `json:"mode,omitempty"` + // PathOnCompute - Location of data inside the container process. + PathOnCompute *string `json:"pathOnCompute,omitempty"` + // PathOnDatastore - Path within the datastore to the data. + PathOnDatastore *string `json:"pathOnDatastore,omitempty"` +} + +// OutputPathAssetReference reference to an asset via its path in a job output. +type OutputPathAssetReference struct { + // JobID - ARM resource ID of the job. + JobID *string `json:"jobId,omitempty"` + // Path - The path of the file/directory in the job output. + Path *string `json:"path,omitempty"` + // ReferenceType - Possible values include: 'ReferenceTypeAssetReferenceBase', 'ReferenceTypeDataPath', 'ReferenceTypeID', 'ReferenceTypeOutputPath' + ReferenceType ReferenceTypeBasicAssetReferenceBase `json:"referenceType,omitempty"` +} + +// MarshalJSON is the custom marshaler for OutputPathAssetReference. +func (opar OutputPathAssetReference) MarshalJSON() ([]byte, error) { + opar.ReferenceType = ReferenceTypeOutputPath + objectMap := make(map[string]interface{}) + if opar.JobID != nil { + objectMap["jobId"] = opar.JobID + } + if opar.Path != nil { + objectMap["path"] = opar.Path + } + if opar.ReferenceType != "" { + objectMap["referenceType"] = opar.ReferenceType + } + return json.Marshal(objectMap) +} + +// AsDataPathAssetReference is the BasicAssetReferenceBase implementation for OutputPathAssetReference. +func (opar OutputPathAssetReference) AsDataPathAssetReference() (*DataPathAssetReference, bool) { + return nil, false +} + +// AsIDAssetReference is the BasicAssetReferenceBase implementation for OutputPathAssetReference. +func (opar OutputPathAssetReference) AsIDAssetReference() (*IDAssetReference, bool) { + return nil, false +} + +// AsOutputPathAssetReference is the BasicAssetReferenceBase implementation for OutputPathAssetReference. +func (opar OutputPathAssetReference) AsOutputPathAssetReference() (*OutputPathAssetReference, bool) { + return &opar, true +} + +// AsAssetReferenceBase is the BasicAssetReferenceBase implementation for OutputPathAssetReference. +func (opar OutputPathAssetReference) AsAssetReferenceBase() (*AssetReferenceBase, bool) { + return nil, false +} + +// AsBasicAssetReferenceBase is the BasicAssetReferenceBase implementation for OutputPathAssetReference. +func (opar OutputPathAssetReference) AsBasicAssetReferenceBase() (BasicAssetReferenceBase, bool) { + return &opar, true +} + +// PaginatedComputeResourcesList paginated list of Machine Learning compute objects wrapped in ARM resource +// envelope. +type PaginatedComputeResourcesList struct { + autorest.Response `json:"-"` + // Value - An array of Machine Learning compute objects wrapped in ARM resource envelope. + Value *[]ComputeResource `json:"value,omitempty"` + // NextLink - A continuation link (absolute URI) to the next page of results in the list. + NextLink *string `json:"nextLink,omitempty"` +} + +// PaginatedComputeResourcesListIterator provides access to a complete listing of ComputeResource values. +type PaginatedComputeResourcesListIterator struct { + i int + page PaginatedComputeResourcesListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PaginatedComputeResourcesListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PaginatedComputeResourcesListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PaginatedComputeResourcesListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PaginatedComputeResourcesListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PaginatedComputeResourcesListIterator) Response() PaginatedComputeResourcesList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PaginatedComputeResourcesListIterator) Value() ComputeResource { + if !iter.page.NotDone() { + return ComputeResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PaginatedComputeResourcesListIterator type. +func NewPaginatedComputeResourcesListIterator(page PaginatedComputeResourcesListPage) PaginatedComputeResourcesListIterator { + return PaginatedComputeResourcesListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pcrl PaginatedComputeResourcesList) IsEmpty() bool { + return pcrl.Value == nil || len(*pcrl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pcrl PaginatedComputeResourcesList) hasNextLink() bool { + return pcrl.NextLink != nil && len(*pcrl.NextLink) != 0 +} + +// paginatedComputeResourcesListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pcrl PaginatedComputeResourcesList) paginatedComputeResourcesListPreparer(ctx context.Context) (*http.Request, error) { + if !pcrl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pcrl.NextLink))) +} + +// PaginatedComputeResourcesListPage contains a page of ComputeResource values. +type PaginatedComputeResourcesListPage struct { + fn func(context.Context, PaginatedComputeResourcesList) (PaginatedComputeResourcesList, error) + pcrl PaginatedComputeResourcesList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PaginatedComputeResourcesListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PaginatedComputeResourcesListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pcrl) + if err != nil { + return err + } + page.pcrl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PaginatedComputeResourcesListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PaginatedComputeResourcesListPage) NotDone() bool { + return !page.pcrl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PaginatedComputeResourcesListPage) Response() PaginatedComputeResourcesList { + return page.pcrl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PaginatedComputeResourcesListPage) Values() []ComputeResource { + if page.pcrl.IsEmpty() { + return nil + } + return *page.pcrl.Value +} + +// Creates a new instance of the PaginatedComputeResourcesListPage type. +func NewPaginatedComputeResourcesListPage(cur PaginatedComputeResourcesList, getNextPage func(context.Context, PaginatedComputeResourcesList) (PaginatedComputeResourcesList, error)) PaginatedComputeResourcesListPage { + return PaginatedComputeResourcesListPage{ + fn: getNextPage, + pcrl: cur, + } +} + +// PaginatedWorkspaceConnectionsList paginated list of Workspace connection objects. +type PaginatedWorkspaceConnectionsList struct { + autorest.Response `json:"-"` + // Value - An array of Workspace connection objects. + Value *[]WorkspaceConnection `json:"value,omitempty"` + // NextLink - A continuation link (absolute URI) to the next page of results in the list. + NextLink *string `json:"nextLink,omitempty"` +} + +// PartialAksOnlineDeployment ... +type PartialAksOnlineDeployment struct { + ContainerResourceRequirements *ContainerResourceRequirements `json:"containerResourceRequirements,omitempty"` + AppInsightsEnabled *bool `json:"appInsightsEnabled,omitempty"` + LivenessProbe *ProbeSettings `json:"livenessProbe,omitempty"` + RequestSettings *OnlineRequestSettings `json:"requestSettings,omitempty"` + ScaleSettings BasicOnlineScaleSettings `json:"scaleSettings,omitempty"` + // EndpointComputeType - Possible values include: 'EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypePartialOnlineDeployment', 'EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeK8S', 'EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeManaged' + EndpointComputeType EndpointComputeTypeBasicPartialOnlineDeployment `json:"endpointComputeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for PartialAksOnlineDeployment. +func (paod PartialAksOnlineDeployment) MarshalJSON() ([]byte, error) { + paod.EndpointComputeType = EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeK8S + objectMap := make(map[string]interface{}) + if paod.ContainerResourceRequirements != nil { + objectMap["containerResourceRequirements"] = paod.ContainerResourceRequirements + } + if paod.AppInsightsEnabled != nil { + objectMap["appInsightsEnabled"] = paod.AppInsightsEnabled + } + if paod.LivenessProbe != nil { + objectMap["livenessProbe"] = paod.LivenessProbe + } + if paod.RequestSettings != nil { + objectMap["requestSettings"] = paod.RequestSettings + } + objectMap["scaleSettings"] = paod.ScaleSettings + if paod.EndpointComputeType != "" { + objectMap["endpointComputeType"] = paod.EndpointComputeType + } + return json.Marshal(objectMap) +} + +// AsPartialAksOnlineDeployment is the BasicPartialOnlineDeployment implementation for PartialAksOnlineDeployment. +func (paod PartialAksOnlineDeployment) AsPartialAksOnlineDeployment() (*PartialAksOnlineDeployment, bool) { + return &paod, true +} + +// AsPartialManagedOnlineDeployment is the BasicPartialOnlineDeployment implementation for PartialAksOnlineDeployment. +func (paod PartialAksOnlineDeployment) AsPartialManagedOnlineDeployment() (*PartialManagedOnlineDeployment, bool) { + return nil, false +} + +// AsPartialOnlineDeployment is the BasicPartialOnlineDeployment implementation for PartialAksOnlineDeployment. +func (paod PartialAksOnlineDeployment) AsPartialOnlineDeployment() (*PartialOnlineDeployment, bool) { + return nil, false +} + +// AsBasicPartialOnlineDeployment is the BasicPartialOnlineDeployment implementation for PartialAksOnlineDeployment. +func (paod PartialAksOnlineDeployment) AsBasicPartialOnlineDeployment() (BasicPartialOnlineDeployment, bool) { + return &paod, true +} + +// UnmarshalJSON is the custom unmarshaler for PartialAksOnlineDeployment struct. +func (paod *PartialAksOnlineDeployment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "containerResourceRequirements": + if v != nil { + var containerResourceRequirements ContainerResourceRequirements + err = json.Unmarshal(*v, &containerResourceRequirements) + if err != nil { + return err + } + paod.ContainerResourceRequirements = &containerResourceRequirements + } + case "appInsightsEnabled": + if v != nil { + var appInsightsEnabled bool + err = json.Unmarshal(*v, &appInsightsEnabled) + if err != nil { + return err + } + paod.AppInsightsEnabled = &appInsightsEnabled + } + case "livenessProbe": + if v != nil { + var livenessProbe ProbeSettings + err = json.Unmarshal(*v, &livenessProbe) + if err != nil { + return err + } + paod.LivenessProbe = &livenessProbe + } + case "requestSettings": + if v != nil { + var requestSettings OnlineRequestSettings + err = json.Unmarshal(*v, &requestSettings) + if err != nil { + return err + } + paod.RequestSettings = &requestSettings + } + case "scaleSettings": + if v != nil { + scaleSettings, err := unmarshalBasicOnlineScaleSettings(*v) + if err != nil { + return err + } + paod.ScaleSettings = scaleSettings + } + case "endpointComputeType": + if v != nil { + var endpointComputeType EndpointComputeTypeBasicPartialOnlineDeployment + err = json.Unmarshal(*v, &endpointComputeType) + if err != nil { + return err + } + paod.EndpointComputeType = endpointComputeType + } + } + } + + return nil +} + +// PartialBatchDeployment mutable batch inference settings per deployment. +type PartialBatchDeployment struct { + // Description - Description of the endpoint deployment. + Description *string `json:"description,omitempty"` +} + +// PartialBatchDeploymentPartialTrackedResource strictly used in update requests. +type PartialBatchDeploymentPartialTrackedResource struct { + // Identity - Service identity associated with a resource. + Identity *ResourceIdentity `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + // Properties - Additional attributes of the entity. + Properties *PartialBatchDeployment `json:"properties,omitempty"` + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PartialBatchDeploymentPartialTrackedResource. +func (pbdptr PartialBatchDeploymentPartialTrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pbdptr.Identity != nil { + objectMap["identity"] = pbdptr.Identity + } + if pbdptr.Kind != nil { + objectMap["kind"] = pbdptr.Kind + } + if pbdptr.Location != nil { + objectMap["location"] = pbdptr.Location + } + if pbdptr.Properties != nil { + objectMap["properties"] = pbdptr.Properties + } + if pbdptr.Tags != nil { + objectMap["tags"] = pbdptr.Tags + } + return json.Marshal(objectMap) +} + +// PartialBatchEndpoint mutable Batch endpoint configuration +type PartialBatchEndpoint struct { + // Traffic - Traffic rules on how the traffic will be routed across deployments. + Traffic map[string]*int32 `json:"traffic"` +} + +// MarshalJSON is the custom marshaler for PartialBatchEndpoint. +func (pbe PartialBatchEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pbe.Traffic != nil { + objectMap["traffic"] = pbe.Traffic + } + return json.Marshal(objectMap) +} + +// PartialBatchEndpointPartialTrackedResource strictly used in update requests. +type PartialBatchEndpointPartialTrackedResource struct { + // Identity - Service identity associated with a resource. + Identity *ResourceIdentity `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + // Properties - Additional attributes of the entity. + Properties *PartialBatchEndpoint `json:"properties,omitempty"` + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PartialBatchEndpointPartialTrackedResource. +func (pbeptr PartialBatchEndpointPartialTrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pbeptr.Identity != nil { + objectMap["identity"] = pbeptr.Identity + } + if pbeptr.Kind != nil { + objectMap["kind"] = pbeptr.Kind + } + if pbeptr.Location != nil { + objectMap["location"] = pbeptr.Location + } + if pbeptr.Properties != nil { + objectMap["properties"] = pbeptr.Properties + } + if pbeptr.Tags != nil { + objectMap["tags"] = pbeptr.Tags + } + return json.Marshal(objectMap) +} + +// PartialManagedOnlineDeployment ... +type PartialManagedOnlineDeployment struct { + ReadinessProbe *ProbeSettings `json:"readinessProbe,omitempty"` + AppInsightsEnabled *bool `json:"appInsightsEnabled,omitempty"` + LivenessProbe *ProbeSettings `json:"livenessProbe,omitempty"` + RequestSettings *OnlineRequestSettings `json:"requestSettings,omitempty"` + ScaleSettings BasicOnlineScaleSettings `json:"scaleSettings,omitempty"` + // EndpointComputeType - Possible values include: 'EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypePartialOnlineDeployment', 'EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeK8S', 'EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeManaged' + EndpointComputeType EndpointComputeTypeBasicPartialOnlineDeployment `json:"endpointComputeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for PartialManagedOnlineDeployment. +func (pmod PartialManagedOnlineDeployment) MarshalJSON() ([]byte, error) { + pmod.EndpointComputeType = EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeManaged + objectMap := make(map[string]interface{}) + if pmod.ReadinessProbe != nil { + objectMap["readinessProbe"] = pmod.ReadinessProbe + } + if pmod.AppInsightsEnabled != nil { + objectMap["appInsightsEnabled"] = pmod.AppInsightsEnabled + } + if pmod.LivenessProbe != nil { + objectMap["livenessProbe"] = pmod.LivenessProbe + } + if pmod.RequestSettings != nil { + objectMap["requestSettings"] = pmod.RequestSettings + } + objectMap["scaleSettings"] = pmod.ScaleSettings + if pmod.EndpointComputeType != "" { + objectMap["endpointComputeType"] = pmod.EndpointComputeType + } + return json.Marshal(objectMap) +} + +// AsPartialAksOnlineDeployment is the BasicPartialOnlineDeployment implementation for PartialManagedOnlineDeployment. +func (pmod PartialManagedOnlineDeployment) AsPartialAksOnlineDeployment() (*PartialAksOnlineDeployment, bool) { + return nil, false +} + +// AsPartialManagedOnlineDeployment is the BasicPartialOnlineDeployment implementation for PartialManagedOnlineDeployment. +func (pmod PartialManagedOnlineDeployment) AsPartialManagedOnlineDeployment() (*PartialManagedOnlineDeployment, bool) { + return &pmod, true +} + +// AsPartialOnlineDeployment is the BasicPartialOnlineDeployment implementation for PartialManagedOnlineDeployment. +func (pmod PartialManagedOnlineDeployment) AsPartialOnlineDeployment() (*PartialOnlineDeployment, bool) { + return nil, false +} + +// AsBasicPartialOnlineDeployment is the BasicPartialOnlineDeployment implementation for PartialManagedOnlineDeployment. +func (pmod PartialManagedOnlineDeployment) AsBasicPartialOnlineDeployment() (BasicPartialOnlineDeployment, bool) { + return &pmod, true +} + +// UnmarshalJSON is the custom unmarshaler for PartialManagedOnlineDeployment struct. +func (pmod *PartialManagedOnlineDeployment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "readinessProbe": + if v != nil { + var readinessProbe ProbeSettings + err = json.Unmarshal(*v, &readinessProbe) + if err != nil { + return err + } + pmod.ReadinessProbe = &readinessProbe + } + case "appInsightsEnabled": + if v != nil { + var appInsightsEnabled bool + err = json.Unmarshal(*v, &appInsightsEnabled) + if err != nil { + return err + } + pmod.AppInsightsEnabled = &appInsightsEnabled + } + case "livenessProbe": + if v != nil { + var livenessProbe ProbeSettings + err = json.Unmarshal(*v, &livenessProbe) + if err != nil { + return err + } + pmod.LivenessProbe = &livenessProbe + } + case "requestSettings": + if v != nil { + var requestSettings OnlineRequestSettings + err = json.Unmarshal(*v, &requestSettings) + if err != nil { + return err + } + pmod.RequestSettings = &requestSettings + } + case "scaleSettings": + if v != nil { + scaleSettings, err := unmarshalBasicOnlineScaleSettings(*v) + if err != nil { + return err + } + pmod.ScaleSettings = scaleSettings + } + case "endpointComputeType": + if v != nil { + var endpointComputeType EndpointComputeTypeBasicPartialOnlineDeployment + err = json.Unmarshal(*v, &endpointComputeType) + if err != nil { + return err + } + pmod.EndpointComputeType = endpointComputeType + } + } + } + + return nil +} + +// BasicPartialOnlineDeployment mutable online deployment configuration +type BasicPartialOnlineDeployment interface { + AsPartialAksOnlineDeployment() (*PartialAksOnlineDeployment, bool) + AsPartialManagedOnlineDeployment() (*PartialManagedOnlineDeployment, bool) + AsPartialOnlineDeployment() (*PartialOnlineDeployment, bool) +} + +// PartialOnlineDeployment mutable online deployment configuration +type PartialOnlineDeployment struct { + AppInsightsEnabled *bool `json:"appInsightsEnabled,omitempty"` + LivenessProbe *ProbeSettings `json:"livenessProbe,omitempty"` + RequestSettings *OnlineRequestSettings `json:"requestSettings,omitempty"` + ScaleSettings BasicOnlineScaleSettings `json:"scaleSettings,omitempty"` + // EndpointComputeType - Possible values include: 'EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypePartialOnlineDeployment', 'EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeK8S', 'EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeManaged' + EndpointComputeType EndpointComputeTypeBasicPartialOnlineDeployment `json:"endpointComputeType,omitempty"` +} + +func unmarshalBasicPartialOnlineDeployment(body []byte) (BasicPartialOnlineDeployment, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["endpointComputeType"] { + case string(EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeK8S): + var paod PartialAksOnlineDeployment + err := json.Unmarshal(body, &paod) + return paod, err + case string(EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeManaged): + var pmod PartialManagedOnlineDeployment + err := json.Unmarshal(body, &pmod) + return pmod, err + default: + var pod PartialOnlineDeployment + err := json.Unmarshal(body, &pod) + return pod, err + } +} +func unmarshalBasicPartialOnlineDeploymentArray(body []byte) ([]BasicPartialOnlineDeployment, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + podArray := make([]BasicPartialOnlineDeployment, len(rawMessages)) + + for index, rawMessage := range rawMessages { + pod, err := unmarshalBasicPartialOnlineDeployment(*rawMessage) + if err != nil { + return nil, err + } + podArray[index] = pod + } + return podArray, nil +} + +// MarshalJSON is the custom marshaler for PartialOnlineDeployment. +func (pod PartialOnlineDeployment) MarshalJSON() ([]byte, error) { + pod.EndpointComputeType = EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypePartialOnlineDeployment + objectMap := make(map[string]interface{}) + if pod.AppInsightsEnabled != nil { + objectMap["appInsightsEnabled"] = pod.AppInsightsEnabled + } + if pod.LivenessProbe != nil { + objectMap["livenessProbe"] = pod.LivenessProbe + } + if pod.RequestSettings != nil { + objectMap["requestSettings"] = pod.RequestSettings + } + objectMap["scaleSettings"] = pod.ScaleSettings + if pod.EndpointComputeType != "" { + objectMap["endpointComputeType"] = pod.EndpointComputeType + } + return json.Marshal(objectMap) +} + +// AsPartialAksOnlineDeployment is the BasicPartialOnlineDeployment implementation for PartialOnlineDeployment. +func (pod PartialOnlineDeployment) AsPartialAksOnlineDeployment() (*PartialAksOnlineDeployment, bool) { + return nil, false +} + +// AsPartialManagedOnlineDeployment is the BasicPartialOnlineDeployment implementation for PartialOnlineDeployment. +func (pod PartialOnlineDeployment) AsPartialManagedOnlineDeployment() (*PartialManagedOnlineDeployment, bool) { + return nil, false +} + +// AsPartialOnlineDeployment is the BasicPartialOnlineDeployment implementation for PartialOnlineDeployment. +func (pod PartialOnlineDeployment) AsPartialOnlineDeployment() (*PartialOnlineDeployment, bool) { + return &pod, true +} + +// AsBasicPartialOnlineDeployment is the BasicPartialOnlineDeployment implementation for PartialOnlineDeployment. +func (pod PartialOnlineDeployment) AsBasicPartialOnlineDeployment() (BasicPartialOnlineDeployment, bool) { + return &pod, true +} + +// UnmarshalJSON is the custom unmarshaler for PartialOnlineDeployment struct. +func (pod *PartialOnlineDeployment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "appInsightsEnabled": + if v != nil { + var appInsightsEnabled bool + err = json.Unmarshal(*v, &appInsightsEnabled) + if err != nil { + return err + } + pod.AppInsightsEnabled = &appInsightsEnabled + } + case "livenessProbe": + if v != nil { + var livenessProbe ProbeSettings + err = json.Unmarshal(*v, &livenessProbe) + if err != nil { + return err + } + pod.LivenessProbe = &livenessProbe + } + case "requestSettings": + if v != nil { + var requestSettings OnlineRequestSettings + err = json.Unmarshal(*v, &requestSettings) + if err != nil { + return err + } + pod.RequestSettings = &requestSettings + } + case "scaleSettings": + if v != nil { + scaleSettings, err := unmarshalBasicOnlineScaleSettings(*v) + if err != nil { + return err + } + pod.ScaleSettings = scaleSettings + } + case "endpointComputeType": + if v != nil { + var endpointComputeType EndpointComputeTypeBasicPartialOnlineDeployment + err = json.Unmarshal(*v, &endpointComputeType) + if err != nil { + return err + } + pod.EndpointComputeType = endpointComputeType + } + } + } + + return nil +} + +// PartialOnlineDeploymentPartialTrackedResource strictly used in update requests. +type PartialOnlineDeploymentPartialTrackedResource struct { + // Identity - Service identity associated with a resource. + Identity *ResourceIdentity `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + // Properties - Additional attributes of the entity. + Properties BasicPartialOnlineDeployment `json:"properties,omitempty"` + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PartialOnlineDeploymentPartialTrackedResource. +func (podptr PartialOnlineDeploymentPartialTrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if podptr.Identity != nil { + objectMap["identity"] = podptr.Identity + } + if podptr.Kind != nil { + objectMap["kind"] = podptr.Kind + } + if podptr.Location != nil { + objectMap["location"] = podptr.Location + } + objectMap["properties"] = podptr.Properties + if podptr.Tags != nil { + objectMap["tags"] = podptr.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PartialOnlineDeploymentPartialTrackedResource struct. +func (podptr *PartialOnlineDeploymentPartialTrackedResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "identity": + if v != nil { + var identity ResourceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + podptr.Identity = &identity + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + podptr.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + podptr.Location = &location + } + case "properties": + if v != nil { + properties, err := unmarshalBasicPartialOnlineDeployment(*v) + if err != nil { + return err + } + podptr.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + podptr.Tags = tags + } + } + } + + return nil +} + +// PartialOnlineEndpoint mutable online endpoint configuration +type PartialOnlineEndpoint struct { + // Traffic - Traffic rules on how the traffic will be routed across deployments. + Traffic map[string]*int32 `json:"traffic"` +} + +// MarshalJSON is the custom marshaler for PartialOnlineEndpoint. +func (poe PartialOnlineEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if poe.Traffic != nil { + objectMap["traffic"] = poe.Traffic + } + return json.Marshal(objectMap) +} + +// PartialOnlineEndpointPartialTrackedResource strictly used in update requests. +type PartialOnlineEndpointPartialTrackedResource struct { + // Identity - Service identity associated with a resource. + Identity *ResourceIdentity `json:"identity,omitempty"` + Kind *string `json:"kind,omitempty"` + Location *string `json:"location,omitempty"` + // Properties - Additional attributes of the entity. + Properties *PartialOnlineEndpoint `json:"properties,omitempty"` + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PartialOnlineEndpointPartialTrackedResource. +func (poeptr PartialOnlineEndpointPartialTrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if poeptr.Identity != nil { + objectMap["identity"] = poeptr.Identity + } + if poeptr.Kind != nil { + objectMap["kind"] = poeptr.Kind + } + if poeptr.Location != nil { + objectMap["location"] = poeptr.Location + } + if poeptr.Properties != nil { + objectMap["properties"] = poeptr.Properties + } + if poeptr.Tags != nil { + objectMap["tags"] = poeptr.Tags + } + return json.Marshal(objectMap) +} + +// Password ... +type Password struct { + // Name - READ-ONLY + Name *string `json:"name,omitempty"` + // Value - READ-ONLY + Value *string `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for Password. +func (p Password) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PersonalComputeInstanceSettings settings for a personal compute instance. +type PersonalComputeInstanceSettings struct { + // AssignedUser - A user explicitly assigned to a personal compute instance. + AssignedUser *AssignedUser `json:"assignedUser,omitempty"` +} + +// PrivateEndpoint the Private Endpoint resource. +type PrivateEndpoint struct { + // ID - READ-ONLY; The ARM identifier for Private Endpoint + ID *string `json:"id,omitempty"` + // SubnetArmID - READ-ONLY; The ARM identifier for Subnet resource that private endpoint links to + SubnetArmID *string `json:"subnetArmId,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpoint. +func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateEndpointConnection the Private Endpoint Connection resource. +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // PrivateEndpointConnectionProperties - Resource properties. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // Identity - The identity of the resource. + Identity *Identity `json:"identity,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Contains resource tags defined as key/value pairs. + Tags map[string]*string `json:"tags"` + // Sku - The sku of the workspace. + Sku *Sku `json:"sku,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + if pec.Identity != nil { + objectMap["identity"] = pec.Identity + } + if pec.Location != nil { + objectMap["location"] = pec.Location + } + if pec.Tags != nil { + objectMap["tags"] = pec.Tags + } + if pec.Sku != nil { + objectMap["sku"] = pec.Sku + } + if pec.SystemData != nil { + objectMap["systemData"] = pec.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + pec.Identity = &identity + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pec.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pec.Tags = tags + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + pec.Sku = &sku + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + pec.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + } + } + + return nil +} + +// PrivateEndpointConnectionListResult list of private endpoint connection associated with the specified +// workspace +type PrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - Array of private endpoint connections + Value *[]PrivateEndpointConnection `json:"value,omitempty"` +} + +// PrivateEndpointConnectionProperties properties of the PrivateEndpointConnectProperties. +type PrivateEndpointConnectionProperties struct { + // PrivateEndpoint - The resource of private end point. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - The provisioning state of the private endpoint connection resource. Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateCreating', 'PrivateEndpointConnectionProvisioningStateDeleting', 'PrivateEndpointConnectionProvisioningStateFailed' + ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} + +// PrivateLinkResource a private link resource +type PrivateLinkResource struct { + // PrivateLinkResourceProperties - Resource properties. + *PrivateLinkResourceProperties `json:"properties,omitempty"` + // Identity - The identity of the resource. + Identity *Identity `json:"identity,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Contains resource tags defined as key/value pairs. + Tags map[string]*string `json:"tags"` + // Sku - The sku of the workspace. + Sku *Sku `json:"sku,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResource. +func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.PrivateLinkResourceProperties != nil { + objectMap["properties"] = plr.PrivateLinkResourceProperties + } + if plr.Identity != nil { + objectMap["identity"] = plr.Identity + } + if plr.Location != nil { + objectMap["location"] = plr.Location + } + if plr.Tags != nil { + objectMap["tags"] = plr.Tags + } + if plr.Sku != nil { + objectMap["sku"] = plr.Sku + } + if plr.SystemData != nil { + objectMap["systemData"] = plr.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. +func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateLinkResourceProperties PrivateLinkResourceProperties + err = json.Unmarshal(*v, &privateLinkResourceProperties) + if err != nil { + return err + } + plr.PrivateLinkResourceProperties = &privateLinkResourceProperties + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + plr.Identity = &identity + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + plr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + plr.Tags = tags + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + plr.Sku = &sku + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + plr.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + plr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + plr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + plr.Type = &typeVar + } + } + } + + return nil +} + +// PrivateLinkResourceListResult a list of private link resources +type PrivateLinkResourceListResult struct { + autorest.Response `json:"-"` + // Value - Array of private link resources + Value *[]PrivateLinkResource `json:"value,omitempty"` +} + +// PrivateLinkResourceProperties properties of a private link resource. +type PrivateLinkResourceProperties struct { + // GroupID - READ-ONLY; The private link resource group id. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - READ-ONLY; The private link resource required member names. + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - The private link resource Private link DNS zone name. + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. +func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plrp.RequiredZoneNames != nil { + objectMap["requiredZoneNames"] = plrp.RequiredZoneNames + } + return json.Marshal(objectMap) +} + +// PrivateLinkServiceConnectionState a collection of information about the state of the connection between +// service consumer and provider. +type PrivateLinkServiceConnectionState struct { + // Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected', 'Timeout' + Status PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` + // Description - The reason for approval/rejection of the connection. + Description *string `json:"description,omitempty"` + // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// ProbeSettings ... +type ProbeSettings struct { + // FailureThreshold - The number of failures to allow before returning an unhealthy status. + FailureThreshold *int32 `json:"failureThreshold,omitempty"` + // InitialDelay - The delay before the first probe in ISO 8601 format. + InitialDelay *string `json:"initialDelay,omitempty"` + // Period - The length of time between probes in ISO 8601 format. + Period *string `json:"period,omitempty"` + // SuccessThreshold - The number of successful probes before returning a healthy status. + SuccessThreshold *int32 `json:"successThreshold,omitempty"` + // Timeout - The probe timeout in ISO 8601 format. + Timeout *string `json:"timeout,omitempty"` +} + +// ProgressMetrics progress metrics definition +type ProgressMetrics struct { + // CompletedDatapointCount - READ-ONLY; The completed datapoint count. + CompletedDatapointCount *int64 `json:"completedDatapointCount,omitempty"` + // IncrementalDatasetLastRefreshTime - READ-ONLY; The time of last successful incremental dataset refresh in UTC. + IncrementalDatasetLastRefreshTime *date.Time `json:"incrementalDatasetLastRefreshTime,omitempty"` + // SkippedDatapointCount - READ-ONLY; The skipped datapoint count. + SkippedDatapointCount *int64 `json:"skippedDatapointCount,omitempty"` + // TotalDatapointCount - READ-ONLY; The total datapoint count. + TotalDatapointCount *int64 `json:"totalDatapointCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProgressMetrics. +func (pm ProgressMetrics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PyTorch pyTorch distribution configuration. +type PyTorch struct { + // ProcessCount - Total process count for the distributed job. + ProcessCount *int32 `json:"processCount,omitempty"` + // DistributionType - Possible values include: 'DistributionTypeDistributionConfiguration', 'DistributionTypeMpi1', 'DistributionTypePyTorch1', 'DistributionTypeTensorFlow1' + DistributionType DistributionTypeBasicDistributionConfiguration `json:"distributionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for PyTorch. +func (pt PyTorch) MarshalJSON() ([]byte, error) { + pt.DistributionType = DistributionTypePyTorch1 + objectMap := make(map[string]interface{}) + if pt.ProcessCount != nil { + objectMap["processCount"] = pt.ProcessCount + } + if pt.DistributionType != "" { + objectMap["distributionType"] = pt.DistributionType + } + return json.Marshal(objectMap) +} + +// AsMpi is the BasicDistributionConfiguration implementation for PyTorch. +func (pt PyTorch) AsMpi() (*Mpi, bool) { + return nil, false +} + +// AsPyTorch is the BasicDistributionConfiguration implementation for PyTorch. +func (pt PyTorch) AsPyTorch() (*PyTorch, bool) { + return &pt, true +} + +// AsTensorFlow is the BasicDistributionConfiguration implementation for PyTorch. +func (pt PyTorch) AsTensorFlow() (*TensorFlow, bool) { + return nil, false +} + +// AsDistributionConfiguration is the BasicDistributionConfiguration implementation for PyTorch. +func (pt PyTorch) AsDistributionConfiguration() (*DistributionConfiguration, bool) { + return nil, false +} + +// AsBasicDistributionConfiguration is the BasicDistributionConfiguration implementation for PyTorch. +func (pt PyTorch) AsBasicDistributionConfiguration() (BasicDistributionConfiguration, bool) { + return &pt, true +} + +// QuotaBaseProperties the properties for Quota update or retrieval. +type QuotaBaseProperties struct { + // ID - Specifies the resource ID. + ID *string `json:"id,omitempty"` + // Type - Specifies the resource type. + Type *string `json:"type,omitempty"` + // Limit - The maximum permitted quota of the resource. + Limit *int64 `json:"limit,omitempty"` + // Unit - An enum describing the unit of quota measurement. Possible values include: 'Count' + Unit QuotaUnit `json:"unit,omitempty"` +} + +// QuotaUpdateParameters quota update parameters. +type QuotaUpdateParameters struct { + // Value - The list for update quota. + Value *[]QuotaBaseProperties `json:"value,omitempty"` + // Location - Region of workspace quota to be updated. + Location *string `json:"location,omitempty"` +} + +// Recurrence the workflow trigger recurrence for ComputeStartStop schedule type. +type Recurrence struct { + // Frequency - Possible values include: 'RecurrenceFrequencyNotSpecified', 'RecurrenceFrequencySecond', 'RecurrenceFrequencyMinute', 'RecurrenceFrequencyHour', 'RecurrenceFrequencyDay', 'RecurrenceFrequencyWeek', 'RecurrenceFrequencyMonth', 'RecurrenceFrequencyYear' + Frequency RecurrenceFrequency `json:"frequency,omitempty"` + // Interval - The interval. + Interval *int32 `json:"interval,omitempty"` + // StartTime - The start time. + StartTime *string `json:"startTime,omitempty"` + // TimeZone - The time zone. + TimeZone *string `json:"timeZone,omitempty"` + Schedule *RecurrenceSchedule `json:"schedule,omitempty"` +} + +// RecurrenceSchedule the recurrence schedule +type RecurrenceSchedule struct { + // Minutes - The minutes. + Minutes *[]int32 `json:"minutes,omitempty"` + // Hours - The hours. + Hours *[]int32 `json:"hours,omitempty"` + // WeekDays - The days of the week. + WeekDays *[]DaysOfWeek `json:"weekDays,omitempty"` +} + +// RegenerateEndpointKeysRequest ... +type RegenerateEndpointKeysRequest struct { + // KeyType - Specification for which type of key to generate. Primary or Secondary. Possible values include: 'Primary', 'Secondary' + KeyType KeyType `json:"keyType,omitempty"` + // KeyValue - The value the key is set to. + KeyValue *string `json:"keyValue,omitempty"` +} + +// RegistryListCredentialsResult ... +type RegistryListCredentialsResult struct { + // Location - READ-ONLY + Location *string `json:"location,omitempty"` + // Username - READ-ONLY + Username *string `json:"username,omitempty"` + Passwords *[]Password `json:"passwords,omitempty"` +} + +// MarshalJSON is the custom marshaler for RegistryListCredentialsResult. +func (rlcr RegistryListCredentialsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rlcr.Passwords != nil { + objectMap["passwords"] = rlcr.Passwords + } + return json.Marshal(objectMap) +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceID represents a resource ID. For example, for a subnet, it is the resource URL for the subnet. +type ResourceID struct { + // ID - The ID of the resource + ID *string `json:"id,omitempty"` +} + +// ResourceIdentity service identity associated with a resource. +type ResourceIdentity struct { + // PrincipalID - READ-ONLY; Client ID that is used when authenticating. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; AAD Tenant where this identity lives. + TenantID *string `json:"tenantId,omitempty"` + // Type - Defines values for a ResourceIdentity's type. Possible values include: 'ResourceIdentityAssignmentSystemAssigned', 'ResourceIdentityAssignmentUserAssigned', 'ResourceIdentityAssignmentSystemAssignedUserAssigned', 'ResourceIdentityAssignmentNone' + Type ResourceIdentityAssignment `json:"type,omitempty"` + // UserAssignedIdentities - Dictionary of the user assigned identities, key is ARM resource ID of the UAI. + UserAssignedIdentities map[string]*UserAssignedIdentityMeta `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for ResourceIdentity. +func (ri ResourceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ri.Type != "" { + objectMap["type"] = ri.Type + } + if ri.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = ri.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// ResourceName the Resource Name. +type ResourceName struct { + // Value - READ-ONLY; The name of the resource. + Value *string `json:"value,omitempty"` + // LocalizedValue - READ-ONLY; The localized name of the resource. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceName. +func (rn ResourceName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceQuota the quota assigned to a resource. +type ResourceQuota struct { + // ID - READ-ONLY; Specifies the resource ID. + ID *string `json:"id,omitempty"` + // AmlWorkspaceLocation - READ-ONLY; Region of the AML workspace in the id. + AmlWorkspaceLocation *string `json:"amlWorkspaceLocation,omitempty"` + // Type - READ-ONLY; Specifies the resource type. + Type *string `json:"type,omitempty"` + // Name - READ-ONLY; Name of the resource. + Name *ResourceName `json:"name,omitempty"` + // Limit - READ-ONLY; The maximum permitted quota of the resource. + Limit *int64 `json:"limit,omitempty"` + // Unit - READ-ONLY; An enum describing the unit of quota measurement. Possible values include: 'Count' + Unit QuotaUnit `json:"unit,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceQuota. +func (rq ResourceQuota) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceSkuLocationInfo ... +type ResourceSkuLocationInfo struct { + // Location - READ-ONLY; Location of the SKU + Location *string `json:"location,omitempty"` + // Zones - READ-ONLY; List of availability zones where the SKU is supported. + Zones *[]string `json:"zones,omitempty"` + // ZoneDetails - READ-ONLY; Details of capabilities available to a SKU in specific zones. + ZoneDetails *[]ResourceSkuZoneDetails `json:"zoneDetails,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceSkuLocationInfo. +func (rsli ResourceSkuLocationInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceSkuZoneDetails describes The zonal capabilities of a SKU. +type ResourceSkuZoneDetails struct { + // Name - READ-ONLY; The set of zones that the SKU is available in with the specified capabilities. + Name *[]string `json:"name,omitempty"` + // Capabilities - READ-ONLY; A list of capabilities that are available for the SKU in the specified list of zones. + Capabilities *[]SKUCapability `json:"capabilities,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceSkuZoneDetails. +func (rszd ResourceSkuZoneDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Restriction the restriction because of which SKU cannot be used. +type Restriction struct { + // Type - READ-ONLY; The type of restrictions. As of now only possible value for this is location. + Type *string `json:"type,omitempty"` + // Values - READ-ONLY; The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. + Values *[]string `json:"values,omitempty"` + // ReasonCode - The reason for the restriction. Possible values include: 'NotSpecified', 'NotAvailableForRegion', 'NotAvailableForSubscription' + ReasonCode ReasonCode `json:"reasonCode,omitempty"` +} + +// MarshalJSON is the custom marshaler for Restriction. +func (r Restriction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.ReasonCode != "" { + objectMap["reasonCode"] = r.ReasonCode + } + return json.Marshal(objectMap) +} + +// Route ... +type Route struct { + // Path - The path for the route. + Path *string `json:"path,omitempty"` + // Port - The port for the route. + Port *int32 `json:"port,omitempty"` +} + +// SasDatastoreCredentials SAS datastore credentials configuration. +type SasDatastoreCredentials struct { + // Secrets - Storage container secrets. + Secrets *SasDatastoreSecrets `json:"secrets,omitempty"` + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey', 'CredentialsTypeCertificate', 'CredentialsTypeNone', 'CredentialsTypeSas', 'CredentialsTypeServicePrincipal', 'CredentialsTypeSQLAdmin' + CredentialsType CredentialsTypeBasicDatastoreCredentials `json:"credentialsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SasDatastoreCredentials. +func (sdc SasDatastoreCredentials) MarshalJSON() ([]byte, error) { + sdc.CredentialsType = CredentialsTypeSas + objectMap := make(map[string]interface{}) + if sdc.Secrets != nil { + objectMap["secrets"] = sdc.Secrets + } + if sdc.CredentialsType != "" { + objectMap["credentialsType"] = sdc.CredentialsType + } + return json.Marshal(objectMap) +} + +// AsAccountKeyDatastoreCredentials is the BasicDatastoreCredentials implementation for SasDatastoreCredentials. +func (sdc SasDatastoreCredentials) AsAccountKeyDatastoreCredentials() (*AccountKeyDatastoreCredentials, bool) { + return nil, false +} + +// AsCertificateDatastoreCredentials is the BasicDatastoreCredentials implementation for SasDatastoreCredentials. +func (sdc SasDatastoreCredentials) AsCertificateDatastoreCredentials() (*CertificateDatastoreCredentials, bool) { + return nil, false +} + +// AsNoneDatastoreCredentials is the BasicDatastoreCredentials implementation for SasDatastoreCredentials. +func (sdc SasDatastoreCredentials) AsNoneDatastoreCredentials() (*NoneDatastoreCredentials, bool) { + return nil, false +} + +// AsSasDatastoreCredentials is the BasicDatastoreCredentials implementation for SasDatastoreCredentials. +func (sdc SasDatastoreCredentials) AsSasDatastoreCredentials() (*SasDatastoreCredentials, bool) { + return &sdc, true +} + +// AsServicePrincipalDatastoreCredentials is the BasicDatastoreCredentials implementation for SasDatastoreCredentials. +func (sdc SasDatastoreCredentials) AsServicePrincipalDatastoreCredentials() (*ServicePrincipalDatastoreCredentials, bool) { + return nil, false +} + +// AsSQLAdminDatastoreCredentials is the BasicDatastoreCredentials implementation for SasDatastoreCredentials. +func (sdc SasDatastoreCredentials) AsSQLAdminDatastoreCredentials() (*SQLAdminDatastoreCredentials, bool) { + return nil, false +} + +// AsDatastoreCredentials is the BasicDatastoreCredentials implementation for SasDatastoreCredentials. +func (sdc SasDatastoreCredentials) AsDatastoreCredentials() (*DatastoreCredentials, bool) { + return nil, false +} + +// AsBasicDatastoreCredentials is the BasicDatastoreCredentials implementation for SasDatastoreCredentials. +func (sdc SasDatastoreCredentials) AsBasicDatastoreCredentials() (BasicDatastoreCredentials, bool) { + return &sdc, true +} + +// SasDatastoreSecrets datastore SAS secrets. +type SasDatastoreSecrets struct { + // SasToken - Storage container SAS token. + SasToken *string `json:"sasToken,omitempty"` + // SecretsType - Possible values include: 'SecretsTypeDatastoreSecrets', 'SecretsTypeAccountKey1', 'SecretsTypeCertificate1', 'SecretsTypeNone1', 'SecretsTypeSas1', 'SecretsTypeServicePrincipal1', 'SecretsTypeSQLAdmin1' + SecretsType SecretsTypeBasicDatastoreSecrets `json:"secretsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SasDatastoreSecrets. +func (sds SasDatastoreSecrets) MarshalJSON() ([]byte, error) { + sds.SecretsType = SecretsTypeSas1 + objectMap := make(map[string]interface{}) + if sds.SasToken != nil { + objectMap["sasToken"] = sds.SasToken + } + if sds.SecretsType != "" { + objectMap["secretsType"] = sds.SecretsType + } + return json.Marshal(objectMap) +} + +// AsAccountKeyDatastoreSecrets is the BasicDatastoreSecrets implementation for SasDatastoreSecrets. +func (sds SasDatastoreSecrets) AsAccountKeyDatastoreSecrets() (*AccountKeyDatastoreSecrets, bool) { + return nil, false +} + +// AsCertificateDatastoreSecrets is the BasicDatastoreSecrets implementation for SasDatastoreSecrets. +func (sds SasDatastoreSecrets) AsCertificateDatastoreSecrets() (*CertificateDatastoreSecrets, bool) { + return nil, false +} + +// AsNoneDatastoreSecrets is the BasicDatastoreSecrets implementation for SasDatastoreSecrets. +func (sds SasDatastoreSecrets) AsNoneDatastoreSecrets() (*NoneDatastoreSecrets, bool) { + return nil, false +} + +// AsSasDatastoreSecrets is the BasicDatastoreSecrets implementation for SasDatastoreSecrets. +func (sds SasDatastoreSecrets) AsSasDatastoreSecrets() (*SasDatastoreSecrets, bool) { + return &sds, true +} + +// AsServicePrincipalDatastoreSecrets is the BasicDatastoreSecrets implementation for SasDatastoreSecrets. +func (sds SasDatastoreSecrets) AsServicePrincipalDatastoreSecrets() (*ServicePrincipalDatastoreSecrets, bool) { + return nil, false +} + +// AsSQLAdminDatastoreSecrets is the BasicDatastoreSecrets implementation for SasDatastoreSecrets. +func (sds SasDatastoreSecrets) AsSQLAdminDatastoreSecrets() (*SQLAdminDatastoreSecrets, bool) { + return nil, false +} + +// AsDatastoreSecrets is the BasicDatastoreSecrets implementation for SasDatastoreSecrets. +func (sds SasDatastoreSecrets) AsDatastoreSecrets() (*DatastoreSecrets, bool) { + return nil, false +} + +// AsBasicDatastoreSecrets is the BasicDatastoreSecrets implementation for SasDatastoreSecrets. +func (sds SasDatastoreSecrets) AsBasicDatastoreSecrets() (BasicDatastoreSecrets, bool) { + return &sds, true +} + +// ScaleSettings scale settings for AML Compute +type ScaleSettings struct { + // MaxNodeCount - Max number of nodes to use + MaxNodeCount *int32 `json:"maxNodeCount,omitempty"` + // MinNodeCount - Min number of nodes to use + MinNodeCount *int32 `json:"minNodeCount,omitempty"` + // NodeIdleTimeBeforeScaleDown - Node Idle Time before scaling down amlCompute. This string needs to be in the RFC Format. + NodeIdleTimeBeforeScaleDown *string `json:"nodeIdleTimeBeforeScaleDown,omitempty"` +} + +// ScriptReference script reference +type ScriptReference struct { + // ScriptSource - The storage source of the script: inline, workspace. + ScriptSource *string `json:"scriptSource,omitempty"` + // ScriptData - The location of scripts in the mounted volume. + ScriptData *string `json:"scriptData,omitempty"` + // ScriptArguments - Optional command line arguments passed to the script to run. + ScriptArguments *string `json:"scriptArguments,omitempty"` + // Timeout - Optional time period passed to timeout command. + Timeout *string `json:"timeout,omitempty"` +} + +// ScriptsToExecute customized setup scripts +type ScriptsToExecute struct { + // StartupScript - Script that's run every time the machine starts. + StartupScript *ScriptReference `json:"startupScript,omitempty"` + // CreationScript - Script that's run only once during provision of the compute. + CreationScript *ScriptReference `json:"creationScript,omitempty"` +} + +// ServiceManagedResourcesSettings ... +type ServiceManagedResourcesSettings struct { + // CosmosDb - The settings for the service managed cosmosdb account. + CosmosDb *CosmosDbSettings `json:"cosmosDb,omitempty"` +} + +// ServicePrincipalCredentials service principal credentials. +type ServicePrincipalCredentials struct { + // ClientID - Client Id + ClientID *string `json:"clientId,omitempty"` + // ClientSecret - Client secret + ClientSecret *string `json:"clientSecret,omitempty"` +} + +// ServicePrincipalDatastoreCredentials service Principal datastore credentials configuration. +type ServicePrincipalDatastoreCredentials struct { + // AuthorityURL - Authority URL used for authentication. + AuthorityURL *string `json:"authorityUrl,omitempty"` + // ClientID - Service principal client ID. + ClientID *uuid.UUID `json:"clientId,omitempty"` + // ResourceURI - Resource the service principal has access to. + ResourceURI *string `json:"resourceUri,omitempty"` + // Secrets - Service principal secrets. + Secrets *ServicePrincipalDatastoreSecrets `json:"secrets,omitempty"` + // TenantID - ID of the tenant to which the service principal belongs. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey', 'CredentialsTypeCertificate', 'CredentialsTypeNone', 'CredentialsTypeSas', 'CredentialsTypeServicePrincipal', 'CredentialsTypeSQLAdmin' + CredentialsType CredentialsTypeBasicDatastoreCredentials `json:"credentialsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServicePrincipalDatastoreCredentials. +func (spdc ServicePrincipalDatastoreCredentials) MarshalJSON() ([]byte, error) { + spdc.CredentialsType = CredentialsTypeServicePrincipal + objectMap := make(map[string]interface{}) + if spdc.AuthorityURL != nil { + objectMap["authorityUrl"] = spdc.AuthorityURL + } + if spdc.ClientID != nil { + objectMap["clientId"] = spdc.ClientID + } + if spdc.ResourceURI != nil { + objectMap["resourceUri"] = spdc.ResourceURI + } + if spdc.Secrets != nil { + objectMap["secrets"] = spdc.Secrets + } + if spdc.TenantID != nil { + objectMap["tenantId"] = spdc.TenantID + } + if spdc.CredentialsType != "" { + objectMap["credentialsType"] = spdc.CredentialsType + } + return json.Marshal(objectMap) +} + +// AsAccountKeyDatastoreCredentials is the BasicDatastoreCredentials implementation for ServicePrincipalDatastoreCredentials. +func (spdc ServicePrincipalDatastoreCredentials) AsAccountKeyDatastoreCredentials() (*AccountKeyDatastoreCredentials, bool) { + return nil, false +} + +// AsCertificateDatastoreCredentials is the BasicDatastoreCredentials implementation for ServicePrincipalDatastoreCredentials. +func (spdc ServicePrincipalDatastoreCredentials) AsCertificateDatastoreCredentials() (*CertificateDatastoreCredentials, bool) { + return nil, false +} + +// AsNoneDatastoreCredentials is the BasicDatastoreCredentials implementation for ServicePrincipalDatastoreCredentials. +func (spdc ServicePrincipalDatastoreCredentials) AsNoneDatastoreCredentials() (*NoneDatastoreCredentials, bool) { + return nil, false +} + +// AsSasDatastoreCredentials is the BasicDatastoreCredentials implementation for ServicePrincipalDatastoreCredentials. +func (spdc ServicePrincipalDatastoreCredentials) AsSasDatastoreCredentials() (*SasDatastoreCredentials, bool) { + return nil, false +} + +// AsServicePrincipalDatastoreCredentials is the BasicDatastoreCredentials implementation for ServicePrincipalDatastoreCredentials. +func (spdc ServicePrincipalDatastoreCredentials) AsServicePrincipalDatastoreCredentials() (*ServicePrincipalDatastoreCredentials, bool) { + return &spdc, true +} + +// AsSQLAdminDatastoreCredentials is the BasicDatastoreCredentials implementation for ServicePrincipalDatastoreCredentials. +func (spdc ServicePrincipalDatastoreCredentials) AsSQLAdminDatastoreCredentials() (*SQLAdminDatastoreCredentials, bool) { + return nil, false +} + +// AsDatastoreCredentials is the BasicDatastoreCredentials implementation for ServicePrincipalDatastoreCredentials. +func (spdc ServicePrincipalDatastoreCredentials) AsDatastoreCredentials() (*DatastoreCredentials, bool) { + return nil, false +} + +// AsBasicDatastoreCredentials is the BasicDatastoreCredentials implementation for ServicePrincipalDatastoreCredentials. +func (spdc ServicePrincipalDatastoreCredentials) AsBasicDatastoreCredentials() (BasicDatastoreCredentials, bool) { + return &spdc, true +} + +// ServicePrincipalDatastoreSecrets datastore Service Principal secrets. +type ServicePrincipalDatastoreSecrets struct { + // ClientSecret - Service principal secret. + ClientSecret *string `json:"clientSecret,omitempty"` + // SecretsType - Possible values include: 'SecretsTypeDatastoreSecrets', 'SecretsTypeAccountKey1', 'SecretsTypeCertificate1', 'SecretsTypeNone1', 'SecretsTypeSas1', 'SecretsTypeServicePrincipal1', 'SecretsTypeSQLAdmin1' + SecretsType SecretsTypeBasicDatastoreSecrets `json:"secretsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServicePrincipalDatastoreSecrets. +func (spds ServicePrincipalDatastoreSecrets) MarshalJSON() ([]byte, error) { + spds.SecretsType = SecretsTypeServicePrincipal1 + objectMap := make(map[string]interface{}) + if spds.ClientSecret != nil { + objectMap["clientSecret"] = spds.ClientSecret + } + if spds.SecretsType != "" { + objectMap["secretsType"] = spds.SecretsType + } + return json.Marshal(objectMap) +} + +// AsAccountKeyDatastoreSecrets is the BasicDatastoreSecrets implementation for ServicePrincipalDatastoreSecrets. +func (spds ServicePrincipalDatastoreSecrets) AsAccountKeyDatastoreSecrets() (*AccountKeyDatastoreSecrets, bool) { + return nil, false +} + +// AsCertificateDatastoreSecrets is the BasicDatastoreSecrets implementation for ServicePrincipalDatastoreSecrets. +func (spds ServicePrincipalDatastoreSecrets) AsCertificateDatastoreSecrets() (*CertificateDatastoreSecrets, bool) { + return nil, false +} + +// AsNoneDatastoreSecrets is the BasicDatastoreSecrets implementation for ServicePrincipalDatastoreSecrets. +func (spds ServicePrincipalDatastoreSecrets) AsNoneDatastoreSecrets() (*NoneDatastoreSecrets, bool) { + return nil, false +} + +// AsSasDatastoreSecrets is the BasicDatastoreSecrets implementation for ServicePrincipalDatastoreSecrets. +func (spds ServicePrincipalDatastoreSecrets) AsSasDatastoreSecrets() (*SasDatastoreSecrets, bool) { + return nil, false +} + +// AsServicePrincipalDatastoreSecrets is the BasicDatastoreSecrets implementation for ServicePrincipalDatastoreSecrets. +func (spds ServicePrincipalDatastoreSecrets) AsServicePrincipalDatastoreSecrets() (*ServicePrincipalDatastoreSecrets, bool) { + return &spds, true +} + +// AsSQLAdminDatastoreSecrets is the BasicDatastoreSecrets implementation for ServicePrincipalDatastoreSecrets. +func (spds ServicePrincipalDatastoreSecrets) AsSQLAdminDatastoreSecrets() (*SQLAdminDatastoreSecrets, bool) { + return nil, false +} + +// AsDatastoreSecrets is the BasicDatastoreSecrets implementation for ServicePrincipalDatastoreSecrets. +func (spds ServicePrincipalDatastoreSecrets) AsDatastoreSecrets() (*DatastoreSecrets, bool) { + return nil, false +} + +// AsBasicDatastoreSecrets is the BasicDatastoreSecrets implementation for ServicePrincipalDatastoreSecrets. +func (spds ServicePrincipalDatastoreSecrets) AsBasicDatastoreSecrets() (BasicDatastoreSecrets, bool) { + return &spds, true +} + +// SetupScripts details of customized scripts to execute for setting up the cluster. +type SetupScripts struct { + // Scripts - Customized setup scripts + Scripts *ScriptsToExecute `json:"scripts,omitempty"` +} + +// SharedPrivateLinkResource ... +type SharedPrivateLinkResource struct { + // Name - Unique name of the private link. + Name *string `json:"name,omitempty"` + // SharedPrivateLinkResourceProperty - Resource properties. + *SharedPrivateLinkResourceProperty `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SharedPrivateLinkResource. +func (splr SharedPrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if splr.Name != nil { + objectMap["name"] = splr.Name + } + if splr.SharedPrivateLinkResourceProperty != nil { + objectMap["properties"] = splr.SharedPrivateLinkResourceProperty + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SharedPrivateLinkResource struct. +func (splr *SharedPrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + splr.Name = &name + } + case "properties": + if v != nil { + var sharedPrivateLinkResourceProperty SharedPrivateLinkResourceProperty + err = json.Unmarshal(*v, &sharedPrivateLinkResourceProperty) + if err != nil { + return err + } + splr.SharedPrivateLinkResourceProperty = &sharedPrivateLinkResourceProperty + } + } + } + + return nil +} + +// SharedPrivateLinkResourceProperty properties of a shared private link resource. +type SharedPrivateLinkResourceProperty struct { + // PrivateLinkResourceID - The resource id that private link links to. + PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"` + // GroupID - The private link resource group id. + GroupID *string `json:"groupId,omitempty"` + // RequestMessage - Request message. + RequestMessage *string `json:"requestMessage,omitempty"` + // Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected', 'Timeout' + Status PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` +} + +// Sku sku of the resource +type Sku struct { + // Name - Name of the sku + Name *string `json:"name,omitempty"` + // Tier - Tier of the sku like Basic or Enterprise + Tier *string `json:"tier,omitempty"` +} + +// SKUCapability features/user capabilities associated with the sku +type SKUCapability struct { + // Name - Capability/Feature ID + Name *string `json:"name,omitempty"` + // Value - Details about the feature/capability + Value *string `json:"value,omitempty"` +} + +// SkuListResult list of skus with features +type SkuListResult struct { + autorest.Response `json:"-"` + Value *[]WorkspaceSku `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of Workspace Skus. Call ListNext() with this URI to fetch the next page of Workspace Skus + NextLink *string `json:"nextLink,omitempty"` +} + +// SkuListResultIterator provides access to a complete listing of WorkspaceSku values. +type SkuListResultIterator struct { + i int + page SkuListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SkuListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkuListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SkuListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SkuListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SkuListResultIterator) Response() SkuListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SkuListResultIterator) Value() WorkspaceSku { + if !iter.page.NotDone() { + return WorkspaceSku{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SkuListResultIterator type. +func NewSkuListResultIterator(page SkuListResultPage) SkuListResultIterator { + return SkuListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (slr SkuListResult) IsEmpty() bool { + return slr.Value == nil || len(*slr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (slr SkuListResult) hasNextLink() bool { + return slr.NextLink != nil && len(*slr.NextLink) != 0 +} + +// skuListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (slr SkuListResult) skuListResultPreparer(ctx context.Context) (*http.Request, error) { + if !slr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(slr.NextLink))) +} + +// SkuListResultPage contains a page of WorkspaceSku values. +type SkuListResultPage struct { + fn func(context.Context, SkuListResult) (SkuListResult, error) + slr SkuListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SkuListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkuListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.slr) + if err != nil { + return err + } + page.slr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SkuListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SkuListResultPage) NotDone() bool { + return !page.slr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SkuListResultPage) Response() SkuListResult { + return page.slr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SkuListResultPage) Values() []WorkspaceSku { + if page.slr.IsEmpty() { + return nil + } + return *page.slr.Value +} + +// Creates a new instance of the SkuListResultPage type. +func NewSkuListResultPage(cur SkuListResult, getNextPage func(context.Context, SkuListResult) (SkuListResult, error)) SkuListResultPage { + return SkuListResultPage{ + fn: getNextPage, + slr: cur, + } +} + +// SQLAdminDatastoreCredentials SQL Admin datastore credentials configuration. +type SQLAdminDatastoreCredentials struct { + // Secrets - SQL database secrets. + Secrets *SQLAdminDatastoreSecrets `json:"secrets,omitempty"` + // UserID - SQL database user name. + UserID *string `json:"userId,omitempty"` + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey', 'CredentialsTypeCertificate', 'CredentialsTypeNone', 'CredentialsTypeSas', 'CredentialsTypeServicePrincipal', 'CredentialsTypeSQLAdmin' + CredentialsType CredentialsTypeBasicDatastoreCredentials `json:"credentialsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLAdminDatastoreCredentials. +func (sadc SQLAdminDatastoreCredentials) MarshalJSON() ([]byte, error) { + sadc.CredentialsType = CredentialsTypeSQLAdmin + objectMap := make(map[string]interface{}) + if sadc.Secrets != nil { + objectMap["secrets"] = sadc.Secrets + } + if sadc.UserID != nil { + objectMap["userId"] = sadc.UserID + } + if sadc.CredentialsType != "" { + objectMap["credentialsType"] = sadc.CredentialsType + } + return json.Marshal(objectMap) +} + +// AsAccountKeyDatastoreCredentials is the BasicDatastoreCredentials implementation for SQLAdminDatastoreCredentials. +func (sadc SQLAdminDatastoreCredentials) AsAccountKeyDatastoreCredentials() (*AccountKeyDatastoreCredentials, bool) { + return nil, false +} + +// AsCertificateDatastoreCredentials is the BasicDatastoreCredentials implementation for SQLAdminDatastoreCredentials. +func (sadc SQLAdminDatastoreCredentials) AsCertificateDatastoreCredentials() (*CertificateDatastoreCredentials, bool) { + return nil, false +} + +// AsNoneDatastoreCredentials is the BasicDatastoreCredentials implementation for SQLAdminDatastoreCredentials. +func (sadc SQLAdminDatastoreCredentials) AsNoneDatastoreCredentials() (*NoneDatastoreCredentials, bool) { + return nil, false +} + +// AsSasDatastoreCredentials is the BasicDatastoreCredentials implementation for SQLAdminDatastoreCredentials. +func (sadc SQLAdminDatastoreCredentials) AsSasDatastoreCredentials() (*SasDatastoreCredentials, bool) { + return nil, false +} + +// AsServicePrincipalDatastoreCredentials is the BasicDatastoreCredentials implementation for SQLAdminDatastoreCredentials. +func (sadc SQLAdminDatastoreCredentials) AsServicePrincipalDatastoreCredentials() (*ServicePrincipalDatastoreCredentials, bool) { + return nil, false +} + +// AsSQLAdminDatastoreCredentials is the BasicDatastoreCredentials implementation for SQLAdminDatastoreCredentials. +func (sadc SQLAdminDatastoreCredentials) AsSQLAdminDatastoreCredentials() (*SQLAdminDatastoreCredentials, bool) { + return &sadc, true +} + +// AsDatastoreCredentials is the BasicDatastoreCredentials implementation for SQLAdminDatastoreCredentials. +func (sadc SQLAdminDatastoreCredentials) AsDatastoreCredentials() (*DatastoreCredentials, bool) { + return nil, false +} + +// AsBasicDatastoreCredentials is the BasicDatastoreCredentials implementation for SQLAdminDatastoreCredentials. +func (sadc SQLAdminDatastoreCredentials) AsBasicDatastoreCredentials() (BasicDatastoreCredentials, bool) { + return &sadc, true +} + +// SQLAdminDatastoreSecrets datastore SQL Admin secrets. +type SQLAdminDatastoreSecrets struct { + // Password - SQL database password. + Password *string `json:"password,omitempty"` + // SecretsType - Possible values include: 'SecretsTypeDatastoreSecrets', 'SecretsTypeAccountKey1', 'SecretsTypeCertificate1', 'SecretsTypeNone1', 'SecretsTypeSas1', 'SecretsTypeServicePrincipal1', 'SecretsTypeSQLAdmin1' + SecretsType SecretsTypeBasicDatastoreSecrets `json:"secretsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLAdminDatastoreSecrets. +func (sads SQLAdminDatastoreSecrets) MarshalJSON() ([]byte, error) { + sads.SecretsType = SecretsTypeSQLAdmin1 + objectMap := make(map[string]interface{}) + if sads.Password != nil { + objectMap["password"] = sads.Password + } + if sads.SecretsType != "" { + objectMap["secretsType"] = sads.SecretsType + } + return json.Marshal(objectMap) +} + +// AsAccountKeyDatastoreSecrets is the BasicDatastoreSecrets implementation for SQLAdminDatastoreSecrets. +func (sads SQLAdminDatastoreSecrets) AsAccountKeyDatastoreSecrets() (*AccountKeyDatastoreSecrets, bool) { + return nil, false +} + +// AsCertificateDatastoreSecrets is the BasicDatastoreSecrets implementation for SQLAdminDatastoreSecrets. +func (sads SQLAdminDatastoreSecrets) AsCertificateDatastoreSecrets() (*CertificateDatastoreSecrets, bool) { + return nil, false +} + +// AsNoneDatastoreSecrets is the BasicDatastoreSecrets implementation for SQLAdminDatastoreSecrets. +func (sads SQLAdminDatastoreSecrets) AsNoneDatastoreSecrets() (*NoneDatastoreSecrets, bool) { + return nil, false +} + +// AsSasDatastoreSecrets is the BasicDatastoreSecrets implementation for SQLAdminDatastoreSecrets. +func (sads SQLAdminDatastoreSecrets) AsSasDatastoreSecrets() (*SasDatastoreSecrets, bool) { + return nil, false +} + +// AsServicePrincipalDatastoreSecrets is the BasicDatastoreSecrets implementation for SQLAdminDatastoreSecrets. +func (sads SQLAdminDatastoreSecrets) AsServicePrincipalDatastoreSecrets() (*ServicePrincipalDatastoreSecrets, bool) { + return nil, false +} + +// AsSQLAdminDatastoreSecrets is the BasicDatastoreSecrets implementation for SQLAdminDatastoreSecrets. +func (sads SQLAdminDatastoreSecrets) AsSQLAdminDatastoreSecrets() (*SQLAdminDatastoreSecrets, bool) { + return &sads, true +} + +// AsDatastoreSecrets is the BasicDatastoreSecrets implementation for SQLAdminDatastoreSecrets. +func (sads SQLAdminDatastoreSecrets) AsDatastoreSecrets() (*DatastoreSecrets, bool) { + return nil, false +} + +// AsBasicDatastoreSecrets is the BasicDatastoreSecrets implementation for SQLAdminDatastoreSecrets. +func (sads SQLAdminDatastoreSecrets) AsBasicDatastoreSecrets() (BasicDatastoreSecrets, bool) { + return &sads, true +} + +// SslConfiguration the ssl configuration for scoring +type SslConfiguration struct { + // Status - Enable or disable ssl for scoring. Possible values include: 'Status1Disabled', 'Status1Enabled', 'Status1Auto' + Status Status1 `json:"status,omitempty"` + // Cert - Cert data + Cert *string `json:"cert,omitempty"` + // Key - Key data + Key *string `json:"key,omitempty"` + // Cname - CNAME of the cert + Cname *string `json:"cname,omitempty"` + // LeafDomainLabel - Leaf domain label of public endpoint + LeafDomainLabel *string `json:"leafDomainLabel,omitempty"` + // OverwriteExistingDomain - Indicates whether to overwrite existing domain label. + OverwriteExistingDomain *bool `json:"overwriteExistingDomain,omitempty"` +} + +// StatusMessage active message associated with project +type StatusMessage struct { + // Code - READ-ONLY; Service-defined message code. + Code *string `json:"code,omitempty"` + // CreatedTimeUtc - READ-ONLY; Time in UTC at which the message was created. + CreatedTimeUtc *date.Time `json:"createdTimeUtc,omitempty"` + // Level - READ-ONLY; Severity level of message. Possible values include: 'StatusMessageLevelError', 'StatusMessageLevelInformation', 'StatusMessageLevelWarning' + Level StatusMessageLevel `json:"level,omitempty"` + // Message - READ-ONLY; A human-readable representation of the message code. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for StatusMessage. +func (sm StatusMessage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SweepJob sweep job definition. +type SweepJob struct { + // Algorithm - Type of the hyperparameter sampling algorithms. Possible values include: 'Grid', 'Random', 'Bayesian' + Algorithm SamplingAlgorithm `json:"algorithm,omitempty"` + // Compute - Compute binding for the job. + Compute *ComputeConfiguration `json:"compute,omitempty"` + // EarlyTermination - Early termination policies enable canceling poor-performing runs before they complete + EarlyTermination BasicEarlyTerminationPolicy `json:"earlyTermination,omitempty"` + // ExperimentName - The name of the experiment the job belongs to. If not set, the job is placed in the "Default" experiment. + ExperimentName *string `json:"experimentName,omitempty"` + // Identity - Identity configuration. If set, this should be one of AmlToken, ManagedIdentity or null. + // Defaults to AmlToken if null. + Identity BasicIdentityConfiguration `json:"identity,omitempty"` + MaxConcurrentTrials *int32 `json:"maxConcurrentTrials,omitempty"` + MaxTotalTrials *int32 `json:"maxTotalTrials,omitempty"` + Objective *Objective `json:"objective,omitempty"` + // Output - READ-ONLY; Location of the job output logs and artifacts. + Output *JobOutput `json:"output,omitempty"` + // Priority - Job priority for scheduling policy. Only applies to AMLCompute. + // Private preview feature and only available to users on the allow list. + Priority *int32 `json:"priority,omitempty"` + // SearchSpace - A dictionary containing each parameter and its distribution. The dictionary key is the name of the parameter + SearchSpace map[string]interface{} `json:"searchSpace"` + // Status - READ-ONLY; The status of a job. Possible values include: 'JobStatusNotStarted', 'JobStatusStarting', 'JobStatusProvisioning', 'JobStatusPreparing', 'JobStatusQueued', 'JobStatusRunning', 'JobStatusFinalizing', 'JobStatusCancelRequested', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusCanceled', 'JobStatusNotResponding', 'JobStatusPaused', 'JobStatusUnknown' + Status JobStatus `json:"status,omitempty"` + // Timeout - The total timeout in ISO 8601 format. Only supports duration with precision as low as Minutes. + Timeout *string `json:"timeout,omitempty"` + // Trial - Trial component definition. + Trial *TrialComponent `json:"trial,omitempty"` + // Description - The asset description text. + Description *string `json:"description,omitempty"` + // InteractionEndpoints - READ-ONLY; List of JobEndpoints. + // For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + InteractionEndpoints map[string]*JobEndpoint `json:"interactionEndpoints"` + // Properties - The asset property dictionary. + Properties map[string]*string `json:"properties"` + // ProvisioningState - READ-ONLY; Possible values include: 'Succeeded', 'Failed', 'Canceled', 'InProgress' + ProvisioningState JobProvisioningState `json:"provisioningState,omitempty"` + // Tags - Tag dictionary. Tags can be added, removed, and updated. + Tags map[string]*string `json:"tags"` + // JobType - Possible values include: 'JobTypeJobBase', 'JobTypeCommand', 'JobTypeSweep' + JobType JobTypeBasicJobBase `json:"jobType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SweepJob. +func (sj SweepJob) MarshalJSON() ([]byte, error) { + sj.JobType = JobTypeSweep + objectMap := make(map[string]interface{}) + if sj.Algorithm != "" { + objectMap["algorithm"] = sj.Algorithm + } + if sj.Compute != nil { + objectMap["compute"] = sj.Compute + } + objectMap["earlyTermination"] = sj.EarlyTermination + if sj.ExperimentName != nil { + objectMap["experimentName"] = sj.ExperimentName + } + objectMap["identity"] = sj.Identity + if sj.MaxConcurrentTrials != nil { + objectMap["maxConcurrentTrials"] = sj.MaxConcurrentTrials + } + if sj.MaxTotalTrials != nil { + objectMap["maxTotalTrials"] = sj.MaxTotalTrials + } + if sj.Objective != nil { + objectMap["objective"] = sj.Objective + } + if sj.Priority != nil { + objectMap["priority"] = sj.Priority + } + if sj.SearchSpace != nil { + objectMap["searchSpace"] = sj.SearchSpace + } + if sj.Timeout != nil { + objectMap["timeout"] = sj.Timeout + } + if sj.Trial != nil { + objectMap["trial"] = sj.Trial + } + if sj.Description != nil { + objectMap["description"] = sj.Description + } + if sj.Properties != nil { + objectMap["properties"] = sj.Properties + } + if sj.Tags != nil { + objectMap["tags"] = sj.Tags + } + if sj.JobType != "" { + objectMap["jobType"] = sj.JobType + } + return json.Marshal(objectMap) +} + +// AsCommandJob is the BasicJobBase implementation for SweepJob. +func (sj SweepJob) AsCommandJob() (*CommandJob, bool) { + return nil, false +} + +// AsSweepJob is the BasicJobBase implementation for SweepJob. +func (sj SweepJob) AsSweepJob() (*SweepJob, bool) { + return &sj, true +} + +// AsJobBase is the BasicJobBase implementation for SweepJob. +func (sj SweepJob) AsJobBase() (*JobBase, bool) { + return nil, false +} + +// AsBasicJobBase is the BasicJobBase implementation for SweepJob. +func (sj SweepJob) AsBasicJobBase() (BasicJobBase, bool) { + return &sj, true +} + +// UnmarshalJSON is the custom unmarshaler for SweepJob struct. +func (sj *SweepJob) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "algorithm": + if v != nil { + var algorithm SamplingAlgorithm + err = json.Unmarshal(*v, &algorithm) + if err != nil { + return err + } + sj.Algorithm = algorithm + } + case "compute": + if v != nil { + var compute ComputeConfiguration + err = json.Unmarshal(*v, &compute) + if err != nil { + return err + } + sj.Compute = &compute + } + case "earlyTermination": + if v != nil { + earlyTermination, err := unmarshalBasicEarlyTerminationPolicy(*v) + if err != nil { + return err + } + sj.EarlyTermination = earlyTermination + } + case "experimentName": + if v != nil { + var experimentName string + err = json.Unmarshal(*v, &experimentName) + if err != nil { + return err + } + sj.ExperimentName = &experimentName + } + case "identity": + if v != nil { + identity, err := unmarshalBasicIdentityConfiguration(*v) + if err != nil { + return err + } + sj.Identity = identity + } + case "maxConcurrentTrials": + if v != nil { + var maxConcurrentTrials int32 + err = json.Unmarshal(*v, &maxConcurrentTrials) + if err != nil { + return err + } + sj.MaxConcurrentTrials = &maxConcurrentTrials + } + case "maxTotalTrials": + if v != nil { + var maxTotalTrials int32 + err = json.Unmarshal(*v, &maxTotalTrials) + if err != nil { + return err + } + sj.MaxTotalTrials = &maxTotalTrials + } + case "objective": + if v != nil { + var objective Objective + err = json.Unmarshal(*v, &objective) + if err != nil { + return err + } + sj.Objective = &objective + } + case "output": + if v != nil { + var output JobOutput + err = json.Unmarshal(*v, &output) + if err != nil { + return err + } + sj.Output = &output + } + case "priority": + if v != nil { + var priority int32 + err = json.Unmarshal(*v, &priority) + if err != nil { + return err + } + sj.Priority = &priority + } + case "searchSpace": + if v != nil { + var searchSpace map[string]interface{} + err = json.Unmarshal(*v, &searchSpace) + if err != nil { + return err + } + sj.SearchSpace = searchSpace + } + case "status": + if v != nil { + var status JobStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + sj.Status = status + } + case "timeout": + if v != nil { + var timeout string + err = json.Unmarshal(*v, &timeout) + if err != nil { + return err + } + sj.Timeout = &timeout + } + case "trial": + if v != nil { + var trial TrialComponent + err = json.Unmarshal(*v, &trial) + if err != nil { + return err + } + sj.Trial = &trial + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + sj.Description = &description + } + case "interactionEndpoints": + if v != nil { + var interactionEndpoints map[string]*JobEndpoint + err = json.Unmarshal(*v, &interactionEndpoints) + if err != nil { + return err + } + sj.InteractionEndpoints = interactionEndpoints + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + sj.Properties = properties + } + case "provisioningState": + if v != nil { + var provisioningState JobProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + sj.ProvisioningState = provisioningState + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + sj.Tags = tags + } + case "jobType": + if v != nil { + var jobType JobTypeBasicJobBase + err = json.Unmarshal(*v, &jobType) + if err != nil { + return err + } + sj.JobType = jobType + } + } + } + + return nil +} + +// SynapseSpark a SynapseSpark compute. +type SynapseSpark struct { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // ComputeLocation - Location for the underlying compute + ComputeLocation *string `json:"computeLocation,omitempty"` + // ProvisioningState - READ-ONLY; The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Possible values include: 'ProvisioningStateUnknown', 'ProvisioningStateUpdating', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Description - The description of the Machine Learning compute. + Description *string `json:"description,omitempty"` + // CreatedOn - READ-ONLY; The time at which the compute was created. + CreatedOn *date.Time `json:"createdOn,omitempty"` + // ModifiedOn - READ-ONLY; The time at which the compute was last modified. + ModifiedOn *date.Time `json:"modifiedOn,omitempty"` + // ResourceID - ARM resource id of the underlying compute + ResourceID *string `json:"resourceId,omitempty"` + // ProvisioningErrors - READ-ONLY; Errors during provisioning + ProvisioningErrors *[]ErrorResponse `json:"provisioningErrors,omitempty"` + // 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. + IsAttachedCompute *bool `json:"isAttachedCompute,omitempty"` + // DisableLocalAuth - Opt-out of local authentication and ensure customers can use only MSI and AAD exclusively for authentication. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + // Properties - AKS properties + Properties *SynapseSparkProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SynapseSpark. +func (ss SynapseSpark) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ss.ComputeType != "" { + objectMap["computeType"] = ss.ComputeType + } + if ss.ComputeLocation != nil { + objectMap["computeLocation"] = ss.ComputeLocation + } + if ss.Description != nil { + objectMap["description"] = ss.Description + } + if ss.ResourceID != nil { + objectMap["resourceId"] = ss.ResourceID + } + if ss.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = ss.DisableLocalAuth + } + if ss.Properties != nil { + objectMap["properties"] = ss.Properties + } + return json.Marshal(objectMap) +} + +// SynapseSparkPoolProperties properties specific to Synapse Spark pools. +type SynapseSparkPoolProperties struct { + // Properties - AKS properties + Properties *SynapseSparkProperties `json:"properties,omitempty"` +} + +// SynapseSparkProperties AKS properties +type SynapseSparkProperties struct { + // AutoScaleProperties - Auto scale properties. + AutoScaleProperties *AutoScaleProperties `json:"autoScaleProperties,omitempty"` + // AutoPauseProperties - Auto pause properties. + AutoPauseProperties *AutoPauseProperties `json:"autoPauseProperties,omitempty"` + // SparkVersion - Spark version. + SparkVersion *string `json:"sparkVersion,omitempty"` + // NodeCount - The number of compute nodes currently assigned to the compute. + NodeCount *int32 `json:"nodeCount,omitempty"` + // NodeSize - Node size. + NodeSize *string `json:"nodeSize,omitempty"` + // NodeSizeFamily - Node size family. + NodeSizeFamily *string `json:"nodeSizeFamily,omitempty"` + // SubscriptionID - Azure subscription identifier. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // ResourceGroup - Name of the resource group in which workspace is located. + ResourceGroup *string `json:"resourceGroup,omitempty"` + // WorkspaceName - Name of Azure Machine Learning workspace. + WorkspaceName *string `json:"workspaceName,omitempty"` + // PoolName - Pool name. + PoolName *string `json:"poolName,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// SystemService a system service running on a compute. +type SystemService struct { + // SystemServiceType - READ-ONLY; The type of this system service. + SystemServiceType *string `json:"systemServiceType,omitempty"` + // PublicIPAddress - READ-ONLY; Public IP address + PublicIPAddress *string `json:"publicIpAddress,omitempty"` + // Version - READ-ONLY; The version for this type. + Version *string `json:"version,omitempty"` +} + +// MarshalJSON is the custom marshaler for SystemService. +func (ss SystemService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// TensorFlow tensorFlow distribution configuration. +type TensorFlow struct { + ParameterServerCount *int32 `json:"parameterServerCount,omitempty"` + // WorkerCount - Number of workers. Overwrites the node count in compute binding. + WorkerCount *int32 `json:"workerCount,omitempty"` + // DistributionType - Possible values include: 'DistributionTypeDistributionConfiguration', 'DistributionTypeMpi1', 'DistributionTypePyTorch1', 'DistributionTypeTensorFlow1' + DistributionType DistributionTypeBasicDistributionConfiguration `json:"distributionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for TensorFlow. +func (tf TensorFlow) MarshalJSON() ([]byte, error) { + tf.DistributionType = DistributionTypeTensorFlow1 + objectMap := make(map[string]interface{}) + if tf.ParameterServerCount != nil { + objectMap["parameterServerCount"] = tf.ParameterServerCount + } + if tf.WorkerCount != nil { + objectMap["workerCount"] = tf.WorkerCount + } + if tf.DistributionType != "" { + objectMap["distributionType"] = tf.DistributionType + } + return json.Marshal(objectMap) +} + +// AsMpi is the BasicDistributionConfiguration implementation for TensorFlow. +func (tf TensorFlow) AsMpi() (*Mpi, bool) { + return nil, false +} + +// AsPyTorch is the BasicDistributionConfiguration implementation for TensorFlow. +func (tf TensorFlow) AsPyTorch() (*PyTorch, bool) { + return nil, false +} + +// AsTensorFlow is the BasicDistributionConfiguration implementation for TensorFlow. +func (tf TensorFlow) AsTensorFlow() (*TensorFlow, bool) { + return &tf, true +} + +// AsDistributionConfiguration is the BasicDistributionConfiguration implementation for TensorFlow. +func (tf TensorFlow) AsDistributionConfiguration() (*DistributionConfiguration, bool) { + return nil, false +} + +// AsBasicDistributionConfiguration is the BasicDistributionConfiguration implementation for TensorFlow. +func (tf TensorFlow) AsBasicDistributionConfiguration() (BasicDistributionConfiguration, bool) { + return &tf, true +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + +// TrialComponent trial component definition. +type TrialComponent struct { + // CodeID - ARM resource ID of the code asset. + CodeID *string `json:"codeId,omitempty"` + // Command - The command to execute on startup of the job. eg. "python train.py" + Command *string `json:"command,omitempty"` + // Distribution - Distribution configuration of the job. If set, this should be one of Mpi, Tensorflow, PyTorch, or null. + Distribution BasicDistributionConfiguration `json:"distribution,omitempty"` + // EnvironmentID - The ARM resource ID of the Environment specification for the job. + EnvironmentID *string `json:"environmentId,omitempty"` + // EnvironmentVariables - Environment variables included in the job. + EnvironmentVariables map[string]*string `json:"environmentVariables"` + // InputDataBindings - Mapping of input data bindings used in the job. + InputDataBindings map[string]*InputDataBinding `json:"inputDataBindings"` + // OutputDataBindings - Mapping of output data bindings used in the job. + OutputDataBindings map[string]*OutputDataBinding `json:"outputDataBindings"` + // Timeout - The max run duration in ISO 8601 format, after which the trial component will be cancelled. + // Only supports duration with precision as low as Seconds. + Timeout *string `json:"timeout,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrialComponent. +func (tc TrialComponent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tc.CodeID != nil { + objectMap["codeId"] = tc.CodeID + } + if tc.Command != nil { + objectMap["command"] = tc.Command + } + objectMap["distribution"] = tc.Distribution + if tc.EnvironmentID != nil { + objectMap["environmentId"] = tc.EnvironmentID + } + if tc.EnvironmentVariables != nil { + objectMap["environmentVariables"] = tc.EnvironmentVariables + } + if tc.InputDataBindings != nil { + objectMap["inputDataBindings"] = tc.InputDataBindings + } + if tc.OutputDataBindings != nil { + objectMap["outputDataBindings"] = tc.OutputDataBindings + } + if tc.Timeout != nil { + objectMap["timeout"] = tc.Timeout + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TrialComponent struct. +func (tc *TrialComponent) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "codeId": + if v != nil { + var codeID string + err = json.Unmarshal(*v, &codeID) + if err != nil { + return err + } + tc.CodeID = &codeID + } + case "command": + if v != nil { + var command string + err = json.Unmarshal(*v, &command) + if err != nil { + return err + } + tc.Command = &command + } + case "distribution": + if v != nil { + distribution, err := unmarshalBasicDistributionConfiguration(*v) + if err != nil { + return err + } + tc.Distribution = distribution + } + case "environmentId": + if v != nil { + var environmentID string + err = json.Unmarshal(*v, &environmentID) + if err != nil { + return err + } + tc.EnvironmentID = &environmentID + } + case "environmentVariables": + if v != nil { + var environmentVariables map[string]*string + err = json.Unmarshal(*v, &environmentVariables) + if err != nil { + return err + } + tc.EnvironmentVariables = environmentVariables + } + case "inputDataBindings": + if v != nil { + var inputDataBindings map[string]*InputDataBinding + err = json.Unmarshal(*v, &inputDataBindings) + if err != nil { + return err + } + tc.InputDataBindings = inputDataBindings + } + case "outputDataBindings": + if v != nil { + var outputDataBindings map[string]*OutputDataBinding + err = json.Unmarshal(*v, &outputDataBindings) + if err != nil { + return err + } + tc.OutputDataBindings = outputDataBindings + } + case "timeout": + if v != nil { + var timeout string + err = json.Unmarshal(*v, &timeout) + if err != nil { + return err + } + tc.Timeout = &timeout + } + } + } + + return nil +} + +// TruncationSelectionPolicy defines an early termination policy that cancels a given percentage of runs at +// each evaluation interval. +type TruncationSelectionPolicy struct { + TruncationPercentage *int32 `json:"truncationPercentage,omitempty"` + DelayEvaluation *int32 `json:"delayEvaluation,omitempty"` + EvaluationInterval *int32 `json:"evaluationInterval,omitempty"` + // PolicyType - Possible values include: 'PolicyTypeEarlyTerminationPolicy', 'PolicyTypeBandit', 'PolicyTypeMedianStopping', 'PolicyTypeTruncationSelection' + PolicyType PolicyType `json:"policyType,omitempty"` +} + +// MarshalJSON is the custom marshaler for TruncationSelectionPolicy. +func (tsp TruncationSelectionPolicy) MarshalJSON() ([]byte, error) { + tsp.PolicyType = PolicyTypeTruncationSelection + objectMap := make(map[string]interface{}) + if tsp.TruncationPercentage != nil { + objectMap["truncationPercentage"] = tsp.TruncationPercentage + } + if tsp.DelayEvaluation != nil { + objectMap["delayEvaluation"] = tsp.DelayEvaluation + } + if tsp.EvaluationInterval != nil { + objectMap["evaluationInterval"] = tsp.EvaluationInterval + } + if tsp.PolicyType != "" { + objectMap["policyType"] = tsp.PolicyType + } + return json.Marshal(objectMap) +} + +// AsBanditPolicy is the BasicEarlyTerminationPolicy implementation for TruncationSelectionPolicy. +func (tsp TruncationSelectionPolicy) AsBanditPolicy() (*BanditPolicy, bool) { + return nil, false +} + +// AsMedianStoppingPolicy is the BasicEarlyTerminationPolicy implementation for TruncationSelectionPolicy. +func (tsp TruncationSelectionPolicy) AsMedianStoppingPolicy() (*MedianStoppingPolicy, bool) { + return nil, false +} + +// AsTruncationSelectionPolicy is the BasicEarlyTerminationPolicy implementation for TruncationSelectionPolicy. +func (tsp TruncationSelectionPolicy) AsTruncationSelectionPolicy() (*TruncationSelectionPolicy, bool) { + return &tsp, true +} + +// AsEarlyTerminationPolicy is the BasicEarlyTerminationPolicy implementation for TruncationSelectionPolicy. +func (tsp TruncationSelectionPolicy) AsEarlyTerminationPolicy() (*EarlyTerminationPolicy, bool) { + return nil, false +} + +// AsBasicEarlyTerminationPolicy is the BasicEarlyTerminationPolicy implementation for TruncationSelectionPolicy. +func (tsp TruncationSelectionPolicy) AsBasicEarlyTerminationPolicy() (BasicEarlyTerminationPolicy, bool) { + return &tsp, true +} + +// UpdateWorkspaceQuotas the properties for update Quota response. +type UpdateWorkspaceQuotas struct { + // ID - READ-ONLY; Specifies the resource ID. + ID *string `json:"id,omitempty"` + // Type - READ-ONLY; Specifies the resource type. + Type *string `json:"type,omitempty"` + // Limit - The maximum permitted quota of the resource. + Limit *int64 `json:"limit,omitempty"` + // Unit - READ-ONLY; An enum describing the unit of quota measurement. Possible values include: 'Count' + Unit QuotaUnit `json:"unit,omitempty"` + // Status - Status of update workspace quota. Possible values include: 'Undefined', 'Success', 'Failure', 'InvalidQuotaBelowClusterMinimum', 'InvalidQuotaExceedsSubscriptionLimit', 'InvalidVMFamilyName', 'OperationNotSupportedForSku', 'OperationNotEnabledForRegion' + Status Status `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for UpdateWorkspaceQuotas. +func (uwq UpdateWorkspaceQuotas) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if uwq.Limit != nil { + objectMap["limit"] = uwq.Limit + } + if uwq.Status != "" { + objectMap["status"] = uwq.Status + } + return json.Marshal(objectMap) +} + +// UpdateWorkspaceQuotasResult the result of update workspace quota. +type UpdateWorkspaceQuotasResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of workspace quota update result. + Value *[]UpdateWorkspaceQuotas `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page of workspace quota update result. Call ListNext() with this to fetch the next page of Workspace Quota update result. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for UpdateWorkspaceQuotasResult. +func (uwqr UpdateWorkspaceQuotasResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Usage describes AML Resource Usage. +type Usage struct { + // ID - READ-ONLY; Specifies the resource ID. + ID *string `json:"id,omitempty"` + // AmlWorkspaceLocation - READ-ONLY; Region of the AML workspace in the id. + AmlWorkspaceLocation *string `json:"amlWorkspaceLocation,omitempty"` + // Type - READ-ONLY; Specifies the resource type. + Type *string `json:"type,omitempty"` + // Unit - READ-ONLY; An enum describing the unit of usage measurement. Possible values include: 'UsageUnitCount' + Unit UsageUnit `json:"unit,omitempty"` + // CurrentValue - READ-ONLY; The current usage of the resource. + CurrentValue *int64 `json:"currentValue,omitempty"` + // Limit - READ-ONLY; The maximum permitted usage of the resource. + Limit *int64 `json:"limit,omitempty"` + // Name - READ-ONLY; The name of the type of usage. + Name *UsageName `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for Usage. +func (u Usage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UsageName the Usage Names. +type UsageName struct { + // Value - READ-ONLY; The name of the resource. + Value *string `json:"value,omitempty"` + // LocalizedValue - READ-ONLY; The localized name of the resource. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// MarshalJSON is the custom marshaler for UsageName. +func (un UsageName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UserAccountCredentials settings for user account that gets created on each on the nodes of a compute. +type UserAccountCredentials struct { + // AdminUserName - Name of the administrator user account which can be used to SSH to nodes. + AdminUserName *string `json:"adminUserName,omitempty"` + // AdminUserSSHPublicKey - SSH public key of the administrator user account. + AdminUserSSHPublicKey *string `json:"adminUserSshPublicKey,omitempty"` + // AdminUserPassword - Password of the administrator user account. + AdminUserPassword *string `json:"adminUserPassword,omitempty"` +} + +// UserAssignedIdentity user Assigned Identity +type UserAssignedIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of the user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of the user assigned identity. + TenantID *string `json:"tenantId,omitempty"` + // ClientID - READ-ONLY; The clientId(aka appId) of the user assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserAssignedIdentity. +func (uai UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UserAssignedIdentityMeta user assigned identities associated with a resource. +type UserAssignedIdentityMeta struct { + // ClientID - Aka application ID, a unique identifier generated by Azure AD that is tied to an application and service principal during its initial provisioning. + ClientID *string `json:"clientId,omitempty"` + // PrincipalID - The object ID of the service principal object for your managed identity that is used to grant role-based access to an Azure resource. + PrincipalID *string `json:"principalId,omitempty"` +} + +// VirtualMachine a Machine Learning compute based on Azure Virtual Machines. +type VirtualMachine struct { + Properties *VirtualMachineProperties `json:"properties,omitempty"` + // ComputeLocation - Location for the underlying compute + ComputeLocation *string `json:"computeLocation,omitempty"` + // ProvisioningState - READ-ONLY; The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Possible values include: 'ProvisioningStateUnknown', 'ProvisioningStateUpdating', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Description - The description of the Machine Learning compute. + Description *string `json:"description,omitempty"` + // CreatedOn - READ-ONLY; The time at which the compute was created. + CreatedOn *date.Time `json:"createdOn,omitempty"` + // ModifiedOn - READ-ONLY; The time at which the compute was last modified. + ModifiedOn *date.Time `json:"modifiedOn,omitempty"` + // ResourceID - ARM resource id of the underlying compute + ResourceID *string `json:"resourceId,omitempty"` + // ProvisioningErrors - READ-ONLY; Errors during provisioning + ProvisioningErrors *[]ErrorResponse `json:"provisioningErrors,omitempty"` + // 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. + IsAttachedCompute *bool `json:"isAttachedCompute,omitempty"` + // DisableLocalAuth - Opt-out of local authentication and ensure customers can use only MSI and AAD exclusively for authentication. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + // ComputeType - Possible values include: 'ComputeTypeCompute', 'ComputeTypeAKS1', 'ComputeTypeAmlCompute1', 'ComputeTypeComputeInstance1', 'ComputeTypeVirtualMachine1', 'ComputeTypeHDInsight1', 'ComputeTypeDataFactory1', 'ComputeTypeDatabricks1', 'ComputeTypeDataLakeAnalytics1' + ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualMachine. +func (VM VirtualMachine) MarshalJSON() ([]byte, error) { + VM.ComputeType = ComputeTypeVirtualMachine1 + objectMap := make(map[string]interface{}) + if VM.Properties != nil { + objectMap["properties"] = VM.Properties + } + if VM.ComputeLocation != nil { + objectMap["computeLocation"] = VM.ComputeLocation + } + if VM.Description != nil { + objectMap["description"] = VM.Description + } + if VM.ResourceID != nil { + objectMap["resourceId"] = VM.ResourceID + } + if VM.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = VM.DisableLocalAuth + } + if VM.ComputeType != "" { + objectMap["computeType"] = VM.ComputeType + } + return json.Marshal(objectMap) +} + +// AsAKS is the BasicCompute implementation for VirtualMachine. +func (VM VirtualMachine) AsAKS() (*AKS, bool) { + return nil, false +} + +// AsAmlCompute is the BasicCompute implementation for VirtualMachine. +func (VM VirtualMachine) AsAmlCompute() (*AmlCompute, bool) { + return nil, false +} + +// AsComputeInstance is the BasicCompute implementation for VirtualMachine. +func (VM VirtualMachine) AsComputeInstance() (*ComputeInstance, bool) { + return nil, false +} + +// AsVirtualMachine is the BasicCompute implementation for VirtualMachine. +func (VM VirtualMachine) AsVirtualMachine() (*VirtualMachine, bool) { + return &VM, true +} + +// AsHDInsight is the BasicCompute implementation for VirtualMachine. +func (VM VirtualMachine) AsHDInsight() (*HDInsight, bool) { + return nil, false +} + +// AsDataFactory is the BasicCompute implementation for VirtualMachine. +func (VM VirtualMachine) AsDataFactory() (*DataFactory, bool) { + return nil, false +} + +// AsDatabricks is the BasicCompute implementation for VirtualMachine. +func (VM VirtualMachine) AsDatabricks() (*Databricks, bool) { + return nil, false +} + +// AsDataLakeAnalytics is the BasicCompute implementation for VirtualMachine. +func (VM VirtualMachine) AsDataLakeAnalytics() (*DataLakeAnalytics, bool) { + return nil, false +} + +// AsCompute is the BasicCompute implementation for VirtualMachine. +func (VM VirtualMachine) AsCompute() (*Compute, bool) { + return nil, false +} + +// AsBasicCompute is the BasicCompute implementation for VirtualMachine. +func (VM VirtualMachine) AsBasicCompute() (BasicCompute, bool) { + return &VM, true +} + +// VirtualMachineImage virtual Machine image for Windows AML Compute +type VirtualMachineImage struct { + // ID - Virtual Machine image path + ID *string `json:"id,omitempty"` +} + +// VirtualMachineProperties ... +type VirtualMachineProperties struct { + // VirtualMachineSize - Virtual Machine size + VirtualMachineSize *string `json:"virtualMachineSize,omitempty"` + // SSHPort - Port open for ssh connections. + SSHPort *int32 `json:"sshPort,omitempty"` + // Address - Public IP address of the virtual machine. + Address *string `json:"address,omitempty"` + // AdministratorAccount - Admin credentials for virtual machine + AdministratorAccount *VirtualMachineSSHCredentials `json:"administratorAccount,omitempty"` + // IsNotebookInstanceCompute - Indicates whether this compute will be used for running notebooks. + IsNotebookInstanceCompute *bool `json:"isNotebookInstanceCompute,omitempty"` +} + +// VirtualMachineSecrets secrets related to a Machine Learning compute based on AKS. +type VirtualMachineSecrets struct { + // AdministratorAccount - Admin credentials for virtual machine. + AdministratorAccount *VirtualMachineSSHCredentials `json:"administratorAccount,omitempty"` + // ComputeType - Possible values include: 'ComputeTypeBasicComputeSecretsComputeTypeComputeSecrets', 'ComputeTypeBasicComputeSecretsComputeTypeAKS', 'ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine', 'ComputeTypeBasicComputeSecretsComputeTypeDatabricks' + ComputeType ComputeTypeBasicComputeSecrets `json:"computeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineSecrets. +func (vms VirtualMachineSecrets) MarshalJSON() ([]byte, error) { + vms.ComputeType = ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine + objectMap := make(map[string]interface{}) + if vms.AdministratorAccount != nil { + objectMap["administratorAccount"] = vms.AdministratorAccount + } + if vms.ComputeType != "" { + objectMap["computeType"] = vms.ComputeType + } + return json.Marshal(objectMap) +} + +// AsAksComputeSecrets is the BasicComputeSecrets implementation for VirtualMachineSecrets. +func (vms VirtualMachineSecrets) AsAksComputeSecrets() (*AksComputeSecrets, bool) { + return nil, false +} + +// AsVirtualMachineSecrets is the BasicComputeSecrets implementation for VirtualMachineSecrets. +func (vms VirtualMachineSecrets) AsVirtualMachineSecrets() (*VirtualMachineSecrets, bool) { + return &vms, true +} + +// AsDatabricksComputeSecrets is the BasicComputeSecrets implementation for VirtualMachineSecrets. +func (vms VirtualMachineSecrets) AsDatabricksComputeSecrets() (*DatabricksComputeSecrets, bool) { + return nil, false +} + +// AsComputeSecrets is the BasicComputeSecrets implementation for VirtualMachineSecrets. +func (vms VirtualMachineSecrets) AsComputeSecrets() (*ComputeSecrets, bool) { + return nil, false +} + +// AsBasicComputeSecrets is the BasicComputeSecrets implementation for VirtualMachineSecrets. +func (vms VirtualMachineSecrets) AsBasicComputeSecrets() (BasicComputeSecrets, bool) { + return &vms, true +} + +// VirtualMachineSize describes the properties of a VM size. +type VirtualMachineSize struct { + // Name - READ-ONLY; The name of the virtual machine size. + Name *string `json:"name,omitempty"` + // Family - READ-ONLY; The family name of the virtual machine size. + Family *string `json:"family,omitempty"` + // VCPUs - READ-ONLY; The number of vCPUs supported by the virtual machine size. + VCPUs *int32 `json:"vCPUs,omitempty"` + // Gpus - READ-ONLY; The number of gPUs supported by the virtual machine size. + Gpus *int32 `json:"gpus,omitempty"` + // OsVhdSizeMB - READ-ONLY; The OS VHD disk size, in MB, allowed by the virtual machine size. + OsVhdSizeMB *int32 `json:"osVhdSizeMB,omitempty"` + // MaxResourceVolumeMB - READ-ONLY; The resource volume size, in MB, allowed by the virtual machine size. + MaxResourceVolumeMB *int32 `json:"maxResourceVolumeMB,omitempty"` + // MemoryGB - READ-ONLY; The amount of memory, in GB, supported by the virtual machine size. + MemoryGB *float64 `json:"memoryGB,omitempty"` + // LowPriorityCapable - READ-ONLY; Specifies if the virtual machine size supports low priority VMs. + LowPriorityCapable *bool `json:"lowPriorityCapable,omitempty"` + // PremiumIO - READ-ONLY; Specifies if the virtual machine size supports premium IO. + PremiumIO *bool `json:"premiumIO,omitempty"` + // EstimatedVMPrices - The estimated price information for using a VM. + EstimatedVMPrices *EstimatedVMPrices `json:"estimatedVMPrices,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualMachineSize. +func (vms VirtualMachineSize) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vms.EstimatedVMPrices != nil { + objectMap["estimatedVMPrices"] = vms.EstimatedVMPrices + } + return json.Marshal(objectMap) +} + +// VirtualMachineSizeListResult the List Virtual Machine size operation response. +type VirtualMachineSizeListResult struct { + autorest.Response `json:"-"` + // Value - The list of virtual machine sizes supported by AmlCompute. + Value *[]VirtualMachineSize `json:"value,omitempty"` +} + +// VirtualMachineSSHCredentials admin credentials for virtual machine +type VirtualMachineSSHCredentials struct { + // Username - Username of admin account + Username *string `json:"username,omitempty"` + // Password - Password of admin account + Password *string `json:"password,omitempty"` + // PublicKeyData - Public key data + PublicKeyData *string `json:"publicKeyData,omitempty"` + // PrivateKeyData - Private key data + PrivateKeyData *string `json:"privateKeyData,omitempty"` +} + +// Workspace an object that represents a machine learning workspace. +type Workspace struct { + autorest.Response `json:"-"` + // WorkspaceProperties - The properties of the machine learning workspace. + *WorkspaceProperties `json:"properties,omitempty"` + // Identity - The identity of the resource. + Identity *Identity `json:"identity,omitempty"` + // Location - Specifies the location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Contains resource tags defined as key/value pairs. + Tags map[string]*string `json:"tags"` + // Sku - The sku of the workspace. + Sku *Sku `json:"sku,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Workspace. +func (w Workspace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if w.WorkspaceProperties != nil { + objectMap["properties"] = w.WorkspaceProperties + } + if w.Identity != nil { + objectMap["identity"] = w.Identity + } + if w.Location != nil { + objectMap["location"] = w.Location + } + if w.Tags != nil { + objectMap["tags"] = w.Tags + } + if w.Sku != nil { + objectMap["sku"] = w.Sku + } + if w.SystemData != nil { + objectMap["systemData"] = w.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Workspace struct. +func (w *Workspace) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var workspaceProperties WorkspaceProperties + err = json.Unmarshal(*v, &workspaceProperties) + if err != nil { + return err + } + w.WorkspaceProperties = &workspaceProperties + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + w.Identity = &identity + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + w.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + w.Tags = tags + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + w.Sku = &sku + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + w.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + w.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + w.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + w.Type = &typeVar + } + } + } + + return nil +} + +// WorkspaceConnection workspace connection. +type WorkspaceConnection struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; ResourceId of the workspace connection. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Friendly name of the workspace connection. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type of workspace connection. + Type *string `json:"type,omitempty"` + // WorkspaceConnectionProps - Properties of workspace connection. + *WorkspaceConnectionProps `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkspaceConnection. +func (wc WorkspaceConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wc.WorkspaceConnectionProps != nil { + objectMap["properties"] = wc.WorkspaceConnectionProps + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WorkspaceConnection struct. +func (wc *WorkspaceConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + wc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + wc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + wc.Type = &typeVar + } + case "properties": + if v != nil { + var workspaceConnectionProps WorkspaceConnectionProps + err = json.Unmarshal(*v, &workspaceConnectionProps) + if err != nil { + return err + } + wc.WorkspaceConnectionProps = &workspaceConnectionProps + } + } + } + + return nil +} + +// WorkspaceConnectionProps workspace Connection specific properties. +type WorkspaceConnectionProps struct { + // Category - Category of the workspace connection. + Category *string `json:"category,omitempty"` + // Target - Target of the workspace connection. + Target *string `json:"target,omitempty"` + // AuthType - Authorization type of the workspace connection. + AuthType *string `json:"authType,omitempty"` + // Value - Value details of the workspace connection. + Value *string `json:"value,omitempty"` + // ValueFormat - format for the workspace connection value. Possible values include: 'JSON' + ValueFormat ValueFormat `json:"valueFormat,omitempty"` +} + +// WorkspaceListResult the result of a request to list machine learning workspaces. +type WorkspaceListResult struct { + autorest.Response `json:"-"` + // 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. + Value *[]Workspace `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next list of machine learning workspaces. + NextLink *string `json:"nextLink,omitempty"` +} + +// WorkspaceListResultIterator provides access to a complete listing of Workspace values. +type WorkspaceListResultIterator struct { + i int + page WorkspaceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *WorkspaceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *WorkspaceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter WorkspaceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter WorkspaceListResultIterator) Response() WorkspaceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter WorkspaceListResultIterator) Value() Workspace { + if !iter.page.NotDone() { + return Workspace{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the WorkspaceListResultIterator type. +func NewWorkspaceListResultIterator(page WorkspaceListResultPage) WorkspaceListResultIterator { + return WorkspaceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (wlr WorkspaceListResult) IsEmpty() bool { + return wlr.Value == nil || len(*wlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (wlr WorkspaceListResult) hasNextLink() bool { + return wlr.NextLink != nil && len(*wlr.NextLink) != 0 +} + +// workspaceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (wlr WorkspaceListResult) workspaceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !wlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(wlr.NextLink))) +} + +// WorkspaceListResultPage contains a page of Workspace values. +type WorkspaceListResultPage struct { + fn func(context.Context, WorkspaceListResult) (WorkspaceListResult, error) + wlr WorkspaceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *WorkspaceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.wlr) + if err != nil { + return err + } + page.wlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *WorkspaceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page WorkspaceListResultPage) NotDone() bool { + return !page.wlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page WorkspaceListResultPage) Response() WorkspaceListResult { + return page.wlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page WorkspaceListResultPage) Values() []Workspace { + if page.wlr.IsEmpty() { + return nil + } + return *page.wlr.Value +} + +// Creates a new instance of the WorkspaceListResultPage type. +func NewWorkspaceListResultPage(cur WorkspaceListResult, getNextPage func(context.Context, WorkspaceListResult) (WorkspaceListResult, error)) WorkspaceListResultPage { + return WorkspaceListResultPage{ + fn: getNextPage, + wlr: cur, + } +} + +// WorkspaceProperties the properties of a machine learning workspace. +type WorkspaceProperties struct { + // WorkspaceID - READ-ONLY; The immutable id associated with this workspace. + WorkspaceID *string `json:"workspaceId,omitempty"` + // Description - The description of this workspace. + Description *string `json:"description,omitempty"` + // FriendlyName - The friendly name for this workspace. This name in mutable + FriendlyName *string `json:"friendlyName,omitempty"` + // KeyVault - ARM id of the key vault associated with this workspace. This cannot be changed once the workspace has been created + KeyVault *string `json:"keyVault,omitempty"` + // ApplicationInsights - ARM id of the application insights associated with this workspace. This cannot be changed once the workspace has been created + ApplicationInsights *string `json:"applicationInsights,omitempty"` + // ContainerRegistry - ARM id of the container registry associated with this workspace. This cannot be changed once the workspace has been created + ContainerRegistry *string `json:"containerRegistry,omitempty"` + // StorageAccount - ARM id of the storage account associated with this workspace. This cannot be changed once the workspace has been created + StorageAccount *string `json:"storageAccount,omitempty"` + // DiscoveryURL - Url for the discovery service to identify regional endpoints for machine learning experimentation services + DiscoveryURL *string `json:"discoveryUrl,omitempty"` + // ProvisioningState - READ-ONLY; The current deployment state of workspace resource. The provisioningState is to indicate states for resource provisioning. Possible values include: 'ProvisioningStateUnknown', 'ProvisioningStateUpdating', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Encryption - The encryption settings of Azure ML workspace. + Encryption *EncryptionProperty `json:"encryption,omitempty"` + // HbiWorkspace - The flag to signal HBI data in the workspace and reduce diagnostic data collected by the service + HbiWorkspace *bool `json:"hbiWorkspace,omitempty"` + // ServiceProvisionedResourceGroup - READ-ONLY; The name of the managed resource group created by workspace RP in customer subscription if the workspace is CMK workspace + ServiceProvisionedResourceGroup *string `json:"serviceProvisionedResourceGroup,omitempty"` + // PrivateLinkCount - READ-ONLY; Count of private connections in the workspace + PrivateLinkCount *int32 `json:"privateLinkCount,omitempty"` + // ImageBuildCompute - The compute name for image build + ImageBuildCompute *string `json:"imageBuildCompute,omitempty"` + // AllowPublicAccessWhenBehindVnet - The flag to indicate whether to allow public access when behind VNet. + AllowPublicAccessWhenBehindVnet *bool `json:"allowPublicAccessWhenBehindVnet,omitempty"` + // PrivateEndpointConnections - READ-ONLY; The list of private endpoint connections in the workspace. + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // SharedPrivateLinkResources - The list of shared private link resources in this workspace. + SharedPrivateLinkResources *[]SharedPrivateLinkResource `json:"sharedPrivateLinkResources,omitempty"` + // NotebookInfo - READ-ONLY; The notebook info of Azure ML workspace. + NotebookInfo *NotebookResourceInfo `json:"notebookInfo,omitempty"` + // ServiceManagedResourcesSettings - The service managed resource settings. + ServiceManagedResourcesSettings *ServiceManagedResourcesSettings `json:"serviceManagedResourcesSettings,omitempty"` + // PrimaryUserAssignedIdentity - The user assigned identity resource id that represents the workspace identity. + PrimaryUserAssignedIdentity *string `json:"primaryUserAssignedIdentity,omitempty"` + // TenantID - READ-ONLY; The tenant id associated with this workspace. + TenantID *string `json:"tenantId,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkspaceProperties. +func (wp WorkspaceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wp.Description != nil { + objectMap["description"] = wp.Description + } + if wp.FriendlyName != nil { + objectMap["friendlyName"] = wp.FriendlyName + } + if wp.KeyVault != nil { + objectMap["keyVault"] = wp.KeyVault + } + if wp.ApplicationInsights != nil { + objectMap["applicationInsights"] = wp.ApplicationInsights + } + if wp.ContainerRegistry != nil { + objectMap["containerRegistry"] = wp.ContainerRegistry + } + if wp.StorageAccount != nil { + objectMap["storageAccount"] = wp.StorageAccount + } + if wp.DiscoveryURL != nil { + objectMap["discoveryUrl"] = wp.DiscoveryURL + } + if wp.Encryption != nil { + objectMap["encryption"] = wp.Encryption + } + if wp.HbiWorkspace != nil { + objectMap["hbiWorkspace"] = wp.HbiWorkspace + } + if wp.ImageBuildCompute != nil { + objectMap["imageBuildCompute"] = wp.ImageBuildCompute + } + if wp.AllowPublicAccessWhenBehindVnet != nil { + objectMap["allowPublicAccessWhenBehindVnet"] = wp.AllowPublicAccessWhenBehindVnet + } + if wp.SharedPrivateLinkResources != nil { + objectMap["sharedPrivateLinkResources"] = wp.SharedPrivateLinkResources + } + if wp.ServiceManagedResourcesSettings != nil { + objectMap["serviceManagedResourcesSettings"] = wp.ServiceManagedResourcesSettings + } + if wp.PrimaryUserAssignedIdentity != nil { + objectMap["primaryUserAssignedIdentity"] = wp.PrimaryUserAssignedIdentity + } + return json.Marshal(objectMap) +} + +// WorkspacePropertiesUpdateParameters the parameters for updating the properties of a machine learning +// workspace. +type WorkspacePropertiesUpdateParameters struct { + // Description - The description of this workspace. + Description *string `json:"description,omitempty"` + // FriendlyName - The friendly name for this workspace. + FriendlyName *string `json:"friendlyName,omitempty"` + // ImageBuildCompute - The compute name for image build + ImageBuildCompute *string `json:"imageBuildCompute,omitempty"` + // ServiceManagedResourcesSettings - The service managed resource settings. + ServiceManagedResourcesSettings *ServiceManagedResourcesSettings `json:"serviceManagedResourcesSettings,omitempty"` + // PrimaryUserAssignedIdentity - The user assigned identity resource id that represents the workspace identity. + PrimaryUserAssignedIdentity *string `json:"primaryUserAssignedIdentity,omitempty"` +} + +// WorkspacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WorkspacesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WorkspacesClient) (Workspace, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WorkspacesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WorkspacesCreateOrUpdateFuture.Result. +func (future *WorkspacesCreateOrUpdateFuture) result(client WorkspacesClient) (w Workspace, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + w.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.WorkspacesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { + w, err = client.CreateOrUpdateResponder(w.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesCreateOrUpdateFuture", "Result", w.Response.Response, "Failure responding to request") + } + } + return +} + +// WorkspacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WorkspacesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WorkspacesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WorkspacesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WorkspacesDeleteFuture.Result. +func (future *WorkspacesDeleteFuture) result(client WorkspacesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.WorkspacesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// WorkspaceSku describes Workspace Sku details and features +type WorkspaceSku struct { + // Locations - READ-ONLY; The set of locations that the SKU is available. This will be supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). + Locations *[]string `json:"locations,omitempty"` + // LocationInfo - READ-ONLY; A list of locations and availability zones in those locations where the SKU is available. + LocationInfo *[]ResourceSkuLocationInfo `json:"locationInfo,omitempty"` + // Tier - READ-ONLY; Sku Tier like Basic or Enterprise + Tier *string `json:"tier,omitempty"` + // ResourceType - READ-ONLY + ResourceType *string `json:"resourceType,omitempty"` + // Name - READ-ONLY + Name *string `json:"name,omitempty"` + // Capabilities - READ-ONLY; List of features/user capabilities associated with the sku + Capabilities *[]SKUCapability `json:"capabilities,omitempty"` + // Restrictions - The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. + Restrictions *[]Restriction `json:"restrictions,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkspaceSku. +func (ws WorkspaceSku) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ws.Restrictions != nil { + objectMap["restrictions"] = ws.Restrictions + } + return json.Marshal(objectMap) +} + +// WorkspacesPrepareNotebookFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WorkspacesPrepareNotebookFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WorkspacesClient) (NotebookResourceInfo, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WorkspacesPrepareNotebookFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WorkspacesPrepareNotebookFuture.Result. +func (future *WorkspacesPrepareNotebookFuture) result(client WorkspacesClient) (nri NotebookResourceInfo, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesPrepareNotebookFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + nri.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.WorkspacesPrepareNotebookFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if nri.Response.Response, err = future.GetResult(sender); err == nil && nri.Response.Response.StatusCode != http.StatusNoContent { + nri, err = client.PrepareNotebookResponder(nri.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesPrepareNotebookFuture", "Result", nri.Response.Response, "Failure responding to request") + } + } + return +} + +// WorkspacesResyncKeysFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WorkspacesResyncKeysFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WorkspacesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WorkspacesResyncKeysFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WorkspacesResyncKeysFuture.Result. +func (future *WorkspacesResyncKeysFuture) result(client WorkspacesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesResyncKeysFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.WorkspacesResyncKeysFuture") + return + } + ar.Response = future.Response() + return +} + +// WorkspaceUpdateParameters the parameters for updating a machine learning workspace. +type WorkspaceUpdateParameters struct { + // Tags - The resource tags for the machine learning workspace. + Tags map[string]*string `json:"tags"` + // Sku - The sku of the workspace. + Sku *Sku `json:"sku,omitempty"` + // Identity - The identity of the resource. + Identity *Identity `json:"identity,omitempty"` + // WorkspacePropertiesUpdateParameters - The properties that the machine learning workspace will be updated with. + *WorkspacePropertiesUpdateParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkspaceUpdateParameters. +func (wup WorkspaceUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wup.Tags != nil { + objectMap["tags"] = wup.Tags + } + if wup.Sku != nil { + objectMap["sku"] = wup.Sku + } + if wup.Identity != nil { + objectMap["identity"] = wup.Identity + } + if wup.WorkspacePropertiesUpdateParameters != nil { + objectMap["properties"] = wup.WorkspacePropertiesUpdateParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WorkspaceUpdateParameters struct. +func (wup *WorkspaceUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + wup.Tags = tags + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + wup.Sku = &sku + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + wup.Identity = &identity + } + case "properties": + if v != nil { + var workspacePropertiesUpdateParameters WorkspacePropertiesUpdateParameters + err = json.Unmarshal(*v, &workspacePropertiesUpdateParameters) + if err != nil { + return err + } + wup.WorkspacePropertiesUpdateParameters = &workspacePropertiesUpdateParameters + } + } + } + + return nil +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/modelversions.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/modelversions.go new file mode 100644 index 000000000000..122770e33dac --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/modelversions.go @@ -0,0 +1,470 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ModelVersionsClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type ModelVersionsClient struct { + BaseClient +} + +// NewModelVersionsClient creates an instance of the ModelVersionsClient client. +func NewModelVersionsClient(subscriptionID string) ModelVersionsClient { + return NewModelVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewModelVersionsClientWithBaseURI creates an instance of the ModelVersionsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewModelVersionsClientWithBaseURI(baseURI string, subscriptionID string) ModelVersionsClient { + return ModelVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// name - container name. +// version - version identifier. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - version entity to create or update. +func (client ModelVersionsClient) CreateOrUpdate(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string, body ModelVersionResource) (result ModelVersionResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelVersionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.Path", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.Path", Name: validation.Pattern, Rule: `[a-zA-Z0-9_]`, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ModelVersionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, name, version, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelVersionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelVersionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelVersionsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ModelVersionsClient) CreateOrUpdatePreparer(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string, body ModelVersionResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "version": autorest.Encode("path", version), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ModelVersionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ModelVersionsClient) CreateOrUpdateResponder(resp *http.Response) (result ModelVersionResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// name - container name. +// version - version identifier. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client ModelVersionsClient) Delete(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelVersionsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ModelVersionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, name, version, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelVersionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelVersionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelVersionsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ModelVersionsClient) DeletePreparer(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "version": autorest.Encode("path", version), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ModelVersionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ModelVersionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// name - container name. +// version - version identifier. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client ModelVersionsClient) Get(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (result ModelVersionResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelVersionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ModelVersionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, name, version, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelVersionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelVersionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelVersionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ModelVersionsClient) GetPreparer(ctx context.Context, name string, version string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "version": autorest.Encode("path", version), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ModelVersionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ModelVersionsClient) GetResponder(resp *http.Response) (result ModelVersionResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// name - model name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// skip - continuation token for pagination. +// orderBy - ordering of list. +// top - maximum number of records to return. +// version - model version. +// description - model description. +// offset - number of initial results to skip. +// tags - comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2 +// properties - comma-separated list of property names (and optionally values). Example: prop1,prop2=value2 +func (client ModelVersionsClient) List(ctx context.Context, name string, resourceGroupName string, workspaceName string, skip string, orderBy string, top *int32, version string, description string, offset *int32, tags string, properties string) (result ModelVersionResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelVersionsClient.List") + defer func() { + sc := -1 + if result.mvrapr.Response.Response != nil { + sc = result.mvrapr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ModelVersionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, name, resourceGroupName, workspaceName, skip, orderBy, top, version, description, offset, tags, properties) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mvrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelVersionsClient", "List", resp, "Failure sending request") + return + } + + result.mvrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelVersionsClient", "List", resp, "Failure responding to request") + return + } + if result.mvrapr.hasNextLink() && result.mvrapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ModelVersionsClient) ListPreparer(ctx context.Context, name string, resourceGroupName string, workspaceName string, skip string, orderBy string, top *int32, version string, description string, offset *int32, tags string, properties string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + if len(orderBy) > 0 { + queryParameters["$orderBy"] = autorest.Encode("query", orderBy) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(version) > 0 { + queryParameters["version"] = autorest.Encode("query", version) + } + if len(description) > 0 { + queryParameters["description"] = autorest.Encode("query", description) + } + if offset != nil { + queryParameters["offset"] = autorest.Encode("query", *offset) + } + if len(tags) > 0 { + queryParameters["tags"] = autorest.Encode("query", tags) + } + if len(properties) > 0 { + queryParameters["properties"] = autorest.Encode("query", properties) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ModelVersionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ModelVersionsClient) ListResponder(resp *http.Response) (result ModelVersionResourceArmPaginatedResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ModelVersionsClient) listNextResults(ctx context.Context, lastResults ModelVersionResourceArmPaginatedResult) (result ModelVersionResourceArmPaginatedResult, err error) { + req, err := lastResults.modelVersionResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.ModelVersionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.ModelVersionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ModelVersionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ModelVersionsClient) ListComplete(ctx context.Context, name string, resourceGroupName string, workspaceName string, skip string, orderBy string, top *int32, version string, description string, offset *int32, tags string, properties string) (result ModelVersionResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ModelVersionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, name, resourceGroupName, workspaceName, skip, orderBy, top, version, description, offset, tags, properties) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/onlinedeployments.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/onlinedeployments.go new file mode 100644 index 000000000000..d5694f1add06 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/onlinedeployments.go @@ -0,0 +1,642 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OnlineDeploymentsClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type OnlineDeploymentsClient struct { + BaseClient +} + +// NewOnlineDeploymentsClient creates an instance of the OnlineDeploymentsClient client. +func NewOnlineDeploymentsClient(subscriptionID string) OnlineDeploymentsClient { + return NewOnlineDeploymentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOnlineDeploymentsClientWithBaseURI creates an instance of the OnlineDeploymentsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewOnlineDeploymentsClientWithBaseURI(baseURI string, subscriptionID string) OnlineDeploymentsClient { + return OnlineDeploymentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// endpointName - inference endpoint name. +// deploymentName - inference Endpoint Deployment name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - inference Endpoint entity to apply during operation. +func (client OnlineDeploymentsClient) CreateOrUpdate(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string, body OnlineDeploymentTrackedResource) (result OnlineDeploymentsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineDeploymentsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: endpointName, + Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineDeploymentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, endpointName, deploymentName, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client OnlineDeploymentsClient) CreateOrUpdatePreparer(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string, body OnlineDeploymentTrackedResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client OnlineDeploymentsClient) CreateOrUpdateSender(req *http.Request) (future OnlineDeploymentsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client OnlineDeploymentsClient) CreateOrUpdateResponder(resp *http.Response) (result OnlineDeploymentTrackedResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// endpointName - inference endpoint name. +// deploymentName - inference Endpoint Deployment name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client OnlineDeploymentsClient) Delete(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string) (result OnlineDeploymentsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineDeploymentsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineDeploymentsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, endpointName, deploymentName, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client OnlineDeploymentsClient) DeletePreparer(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client OnlineDeploymentsClient) DeleteSender(req *http.Request) (future OnlineDeploymentsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client OnlineDeploymentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// endpointName - inference endpoint name. +// deploymentName - inference Endpoint Deployment name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client OnlineDeploymentsClient) Get(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string) (result OnlineDeploymentTrackedResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineDeploymentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineDeploymentsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, endpointName, deploymentName, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OnlineDeploymentsClient) GetPreparer(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client OnlineDeploymentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client OnlineDeploymentsClient) GetResponder(resp *http.Response) (result OnlineDeploymentTrackedResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLogs sends the get logs request. +// Parameters: +// endpointName - inference endpoint name. +// deploymentName - the name and identifier for the endpoint. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - the request containing parameters for retrieving logs. +func (client OnlineDeploymentsClient) GetLogs(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string, body DeploymentLogsRequest) (result DeploymentLogs, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineDeploymentsClient.GetLogs") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineDeploymentsClient", "GetLogs", err.Error()) + } + + req, err := client.GetLogsPreparer(ctx, endpointName, deploymentName, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "GetLogs", nil, "Failure preparing request") + return + } + + resp, err := client.GetLogsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "GetLogs", resp, "Failure sending request") + return + } + + result, err = client.GetLogsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "GetLogs", resp, "Failure responding to request") + return + } + + return +} + +// GetLogsPreparer prepares the GetLogs request. +func (client OnlineDeploymentsClient) GetLogsPreparer(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string, body DeploymentLogsRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}/getLogs", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetLogsSender sends the GetLogs request. The method will close the +// http.Response Body if it receives an error. +func (client OnlineDeploymentsClient) GetLogsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetLogsResponder handles the response to the GetLogs request. The method always +// closes the http.Response Body. +func (client OnlineDeploymentsClient) GetLogsResponder(resp *http.Response) (result DeploymentLogs, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// endpointName - inference endpoint name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// orderBy - ordering of list. +// top - top of list. +// skip - continuation token for pagination. +func (client OnlineDeploymentsClient) List(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (result OnlineDeploymentTrackedResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineDeploymentsClient.List") + defer func() { + sc := -1 + if result.odtrapr.Response.Response != nil { + sc = result.odtrapr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineDeploymentsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, endpointName, resourceGroupName, workspaceName, orderBy, top, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.odtrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "List", resp, "Failure sending request") + return + } + + result.odtrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "List", resp, "Failure responding to request") + return + } + if result.odtrapr.hasNextLink() && result.odtrapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OnlineDeploymentsClient) ListPreparer(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(orderBy) > 0 { + queryParameters["$orderBy"] = autorest.Encode("query", orderBy) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OnlineDeploymentsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OnlineDeploymentsClient) ListResponder(resp *http.Response) (result OnlineDeploymentTrackedResourceArmPaginatedResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OnlineDeploymentsClient) listNextResults(ctx context.Context, lastResults OnlineDeploymentTrackedResourceArmPaginatedResult) (result OnlineDeploymentTrackedResourceArmPaginatedResult, err error) { + req, err := lastResults.onlineDeploymentTrackedResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OnlineDeploymentsClient) ListComplete(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, orderBy string, top *int32, skip string) (result OnlineDeploymentTrackedResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineDeploymentsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, endpointName, resourceGroupName, workspaceName, orderBy, top, skip) + return +} + +// Update sends the update request. +// Parameters: +// endpointName - online Endpoint name. +// deploymentName - inference Endpoint Deployment name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - online Endpoint entity to apply during operation. +func (client OnlineDeploymentsClient) Update(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string, body PartialOnlineDeploymentPartialTrackedResource) (result OnlineDeploymentsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineDeploymentsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: endpointName, + Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: deploymentName, + Constraints: []validation.Constraint{{Target: "deploymentName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineDeploymentsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, endpointName, deploymentName, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client OnlineDeploymentsClient) UpdatePreparer(ctx context.Context, endpointName string, deploymentName string, resourceGroupName string, workspaceName string, body PartialOnlineDeploymentPartialTrackedResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deploymentName": autorest.Encode("path", deploymentName), + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client OnlineDeploymentsClient) UpdateSender(req *http.Request) (future OnlineDeploymentsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client OnlineDeploymentsClient) UpdateResponder(resp *http.Response) (result OnlineDeploymentTrackedResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/onlineendpoints.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/onlineendpoints.go new file mode 100644 index 000000000000..889c2172fa30 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/onlineendpoints.go @@ -0,0 +1,818 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OnlineEndpointsClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type OnlineEndpointsClient struct { + BaseClient +} + +// NewOnlineEndpointsClient creates an instance of the OnlineEndpointsClient client. +func NewOnlineEndpointsClient(subscriptionID string) OnlineEndpointsClient { + return NewOnlineEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOnlineEndpointsClientWithBaseURI creates an instance of the OnlineEndpointsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOnlineEndpointsClientWithBaseURI(baseURI string, subscriptionID string) OnlineEndpointsClient { + return OnlineEndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// endpointName - online Endpoint name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - online Endpoint entity to apply during operation. +func (client OnlineEndpointsClient) CreateOrUpdate(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, body OnlineEndpointTrackedResource) (result OnlineEndpointsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineEndpointsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: endpointName, + Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineEndpointsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, endpointName, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client OnlineEndpointsClient) CreateOrUpdatePreparer(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, body OnlineEndpointTrackedResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client OnlineEndpointsClient) CreateOrUpdateSender(req *http.Request) (future OnlineEndpointsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client OnlineEndpointsClient) CreateOrUpdateResponder(resp *http.Response) (result OnlineEndpointTrackedResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// endpointName - online Endpoint name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client OnlineEndpointsClient) Delete(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (result OnlineEndpointsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineEndpointsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineEndpointsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, endpointName, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client OnlineEndpointsClient) DeletePreparer(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client OnlineEndpointsClient) DeleteSender(req *http.Request) (future OnlineEndpointsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client OnlineEndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// endpointName - online Endpoint name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client OnlineEndpointsClient) Get(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (result OnlineEndpointTrackedResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineEndpointsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineEndpointsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, endpointName, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OnlineEndpointsClient) GetPreparer(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client OnlineEndpointsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client OnlineEndpointsClient) GetResponder(resp *http.Response) (result OnlineEndpointTrackedResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetToken sends the get token request. +// Parameters: +// endpointName - online Endpoint name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client OnlineEndpointsClient) GetToken(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (result EndpointAuthToken, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineEndpointsClient.GetToken") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineEndpointsClient", "GetToken", err.Error()) + } + + req, err := client.GetTokenPreparer(ctx, endpointName, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "GetToken", nil, "Failure preparing request") + return + } + + resp, err := client.GetTokenSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "GetToken", resp, "Failure sending request") + return + } + + result, err = client.GetTokenResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "GetToken", resp, "Failure responding to request") + return + } + + return +} + +// GetTokenPreparer prepares the GetToken request. +func (client OnlineEndpointsClient) GetTokenPreparer(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/token", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetTokenSender sends the GetToken request. The method will close the +// http.Response Body if it receives an error. +func (client OnlineEndpointsClient) GetTokenSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetTokenResponder handles the response to the GetToken request. The method always +// closes the http.Response Body. +func (client OnlineEndpointsClient) GetTokenResponder(resp *http.Response) (result EndpointAuthToken, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - name of the endpoint. +// count - number of endpoints to be retrieved in a page of results. +// computeType - endpointComputeType to be filtered by. +// skip - continuation token for pagination. +// tags - a set of tags with which to filter the returned models. It is a comma separated string of tags key or +// tags key=value. Example: tagKey1,tagKey2,tagKey3=value3 . +// properties - a set of properties with which to filter the returned models. It is a comma separated string of +// properties key and/or properties key=value Example: propKey1,propKey2,propKey3=value3 . +// orderBy - the option to order the response. +func (client OnlineEndpointsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, name string, count *int32, computeType EndpointComputeType, skip string, tags string, properties string, orderBy OrderString) (result OnlineEndpointTrackedResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineEndpointsClient.List") + defer func() { + sc := -1 + if result.oetrapr.Response.Response != nil { + sc = result.oetrapr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineEndpointsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, name, count, computeType, skip, tags, properties, orderBy) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.oetrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "List", resp, "Failure sending request") + return + } + + result.oetrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "List", resp, "Failure responding to request") + return + } + if result.oetrapr.hasNextLink() && result.oetrapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OnlineEndpointsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, count *int32, computeType EndpointComputeType, skip string, tags string, properties string, orderBy OrderString) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(name) > 0 { + queryParameters["name"] = autorest.Encode("query", name) + } + if count != nil { + queryParameters["count"] = autorest.Encode("query", *count) + } + if len(string(computeType)) > 0 { + queryParameters["computeType"] = autorest.Encode("query", computeType) + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + if len(tags) > 0 { + queryParameters["tags"] = autorest.Encode("query", tags) + } + if len(properties) > 0 { + queryParameters["properties"] = autorest.Encode("query", properties) + } + if len(string(orderBy)) > 0 { + queryParameters["orderBy"] = autorest.Encode("query", orderBy) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OnlineEndpointsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OnlineEndpointsClient) ListResponder(resp *http.Response) (result OnlineEndpointTrackedResourceArmPaginatedResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OnlineEndpointsClient) listNextResults(ctx context.Context, lastResults OnlineEndpointTrackedResourceArmPaginatedResult) (result OnlineEndpointTrackedResourceArmPaginatedResult, err error) { + req, err := lastResults.onlineEndpointTrackedResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OnlineEndpointsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, name string, count *int32, computeType EndpointComputeType, skip string, tags string, properties string, orderBy OrderString) (result OnlineEndpointTrackedResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineEndpointsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName, name, count, computeType, skip, tags, properties, orderBy) + return +} + +// ListKeys sends the list keys request. +// Parameters: +// endpointName - online Endpoint name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client OnlineEndpointsClient) ListKeys(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (result EndpointAuthKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineEndpointsClient.ListKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineEndpointsClient", "ListKeys", err.Error()) + } + + req, err := client.ListKeysPreparer(ctx, endpointName, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "ListKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client OnlineEndpointsClient) ListKeysPreparer(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client OnlineEndpointsClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client OnlineEndpointsClient) ListKeysResponder(resp *http.Response) (result EndpointAuthKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKeys sends the regenerate keys request. +// Parameters: +// endpointName - online Endpoint name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - regenerateKeys request . +func (client OnlineEndpointsClient) RegenerateKeys(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, body RegenerateEndpointKeysRequest) (result OnlineEndpointsRegenerateKeysFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineEndpointsClient.RegenerateKeys") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineEndpointsClient", "RegenerateKeys", err.Error()) + } + + req, err := client.RegenerateKeysPreparer(ctx, endpointName, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "RegenerateKeys", nil, "Failure preparing request") + return + } + + result, err = client.RegenerateKeysSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "RegenerateKeys", nil, "Failure sending request") + return + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client OnlineEndpointsClient) RegenerateKeysPreparer(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, body RegenerateEndpointKeysRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/regenerateKeys", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateKeysSender sends the RegenerateKeys request. The method will close the +// http.Response Body if it receives an error. +func (client OnlineEndpointsClient) RegenerateKeysSender(req *http.Request) (future OnlineEndpointsRegenerateKeysFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always +// closes the http.Response Body. +func (client OnlineEndpointsClient) RegenerateKeysResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update sends the update request. +// Parameters: +// endpointName - online Endpoint name. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// body - online Endpoint entity to apply during operation. +func (client OnlineEndpointsClient) Update(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, body PartialOnlineEndpointPartialTrackedResource) (result OnlineEndpointsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineEndpointsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineEndpointsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, endpointName, resourceGroupName, workspaceName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineEndpointsClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client OnlineEndpointsClient) UpdatePreparer(ctx context.Context, endpointName string, resourceGroupName string, workspaceName string, body PartialOnlineEndpointPartialTrackedResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client OnlineEndpointsClient) UpdateSender(req *http.Request) (future OnlineEndpointsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client OnlineEndpointsClient) UpdateResponder(resp *http.Response) (result OnlineEndpointTrackedResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/operations.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/operations.go new file mode 100644 index 000000000000..319bd96e6c55 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/operations.go @@ -0,0 +1,98 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available Azure Machine Learning Workspaces REST API operations. +func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OperationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.MachineLearningServices/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/privateendpointconnections.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/privateendpointconnections.go new file mode 100644 index 000000000000..b1f29997377b --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/privateendpointconnections.go @@ -0,0 +1,385 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateEndpointConnectionsClient is the these APIs allow end users to operate on Azure Machine Learning Workspace +// resources. +type PrivateEndpointConnectionsClient struct { + BaseClient +} + +// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. +func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { + return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate update the state of specified private endpoint connection associated with the workspace. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// privateEndpointConnectionName - the name of the private endpoint connection associated with the workspace +// properties - the private endpoint connection properties. +func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: properties, + Constraints: []validation.Constraint{{Target: "properties.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "properties.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("machinelearningservices.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName, properties) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.PrivateEndpointConnectionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.PrivateEndpointConnectionsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, properties PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(properties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified private endpoint connection associated with the workspace. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// privateEndpointConnectionName - the name of the private endpoint connection associated with the workspace +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.PrivateEndpointConnectionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.PrivateEndpointConnectionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.PrivateEndpointConnectionsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified private endpoint connection associated with the workspace. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// privateEndpointConnectionName - the name of the private endpoint connection associated with the workspace +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.PrivateEndpointConnectionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all the private endpoint connections associated with the workspace. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateEndpointConnectionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.PrivateEndpointConnectionsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/privatelinkresources.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/privatelinkresources.go new file mode 100644 index 000000000000..326c3aa311cf --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/privatelinkresources.go @@ -0,0 +1,119 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateLinkResourcesClient is the these APIs allow end users to operate on Azure Machine Learning Workspace +// resources. +type PrivateLinkResourcesClient struct { + BaseClient +} + +// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. +func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { + return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { + return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets the private link resources that need to be created for a workspace. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateLinkResourceListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.PrivateLinkResourcesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.PrivateLinkResourcesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourcesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/quotas.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/quotas.go new file mode 100644 index 000000000000..310ae3de36ec --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/quotas.go @@ -0,0 +1,241 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// QuotasClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type QuotasClient struct { + BaseClient +} + +// NewQuotasClient creates an instance of the QuotasClient client. +func NewQuotasClient(subscriptionID string) QuotasClient { + return NewQuotasClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewQuotasClientWithBaseURI creates an instance of the QuotasClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewQuotasClientWithBaseURI(baseURI string, subscriptionID string) QuotasClient { + return QuotasClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets the currently assigned Workspace Quotas based on VMFamily. +// Parameters: +// location - the location for which resource usage is queried. +func (client QuotasClient) List(ctx context.Context, location string) (result ListWorkspaceQuotasPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QuotasClient.List") + defer func() { + sc := -1 + if result.lwq.Response.Response != nil { + sc = result.lwq.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.QuotasClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.QuotasClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lwq.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.QuotasClient", "List", resp, "Failure sending request") + return + } + + result.lwq, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.QuotasClient", "List", resp, "Failure responding to request") + return + } + if result.lwq.hasNextLink() && result.lwq.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client QuotasClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/quotas", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client QuotasClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client QuotasClient) ListResponder(resp *http.Response) (result ListWorkspaceQuotas, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client QuotasClient) listNextResults(ctx context.Context, lastResults ListWorkspaceQuotas) (result ListWorkspaceQuotas, err error) { + req, err := lastResults.listWorkspaceQuotasPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.QuotasClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.QuotasClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.QuotasClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client QuotasClient) ListComplete(ctx context.Context, location string) (result ListWorkspaceQuotasIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QuotasClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location) + return +} + +// Update update quota for each VM family in workspace. +// Parameters: +// location - the location for update quota is queried. +// parameters - quota update parameters. +func (client QuotasClient) Update(ctx context.Context, location string, parameters QuotaUpdateParameters) (result UpdateWorkspaceQuotasResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QuotasClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.QuotasClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, location, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.QuotasClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.QuotasClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.QuotasClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client QuotasClient) UpdatePreparer(ctx context.Context, location string, parameters QuotaUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/updateQuotas", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client QuotasClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client QuotasClient) UpdateResponder(resp *http.Response) (result UpdateWorkspaceQuotasResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/usages.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/usages.go new file mode 100644 index 000000000000..009f666ac19a --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/usages.go @@ -0,0 +1,156 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// UsagesClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type UsagesClient struct { + BaseClient +} + +// NewUsagesClient creates an instance of the UsagesClient client. +func NewUsagesClient(subscriptionID string) UsagesClient { + return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsagesClientWithBaseURI creates an instance of the UsagesClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient { + return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets the current usage information as well as limits for AML resources for given subscription and location. +// Parameters: +// location - the location for which resource usage is queried. +func (client UsagesClient) List(ctx context.Context, location string) (result ListUsagesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.List") + defer func() { + sc := -1 + if result.lur.Response.Response != nil { + sc = result.lur.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.UsagesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.UsagesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lur.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.UsagesClient", "List", resp, "Failure sending request") + return + } + + result.lur, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.UsagesClient", "List", resp, "Failure responding to request") + return + } + if result.lur.hasNextLink() && result.lur.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client UsagesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsagesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsagesClient) ListResponder(resp *http.Response) (result ListUsagesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client UsagesClient) listNextResults(ctx context.Context, lastResults ListUsagesResult) (result ListUsagesResult, err error) { + req, err := lastResults.listUsagesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.UsagesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.UsagesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.UsagesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client UsagesClient) ListComplete(ctx context.Context, location string) (result ListUsagesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/version.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/version.go new file mode 100644 index 000000000000..a8e693e914c6 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/version.go @@ -0,0 +1,19 @@ +package machinelearningservices + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " machinelearningservices/2021-03-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/virtualmachinesizes.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/virtualmachinesizes.go new file mode 100644 index 000000000000..d9b5099b625c --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/virtualmachinesizes.go @@ -0,0 +1,116 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualMachineSizesClient is the these APIs allow end users to operate on Azure Machine Learning Workspace +// resources. +type VirtualMachineSizesClient struct { + BaseClient +} + +// NewVirtualMachineSizesClient creates an instance of the VirtualMachineSizesClient client. +func NewVirtualMachineSizesClient(subscriptionID string) VirtualMachineSizesClient { + return NewVirtualMachineSizesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineSizesClientWithBaseURI creates an instance of the VirtualMachineSizesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewVirtualMachineSizesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineSizesClient { + return VirtualMachineSizesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List returns supported VM Sizes in a location +// Parameters: +// location - the location upon which virtual-machine-sizes is queried. +func (client VirtualMachineSizesClient) List(ctx context.Context, location string) (result VirtualMachineSizeListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineSizesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.VirtualMachineSizesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.VirtualMachineSizesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.VirtualMachineSizesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.VirtualMachineSizesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachineSizesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/vmSizes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineSizesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualMachineSizesClient) ListResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/workspaceconnections.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/workspaceconnections.go new file mode 100644 index 000000000000..89b9f7302ee4 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/workspaceconnections.go @@ -0,0 +1,393 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WorkspaceConnectionsClient is the these APIs allow end users to operate on Azure Machine Learning Workspace +// resources. +type WorkspaceConnectionsClient struct { + BaseClient +} + +// NewWorkspaceConnectionsClient creates an instance of the WorkspaceConnectionsClient client. +func NewWorkspaceConnectionsClient(subscriptionID string) WorkspaceConnectionsClient { + return NewWorkspaceConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkspaceConnectionsClientWithBaseURI creates an instance of the WorkspaceConnectionsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewWorkspaceConnectionsClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceConnectionsClient { + return WorkspaceConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create add a new workspace connection. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// connectionName - friendly name of the workspace connection +// parameters - the object for creating or updating a new workspace connection +func (client WorkspaceConnectionsClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, connectionName string, parameters WorkspaceConnection) (result WorkspaceConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceConnectionsClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.WorkspaceConnectionsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, workspaceName, connectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceConnectionsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceConnectionsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceConnectionsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client WorkspaceConnectionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, connectionName string, parameters WorkspaceConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceConnectionsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client WorkspaceConnectionsClient) CreateResponder(resp *http.Response) (result WorkspaceConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a workspace connection. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// connectionName - friendly name of the workspace connection +func (client WorkspaceConnectionsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, connectionName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceConnectionsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.WorkspaceConnectionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceConnectionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceConnectionsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WorkspaceConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceConnectionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WorkspaceConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the detail of a workspace connection. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// connectionName - friendly name of the workspace connection +func (client WorkspaceConnectionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, connectionName string) (result WorkspaceConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.WorkspaceConnectionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client WorkspaceConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WorkspaceConnectionsClient) GetResponder(resp *http.Response) (result WorkspaceConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all connections under a AML workspace. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// target - target of the workspace connection. +// category - category of the workspace connection. +func (client WorkspaceConnectionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, target string, category string) (result PaginatedWorkspaceConnectionsList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceConnectionsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.WorkspaceConnectionsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, target, category) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceConnectionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceConnectionsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client WorkspaceConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, target string, category string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(target) > 0 { + queryParameters["target"] = autorest.Encode("query", target) + } + if len(category) > 0 { + queryParameters["category"] = autorest.Encode("query", category) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WorkspaceConnectionsClient) ListResponder(resp *http.Response) (result PaginatedWorkspaceConnectionsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/workspacefeatures.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/workspacefeatures.go new file mode 100644 index 000000000000..d41e3696f26a --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/workspacefeatures.go @@ -0,0 +1,160 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WorkspaceFeaturesClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type WorkspaceFeaturesClient struct { + BaseClient +} + +// NewWorkspaceFeaturesClient creates an instance of the WorkspaceFeaturesClient client. +func NewWorkspaceFeaturesClient(subscriptionID string) WorkspaceFeaturesClient { + return NewWorkspaceFeaturesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkspaceFeaturesClientWithBaseURI creates an instance of the WorkspaceFeaturesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewWorkspaceFeaturesClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceFeaturesClient { + return WorkspaceFeaturesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all enabled features for a workspace +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client WorkspaceFeaturesClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result ListAmlUserFeatureResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceFeaturesClient.List") + defer func() { + sc := -1 + if result.laufr.Response.Response != nil { + sc = result.laufr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.WorkspaceFeaturesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceFeaturesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.laufr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceFeaturesClient", "List", resp, "Failure sending request") + return + } + + result.laufr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceFeaturesClient", "List", resp, "Failure responding to request") + return + } + if result.laufr.hasNextLink() && result.laufr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client WorkspaceFeaturesClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/features", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceFeaturesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WorkspaceFeaturesClient) ListResponder(resp *http.Response) (result ListAmlUserFeatureResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client WorkspaceFeaturesClient) listNextResults(ctx context.Context, lastResults ListAmlUserFeatureResult) (result ListAmlUserFeatureResult, err error) { + req, err := lastResults.listAmlUserFeatureResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceFeaturesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceFeaturesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceFeaturesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client WorkspaceFeaturesClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result ListAmlUserFeatureResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceFeaturesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/workspaces.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/workspaces.go new file mode 100644 index 000000000000..5f872d8ebe03 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/workspaces.go @@ -0,0 +1,1158 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WorkspacesClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type WorkspacesClient struct { + BaseClient +} + +// NewWorkspacesClient creates an instance of the WorkspacesClient client. +func NewWorkspacesClient(subscriptionID string) WorkspacesClient { + return NewWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkspacesClientWithBaseURI creates an instance of the WorkspacesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) WorkspacesClient { + return WorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a workspace with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// parameters - the parameters for creating or updating a machine learning workspace. +func (client WorkspacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, parameters Workspace) (result WorkspacesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.WorkspaceProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Encryption", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Encryption.KeyVaultProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Encryption.KeyVaultProperties.KeyVaultArmID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.WorkspaceProperties.Encryption.KeyVaultProperties.KeyIdentifier", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("machinelearningservices.WorkspacesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WorkspacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters Workspace) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) CreateOrUpdateSender(req *http.Request) (future WorkspacesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (result Workspace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a machine learning workspace. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client WorkspacesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result WorkspacesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.WorkspacesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WorkspacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) DeleteSender(req *http.Request) (future WorkspacesDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the properties of the specified machine learning workspace. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client WorkspacesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result Workspace, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.WorkspacesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client WorkspacesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) GetResponder(resp *http.Response) (result Workspace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup lists all the available machine learning workspaces under the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// skip - continuation token for pagination. +func (client WorkspacesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, skip string) (result WorkspaceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.wlr.Response.Response != nil { + sc = result.wlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.WorkspacesClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.wlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.wlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.wlr.hasNextLink() && result.wlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client WorkspacesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, skip string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) ListByResourceGroupResponder(resp *http.Response) (result WorkspaceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client WorkspacesClient) listByResourceGroupNextResults(ctx context.Context, lastResults WorkspaceListResult) (result WorkspaceListResult, err error) { + req, err := lastResults.workspaceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client WorkspacesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, skip string) (result WorkspaceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, skip) + return +} + +// ListBySubscription lists all the available machine learning workspaces under the specified subscription. +// Parameters: +// skip - continuation token for pagination. +func (client WorkspacesClient) ListBySubscription(ctx context.Context, skip string) (result WorkspaceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListBySubscription") + defer func() { + sc := -1 + if result.wlr.Response.Response != nil { + sc = result.wlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.WorkspacesClient", "ListBySubscription", err.Error()) + } + + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.wlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.wlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.wlr.hasNextLink() && result.wlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client WorkspacesClient) ListBySubscriptionPreparer(ctx context.Context, skip string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) ListBySubscriptionResponder(resp *http.Response) (result WorkspaceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client WorkspacesClient) listBySubscriptionNextResults(ctx context.Context, lastResults WorkspaceListResult) (result WorkspaceListResult, err error) { + req, err := lastResults.workspaceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client WorkspacesClient) ListBySubscriptionComplete(ctx context.Context, skip string) (result WorkspaceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx, skip) + return +} + +// ListKeys lists all the keys associated with this workspace. This includes keys for the storage account, app insights +// and password for container registry +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client WorkspacesClient) ListKeys(ctx context.Context, resourceGroupName string, workspaceName string) (result ListWorkspaceKeysResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.WorkspacesClient", "ListKeys", err.Error()) + } + + req, err := client.ListKeysPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client WorkspacesClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListKeysSender sends the ListKeys request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) ListKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListKeysResponder handles the response to the ListKeys request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) ListKeysResponder(resp *http.Response) (result ListWorkspaceKeysResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNotebookAccessToken return notebook access token and refresh token +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client WorkspacesClient) ListNotebookAccessToken(ctx context.Context, resourceGroupName string, workspaceName string) (result NotebookAccessTokenResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListNotebookAccessToken") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.WorkspacesClient", "ListNotebookAccessToken", err.Error()) + } + + req, err := client.ListNotebookAccessTokenPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListNotebookAccessToken", nil, "Failure preparing request") + return + } + + resp, err := client.ListNotebookAccessTokenSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListNotebookAccessToken", resp, "Failure sending request") + return + } + + result, err = client.ListNotebookAccessTokenResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListNotebookAccessToken", resp, "Failure responding to request") + return + } + + return +} + +// ListNotebookAccessTokenPreparer prepares the ListNotebookAccessToken request. +func (client WorkspacesClient) ListNotebookAccessTokenPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookAccessToken", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListNotebookAccessTokenSender sends the ListNotebookAccessToken request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) ListNotebookAccessTokenSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListNotebookAccessTokenResponder handles the response to the ListNotebookAccessToken request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) ListNotebookAccessTokenResponder(resp *http.Response) (result NotebookAccessTokenResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListNotebookKeys sends the list notebook keys request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client WorkspacesClient) ListNotebookKeys(ctx context.Context, resourceGroupName string, workspaceName string) (result ListNotebookKeysResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListNotebookKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.WorkspacesClient", "ListNotebookKeys", err.Error()) + } + + req, err := client.ListNotebookKeysPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListNotebookKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListNotebookKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListNotebookKeys", resp, "Failure sending request") + return + } + + result, err = client.ListNotebookKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListNotebookKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListNotebookKeysPreparer prepares the ListNotebookKeys request. +func (client WorkspacesClient) ListNotebookKeysPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListNotebookKeysSender sends the ListNotebookKeys request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) ListNotebookKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListNotebookKeysResponder handles the response to the ListNotebookKeys request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) ListNotebookKeysResponder(resp *http.Response) (result ListNotebookKeysResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListStorageAccountKeys sends the list storage account keys request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client WorkspacesClient) ListStorageAccountKeys(ctx context.Context, resourceGroupName string, workspaceName string) (result ListStorageAccountKeysResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListStorageAccountKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.WorkspacesClient", "ListStorageAccountKeys", err.Error()) + } + + req, err := client.ListStorageAccountKeysPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListStorageAccountKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListStorageAccountKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListStorageAccountKeys", resp, "Failure sending request") + return + } + + result, err = client.ListStorageAccountKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListStorageAccountKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListStorageAccountKeysPreparer prepares the ListStorageAccountKeys request. +func (client WorkspacesClient) ListStorageAccountKeysPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listStorageAccountKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListStorageAccountKeysSender sends the ListStorageAccountKeys request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) ListStorageAccountKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListStorageAccountKeysResponder handles the response to the ListStorageAccountKeys request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) ListStorageAccountKeysResponder(resp *http.Response) (result ListStorageAccountKeysResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// PrepareNotebook sends the prepare notebook request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client WorkspacesClient) PrepareNotebook(ctx context.Context, resourceGroupName string, workspaceName string) (result WorkspacesPrepareNotebookFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.PrepareNotebook") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.WorkspacesClient", "PrepareNotebook", err.Error()) + } + + req, err := client.PrepareNotebookPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "PrepareNotebook", nil, "Failure preparing request") + return + } + + result, err = client.PrepareNotebookSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "PrepareNotebook", nil, "Failure sending request") + return + } + + return +} + +// PrepareNotebookPreparer prepares the PrepareNotebook request. +func (client WorkspacesClient) PrepareNotebookPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/prepareNotebook", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PrepareNotebookSender sends the PrepareNotebook request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) PrepareNotebookSender(req *http.Request) (future WorkspacesPrepareNotebookFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PrepareNotebookResponder handles the response to the PrepareNotebook request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) PrepareNotebookResponder(resp *http.Response) (result NotebookResourceInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ResyncKeys resync all the keys associated with this workspace. This includes keys for the storage account, app +// insights and password for container registry +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client WorkspacesClient) ResyncKeys(ctx context.Context, resourceGroupName string, workspaceName string) (result WorkspacesResyncKeysFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ResyncKeys") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.WorkspacesClient", "ResyncKeys", err.Error()) + } + + req, err := client.ResyncKeysPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ResyncKeys", nil, "Failure preparing request") + return + } + + result, err = client.ResyncKeysSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ResyncKeys", nil, "Failure sending request") + return + } + + return +} + +// ResyncKeysPreparer prepares the ResyncKeys request. +func (client WorkspacesClient) ResyncKeysPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResyncKeysSender sends the ResyncKeys request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) ResyncKeysSender(req *http.Request) (future WorkspacesResyncKeysFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResyncKeysResponder handles the response to the ResyncKeys request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) ResyncKeysResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates a machine learning workspace with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// parameters - the parameters for updating a machine learning workspace. +func (client WorkspacesClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, parameters WorkspaceUpdateParameters) (result Workspace, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.WorkspacesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client WorkspacesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters WorkspaceUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) UpdateResponder(resp *http.Response) (result Workspace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/workspaceskus.go b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/workspaceskus.go new file mode 100644 index 000000000000..017c4fb467d5 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/workspaceskus.go @@ -0,0 +1,151 @@ +package machinelearningservices + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WorkspaceSkusClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type WorkspaceSkusClient struct { + BaseClient +} + +// NewWorkspaceSkusClient creates an instance of the WorkspaceSkusClient client. +func NewWorkspaceSkusClient(subscriptionID string) WorkspaceSkusClient { + return NewWorkspaceSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkspaceSkusClientWithBaseURI creates an instance of the WorkspaceSkusClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWorkspaceSkusClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceSkusClient { + return WorkspaceSkusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all skus with associated features +func (client WorkspaceSkusClient) List(ctx context.Context) (result SkuListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceSkusClient.List") + defer func() { + sc := -1 + if result.slr.Response.Response != nil { + sc = result.slr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.WorkspaceSkusClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceSkusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.slr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceSkusClient", "List", resp, "Failure sending request") + return + } + + result.slr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceSkusClient", "List", resp, "Failure responding to request") + return + } + if result.slr.hasNextLink() && result.slr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client WorkspaceSkusClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-03-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceSkusClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WorkspaceSkusClient) ListResponder(resp *http.Response) (result SkuListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client WorkspaceSkusClient) listNextResults(ctx context.Context, lastResults SkuListResult) (result SkuListResult, err error) { + req, err := lastResults.skuListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceSkusClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceSkusClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceSkusClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client WorkspaceSkusClient) ListComplete(ctx context.Context) (result SkuListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceSkusClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +}