From 88303bf943e5873344060ddf0f30bd75bff16cb1 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 25 May 2022 08:37:49 +0000 Subject: [PATCH] CodeGen from PR 18645 in Azure/azure-rest-api-specs [Hub Generated] Review request for Microsoft.MachineLearningServices to add version stable/2022-05-01 (#18645) * Adds base for updating Microsoft.MachineLearning from version stable/2019-10-01 to version 2022-05-01 * Updates readme * Updates API version in new specs and examples * add 2022-05-01 mfe.json * add 2022-02-01-preview mls.json * add workspaceFeatures.json from 2022-02-01-preview * add example files * update readme * Update mfe spec - Update discriminator values from PascalCase to snake_case - Remove job schedules - Add MLTable * Add ScheduleBase types to machineLearningServices.json * Updated custom-words.txt * Update examples * Update readme * add workspace connection v2 changes * Update readme * Update readme * fix example validation error * Update mfe swagger * Updated examples * Moved 2022-05-01 specs from machinelearning to machinelearningservices * Update readme * port 2022-02-01-preview mfe.json Schedule to machineLearningServices.json * update example w/ provisioningState * Rename workspace connection related auth type * description change to try to trigger pipelines * Revert "description change to try to trigger pipelines" This reverts commit 899cb59290814f98b56bc777cf4f369eb2ed78c8. * update missed common-types v2 -> v3 * Remove unnecessary Credentials properties * fix propertyBag schema * add x-ms-secret * remove checkNameAvailability api * remove traffic property from PartialOnlineEndpoint * prettier * Revert "port 2022-02-01-preview mfe.json Schedule to machineLearningServices.json" This reverts commit 4268210b92105c3c7ba89b2d45d7bcd0c56c2864. * add v1LegacyMode to workpsace properties. * update description and add default value. * update description * [MLC] label sslConfiguration and virtualMachineImage as nullable * reduce PATCH to bare minimum * update examples w/ new spec * [MLC] Mark as null-able for properties Getting API * TEST enum as x-nullable * Revert "TEST enum as x-nullable" This reverts commit 616291c334fa825ac07a8b589797478699c7f6b6. * [MLC] Mark as null-able for properties of List API * remove x-nullable from properties with defaults * description update * enum ordering * fix XmsEnumValidation error for MLC * change x-ms-enum name of SSLConfiguration * update descriptions * change x-ms-client-name 'Details' to 'Properties' * removed x-ms-client-name 'Data' suffix * reorder SecretsType enum Co-authored-by: Teddy Co-authored-by: zhaomuzhi Co-authored-by: Xi Jin Co-authored-by: ZhidaLiu <86350902+ZhidaLiu@users.noreply.github.com> Co-authored-by: Teddy Todorov Co-authored-by: Bingchen Li --- .../mgmt/2016-04-01/workspaces/CHANGELOG.md | 2 +- .../mgmt/2016-04-01/workspaces/_meta.json | 2 +- .../mgmt/2017-01-01/webservices/CHANGELOG.md | 2 +- .../mgmt/2017-01-01/webservices/_meta.json | 2 +- .../mgmt/2019-10-01/workspaces/CHANGELOG.md | 2 +- .../mgmt/2019-10-01/workspaces/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 2 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 2 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 2 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 2 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 2 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 2 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 2 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 2 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 2 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 2 + .../machinelearningservices/_meta.json | 11 + .../batchdeployments.go | 556 + .../machinelearningservices/batchendpoints.go | 624 + .../machinelearningservices/client.go | 41 + .../machinelearningservices/codecontainers.go | 430 + .../machinelearningservices/codeversions.go | 446 + .../componentcontainers.go | 438 + .../componentversions.go | 453 + .../machinelearningservices/compute.go | 1021 + .../machinelearningservices/datacontainers.go | 436 + .../machinelearningservices/datastores.go | 549 + .../machinelearningservices/dataversions.go | 456 + .../machinelearningservices/enums.go | 1789 ++ .../environmentcontainers.go | 438 + .../environmentversions.go | 476 + .../machinelearningservices/jobs.go | 534 + .../machinelearningservicesapi/interfaces.go | 309 + .../modelcontainers.go | 440 + .../machinelearningservices/models.go | 17031 +++++++++++++ .../machinelearningservices/modelversions.go | 476 + .../onlinedeployments.go | 786 + .../onlineendpoints.go | 823 + .../machinelearningservices/operations.go | 98 + .../privateendpointconnections.go | 387 + .../privatelinkresources.go | 119 + .../machinelearningservices/quotas.go | 241 + .../machinelearningservices/usages.go | 156 + .../machinelearningservices/version.go | 19 + .../virtualmachinesizes.go | 116 + .../workspaceconnections.go | 432 + .../workspacefeatures.go | 160 + .../machinelearningservices/workspaces.go | 1346 + .../commitmentplans/CHANGELOG.md | 2 +- .../commitmentplans/_meta.json | 2 +- .../webservices/CHANGELOG.md | 2 +- .../2016-05-01-preview/webservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 2 +- .../machinelearningservices/_meta.json | 2 +- .../machinelearningservices/CHANGELOG.md | 2 +- .../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 | 1103 + .../machinelearningservices/datacontainers.go | 431 + .../machinelearningservices/datastores.go | 552 + .../machinelearningservices/dataversions.go | 454 + .../machinelearningservices/enums.go | 1644 ++ .../environmentcontainers.go | 433 + .../environmentspecificationversions.go | 467 + .../machinelearningservices/jobs.go | 530 + .../machinelearningservices/labelingjobs.go | 714 + .../machinelearningservicesapi/interfaces.go | 305 + .../modelcontainers.go | 435 + .../machinelearningservices/models.go | 16164 ++++++++++++ .../machinelearningservices/modelversions.go | 470 + .../onlinedeployments.go | 645 + .../onlineendpoints.go | 822 + .../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 | 1162 + .../machinelearningservices/workspaceskus.go | 151 + .../machinelearningservices/CHANGELOG.md | 2 + .../machinelearningservices/_meta.json | 11 + .../machinelearningservices/client.go | 42 + .../machinelearningservices/compute.go | 1014 + .../machinelearningservices/enums.go | 663 + .../machinelearningservicesapi/interfaces.go | 127 + .../machinelearningservices/models.go | 5416 ++++ .../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 | 1341 + .../machinelearningservices/workspaceskus.go | 151 + .../machinelearningservices/CHANGELOG.md | 2 + .../machinelearningservices/_meta.json | 11 + .../batchdeployments.go | 556 + .../machinelearningservices/batchendpoints.go | 624 + .../machinelearningservices/client.go | 42 + .../machinelearningservices/codecontainers.go | 430 + .../machinelearningservices/codeversions.go | 446 + .../componentcontainers.go | 438 + .../componentversions.go | 453 + .../machinelearningservices/compute.go | 1021 + .../machinelearningservices/datacontainers.go | 436 + .../machinelearningservices/datastores.go | 549 + .../machinelearningservices/dataversions.go | 456 + .../machinelearningservices/enums.go | 2675 ++ .../environmentcontainers.go | 438 + .../environmentversions.go | 476 + .../machinelearningservices/jobs.go | 539 + .../machinelearningservicesapi/interfaces.go | 308 + .../modelcontainers.go | 440 + .../machinelearningservices/models.go | 20632 ++++++++++++++++ .../machinelearningservices/modelversions.go | 476 + .../onlinedeployments.go | 786 + .../onlineendpoints.go | 823 + .../machinelearningservices/operations.go | 98 + .../privateendpointconnections.go | 387 + .../privatelinkresources.go | 119 + .../machinelearningservices/quotas.go | 241 + .../machinelearningservices/usages.go | 156 + .../machinelearningservices/version.go | 19 + .../virtualmachinesizes.go | 116 + .../workspaceconnections.go | 390 + .../workspacefeatures.go | 160 + .../machinelearningservices/workspaces.go | 1346 + 149 files changed, 108486 insertions(+), 32 deletions(-) create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/CHANGELOG.md create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/_meta.json create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/batchdeployments.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/batchendpoints.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/client.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/codecontainers.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/codeversions.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/componentcontainers.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/componentversions.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/compute.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/datacontainers.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/datastores.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/dataversions.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/enums.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/environmentcontainers.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/environmentversions.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/jobs.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/machinelearningservicesapi/interfaces.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/modelcontainers.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/models.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/modelversions.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/onlinedeployments.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/onlineendpoints.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/operations.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/privateendpointconnections.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/privatelinkresources.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/quotas.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/usages.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/version.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/virtualmachinesizes.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/workspaceconnections.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/workspacefeatures.go create mode 100644 services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/workspaces.go 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 create mode 100644 services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/CHANGELOG.md create mode 100644 services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/_meta.json create mode 100644 services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/client.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/compute.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/enums.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/machinelearningservicesapi/interfaces.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/models.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/operations.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/privateendpointconnections.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/privatelinkresources.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/quotas.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/usages.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/version.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/virtualmachinesizes.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/workspaceconnections.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/workspacefeatures.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/workspaces.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/workspaceskus.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/CHANGELOG.md create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/_meta.json create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/batchdeployments.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/batchendpoints.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/client.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/codecontainers.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/codeversions.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/componentcontainers.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/componentversions.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/compute.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/datacontainers.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/datastores.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/dataversions.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/enums.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/environmentcontainers.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/environmentversions.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/jobs.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/machinelearningservicesapi/interfaces.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/modelcontainers.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/models.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/modelversions.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/onlinedeployments.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/onlineendpoints.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/operations.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/privateendpointconnections.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/privatelinkresources.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/quotas.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/usages.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/version.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/virtualmachinesizes.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/workspaceconnections.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/workspacefeatures.go create mode 100644 services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/workspaces.go diff --git a/services/machinelearning/mgmt/2016-04-01/workspaces/CHANGELOG.md b/services/machinelearning/mgmt/2016-04-01/workspaces/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/machinelearning/mgmt/2016-04-01/workspaces/CHANGELOG.md +++ b/services/machinelearning/mgmt/2016-04-01/workspaces/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/machinelearning/mgmt/2016-04-01/workspaces/_meta.json b/services/machinelearning/mgmt/2016-04-01/workspaces/_meta.json index 2482071d6383..651526361ca9 100644 --- a/services/machinelearning/mgmt/2016-04-01/workspaces/_meta.json +++ b/services/machinelearning/mgmt/2016-04-01/workspaces/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "1d8d2d736316b956adde1200f8cc31eaf73175eb", "readme": "/_/azure-rest-api-specs/specification/machinelearning/resource-manager/readme.md", "tag": "package-workspaces-2016-04", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/machinelearning/mgmt/2017-01-01/webservices/CHANGELOG.md b/services/machinelearning/mgmt/2017-01-01/webservices/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/machinelearning/mgmt/2017-01-01/webservices/CHANGELOG.md +++ b/services/machinelearning/mgmt/2017-01-01/webservices/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/machinelearning/mgmt/2017-01-01/webservices/_meta.json b/services/machinelearning/mgmt/2017-01-01/webservices/_meta.json index 256142f58018..f9b2c71408e6 100644 --- a/services/machinelearning/mgmt/2017-01-01/webservices/_meta.json +++ b/services/machinelearning/mgmt/2017-01-01/webservices/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "1d8d2d736316b956adde1200f8cc31eaf73175eb", "readme": "/_/azure-rest-api-specs/specification/machinelearning/resource-manager/readme.md", "tag": "package-webservices-2017-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/machinelearning/mgmt/2019-10-01/workspaces/CHANGELOG.md b/services/machinelearning/mgmt/2019-10-01/workspaces/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/machinelearning/mgmt/2019-10-01/workspaces/CHANGELOG.md +++ b/services/machinelearning/mgmt/2019-10-01/workspaces/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/machinelearning/mgmt/2019-10-01/workspaces/_meta.json b/services/machinelearning/mgmt/2019-10-01/workspaces/_meta.json index 7e4fe5c83d7d..ed51508ca80f 100644 --- a/services/machinelearning/mgmt/2019-10-01/workspaces/_meta.json +++ b/services/machinelearning/mgmt/2019-10-01/workspaces/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "1d8d2d736316b956adde1200f8cc31eaf73175eb", "readme": "/_/azure-rest-api-specs/specification/machinelearning/resource-manager/readme.md", "tag": "package-workspaces-2019-10", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/machinelearningservices/mgmt/2018-11-19/machinelearningservices/CHANGELOG.md b/services/machinelearningservices/mgmt/2018-11-19/machinelearningservices/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/machinelearningservices/mgmt/2018-11-19/machinelearningservices/CHANGELOG.md +++ b/services/machinelearningservices/mgmt/2018-11-19/machinelearningservices/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/machinelearningservices/mgmt/2018-11-19/machinelearningservices/_meta.json b/services/machinelearningservices/mgmt/2018-11-19/machinelearningservices/_meta.json index 5646c5d17f35..5f7bb931aeea 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": "1d8d2d736316b956adde1200f8cc31eaf73175eb", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2018-11-19", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/machinelearningservices/mgmt/2019-05-01/machinelearningservices/CHANGELOG.md b/services/machinelearningservices/mgmt/2019-05-01/machinelearningservices/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/machinelearningservices/mgmt/2019-05-01/machinelearningservices/CHANGELOG.md +++ b/services/machinelearningservices/mgmt/2019-05-01/machinelearningservices/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/machinelearningservices/mgmt/2019-05-01/machinelearningservices/_meta.json b/services/machinelearningservices/mgmt/2019-05-01/machinelearningservices/_meta.json index 8a26da3cdffa..02a2dab59683 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": "1d8d2d736316b956adde1200f8cc31eaf73175eb", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2019-05-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/machinelearningservices/mgmt/2019-06-01/machinelearningservices/CHANGELOG.md b/services/machinelearningservices/mgmt/2019-06-01/machinelearningservices/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/machinelearningservices/mgmt/2019-06-01/machinelearningservices/CHANGELOG.md +++ b/services/machinelearningservices/mgmt/2019-06-01/machinelearningservices/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/machinelearningservices/mgmt/2019-06-01/machinelearningservices/_meta.json b/services/machinelearningservices/mgmt/2019-06-01/machinelearningservices/_meta.json index 1daafe2e110c..8b41583220c6 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": "1d8d2d736316b956adde1200f8cc31eaf73175eb", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2019-06-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/machinelearningservices/mgmt/2019-11-01/machinelearningservices/CHANGELOG.md b/services/machinelearningservices/mgmt/2019-11-01/machinelearningservices/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/machinelearningservices/mgmt/2019-11-01/machinelearningservices/CHANGELOG.md +++ b/services/machinelearningservices/mgmt/2019-11-01/machinelearningservices/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/machinelearningservices/mgmt/2019-11-01/machinelearningservices/_meta.json b/services/machinelearningservices/mgmt/2019-11-01/machinelearningservices/_meta.json index c3b776dd2458..15d979c180c1 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": "1d8d2d736316b956adde1200f8cc31eaf73175eb", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2019-11-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/machinelearningservices/mgmt/2020-01-01/machinelearningservices/CHANGELOG.md b/services/machinelearningservices/mgmt/2020-01-01/machinelearningservices/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/machinelearningservices/mgmt/2020-01-01/machinelearningservices/CHANGELOG.md +++ b/services/machinelearningservices/mgmt/2020-01-01/machinelearningservices/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/machinelearningservices/mgmt/2020-01-01/machinelearningservices/_meta.json b/services/machinelearningservices/mgmt/2020-01-01/machinelearningservices/_meta.json index f1e503dd63ce..6f175d350bb5 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": "1d8d2d736316b956adde1200f8cc31eaf73175eb", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2020-01-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/machinelearningservices/mgmt/2020-03-01/machinelearningservices/CHANGELOG.md b/services/machinelearningservices/mgmt/2020-03-01/machinelearningservices/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/machinelearningservices/mgmt/2020-03-01/machinelearningservices/CHANGELOG.md +++ b/services/machinelearningservices/mgmt/2020-03-01/machinelearningservices/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/machinelearningservices/mgmt/2020-03-01/machinelearningservices/_meta.json b/services/machinelearningservices/mgmt/2020-03-01/machinelearningservices/_meta.json index ea8e2147ccde..387687ebeec6 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": "1d8d2d736316b956adde1200f8cc31eaf73175eb", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2020-03-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/machinelearningservices/mgmt/2020-04-01/machinelearningservices/CHANGELOG.md b/services/machinelearningservices/mgmt/2020-04-01/machinelearningservices/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/machinelearningservices/mgmt/2020-04-01/machinelearningservices/CHANGELOG.md +++ b/services/machinelearningservices/mgmt/2020-04-01/machinelearningservices/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/machinelearningservices/mgmt/2020-04-01/machinelearningservices/_meta.json b/services/machinelearningservices/mgmt/2020-04-01/machinelearningservices/_meta.json index 0ce43cf4def8..53abe045692c 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": "1d8d2d736316b956adde1200f8cc31eaf73175eb", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2020-04-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/machinelearningservices/mgmt/2021-04-01/machinelearningservices/CHANGELOG.md b/services/machinelearningservices/mgmt/2021-04-01/machinelearningservices/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/machinelearningservices/mgmt/2021-04-01/machinelearningservices/CHANGELOG.md +++ b/services/machinelearningservices/mgmt/2021-04-01/machinelearningservices/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/machinelearningservices/mgmt/2021-04-01/machinelearningservices/_meta.json b/services/machinelearningservices/mgmt/2021-04-01/machinelearningservices/_meta.json index c7c8b3fb248d..e4ee19da9387 100644 --- a/services/machinelearningservices/mgmt/2021-04-01/machinelearningservices/_meta.json +++ b/services/machinelearningservices/mgmt/2021-04-01/machinelearningservices/_meta.json @@ -1,5 +1,5 @@ { - "commit": "b47572ab2069865484c493a4f679d4e72f8b303d", + "commit": "1d8d2d736316b956adde1200f8cc31eaf73175eb", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2021-04-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/machinelearningservices/mgmt/2021-07-01/machinelearningservices/CHANGELOG.md b/services/machinelearningservices/mgmt/2021-07-01/machinelearningservices/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/machinelearningservices/mgmt/2021-07-01/machinelearningservices/CHANGELOG.md +++ b/services/machinelearningservices/mgmt/2021-07-01/machinelearningservices/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/machinelearningservices/mgmt/2021-07-01/machinelearningservices/_meta.json b/services/machinelearningservices/mgmt/2021-07-01/machinelearningservices/_meta.json index 6519961fb79f..2e72d77271f8 100644 --- a/services/machinelearningservices/mgmt/2021-07-01/machinelearningservices/_meta.json +++ b/services/machinelearningservices/mgmt/2021-07-01/machinelearningservices/_meta.json @@ -1,5 +1,5 @@ { - "commit": "47545c5f0842f5be29529674a4609d75a973d783", + "commit": "1d8d2d736316b956adde1200f8cc31eaf73175eb", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2021-07-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/CHANGELOG.md b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/_meta.json b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/_meta.json new file mode 100644 index 000000000000..0b2078fea7a7 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "1d8d2d736316b956adde1200f8cc31eaf73175eb", + "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", + "tag": "package-2022-05-01", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2022-05-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --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=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/batchdeployments.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/batchdeployments.go new file mode 100644 index 000000000000..d7891e30589e --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/batchdeployments.go @@ -0,0 +1,556 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference endpoint name +// deploymentName - the identifier for the Batch inference deployment. +// body - batch inference deployment definition object. +func (client BatchDeploymentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, body BatchDeploymentTrackedResource) (result BatchDeploymentsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchDeploymentsClient.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: 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: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchDeploymentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, endpointName, deploymentName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BatchDeploymentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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 = "2022-05-01" + 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}/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) (future BatchDeploymentsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - endpoint name +// deploymentName - inference deployment identifier. +func (client BatchDeploymentsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string) (result BatchDeploymentsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchDeploymentsClient.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.BatchDeploymentsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, endpointName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BatchDeploymentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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 = "2022-05-01" + 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) (future BatchDeploymentsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 BatchDeploymentsClient) 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - endpoint name +// deploymentName - the identifier for the Batch deployments. +func (client BatchDeploymentsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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, resourceGroupName, workspaceName, endpointName, deploymentName) + 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, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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 = "2022-05-01" + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - endpoint name +// orderBy - ordering of list. +// top - top of list. +// skip - continuation token for pagination. +func (client BatchDeploymentsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName, 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, resourceGroupName string, workspaceName string, endpointName 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 = "2022-05-01" + 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, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName, orderBy, top, skip) + return +} + +// Update sends the update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference endpoint name +// deploymentName - the identifier for the Batch inference deployment. +// body - batch inference deployment definition object. +func (client BatchDeploymentsClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, body PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties) (result BatchDeploymentsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchDeploymentsClient.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}}}, + {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}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchDeploymentsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, endpointName, deploymentName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client BatchDeploymentsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, body PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties) (*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 = "2022-05-01" + 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) (future BatchDeploymentsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 BatchDeploymentsClient) UpdateResponder(resp *http.Response) (result BatchDeploymentTrackedResource, 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/machinelearningservices/mgmt/2022-05-01/machinelearningservices/batchendpoints.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/batchendpoints.go new file mode 100644 index 000000000000..01b3434db286 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/batchendpoints.go @@ -0,0 +1,624 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - name for the Batch inference endpoint. +// body - batch inference endpoint definition object. +func (client BatchEndpointsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, body BatchEndpointTrackedResource) (result BatchEndpointsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchEndpointsClient.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: endpointName, + Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchEndpointsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, endpointName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BatchEndpointsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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 = "2022-05-01" + 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}/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) (future BatchEndpointsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference Endpoint name. +func (client BatchEndpointsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string) (result BatchEndpointsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchEndpointsClient.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.BatchEndpointsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BatchEndpointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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 = "2022-05-01" + 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) (future BatchEndpointsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 BatchEndpointsClient) 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - name for the Batch Endpoint. +func (client BatchEndpointsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName) + 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, resourceGroupName string, workspaceName string, endpointName 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 = "2022-05-01" + 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 = "2022-05-01" + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference Endpoint name. +func (client BatchEndpointsClient) ListKeys(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName) + 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, resourceGroupName string, workspaceName string, endpointName 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 = "2022-05-01" + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - name for the Batch inference endpoint. +// body - mutable batch inference endpoint definition object. +func (client BatchEndpointsClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, body PartialMinimalTrackedResourceWithIdentity) (result BatchEndpointsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchEndpointsClient.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}}}, + {TargetValue: endpointName, + Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchEndpointsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, endpointName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client BatchEndpointsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, body PartialMinimalTrackedResourceWithIdentity) (*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 = "2022-05-01" + 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) (future BatchEndpointsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 BatchEndpointsClient) UpdateResponder(resp *http.Response) (result BatchEndpointTrackedResource, 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/machinelearningservices/mgmt/2022-05-01/machinelearningservices/client.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/client.go new file mode 100644 index 000000000000..3f6ca32c05f8 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/client.go @@ -0,0 +1,41 @@ +// Package machinelearningservices implements the Azure ARM Machinelearningservices service API version 2022-05-01. +// +// 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/machinelearningservices/mgmt/2022-05-01/machinelearningservices/codecontainers.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/codecontainers.go new file mode 100644 index 000000000000..3462e309b3c0 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/codecontainers.go @@ -0,0 +1,430 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// body - container entity to create or update. +func (client CodeContainersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name 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: 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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, 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, resourceGroupName, workspaceName, name, 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, resourceGroupName string, workspaceName string, name 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 = "2022-05-01" + 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}/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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +func (client CodeContainersClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-05-01" + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +func (client CodeContainersClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-05-01" + 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 = "2022-05-01" + 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/machinelearningservices/mgmt/2022-05-01/machinelearningservices/codeversions.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/codeversions.go new file mode 100644 index 000000000000..6bbf04691fce --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/codeversions.go @@ -0,0 +1,446 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// version - version identifier. This is case-sensitive. +// body - version entity to create or update. +func (client CodeVersionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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: 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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.CodeVersionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, name, version, 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, resourceGroupName string, workspaceName string, name string, version 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 = "2022-05-01" + 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}/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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// version - version identifier. This is case-sensitive. +func (client CodeVersionsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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, resourceGroupName, workspaceName, name, version) + 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, resourceGroupName string, workspaceName string, name string, version 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 = "2022-05-01" + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// version - version identifier. This is case-sensitive. +func (client CodeVersionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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, resourceGroupName, workspaceName, name, version) + 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, resourceGroupName string, workspaceName string, name string, version 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 = "2022-05-01" + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// orderBy - ordering of list. +// top - maximum number of records to return. +// skip - continuation token for pagination. +func (client CodeVersionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name, 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, resourceGroupName string, workspaceName string, name 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 = "2022-05-01" + 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, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name, orderBy, top, skip) + return +} diff --git a/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/componentcontainers.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/componentcontainers.go new file mode 100644 index 000000000000..ddb0fe946d2e --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/componentcontainers.go @@ -0,0 +1,438 @@ +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" +) + +// ComponentContainersClient is the these APIs allow end users to operate on Azure Machine Learning Workspace +// resources. +type ComponentContainersClient struct { + BaseClient +} + +// NewComponentContainersClient creates an instance of the ComponentContainersClient client. +func NewComponentContainersClient(subscriptionID string) ComponentContainersClient { + return NewComponentContainersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewComponentContainersClientWithBaseURI creates an instance of the ComponentContainersClient 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 NewComponentContainersClientWithBaseURI(baseURI string, subscriptionID string) ComponentContainersClient { + return ComponentContainersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +// body - container entity to create or update. +func (client ComponentContainersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, body ComponentContainerResource) (result ComponentContainerResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentContainersClient.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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ComponentContainersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, name, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "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.ComponentContainersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ComponentContainersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, body ComponentContainerResource) (*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 = "2022-05-01" + 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}/components/{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 ComponentContainersClient) 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 ComponentContainersClient) CreateOrUpdateResponder(resp *http.Response) (result ComponentContainerResource, 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +func (client ComponentContainersClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentContainersClient.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.ComponentContainersClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ComponentContainersClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, name 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 = "2022-05-01" + 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}/components/{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 ComponentContainersClient) 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 ComponentContainersClient) 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +func (client ComponentContainersClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result ComponentContainerResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentContainersClient.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.ComponentContainersClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "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.ComponentContainersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComponentContainersClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, name 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 = "2022-05-01" + 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}/components/{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 ComponentContainersClient) 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 ComponentContainersClient) GetResponder(resp *http.Response) (result ComponentContainerResource, 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. +// listViewType - view type for including/excluding (for example) archived entities. +func (client ComponentContainersClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType ListViewType) (result ComponentContainerResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentContainersClient.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.ComponentContainersClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, skip, listViewType) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "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.ComponentContainersClient", "List", resp, "Failure sending request") + return + } + + result.ccrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "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 ComponentContainersClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType ListViewType) (*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 = "2022-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + if len(string(listViewType)) > 0 { + queryParameters["listViewType"] = autorest.Encode("query", listViewType) + } else { + queryParameters["listViewType"] = autorest.Encode("query", "ActiveOnly") + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components", 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 ComponentContainersClient) 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 ComponentContainersClient) ListResponder(resp *http.Response) (result ComponentContainerResourceArmPaginatedResult, 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 ComponentContainersClient) listNextResults(ctx context.Context, lastResults ComponentContainerResourceArmPaginatedResult) (result ComponentContainerResourceArmPaginatedResult, err error) { + req, err := lastResults.componentContainerResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "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.ComponentContainersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ComponentContainersClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType ListViewType) (result ComponentContainerResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentContainersClient.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, listViewType) + return +} diff --git a/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/componentversions.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/componentversions.go new file mode 100644 index 000000000000..7b218f39e712 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/componentversions.go @@ -0,0 +1,453 @@ +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" +) + +// ComponentVersionsClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type ComponentVersionsClient struct { + BaseClient +} + +// NewComponentVersionsClient creates an instance of the ComponentVersionsClient client. +func NewComponentVersionsClient(subscriptionID string) ComponentVersionsClient { + return NewComponentVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewComponentVersionsClientWithBaseURI creates an instance of the ComponentVersionsClient 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 NewComponentVersionsClientWithBaseURI(baseURI string, subscriptionID string) ComponentVersionsClient { + return ComponentVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +// version - version identifier. +// body - version entity to create or update. +func (client ComponentVersionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string, body ComponentVersionResource) (result ComponentVersionResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentVersionsClient.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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ComponentVersionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, name, version, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "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.ComponentVersionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ComponentVersionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string, body ComponentVersionResource) (*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 = "2022-05-01" + 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}/components/{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 ComponentVersionsClient) 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 ComponentVersionsClient) CreateOrUpdateResponder(resp *http.Response) (result ComponentVersionResource, 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +// version - version identifier. +func (client ComponentVersionsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentVersionsClient.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.ComponentVersionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, name, version) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ComponentVersionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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 = "2022-05-01" + 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}/components/{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 ComponentVersionsClient) 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 ComponentVersionsClient) 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +// version - version identifier. +func (client ComponentVersionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result ComponentVersionResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentVersionsClient.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.ComponentVersionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, name, version) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "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.ComponentVersionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComponentVersionsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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 = "2022-05-01" + 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}/components/{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 ComponentVersionsClient) 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 ComponentVersionsClient) GetResponder(resp *http.Response) (result ComponentVersionResource, 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 - component name. +// orderBy - ordering of list. +// top - maximum number of records to return. +// skip - continuation token for pagination. +// listViewType - view type for including/excluding (for example) archived entities. +func (client ComponentVersionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType ListViewType) (result ComponentVersionResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentVersionsClient.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.ComponentVersionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, name, orderBy, top, skip, listViewType) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "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.ComponentVersionsClient", "List", resp, "Failure sending request") + return + } + + result.cvrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "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 ComponentVersionsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType ListViewType) (*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 = "2022-05-01" + 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(string(listViewType)) > 0 { + queryParameters["listViewType"] = autorest.Encode("query", listViewType) + } else { + queryParameters["listViewType"] = autorest.Encode("query", "ActiveOnly") + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{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 ComponentVersionsClient) 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 ComponentVersionsClient) ListResponder(resp *http.Response) (result ComponentVersionResourceArmPaginatedResult, 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 ComponentVersionsClient) listNextResults(ctx context.Context, lastResults ComponentVersionResourceArmPaginatedResult) (result ComponentVersionResourceArmPaginatedResult, err error) { + req, err := lastResults.componentVersionResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "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.ComponentVersionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ComponentVersionsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType ListViewType) (result ComponentVersionResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentVersionsClient.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, orderBy, top, skip, listViewType) + return +} diff --git a/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/compute.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/compute.go new file mode 100644 index 000000000000..2963d8c9b364 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/compute.go @@ -0,0 +1,1021 @@ +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}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, 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", result.Response(), "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 = "2022-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil + parameters.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}/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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 = "2022-05-01" + 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 + future.FutureAPI = &azure.Future{} + 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, http.StatusNoContent), + 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 = "2022-05-01" + 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 = "2022-05-01" + 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 = "2022-05-01" + 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 = "2022-05-01" + 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 ComputeRestartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeClient.Restart") + 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", "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 + } + + result, err = client.RestartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "Restart", result.Response(), "Failure sending 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 = "2022-05-01" + 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) (future ComputeRestartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 +} + +// 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, http.StatusAccepted), + 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", result.Response(), "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 = "2022-05-01" + 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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 = "2022-05-01" + 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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 = "2022-05-01" + 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 + future.FutureAPI = &azure.Future{} + 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 +} diff --git a/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/datacontainers.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/datacontainers.go new file mode 100644 index 000000000000..5b0bd69f003f --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/datacontainers.go @@ -0,0 +1,436 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +// body - container entity to create or update. +func (client DataContainersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name 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: 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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, 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, resourceGroupName, workspaceName, name, 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, resourceGroupName string, workspaceName string, name 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 = "2022-05-01" + 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}/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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +func (client DataContainersClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-05-01" + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +func (client DataContainersClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-05-01" + 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. +// listViewType - view type for including/excluding (for example) archived entities. +func (client DataContainersClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType ListViewType) (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, listViewType) + 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, listViewType ListViewType) (*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 = "2022-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + if len(string(listViewType)) > 0 { + queryParameters["listViewType"] = autorest.Encode("query", listViewType) + } else { + queryParameters["listViewType"] = autorest.Encode("query", "ActiveOnly") + } + + 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, listViewType ListViewType) (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, listViewType) + return +} diff --git a/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/datastores.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/datastores.go new file mode 100644 index 000000000000..b95b4103e991 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/datastores.go @@ -0,0 +1,549 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - datastore name. +// body - datastore entity to create or update. +// skipValidation - flag to skip validation. +func (client DatastoresClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, body DatastoreResource, skipValidation *bool) (result DatastoreResource, 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: 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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.DatastoresClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, name, 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, resourceGroupName string, workspaceName string, name string, body DatastoreResource, 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 = "2022-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if skipValidation != nil { + queryParameters["skipValidation"] = autorest.Encode("query", *skipValidation) + } else { + queryParameters["skipValidation"] = autorest.Encode("query", false) + } + + 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 DatastoreResource, 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - datastore name. +func (client DatastoresClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-05-01" + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - datastore name. +func (client DatastoresClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result DatastoreResource, 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-05-01" + 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 DatastoreResource, 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 DatastoreResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatastoresClient.List") + defer func() { + sc := -1 + if result.drapr.Response.Response != nil { + sc = result.drapr.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.drapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "List", resp, "Failure sending request") + return + } + + result.drapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "List", resp, "Failure responding to request") + return + } + if result.drapr.hasNextLink() && result.drapr.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 = "2022-05-01" + 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 DatastoreResourceArmPaginatedResult, 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 DatastoreResourceArmPaginatedResult) (result DatastoreResourceArmPaginatedResult, err error) { + req, err := lastResults.datastoreResourceArmPaginatedResultPreparer(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 DatastoreResourceArmPaginatedResultIterator, 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - datastore name. +func (client DatastoresClient) ListSecrets(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-05-01" + 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/machinelearningservices/mgmt/2022-05-01/machinelearningservices/dataversions.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/dataversions.go new file mode 100644 index 000000000000..b833eb5ba922 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/dataversions.go @@ -0,0 +1,456 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +// version - version identifier. +// body - version entity to create or update. +func (client DataVersionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string, body DataVersionBaseResource) (result DataVersionBaseResource, 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: 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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.DataVersionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, name, version, 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, resourceGroupName string, workspaceName string, name string, version string, body DataVersionBaseResource) (*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 = "2022-05-01" + 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}/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 DataVersionBaseResource, 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +// version - version identifier. +func (client DataVersionsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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, resourceGroupName, workspaceName, name, version) + 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, resourceGroupName string, workspaceName string, name string, version 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 = "2022-05-01" + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +// version - version identifier. +func (client DataVersionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result DataVersionBaseResource, 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, resourceGroupName, workspaceName, name, version) + 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, resourceGroupName string, workspaceName string, name string, version 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 = "2022-05-01" + 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 DataVersionBaseResource, 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 - data container's name +// orderBy - please choose OrderBy value from ['createdtime', 'modifiedtime'] +// top - top count of results, top count cannot be greater than the page size. +// If topCount > page size, results with be default page size count will be returned +// skip - continuation token for pagination. +// tags - comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2 +// listViewType - [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All]View type for +// including/excluding (for example) archived entities. +func (client DataVersionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, tags string, listViewType ListViewType) (result DataVersionBaseResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataVersionsClient.List") + defer func() { + sc := -1 + if result.dvbrapr.Response.Response != nil { + sc = result.dvbrapr.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, resourceGroupName, workspaceName, name, orderBy, top, skip, tags, listViewType) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dvbrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "List", resp, "Failure sending request") + return + } + + result.dvbrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "List", resp, "Failure responding to request") + return + } + if result.dvbrapr.hasNextLink() && result.dvbrapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DataVersionsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, tags string, listViewType ListViewType) (*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 = "2022-05-01" + 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) + } + if len(string(listViewType)) > 0 { + queryParameters["listViewType"] = autorest.Encode("query", listViewType) + } else { + queryParameters["listViewType"] = autorest.Encode("query", "ActiveOnly") + } + + 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 DataVersionBaseResourceArmPaginatedResult, 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 DataVersionBaseResourceArmPaginatedResult) (result DataVersionBaseResourceArmPaginatedResult, err error) { + req, err := lastResults.dataVersionBaseResourceArmPaginatedResultPreparer(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, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, tags string, listViewType ListViewType) (result DataVersionBaseResourceArmPaginatedResultIterator, 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, resourceGroupName, workspaceName, name, orderBy, top, skip, tags, listViewType) + return +} diff --git a/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/enums.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/enums.go new file mode 100644 index 000000000000..af0c11b8bce9 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/enums.go @@ -0,0 +1,1789 @@ +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} +} + +// AuthType enumerates the values for auth type. +type AuthType string + +const ( + // AuthTypeManagedIdentity ... + AuthTypeManagedIdentity AuthType = "ManagedIdentity" + // AuthTypeNone ... + AuthTypeNone AuthType = "None" + // AuthTypePAT ... + AuthTypePAT AuthType = "PAT" + // AuthTypeSAS ... + AuthTypeSAS AuthType = "SAS" + // AuthTypeUsernamePassword ... + AuthTypeUsernamePassword AuthType = "UsernamePassword" + // AuthTypeWorkspaceConnectionPropertiesV2 ... + AuthTypeWorkspaceConnectionPropertiesV2 AuthType = "WorkspaceConnectionPropertiesV2" +) + +// PossibleAuthTypeValues returns an array of possible values for the AuthType const type. +func PossibleAuthTypeValues() []AuthType { + return []AuthType{AuthTypeManagedIdentity, AuthTypeNone, AuthTypePAT, AuthTypeSAS, AuthTypeUsernamePassword, AuthTypeWorkspaceConnectionPropertiesV2} +} + +// Autosave enumerates the values for autosave. +type Autosave string + +const ( + // Local ... + Local Autosave = "Local" + // None ... + None Autosave = "None" + // Remote ... + Remote Autosave = "Remote" +) + +// PossibleAutosaveValues returns an array of possible values for the Autosave const type. +func PossibleAutosaveValues() []Autosave { + return []Autosave{Local, None, Remote} +} + +// 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} +} + +// Caching enumerates the values for caching. +type Caching string + +const ( + // CachingNone ... + CachingNone Caching = "None" + // CachingReadOnly ... + CachingReadOnly Caching = "ReadOnly" + // CachingReadWrite ... + CachingReadWrite Caching = "ReadWrite" +) + +// PossibleCachingValues returns an array of possible values for the Caching const type. +func PossibleCachingValues() []Caching { + return []Caching{CachingNone, CachingReadOnly, CachingReadWrite} +} + +// 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" + // ComputeTypeKubernetes ... + ComputeTypeKubernetes ComputeType = "Kubernetes" + // 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, ComputeTypeKubernetes, ComputeTypeSynapseSpark, ComputeTypeVirtualMachine} +} + +// ComputeTypeBasicCompute enumerates the values for compute type basic compute. +type ComputeTypeBasicCompute string + +const ( + // ComputeTypeCompute ... + ComputeTypeCompute ComputeTypeBasicCompute = "Compute" + // ComputeTypeDataFactory1 ... + ComputeTypeDataFactory1 ComputeTypeBasicCompute = "DataFactory" + // ComputeTypeSynapseSpark1 ... + ComputeTypeSynapseSpark1 ComputeTypeBasicCompute = "SynapseSpark" +) + +// PossibleComputeTypeBasicComputeValues returns an array of possible values for the ComputeTypeBasicCompute const type. +func PossibleComputeTypeBasicComputeValues() []ComputeTypeBasicCompute { + return []ComputeTypeBasicCompute{ComputeTypeCompute, ComputeTypeDataFactory1, ComputeTypeSynapseSpark1} +} + +// ComputeTypeBasicComputeSecrets enumerates the values for compute type basic compute secrets. +type ComputeTypeBasicComputeSecrets string + +const ( + // ComputeTypeComputeSecrets ... + ComputeTypeComputeSecrets ComputeTypeBasicComputeSecrets = "ComputeSecrets" +) + +// PossibleComputeTypeBasicComputeSecretsValues returns an array of possible values for the ComputeTypeBasicComputeSecrets const type. +func PossibleComputeTypeBasicComputeSecretsValues() []ComputeTypeBasicComputeSecrets { + return []ComputeTypeBasicComputeSecrets{ComputeTypeComputeSecrets} +} + +// ConnectionAuthType enumerates the values for connection auth type. +type ConnectionAuthType string + +const ( + // ConnectionAuthTypeManagedIdentity ... + ConnectionAuthTypeManagedIdentity ConnectionAuthType = "ManagedIdentity" + // ConnectionAuthTypeNone ... + ConnectionAuthTypeNone ConnectionAuthType = "None" + // ConnectionAuthTypePAT ... + ConnectionAuthTypePAT ConnectionAuthType = "PAT" + // ConnectionAuthTypeSAS ... + ConnectionAuthTypeSAS ConnectionAuthType = "SAS" + // ConnectionAuthTypeUsernamePassword ... + ConnectionAuthTypeUsernamePassword ConnectionAuthType = "UsernamePassword" +) + +// PossibleConnectionAuthTypeValues returns an array of possible values for the ConnectionAuthType const type. +func PossibleConnectionAuthTypeValues() []ConnectionAuthType { + return []ConnectionAuthType{ConnectionAuthTypeManagedIdentity, ConnectionAuthTypeNone, ConnectionAuthTypePAT, ConnectionAuthTypeSAS, ConnectionAuthTypeUsernamePassword} +} + +// ConnectionCategory enumerates the values for connection category. +type ConnectionCategory string + +const ( + // ContainerRegistry ... + ContainerRegistry ConnectionCategory = "ContainerRegistry" + // Git ... + Git ConnectionCategory = "Git" + // PythonFeed ... + PythonFeed ConnectionCategory = "PythonFeed" +) + +// PossibleConnectionCategoryValues returns an array of possible values for the ConnectionCategory const type. +func PossibleConnectionCategoryValues() []ConnectionCategory { + return []ConnectionCategory{ContainerRegistry, Git, PythonFeed} +} + +// 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} +} + +// 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 ( + // CredentialsTypeAccountKey ... + CredentialsTypeAccountKey CredentialsType = "AccountKey" + // CredentialsTypeCertificate ... + CredentialsTypeCertificate CredentialsType = "Certificate" + // CredentialsTypeNone ... + CredentialsTypeNone CredentialsType = "None" + // CredentialsTypeSas ... + CredentialsTypeSas CredentialsType = "Sas" + // CredentialsTypeServicePrincipal ... + CredentialsTypeServicePrincipal CredentialsType = "ServicePrincipal" +) + +// PossibleCredentialsTypeValues returns an array of possible values for the CredentialsType const type. +func PossibleCredentialsTypeValues() []CredentialsType { + return []CredentialsType{CredentialsTypeAccountKey, CredentialsTypeCertificate, CredentialsTypeNone, CredentialsTypeSas, CredentialsTypeServicePrincipal} +} + +// CredentialsTypeBasicDatastoreCredentials enumerates the values for credentials type basic datastore +// credentials. +type CredentialsTypeBasicDatastoreCredentials string + +const ( + // CredentialsTypeAccountKey1 ... + CredentialsTypeAccountKey1 CredentialsTypeBasicDatastoreCredentials = "AccountKey" + // CredentialsTypeCertificate1 ... + CredentialsTypeCertificate1 CredentialsTypeBasicDatastoreCredentials = "Certificate" + // CredentialsTypeDatastoreCredentials ... + CredentialsTypeDatastoreCredentials CredentialsTypeBasicDatastoreCredentials = "DatastoreCredentials" + // CredentialsTypeNone1 ... + CredentialsTypeNone1 CredentialsTypeBasicDatastoreCredentials = "None" + // CredentialsTypeSas1 ... + CredentialsTypeSas1 CredentialsTypeBasicDatastoreCredentials = "Sas" + // CredentialsTypeServicePrincipal1 ... + CredentialsTypeServicePrincipal1 CredentialsTypeBasicDatastoreCredentials = "ServicePrincipal" +) + +// PossibleCredentialsTypeBasicDatastoreCredentialsValues returns an array of possible values for the CredentialsTypeBasicDatastoreCredentials const type. +func PossibleCredentialsTypeBasicDatastoreCredentialsValues() []CredentialsTypeBasicDatastoreCredentials { + return []CredentialsTypeBasicDatastoreCredentials{CredentialsTypeAccountKey1, CredentialsTypeCertificate1, CredentialsTypeDatastoreCredentials, CredentialsTypeNone1, CredentialsTypeSas1, CredentialsTypeServicePrincipal1} +} + +// DatastoreType enumerates the values for datastore type. +type DatastoreType string + +const ( + // AzureBlob ... + AzureBlob DatastoreType = "AzureBlob" + // AzureDataLakeGen1 ... + AzureDataLakeGen1 DatastoreType = "AzureDataLakeGen1" + // AzureDataLakeGen2 ... + AzureDataLakeGen2 DatastoreType = "AzureDataLakeGen2" + // AzureFile ... + AzureFile DatastoreType = "AzureFile" +) + +// PossibleDatastoreTypeValues returns an array of possible values for the DatastoreType const type. +func PossibleDatastoreTypeValues() []DatastoreType { + return []DatastoreType{AzureBlob, AzureDataLakeGen1, AzureDataLakeGen2, AzureFile} +} + +// DatastoreTypeBasicDatastore enumerates the values for datastore type basic datastore. +type DatastoreTypeBasicDatastore string + +const ( + // DatastoreTypeAzureBlob ... + DatastoreTypeAzureBlob DatastoreTypeBasicDatastore = "AzureBlob" + // DatastoreTypeAzureDataLakeGen1 ... + DatastoreTypeAzureDataLakeGen1 DatastoreTypeBasicDatastore = "AzureDataLakeGen1" + // DatastoreTypeAzureDataLakeGen2 ... + DatastoreTypeAzureDataLakeGen2 DatastoreTypeBasicDatastore = "AzureDataLakeGen2" + // DatastoreTypeAzureFile ... + DatastoreTypeAzureFile DatastoreTypeBasicDatastore = "AzureFile" + // DatastoreTypeDatastore ... + DatastoreTypeDatastore DatastoreTypeBasicDatastore = "Datastore" +) + +// PossibleDatastoreTypeBasicDatastoreValues returns an array of possible values for the DatastoreTypeBasicDatastore const type. +func PossibleDatastoreTypeBasicDatastoreValues() []DatastoreTypeBasicDatastore { + return []DatastoreTypeBasicDatastore{DatastoreTypeAzureBlob, DatastoreTypeAzureDataLakeGen1, DatastoreTypeAzureDataLakeGen2, DatastoreTypeAzureFile, DatastoreTypeDatastore} +} + +// DataType enumerates the values for data type. +type DataType string + +const ( + // Mltable ... + Mltable DataType = "mltable" + // URIFile ... + URIFile DataType = "uri_file" + // URIFolder ... + URIFolder DataType = "uri_folder" +) + +// PossibleDataTypeValues returns an array of possible values for the DataType const type. +func PossibleDataTypeValues() []DataType { + return []DataType{Mltable, URIFile, URIFolder} +} + +// DataTypeBasicDataVersionBase enumerates the values for data type basic data version base. +type DataTypeBasicDataVersionBase string + +const ( + // DataTypeDataVersionBase ... + DataTypeDataVersionBase DataTypeBasicDataVersionBase = "DataVersionBase" + // DataTypeMltable ... + DataTypeMltable DataTypeBasicDataVersionBase = "mltable" + // DataTypeURIFile ... + DataTypeURIFile DataTypeBasicDataVersionBase = "uri_file" + // DataTypeURIFolder ... + DataTypeURIFolder DataTypeBasicDataVersionBase = "uri_folder" +) + +// PossibleDataTypeBasicDataVersionBaseValues returns an array of possible values for the DataTypeBasicDataVersionBase const type. +func PossibleDataTypeBasicDataVersionBaseValues() []DataTypeBasicDataVersionBase { + return []DataTypeBasicDataVersionBase{DataTypeDataVersionBase, DataTypeMltable, DataTypeURIFile, DataTypeURIFolder} +} + +// 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} +} + +// DiagnoseResultLevel enumerates the values for diagnose result level. +type DiagnoseResultLevel string + +const ( + // DiagnoseResultLevelError ... + DiagnoseResultLevelError DiagnoseResultLevel = "Error" + // DiagnoseResultLevelInformation ... + DiagnoseResultLevelInformation DiagnoseResultLevel = "Information" + // DiagnoseResultLevelWarning ... + DiagnoseResultLevelWarning DiagnoseResultLevel = "Warning" +) + +// PossibleDiagnoseResultLevelValues returns an array of possible values for the DiagnoseResultLevel const type. +func PossibleDiagnoseResultLevelValues() []DiagnoseResultLevel { + return []DiagnoseResultLevel{DiagnoseResultLevelError, DiagnoseResultLevelInformation, DiagnoseResultLevelWarning} +} + +// 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} +} + +// 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 ( + // EndpointComputeTypeAzureMLCompute ... + EndpointComputeTypeAzureMLCompute EndpointComputeType = "AzureMLCompute" + // EndpointComputeTypeKubernetes ... + EndpointComputeTypeKubernetes EndpointComputeType = "Kubernetes" + // EndpointComputeTypeManaged ... + EndpointComputeTypeManaged EndpointComputeType = "Managed" +) + +// PossibleEndpointComputeTypeValues returns an array of possible values for the EndpointComputeType const type. +func PossibleEndpointComputeTypeValues() []EndpointComputeType { + return []EndpointComputeType{EndpointComputeTypeAzureMLCompute, EndpointComputeTypeKubernetes, EndpointComputeTypeManaged} +} + +// EndpointComputeTypeBasicOnlineDeployment enumerates the values for endpoint compute type basic online +// deployment. +type EndpointComputeTypeBasicOnlineDeployment string + +const ( + // EndpointComputeTypeKubernetes1 ... + EndpointComputeTypeKubernetes1 EndpointComputeTypeBasicOnlineDeployment = "Kubernetes" + // EndpointComputeTypeManaged1 ... + EndpointComputeTypeManaged1 EndpointComputeTypeBasicOnlineDeployment = "Managed" + // EndpointComputeTypeOnlineDeployment ... + EndpointComputeTypeOnlineDeployment EndpointComputeTypeBasicOnlineDeployment = "OnlineDeployment" +) + +// PossibleEndpointComputeTypeBasicOnlineDeploymentValues returns an array of possible values for the EndpointComputeTypeBasicOnlineDeployment const type. +func PossibleEndpointComputeTypeBasicOnlineDeploymentValues() []EndpointComputeTypeBasicOnlineDeployment { + return []EndpointComputeTypeBasicOnlineDeployment{EndpointComputeTypeKubernetes1, EndpointComputeTypeManaged1, EndpointComputeTypeOnlineDeployment} +} + +// 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} +} + +// EnvironmentType enumerates the values for environment type. +type EnvironmentType string + +const ( + // Curated ... + Curated EnvironmentType = "Curated" + // UserCreated ... + UserCreated EnvironmentType = "UserCreated" +) + +// PossibleEnvironmentTypeValues returns an array of possible values for the EnvironmentType const type. +func PossibleEnvironmentTypeValues() []EnvironmentType { + return []EnvironmentType{Curated, UserCreated} +} + +// 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" + // IdentityConfigurationTypeUserIdentity ... + IdentityConfigurationTypeUserIdentity IdentityConfigurationType = "UserIdentity" +) + +// PossibleIdentityConfigurationTypeValues returns an array of possible values for the IdentityConfigurationType const type. +func PossibleIdentityConfigurationTypeValues() []IdentityConfigurationType { + return []IdentityConfigurationType{IdentityConfigurationTypeAMLToken, IdentityConfigurationTypeManaged, IdentityConfigurationTypeUserIdentity} +} + +// IdentityType enumerates the values for identity type. +type IdentityType string + +const ( + // IdentityTypeAMLToken ... + IdentityTypeAMLToken IdentityType = "AMLToken" + // IdentityTypeIdentityConfiguration ... + IdentityTypeIdentityConfiguration IdentityType = "IdentityConfiguration" + // IdentityTypeManaged ... + IdentityTypeManaged IdentityType = "Managed" + // IdentityTypeUserIdentity ... + IdentityTypeUserIdentity IdentityType = "UserIdentity" +) + +// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{IdentityTypeAMLToken, IdentityTypeIdentityConfiguration, IdentityTypeManaged, IdentityTypeUserIdentity} +} + +// InputDeliveryMode enumerates the values for input delivery mode. +type InputDeliveryMode string + +const ( + // Direct ... + Direct InputDeliveryMode = "Direct" + // Download ... + Download InputDeliveryMode = "Download" + // EvalDownload ... + EvalDownload InputDeliveryMode = "EvalDownload" + // EvalMount ... + EvalMount InputDeliveryMode = "EvalMount" + // ReadOnlyMount ... + ReadOnlyMount InputDeliveryMode = "ReadOnlyMount" + // ReadWriteMount ... + ReadWriteMount InputDeliveryMode = "ReadWriteMount" +) + +// PossibleInputDeliveryModeValues returns an array of possible values for the InputDeliveryMode const type. +func PossibleInputDeliveryModeValues() []InputDeliveryMode { + return []InputDeliveryMode{Direct, Download, EvalDownload, EvalMount, ReadOnlyMount, ReadWriteMount} +} + +// JobInputType enumerates the values for job input type. +type JobInputType string + +const ( + // JobInputTypeCustomModel ... + JobInputTypeCustomModel JobInputType = "custom_model" + // JobInputTypeLiteral ... + JobInputTypeLiteral JobInputType = "literal" + // JobInputTypeMlflowModel ... + JobInputTypeMlflowModel JobInputType = "mlflow_model" + // JobInputTypeMltable ... + JobInputTypeMltable JobInputType = "mltable" + // JobInputTypeTritonModel ... + JobInputTypeTritonModel JobInputType = "triton_model" + // JobInputTypeURIFile ... + JobInputTypeURIFile JobInputType = "uri_file" + // JobInputTypeURIFolder ... + JobInputTypeURIFolder JobInputType = "uri_folder" +) + +// PossibleJobInputTypeValues returns an array of possible values for the JobInputType const type. +func PossibleJobInputTypeValues() []JobInputType { + return []JobInputType{JobInputTypeCustomModel, JobInputTypeLiteral, JobInputTypeMlflowModel, JobInputTypeMltable, JobInputTypeTritonModel, JobInputTypeURIFile, JobInputTypeURIFolder} +} + +// JobInputTypeBasicJobInput enumerates the values for job input type basic job input. +type JobInputTypeBasicJobInput string + +const ( + // JobInputTypeJobInput ... + JobInputTypeJobInput JobInputTypeBasicJobInput = "JobInput" + // JobInputTypeLiteral1 ... + JobInputTypeLiteral1 JobInputTypeBasicJobInput = "literal" +) + +// PossibleJobInputTypeBasicJobInputValues returns an array of possible values for the JobInputTypeBasicJobInput const type. +func PossibleJobInputTypeBasicJobInputValues() []JobInputTypeBasicJobInput { + return []JobInputTypeBasicJobInput{JobInputTypeJobInput, JobInputTypeLiteral1} +} + +// JobLimitsType enumerates the values for job limits type. +type JobLimitsType string + +const ( + // Command ... + Command JobLimitsType = "Command" + // Sweep ... + Sweep JobLimitsType = "Sweep" +) + +// PossibleJobLimitsTypeValues returns an array of possible values for the JobLimitsType const type. +func PossibleJobLimitsTypeValues() []JobLimitsType { + return []JobLimitsType{Command, Sweep} +} + +// JobLimitsTypeBasicJobLimits enumerates the values for job limits type basic job limits. +type JobLimitsTypeBasicJobLimits string + +const ( + // JobLimitsTypeCommand ... + JobLimitsTypeCommand JobLimitsTypeBasicJobLimits = "Command" + // JobLimitsTypeJobLimits ... + JobLimitsTypeJobLimits JobLimitsTypeBasicJobLimits = "JobLimits" + // JobLimitsTypeSweep ... + JobLimitsTypeSweep JobLimitsTypeBasicJobLimits = "Sweep" +) + +// PossibleJobLimitsTypeBasicJobLimitsValues returns an array of possible values for the JobLimitsTypeBasicJobLimits const type. +func PossibleJobLimitsTypeBasicJobLimitsValues() []JobLimitsTypeBasicJobLimits { + return []JobLimitsTypeBasicJobLimits{JobLimitsTypeCommand, JobLimitsTypeJobLimits, JobLimitsTypeSweep} +} + +// JobOutputType enumerates the values for job output type. +type JobOutputType string + +const ( + // JobOutputTypeCustomModel ... + JobOutputTypeCustomModel JobOutputType = "custom_model" + // JobOutputTypeMlflowModel ... + JobOutputTypeMlflowModel JobOutputType = "mlflow_model" + // JobOutputTypeMltable ... + JobOutputTypeMltable JobOutputType = "mltable" + // JobOutputTypeTritonModel ... + JobOutputTypeTritonModel JobOutputType = "triton_model" + // JobOutputTypeURIFile ... + JobOutputTypeURIFile JobOutputType = "uri_file" + // JobOutputTypeURIFolder ... + JobOutputTypeURIFolder JobOutputType = "uri_folder" +) + +// PossibleJobOutputTypeValues returns an array of possible values for the JobOutputType const type. +func PossibleJobOutputTypeValues() []JobOutputType { + return []JobOutputType{JobOutputTypeCustomModel, JobOutputTypeMlflowModel, JobOutputTypeMltable, JobOutputTypeTritonModel, JobOutputTypeURIFile, JobOutputTypeURIFolder} +} + +// JobOutputTypeBasicJobOutput enumerates the values for job output type basic job output. +type JobOutputTypeBasicJobOutput string + +const ( + // JobOutputTypeJobOutput ... + JobOutputTypeJobOutput JobOutputTypeBasicJobOutput = "JobOutput" +) + +// PossibleJobOutputTypeBasicJobOutputValues returns an array of possible values for the JobOutputTypeBasicJobOutput const type. +func PossibleJobOutputTypeBasicJobOutputValues() []JobOutputTypeBasicJobOutput { + return []JobOutputTypeBasicJobOutput{JobOutputTypeJobOutput} +} + +// JobStatus enumerates the values for job status. +type JobStatus string + +const ( + // JobStatusCanceled Following cancellation request, the job is now successfully canceled. + JobStatusCanceled JobStatus = "Canceled" + // JobStatusCancelRequested Cancellation has been requested for the job. + JobStatusCancelRequested JobStatus = "CancelRequested" + // JobStatusCompleted Job completed successfully. This reflects that both the job itself and output + // collection states completed successfully + JobStatusCompleted JobStatus = "Completed" + // JobStatusFailed Job failed. + JobStatusFailed JobStatus = "Failed" + // JobStatusFinalizing Job is completed in the target. It is in output collection state now. + JobStatusFinalizing JobStatus = "Finalizing" + // JobStatusNotResponding When heartbeat is enabled, if the run isn't updating any information to + // RunHistory then the run goes to NotResponding state. + // NotResponding is the only state that is exempt from strict transition orders. A run can go from + // NotResponding to any of the previous states. + JobStatusNotResponding JobStatus = "NotResponding" + // JobStatusNotStarted Run hasn't started yet. + JobStatusNotStarted JobStatus = "NotStarted" + // JobStatusPaused The job is paused by users. Some adjustment to labeling jobs can be made only in paused + // state. + JobStatusPaused JobStatus = "Paused" + // JobStatusPreparing The run environment is being prepared. + JobStatusPreparing JobStatus = "Preparing" + // JobStatusProvisioning (Not used currently) It will be used if ES is creating the compute target. + JobStatusProvisioning JobStatus = "Provisioning" + // JobStatusQueued The job is queued in the compute target. For example, in BatchAI the job is in queued + // state, while waiting for all required nodes to be ready. + JobStatusQueued JobStatus = "Queued" + // JobStatusRunning The job started to run in the compute target. + JobStatusRunning JobStatus = "Running" + // JobStatusStarting Run has started. The user has a run ID. + JobStatusStarting JobStatus = "Starting" + // JobStatusUnknown Default job status if not mapped to all other statuses + 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 ( + // JobTypeCommand ... + JobTypeCommand JobType = "Command" + // JobTypePipeline ... + JobTypePipeline JobType = "Pipeline" + // JobTypeSweep ... + JobTypeSweep JobType = "Sweep" +) + +// PossibleJobTypeValues returns an array of possible values for the JobType const type. +func PossibleJobTypeValues() []JobType { + return []JobType{JobTypeCommand, JobTypePipeline, JobTypeSweep} +} + +// JobTypeBasicJobBase enumerates the values for job type basic job base. +type JobTypeBasicJobBase string + +const ( + // JobTypeCommand1 ... + JobTypeCommand1 JobTypeBasicJobBase = "Command" + // JobTypeJobBase ... + JobTypeJobBase JobTypeBasicJobBase = "JobBase" + // JobTypePipeline1 ... + JobTypePipeline1 JobTypeBasicJobBase = "Pipeline" + // JobTypeSweep1 ... + JobTypeSweep1 JobTypeBasicJobBase = "Sweep" +) + +// PossibleJobTypeBasicJobBaseValues returns an array of possible values for the JobTypeBasicJobBase const type. +func PossibleJobTypeBasicJobBaseValues() []JobTypeBasicJobBase { + return []JobTypeBasicJobBase{JobTypeCommand1, JobTypeJobBase, JobTypePipeline1, JobTypeSweep1} +} + +// 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} +} + +// ListViewType enumerates the values for list view type. +type ListViewType string + +const ( + // ActiveOnly ... + ActiveOnly ListViewType = "ActiveOnly" + // All ... + All ListViewType = "All" + // ArchivedOnly ... + ArchivedOnly ListViewType = "ArchivedOnly" +) + +// PossibleListViewTypeValues returns an array of possible values for the ListViewType const type. +func PossibleListViewTypeValues() []ListViewType { + return []ListViewType{ActiveOnly, All, ArchivedOnly} +} + +// 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} +} + +// ManagedServiceIdentityType enumerates the values for managed service identity type. +type ManagedServiceIdentityType string + +const ( + // ManagedServiceIdentityTypeNone ... + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + // ManagedServiceIdentityTypeSystemAssigned ... + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeSystemAssignedUserAssigned ... + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" + // ManagedServiceIdentityTypeUserAssigned ... + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns an array of possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ManagedServiceIdentityTypeNone, ManagedServiceIdentityTypeSystemAssigned, ManagedServiceIdentityTypeSystemAssignedUserAssigned, ManagedServiceIdentityTypeUserAssigned} +} + +// MountAction enumerates the values for mount action. +type MountAction string + +const ( + // Mount ... + Mount MountAction = "Mount" + // Unmount ... + Unmount MountAction = "Unmount" +) + +// PossibleMountActionValues returns an array of possible values for the MountAction const type. +func PossibleMountActionValues() []MountAction { + return []MountAction{Mount, Unmount} +} + +// MountState enumerates the values for mount state. +type MountState string + +const ( + // Mounted ... + Mounted MountState = "Mounted" + // MountFailed ... + MountFailed MountState = "MountFailed" + // MountRequested ... + MountRequested MountState = "MountRequested" + // Unmounted ... + Unmounted MountState = "Unmounted" + // UnmountFailed ... + UnmountFailed MountState = "UnmountFailed" + // UnmountRequested ... + UnmountRequested MountState = "UnmountRequested" +) + +// PossibleMountStateValues returns an array of possible values for the MountState const type. +func PossibleMountStateValues() []MountState { + return []MountState{Mounted, MountFailed, MountRequested, Unmounted, UnmountFailed, UnmountRequested} +} + +// Network enumerates the values for network. +type Network string + +const ( + // Bridge ... + Bridge Network = "Bridge" + // Host ... + Host Network = "Host" +) + +// PossibleNetworkValues returns an array of possible values for the Network const type. +func PossibleNetworkValues() []Network { + return []Network{Bridge, Host} +} + +// 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} +} + +// OperationTrigger enumerates the values for operation trigger. +type OperationTrigger string + +const ( + // IdleShutdown ... + IdleShutdown OperationTrigger = "IdleShutdown" + // Schedule ... + Schedule OperationTrigger = "Schedule" + // User ... + User OperationTrigger = "User" +) + +// PossibleOperationTriggerValues returns an array of possible values for the OperationTrigger const type. +func PossibleOperationTriggerValues() []OperationTrigger { + return []OperationTrigger{IdleShutdown, Schedule, User} +} + +// 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} +} + +// 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} +} + +// OutputDeliveryMode enumerates the values for output delivery mode. +type OutputDeliveryMode string + +const ( + // OutputDeliveryModeReadWriteMount ... + OutputDeliveryModeReadWriteMount OutputDeliveryMode = "ReadWriteMount" + // OutputDeliveryModeUpload ... + OutputDeliveryModeUpload OutputDeliveryMode = "Upload" +) + +// PossibleOutputDeliveryModeValues returns an array of possible values for the OutputDeliveryMode const type. +func PossibleOutputDeliveryModeValues() []OutputDeliveryMode { + return []OutputDeliveryMode{OutputDeliveryModeReadWriteMount, OutputDeliveryModeUpload} +} + +// 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 ( + // Completed ... + Completed ProvisioningStatus = "Completed" + // Failed ... + Failed ProvisioningStatus = "Failed" + // Provisioning ... + Provisioning ProvisioningStatus = "Provisioning" +) + +// PossibleProvisioningStatusValues returns an array of possible values for the ProvisioningStatus const type. +func PossibleProvisioningStatusValues() []ProvisioningStatus { + return []ProvisioningStatus{Completed, Failed, Provisioning} +} + +// PublicNetworkAccess enumerates the values for public network access. +type PublicNetworkAccess string + +const ( + // PublicNetworkAccessDisabled ... + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + // PublicNetworkAccessEnabled ... + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} +} + +// 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} +} + +// RandomSamplingAlgorithmRule enumerates the values for random sampling algorithm rule. +type RandomSamplingAlgorithmRule string + +const ( + // Random ... + Random RandomSamplingAlgorithmRule = "Random" + // Sobol ... + Sobol RandomSamplingAlgorithmRule = "Sobol" +) + +// PossibleRandomSamplingAlgorithmRuleValues returns an array of possible values for the RandomSamplingAlgorithmRule const type. +func PossibleRandomSamplingAlgorithmRuleValues() []RandomSamplingAlgorithmRule { + return []RandomSamplingAlgorithmRule{Random, Sobol} +} + +// 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} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // SystemAssigned ... + SystemAssigned ResourceIdentityType = "SystemAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{SystemAssigned} +} + +// SamplingAlgorithmType enumerates the values for sampling algorithm type. +type SamplingAlgorithmType string + +const ( + // SamplingAlgorithmTypeBayesian ... + SamplingAlgorithmTypeBayesian SamplingAlgorithmType = "Bayesian" + // SamplingAlgorithmTypeGrid ... + SamplingAlgorithmTypeGrid SamplingAlgorithmType = "Grid" + // SamplingAlgorithmTypeRandom ... + SamplingAlgorithmTypeRandom SamplingAlgorithmType = "Random" +) + +// PossibleSamplingAlgorithmTypeValues returns an array of possible values for the SamplingAlgorithmType const type. +func PossibleSamplingAlgorithmTypeValues() []SamplingAlgorithmType { + return []SamplingAlgorithmType{SamplingAlgorithmTypeBayesian, SamplingAlgorithmTypeGrid, SamplingAlgorithmTypeRandom} +} + +// SamplingAlgorithmTypeBasicSamplingAlgorithm enumerates the values for sampling algorithm type basic sampling +// algorithm. +type SamplingAlgorithmTypeBasicSamplingAlgorithm string + +const ( + // SamplingAlgorithmTypeBayesian1 ... + SamplingAlgorithmTypeBayesian1 SamplingAlgorithmTypeBasicSamplingAlgorithm = "Bayesian" + // SamplingAlgorithmTypeGrid1 ... + SamplingAlgorithmTypeGrid1 SamplingAlgorithmTypeBasicSamplingAlgorithm = "Grid" + // SamplingAlgorithmTypeRandom1 ... + SamplingAlgorithmTypeRandom1 SamplingAlgorithmTypeBasicSamplingAlgorithm = "Random" + // SamplingAlgorithmTypeSamplingAlgorithm ... + SamplingAlgorithmTypeSamplingAlgorithm SamplingAlgorithmTypeBasicSamplingAlgorithm = "SamplingAlgorithm" +) + +// PossibleSamplingAlgorithmTypeBasicSamplingAlgorithmValues returns an array of possible values for the SamplingAlgorithmTypeBasicSamplingAlgorithm const type. +func PossibleSamplingAlgorithmTypeBasicSamplingAlgorithmValues() []SamplingAlgorithmTypeBasicSamplingAlgorithm { + return []SamplingAlgorithmTypeBasicSamplingAlgorithm{SamplingAlgorithmTypeBayesian1, SamplingAlgorithmTypeGrid1, SamplingAlgorithmTypeRandom1, SamplingAlgorithmTypeSamplingAlgorithm} +} + +// ScaleType enumerates the values for scale type. +type ScaleType string + +const ( + // Default ... + Default ScaleType = "Default" + // TargetUtilization ... + TargetUtilization ScaleType = "TargetUtilization" +) + +// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. +func PossibleScaleTypeValues() []ScaleType { + return []ScaleType{Default, TargetUtilization} +} + +// ScaleTypeBasicOnlineScaleSettings enumerates the values for scale type basic online scale settings. +type ScaleTypeBasicOnlineScaleSettings string + +const ( + // ScaleTypeDefault ... + ScaleTypeDefault ScaleTypeBasicOnlineScaleSettings = "Default" + // ScaleTypeOnlineScaleSettings ... + ScaleTypeOnlineScaleSettings ScaleTypeBasicOnlineScaleSettings = "OnlineScaleSettings" + // ScaleTypeTargetUtilization ... + ScaleTypeTargetUtilization ScaleTypeBasicOnlineScaleSettings = "TargetUtilization" +) + +// PossibleScaleTypeBasicOnlineScaleSettingsValues returns an array of possible values for the ScaleTypeBasicOnlineScaleSettings const type. +func PossibleScaleTypeBasicOnlineScaleSettingsValues() []ScaleTypeBasicOnlineScaleSettings { + return []ScaleTypeBasicOnlineScaleSettings{ScaleTypeDefault, ScaleTypeOnlineScaleSettings, ScaleTypeTargetUtilization} +} + +// ScheduleProvisioningState enumerates the values for schedule provisioning state. +type ScheduleProvisioningState string + +const ( + // ScheduleProvisioningStateCompleted ... + ScheduleProvisioningStateCompleted ScheduleProvisioningState = "Completed" + // ScheduleProvisioningStateFailed ... + ScheduleProvisioningStateFailed ScheduleProvisioningState = "Failed" + // ScheduleProvisioningStateProvisioning ... + ScheduleProvisioningStateProvisioning ScheduleProvisioningState = "Provisioning" +) + +// PossibleScheduleProvisioningStateValues returns an array of possible values for the ScheduleProvisioningState const type. +func PossibleScheduleProvisioningStateValues() []ScheduleProvisioningState { + return []ScheduleProvisioningState{ScheduleProvisioningStateCompleted, ScheduleProvisioningStateFailed, ScheduleProvisioningStateProvisioning} +} + +// 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} +} + +// SecretsType enumerates the values for secrets type. +type SecretsType string + +const ( + // AccountKey ... + AccountKey SecretsType = "AccountKey" + // Certificate ... + Certificate SecretsType = "Certificate" + // Sas ... + Sas SecretsType = "Sas" + // ServicePrincipal ... + ServicePrincipal SecretsType = "ServicePrincipal" +) + +// PossibleSecretsTypeValues returns an array of possible values for the SecretsType const type. +func PossibleSecretsTypeValues() []SecretsType { + return []SecretsType{AccountKey, Certificate, Sas, ServicePrincipal} +} + +// SecretsTypeBasicDatastoreSecrets enumerates the values for secrets type basic datastore secrets. +type SecretsTypeBasicDatastoreSecrets string + +const ( + // SecretsTypeAccountKey ... + SecretsTypeAccountKey SecretsTypeBasicDatastoreSecrets = "AccountKey" + // SecretsTypeCertificate ... + SecretsTypeCertificate SecretsTypeBasicDatastoreSecrets = "Certificate" + // SecretsTypeDatastoreSecrets ... + SecretsTypeDatastoreSecrets SecretsTypeBasicDatastoreSecrets = "DatastoreSecrets" + // SecretsTypeSas ... + SecretsTypeSas SecretsTypeBasicDatastoreSecrets = "Sas" + // SecretsTypeServicePrincipal ... + SecretsTypeServicePrincipal SecretsTypeBasicDatastoreSecrets = "ServicePrincipal" +) + +// PossibleSecretsTypeBasicDatastoreSecretsValues returns an array of possible values for the SecretsTypeBasicDatastoreSecrets const type. +func PossibleSecretsTypeBasicDatastoreSecretsValues() []SecretsTypeBasicDatastoreSecrets { + return []SecretsTypeBasicDatastoreSecrets{SecretsTypeAccountKey, SecretsTypeCertificate, SecretsTypeDatastoreSecrets, SecretsTypeSas, SecretsTypeServicePrincipal} +} + +// ServiceDataAccessAuthIdentity enumerates the values for service data access auth identity. +type ServiceDataAccessAuthIdentity string + +const ( + // ServiceDataAccessAuthIdentityNone Do not use any identity for service data access. + ServiceDataAccessAuthIdentityNone ServiceDataAccessAuthIdentity = "None" + // ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity Use the system assigned managed identity of + // the Workspace to authenticate service data access. + ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity ServiceDataAccessAuthIdentity = "WorkspaceSystemAssignedIdentity" + // ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity Use the user assigned managed identity of the + // Workspace to authenticate service data access. + ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity ServiceDataAccessAuthIdentity = "WorkspaceUserAssignedIdentity" +) + +// PossibleServiceDataAccessAuthIdentityValues returns an array of possible values for the ServiceDataAccessAuthIdentity const type. +func PossibleServiceDataAccessAuthIdentityValues() []ServiceDataAccessAuthIdentity { + return []ServiceDataAccessAuthIdentity{ServiceDataAccessAuthIdentityNone, ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity, ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity} +} + +// SkuScaleType enumerates the values for sku scale type. +type SkuScaleType string + +const ( + // SkuScaleTypeAutomatic Automatically scales node count. + SkuScaleTypeAutomatic SkuScaleType = "Automatic" + // SkuScaleTypeManual Node count scaled upon user request. + SkuScaleTypeManual SkuScaleType = "Manual" + // SkuScaleTypeNone Fixed set of nodes. + SkuScaleTypeNone SkuScaleType = "None" +) + +// PossibleSkuScaleTypeValues returns an array of possible values for the SkuScaleType const type. +func PossibleSkuScaleTypeValues() []SkuScaleType { + return []SkuScaleType{SkuScaleTypeAutomatic, SkuScaleTypeManual, SkuScaleTypeNone} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Basic ... + Basic SkuTier = "Basic" + // Free ... + Free SkuTier = "Free" + // Premium ... + Premium SkuTier = "Premium" + // Standard ... + Standard SkuTier = "Standard" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{Basic, Free, Premium, Standard} +} + +// SourceType enumerates the values for source type. +type SourceType string + +const ( + // SourceTypeDataset ... + SourceTypeDataset SourceType = "Dataset" + // SourceTypeDatastore ... + SourceTypeDatastore SourceType = "Datastore" + // SourceTypeURI ... + SourceTypeURI SourceType = "URI" +) + +// PossibleSourceTypeValues returns an array of possible values for the SourceType const type. +func PossibleSourceTypeValues() []SourceType { + return []SourceType{SourceTypeDataset, SourceTypeDatastore, SourceTypeURI} +} + +// 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} +} + +// SslConfigStatus enumerates the values for ssl config status. +type SslConfigStatus string + +const ( + // SslConfigStatusAuto ... + SslConfigStatusAuto SslConfigStatus = "Auto" + // SslConfigStatusDisabled ... + SslConfigStatusDisabled SslConfigStatus = "Disabled" + // SslConfigStatusEnabled ... + SslConfigStatusEnabled SslConfigStatus = "Enabled" +) + +// PossibleSslConfigStatusValues returns an array of possible values for the SslConfigStatus const type. +func PossibleSslConfigStatusValues() []SslConfigStatus { + return []SslConfigStatus{SslConfigStatusAuto, SslConfigStatusDisabled, SslConfigStatusEnabled} +} + +// 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} +} + +// StorageAccountType enumerates the values for storage account type. +type StorageAccountType string + +const ( + // PremiumLRS ... + PremiumLRS StorageAccountType = "Premium_LRS" + // StandardLRS ... + StandardLRS StorageAccountType = "Standard_LRS" +) + +// PossibleStorageAccountTypeValues returns an array of possible values for the StorageAccountType const type. +func PossibleStorageAccountTypeValues() []StorageAccountType { + return []StorageAccountType{PremiumLRS, StandardLRS} +} + +// 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/machinelearningservices/mgmt/2022-05-01/machinelearningservices/environmentcontainers.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/environmentcontainers.go new file mode 100644 index 000000000000..5726e45f6307 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/environmentcontainers.go @@ -0,0 +1,438 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// body - container entity to create or update. +func (client EnvironmentContainersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name 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: 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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, 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, resourceGroupName, workspaceName, name, 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, resourceGroupName string, workspaceName string, name 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 = "2022-05-01" + 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}/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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +func (client EnvironmentContainersClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-05-01" + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +func (client EnvironmentContainersClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-05-01" + 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. +// listViewType - view type for including/excluding (for example) archived entities. +func (client EnvironmentContainersClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType ListViewType) (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, listViewType) + 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, listViewType ListViewType) (*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 = "2022-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + if len(string(listViewType)) > 0 { + queryParameters["listViewType"] = autorest.Encode("query", listViewType) + } else { + queryParameters["listViewType"] = autorest.Encode("query", "ActiveOnly") + } + + 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, listViewType ListViewType) (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, listViewType) + return +} diff --git a/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/environmentversions.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/environmentversions.go new file mode 100644 index 000000000000..d7cee200c442 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/environmentversions.go @@ -0,0 +1,476 @@ +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" +) + +// EnvironmentVersionsClient is the these APIs allow end users to operate on Azure Machine Learning Workspace +// resources. +type EnvironmentVersionsClient struct { + BaseClient +} + +// NewEnvironmentVersionsClient creates an instance of the EnvironmentVersionsClient client. +func NewEnvironmentVersionsClient(subscriptionID string) EnvironmentVersionsClient { + return NewEnvironmentVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEnvironmentVersionsClientWithBaseURI creates an instance of the EnvironmentVersionsClient 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 NewEnvironmentVersionsClientWithBaseURI(baseURI string, subscriptionID string) EnvironmentVersionsClient { + return EnvironmentVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - name of EnvironmentVersion. This is case-sensitive. +// version - version of EnvironmentVersion. +// body - definition of EnvironmentVersion. +func (client EnvironmentVersionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string, body EnvironmentVersionResource) (result EnvironmentVersionResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentVersionsClient.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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.Build", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.Build.ContextURI", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.Build.ContextURI", Name: validation.Pattern, Rule: `[a-zA-Z0-9_]`, Chain: nil}}}, + }}, + {Target: "body.Properties.InferenceConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceConfig.LivenessRoute", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceConfig.LivenessRoute.Path", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceConfig.LivenessRoute.Path", Name: validation.Pattern, Rule: `[a-zA-Z0-9_]`, Chain: nil}}}, + {Target: "body.Properties.InferenceConfig.LivenessRoute.Port", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "body.Properties.InferenceConfig.ReadinessRoute", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceConfig.ReadinessRoute.Path", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceConfig.ReadinessRoute.Path", Name: validation.Pattern, Rule: `[a-zA-Z0-9_]`, Chain: nil}}}, + {Target: "body.Properties.InferenceConfig.ReadinessRoute.Port", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "body.Properties.InferenceConfig.ScoringRoute", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceConfig.ScoringRoute.Path", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceConfig.ScoringRoute.Path", Name: validation.Pattern, Rule: `[a-zA-Z0-9_]`, Chain: nil}}}, + {Target: "body.Properties.InferenceConfig.ScoringRoute.Port", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("machinelearningservices.EnvironmentVersionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, name, version, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "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.EnvironmentVersionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client EnvironmentVersionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string, body EnvironmentVersionResource) (*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 = "2022-05-01" + 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}/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 EnvironmentVersionsClient) 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 EnvironmentVersionsClient) CreateOrUpdateResponder(resp *http.Response) (result EnvironmentVersionResource, 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// version - version identifier. This is case-sensitive. +func (client EnvironmentVersionsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentVersionsClient.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.EnvironmentVersionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, name, version) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client EnvironmentVersionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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 = "2022-05-01" + 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 EnvironmentVersionsClient) 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 EnvironmentVersionsClient) 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// version - version identifier. This is case-sensitive. +func (client EnvironmentVersionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result EnvironmentVersionResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentVersionsClient.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.EnvironmentVersionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, name, version) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "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.EnvironmentVersionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client EnvironmentVersionsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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 = "2022-05-01" + 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 EnvironmentVersionsClient) 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 EnvironmentVersionsClient) GetResponder(resp *http.Response) (result EnvironmentVersionResource, 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 - container name. This is case-sensitive. +// orderBy - ordering of list. +// top - maximum number of records to return. +// skip - continuation token for pagination. +// listViewType - view type for including/excluding (for example) archived entities. +func (client EnvironmentVersionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType ListViewType) (result EnvironmentVersionResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentVersionsClient.List") + defer func() { + sc := -1 + if result.evrapr.Response.Response != nil { + sc = result.evrapr.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.EnvironmentVersionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, name, orderBy, top, skip, listViewType) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.evrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "List", resp, "Failure sending request") + return + } + + result.evrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "List", resp, "Failure responding to request") + return + } + if result.evrapr.hasNextLink() && result.evrapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client EnvironmentVersionsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType ListViewType) (*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 = "2022-05-01" + 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(string(listViewType)) > 0 { + queryParameters["listViewType"] = autorest.Encode("query", listViewType) + } else { + queryParameters["listViewType"] = autorest.Encode("query", "ActiveOnly") + } + + 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 EnvironmentVersionsClient) 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 EnvironmentVersionsClient) ListResponder(resp *http.Response) (result EnvironmentVersionResourceArmPaginatedResult, 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 EnvironmentVersionsClient) listNextResults(ctx context.Context, lastResults EnvironmentVersionResourceArmPaginatedResult) (result EnvironmentVersionResourceArmPaginatedResult, err error) { + req, err := lastResults.environmentVersionResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "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.EnvironmentVersionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client EnvironmentVersionsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType ListViewType) (result EnvironmentVersionResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentVersionsClient.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, orderBy, top, skip, listViewType) + return +} diff --git a/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/jobs.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/jobs.go new file mode 100644 index 000000000000..6e32f193a8b5 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/jobs.go @@ -0,0 +1,534 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// ID - the name and identifier for the Job. This is case-sensitive. +func (client JobsClient) Cancel(ctx context.Context, resourceGroupName string, workspaceName string, ID string) (result JobsCancelFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.Cancel") + 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", "Cancel", err.Error()) + } + + req, err := client.CancelPreparer(ctx, resourceGroupName, workspaceName, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "Cancel", nil, "Failure preparing request") + return + } + + result, err = client.CancelSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.JobsClient", "Cancel", result.Response(), "Failure sending request") + return + } + + return +} + +// CancelPreparer prepares the Cancel request. +func (client JobsClient) CancelPreparer(ctx context.Context, resourceGroupName string, workspaceName string, ID 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 = "2022-05-01" + 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) (future JobsCancelFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 +} + +// 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, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// ID - the name and identifier for the Job. This is case-sensitive. +// body - job definition object. +func (client JobsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, ID 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: 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: ID, + Constraints: []validation.Constraint{{Target: "ID", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.JobsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, ID, 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, resourceGroupName string, workspaceName string, ID 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 = "2022-05-01" + 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}/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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// ID - the name and identifier for the Job. This is case-sensitive. +func (client JobsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, ID 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, resourceGroupName, workspaceName, ID) + 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", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client JobsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, ID 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 = "2022-05-01" + 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 + future.FutureAPI = &azure.Future{} + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// ID - the name and identifier for the Job. This is case-sensitive. +func (client JobsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, ID 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, resourceGroupName, workspaceName, ID) + 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, resourceGroupName string, workspaceName string, ID 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 = "2022-05-01" + 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. +// tag - jobs returned will have this tag key. +// listViewType - view type for including/excluding (for example) archived entities. +func (client JobsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, jobType string, tag string, listViewType ListViewType) (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, tag, listViewType) + 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, tag string, listViewType ListViewType) (*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 = "2022-05-01" + 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(tag) > 0 { + queryParameters["tag"] = autorest.Encode("query", tag) + } + if len(string(listViewType)) > 0 { + queryParameters["listViewType"] = autorest.Encode("query", listViewType) + } else { + queryParameters["listViewType"] = autorest.Encode("query", "ActiveOnly") + } + + 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, tag string, listViewType ListViewType) (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, tag, listViewType) + return +} diff --git a/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/machinelearningservicesapi/interfaces.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/machinelearningservicesapi/interfaces.go new file mode 100644 index 000000000000..f50a8fbd9779 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/machinelearningservicesapi/interfaces.go @@ -0,0 +1,309 @@ +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/machinelearningservices/mgmt/2022-05-01/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.AmlOperationListResult, 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) + Diagnose(ctx context.Context, resourceGroupName string, workspaceName string, parameters *machinelearningservices.DiagnoseWorkspaceParameters) (result machinelearningservices.WorkspacesDiagnoseFuture, 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) + ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, workspaceName string) (result machinelearningservices.ExternalFQDNResponse, 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.WorkspacesUpdateFuture, 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 machinelearningservices.ComputeRestartFuture, 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) +} + +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.WorkspaceConnectionPropertiesV2BasicResource) (result machinelearningservices.WorkspaceConnectionPropertiesV2BasicResource, 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.WorkspaceConnectionPropertiesV2BasicResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, target string, category string) (result machinelearningservices.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, target string, category string) (result machinelearningservices.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultIterator, err error) +} + +var _ WorkspaceConnectionsClientAPI = (*machinelearningservices.WorkspaceConnectionsClient)(nil) + +// BatchEndpointsClientAPI contains the set of methods on the BatchEndpointsClient type. +type BatchEndpointsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, body machinelearningservices.BatchEndpointTrackedResource) (result machinelearningservices.BatchEndpointsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string) (result machinelearningservices.BatchEndpointsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName string, workspaceName string, endpointName string) (result machinelearningservices.EndpointAuthKeys, err error) + Update(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, body machinelearningservices.PartialMinimalTrackedResourceWithIdentity) (result machinelearningservices.BatchEndpointsUpdateFuture, err error) +} + +var _ BatchEndpointsClientAPI = (*machinelearningservices.BatchEndpointsClient)(nil) + +// BatchDeploymentsClientAPI contains the set of methods on the BatchDeploymentsClient type. +type BatchDeploymentsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, body machinelearningservices.BatchDeploymentTrackedResource) (result machinelearningservices.BatchDeploymentsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string) (result machinelearningservices.BatchDeploymentsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string) (result machinelearningservices.BatchDeploymentTrackedResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, orderBy string, top *int32, skip string) (result machinelearningservices.BatchDeploymentTrackedResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, orderBy string, top *int32, skip string) (result machinelearningservices.BatchDeploymentTrackedResourceArmPaginatedResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, body machinelearningservices.PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties) (result machinelearningservices.BatchDeploymentsUpdateFuture, err error) +} + +var _ BatchDeploymentsClientAPI = (*machinelearningservices.BatchDeploymentsClient)(nil) + +// CodeContainersClientAPI contains the set of methods on the CodeContainersClient type. +type CodeContainersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, body machinelearningservices.CodeContainerResource) (result machinelearningservices.CodeContainerResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName string, workspaceName string, name string, version string, body machinelearningservices.CodeVersionResource) (result machinelearningservices.CodeVersionResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result machinelearningservices.CodeVersionResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string) (result machinelearningservices.CodeVersionResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string) (result machinelearningservices.CodeVersionResourceArmPaginatedResultIterator, err error) +} + +var _ CodeVersionsClientAPI = (*machinelearningservices.CodeVersionsClient)(nil) + +// ComponentContainersClientAPI contains the set of methods on the ComponentContainersClient type. +type ComponentContainersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, body machinelearningservices.ComponentContainerResource) (result machinelearningservices.ComponentContainerResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result machinelearningservices.ComponentContainerResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.ComponentContainerResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.ComponentContainerResourceArmPaginatedResultIterator, err error) +} + +var _ ComponentContainersClientAPI = (*machinelearningservices.ComponentContainersClient)(nil) + +// ComponentVersionsClientAPI contains the set of methods on the ComponentVersionsClient type. +type ComponentVersionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string, body machinelearningservices.ComponentVersionResource) (result machinelearningservices.ComponentVersionResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result machinelearningservices.ComponentVersionResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.ComponentVersionResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.ComponentVersionResourceArmPaginatedResultIterator, err error) +} + +var _ ComponentVersionsClientAPI = (*machinelearningservices.ComponentVersionsClient)(nil) + +// DataContainersClientAPI contains the set of methods on the DataContainersClient type. +type DataContainersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, body machinelearningservices.DataContainerResource) (result machinelearningservices.DataContainerResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result machinelearningservices.DataContainerResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.DataContainerResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType machinelearningservices.ListViewType) (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, resourceGroupName string, workspaceName string, name string, version string, body machinelearningservices.DataVersionBaseResource) (result machinelearningservices.DataVersionBaseResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result machinelearningservices.DataVersionBaseResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, tags string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.DataVersionBaseResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, tags string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.DataVersionBaseResourceArmPaginatedResultIterator, err error) +} + +var _ DataVersionsClientAPI = (*machinelearningservices.DataVersionsClient)(nil) + +// DatastoresClientAPI contains the set of methods on the DatastoresClient type. +type DatastoresClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, body machinelearningservices.DatastoreResource, skipValidation *bool) (result machinelearningservices.DatastoreResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result machinelearningservices.DatastoreResource, 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.DatastoreResourceArmPaginatedResultPage, 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.DatastoreResourceArmPaginatedResultIterator, err error) + ListSecrets(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName string, workspaceName string, name string, body machinelearningservices.EnvironmentContainerResource) (result machinelearningservices.EnvironmentContainerResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result machinelearningservices.EnvironmentContainerResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.EnvironmentContainerResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.EnvironmentContainerResourceArmPaginatedResultIterator, err error) +} + +var _ EnvironmentContainersClientAPI = (*machinelearningservices.EnvironmentContainersClient)(nil) + +// EnvironmentVersionsClientAPI contains the set of methods on the EnvironmentVersionsClient type. +type EnvironmentVersionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string, body machinelearningservices.EnvironmentVersionResource) (result machinelearningservices.EnvironmentVersionResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result machinelearningservices.EnvironmentVersionResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.EnvironmentVersionResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.EnvironmentVersionResourceArmPaginatedResultIterator, err error) +} + +var _ EnvironmentVersionsClientAPI = (*machinelearningservices.EnvironmentVersionsClient)(nil) + +// JobsClientAPI contains the set of methods on the JobsClient type. +type JobsClientAPI interface { + Cancel(ctx context.Context, resourceGroupName string, workspaceName string, ID string) (result machinelearningservices.JobsCancelFuture, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, ID string, body machinelearningservices.JobBaseResource) (result machinelearningservices.JobBaseResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, ID string) (result machinelearningservices.JobsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, ID string) (result machinelearningservices.JobBaseResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, jobType string, tag string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.JobBaseResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, jobType string, tag string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.JobBaseResourceArmPaginatedResultIterator, err error) +} + +var _ JobsClientAPI = (*machinelearningservices.JobsClient)(nil) + +// ModelContainersClientAPI contains the set of methods on the ModelContainersClient type. +type ModelContainersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, body machinelearningservices.ModelContainerResource) (result machinelearningservices.ModelContainerResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result machinelearningservices.ModelContainerResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32, listViewType machinelearningservices.ListViewType) (result machinelearningservices.ModelContainerResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32, listViewType machinelearningservices.ListViewType) (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, resourceGroupName string, workspaceName string, name string, version string, body machinelearningservices.ModelVersionResource) (result machinelearningservices.ModelVersionResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result machinelearningservices.ModelVersionResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, name string, skip string, orderBy string, top *int32, version string, description string, offset *int32, tags string, properties string, feed string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.ModelVersionResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, name string, skip string, orderBy string, top *int32, version string, description string, offset *int32, tags string, properties string, feed string, listViewType machinelearningservices.ListViewType) (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, resourceGroupName string, workspaceName string, endpointName string, body machinelearningservices.OnlineEndpointTrackedResource) (result machinelearningservices.OnlineEndpointsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string) (result machinelearningservices.OnlineEndpointsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string) (result machinelearningservices.OnlineEndpointTrackedResource, err error) + GetToken(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName string, workspaceName string, endpointName string) (result machinelearningservices.EndpointAuthKeys, err error) + RegenerateKeys(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, body machinelearningservices.RegenerateEndpointKeysRequest) (result machinelearningservices.OnlineEndpointsRegenerateKeysFuture, err error) + Update(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, body machinelearningservices.PartialMinimalTrackedResourceWithIdentity) (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, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, body machinelearningservices.OnlineDeploymentTrackedResource) (result machinelearningservices.OnlineDeploymentsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string) (result machinelearningservices.OnlineDeploymentsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string) (result machinelearningservices.OnlineDeploymentTrackedResource, err error) + GetLogs(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, body machinelearningservices.DeploymentLogsRequest) (result machinelearningservices.DeploymentLogs, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, orderBy string, top *int32, skip string) (result machinelearningservices.OnlineDeploymentTrackedResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, orderBy string, top *int32, skip string) (result machinelearningservices.OnlineDeploymentTrackedResourceArmPaginatedResultIterator, err error) + ListSkus(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, count *int32, skip string) (result machinelearningservices.SkuResourceArmPaginatedResultPage, err error) + ListSkusComplete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, count *int32, skip string) (result machinelearningservices.SkuResourceArmPaginatedResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, body machinelearningservices.PartialMinimalTrackedResourceWithSku) (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) diff --git a/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/modelcontainers.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/modelcontainers.go new file mode 100644 index 000000000000..b60de593156a --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/modelcontainers.go @@ -0,0 +1,440 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// body - container entity to create or update. +func (client ModelContainersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name 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: 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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, 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, resourceGroupName, workspaceName, name, 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, resourceGroupName string, workspaceName string, name 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 = "2022-05-01" + 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}/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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +func (client ModelContainersClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-05-01" + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +func (client ModelContainersClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-05-01" + 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. +// listViewType - view type for including/excluding (for example) archived entities. +func (client ModelContainersClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32, listViewType ListViewType) (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, listViewType) + 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, listViewType ListViewType) (*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 = "2022-05-01" + 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) + } + if len(string(listViewType)) > 0 { + queryParameters["listViewType"] = autorest.Encode("query", listViewType) + } else { + queryParameters["listViewType"] = autorest.Encode("query", "ActiveOnly") + } + + 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, listViewType ListViewType) (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, listViewType) + return +} diff --git a/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/models.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/models.go new file mode 100644 index 000000000000..aa153544eb8d --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/models.go @@ -0,0 +1,17031 @@ +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/machinelearningservices/mgmt/2022-05-01/machinelearningservices" + +// AccountKeyDatastoreCredentials account key datastore credentials configuration. +type AccountKeyDatastoreCredentials struct { + // Secrets - [Required] Storage account secrets. + Secrets *AccountKeyDatastoreSecrets `json:"secrets,omitempty"` + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey1', 'CredentialsTypeCertificate1', 'CredentialsTypeNone1', 'CredentialsTypeSas1', 'CredentialsTypeServicePrincipal1' + CredentialsType CredentialsTypeBasicDatastoreCredentials `json:"credentialsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountKeyDatastoreCredentials. +func (akdc AccountKeyDatastoreCredentials) MarshalJSON() ([]byte, error) { + akdc.CredentialsType = CredentialsTypeAccountKey1 + 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 +} + +// 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', 'SecretsTypeAccountKey', 'SecretsTypeCertificate', 'SecretsTypeSas', 'SecretsTypeServicePrincipal' + SecretsType SecretsTypeBasicDatastoreSecrets `json:"secretsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountKeyDatastoreSecrets. +func (akds AccountKeyDatastoreSecrets) MarshalJSON() ([]byte, error) { + akds.SecretsType = SecretsTypeAccountKey + 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 +} + +// 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 +} + +// 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 { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // ComputeLocation - READ-ONLY; 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 *AKSProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AKS. +func (a AKS) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.ComputeType != "" { + objectMap["computeType"] = a.ComputeType + } + 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.Properties != nil { + objectMap["properties"] = a.Properties + } + return json.Marshal(objectMap) +} + +// AksComputeSecrets secrets related to a Machine Learning compute based on AKS. +type AksComputeSecrets struct { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // 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"` +} + +// AksComputeSecretsProperties properties of AksComputeSecrets +type AksComputeSecretsProperties 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"` +} + +// 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) +} + +// AKSSchema ... +type AKSSchema struct { + // Properties - AKS properties + Properties *AKSProperties `json:"properties,omitempty"` +} + +// AmlCompute an Azure Machine Learning compute. +type AmlCompute struct { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // ComputeLocation - READ-ONLY; 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 - Properties of AmlCompute + Properties *AmlComputeProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AmlCompute. +func (ac AmlCompute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ac.ComputeType != "" { + objectMap["computeType"] = ac.ComputeType + } + 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.Properties != nil { + objectMap["properties"] = ac.Properties + } + return json.Marshal(objectMap) +} + +// 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 result of AmlCompute Nodes +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"` +} + +// MarshalJSON is the custom marshaler for AmlComputeNodesInformation. +func (acni AmlComputeNodesInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// 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"` + // PropertyBag - A property bag containing additional properties. + PropertyBag interface{} `json:"propertyBag,omitempty"` +} + +// MarshalJSON is the custom marshaler for AmlComputeProperties. +func (acp AmlComputeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if acp.OsType != "" { + objectMap["osType"] = acp.OsType + } + if acp.VMSize != nil { + objectMap["vmSize"] = acp.VMSize + } + if acp.VMPriority != "" { + objectMap["vmPriority"] = acp.VMPriority + } + if acp.VirtualMachineImage != nil { + objectMap["virtualMachineImage"] = acp.VirtualMachineImage + } + if acp.IsolatedNetwork != nil { + objectMap["isolatedNetwork"] = acp.IsolatedNetwork + } + if acp.ScaleSettings != nil { + objectMap["scaleSettings"] = acp.ScaleSettings + } + if acp.UserAccountCredentials != nil { + objectMap["userAccountCredentials"] = acp.UserAccountCredentials + } + if acp.Subnet != nil { + objectMap["subnet"] = acp.Subnet + } + if acp.RemoteLoginPortPublicAccess != "" { + objectMap["remoteLoginPortPublicAccess"] = acp.RemoteLoginPortPublicAccess + } + if acp.EnableNodePublicIP != nil { + objectMap["enableNodePublicIp"] = acp.EnableNodePublicIP + } + if acp.PropertyBag != nil { + objectMap["propertyBag"] = acp.PropertyBag + } + return json.Marshal(objectMap) +} + +// AmlComputeSchema properties(top level) of AmlCompute +type AmlComputeSchema struct { + // Properties - Properties of AmlCompute + Properties *AmlComputeProperties `json:"properties,omitempty"` +} + +// AmlOperation azure Machine Learning workspace REST API operation +type AmlOperation struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display name of operation + Display *AmlOperationDisplay `json:"display,omitempty"` + // IsDataAction - Indicates whether the operation applies to data-plane + IsDataAction *bool `json:"isDataAction,omitempty"` +} + +// AmlOperationDisplay display name of operation +type AmlOperationDisplay 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"` +} + +// AmlOperationListResult an array of operations supported by the resource provider. +type AmlOperationListResult struct { + autorest.Response `json:"-"` + // Value - List of AML workspace operations supported by the AML workspace resource provider. + Value *[]AmlOperation `json:"value,omitempty"` +} + +// AmlToken AML Token identity configuration. +type AmlToken struct { + // IdentityType - Possible values include: 'IdentityTypeIdentityConfiguration', 'IdentityTypeAMLToken', 'IdentityTypeManaged', 'IdentityTypeUserIdentity' + 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 +} + +// AsUserIdentity is the BasicIdentityConfiguration implementation for AmlToken. +func (at AmlToken) AsUserIdentity() (*UserIdentity, 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"` +} + +// AssetBase ... +type AssetBase struct { + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // 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 AssetBase. +func (ab AssetBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ab.IsAnonymous != nil { + objectMap["isAnonymous"] = ab.IsAnonymous + } + if ab.IsArchived != nil { + objectMap["isArchived"] = ab.IsArchived + } + if ab.Description != nil { + objectMap["description"] = ab.Description + } + if ab.Properties != nil { + objectMap["properties"] = ab.Properties + } + if ab.Tags != nil { + objectMap["tags"] = ab.Tags + } + return json.Marshal(objectMap) +} + +// AssetContainer ... +type AssetContainer struct { + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // LatestVersion - READ-ONLY; The latest version inside this container. + LatestVersion *string `json:"latestVersion,omitempty"` + // NextVersion - READ-ONLY; The next auto incremental version + NextVersion *string `json:"nextVersion,omitempty"` + // 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 AssetContainer. +func (ac AssetContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ac.IsArchived != nil { + objectMap["isArchived"] = ac.IsArchived + } + if ac.Description != nil { + objectMap["description"] = ac.Description + } + if ac.Properties != nil { + objectMap["properties"] = ac.Properties + } + if ac.Tags != nil { + objectMap["tags"] = ac.Tags + } + return json.Marshal(objectMap) +} + +// AssetJobInput asset input type. +type AssetJobInput struct { + // Mode - Input Asset Delivery Mode. Possible values include: 'ReadOnlyMount', 'ReadWriteMount', 'Download', 'Direct', 'EvalMount', 'EvalDownload' + Mode InputDeliveryMode `json:"mode,omitempty"` + // URI - [Required] Input Asset URI. + URI *string `json:"uri,omitempty"` +} + +// AssetJobOutput asset output type. +type AssetJobOutput struct { + // Mode - Output Asset Delivery Mode. Possible values include: 'OutputDeliveryModeReadWriteMount', 'OutputDeliveryModeUpload' + Mode OutputDeliveryMode `json:"mode,omitempty"` + // URI - Output Asset URI. + URI *string `json:"uri,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"` +} + +// AzureBlobDatastore azure Blob datastore configuration. +type AzureBlobDatastore struct { + // AccountName - Storage account name. + AccountName *string `json:"accountName,omitempty"` + // ContainerName - Storage account container name. + ContainerName *string `json:"containerName,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"` + // ServiceDataAccessAuthIdentity - Indicates which identity to use to authenticate service data access to customer's storage. Possible values include: 'ServiceDataAccessAuthIdentityNone', 'ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity', 'ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity' + ServiceDataAccessAuthIdentity ServiceDataAccessAuthIdentity `json:"serviceDataAccessAuthIdentity,omitempty"` + // Credentials - [Required] Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // IsDefault - READ-ONLY; Readonly property to indicate if datastore is the workspace default datastore + IsDefault *bool `json:"isDefault,omitempty"` + // 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"` + // DatastoreType - Possible values include: 'DatastoreTypeDatastore', 'DatastoreTypeAzureBlob', 'DatastoreTypeAzureDataLakeGen1', 'DatastoreTypeAzureDataLakeGen2', 'DatastoreTypeAzureFile' + DatastoreType DatastoreTypeBasicDatastore `json:"datastoreType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureBlobDatastore. +func (abd AzureBlobDatastore) MarshalJSON() ([]byte, error) { + abd.DatastoreType = DatastoreTypeAzureBlob + objectMap := make(map[string]interface{}) + if abd.AccountName != nil { + objectMap["accountName"] = abd.AccountName + } + if abd.ContainerName != nil { + objectMap["containerName"] = abd.ContainerName + } + if abd.Endpoint != nil { + objectMap["endpoint"] = abd.Endpoint + } + if abd.Protocol != nil { + objectMap["protocol"] = abd.Protocol + } + if abd.ServiceDataAccessAuthIdentity != "" { + objectMap["serviceDataAccessAuthIdentity"] = abd.ServiceDataAccessAuthIdentity + } + objectMap["credentials"] = abd.Credentials + if abd.DatastoreType != "" { + objectMap["datastoreType"] = abd.DatastoreType + } + if abd.Description != nil { + objectMap["description"] = abd.Description + } + if abd.Properties != nil { + objectMap["properties"] = abd.Properties + } + if abd.Tags != nil { + objectMap["tags"] = abd.Tags + } + return json.Marshal(objectMap) +} + +// AsAzureBlobDatastore is the BasicDatastore implementation for AzureBlobDatastore. +func (abd AzureBlobDatastore) AsAzureBlobDatastore() (*AzureBlobDatastore, bool) { + return &abd, true +} + +// AsAzureDataLakeGen1Datastore is the BasicDatastore implementation for AzureBlobDatastore. +func (abd AzureBlobDatastore) AsAzureDataLakeGen1Datastore() (*AzureDataLakeGen1Datastore, bool) { + return nil, false +} + +// AsAzureDataLakeGen2Datastore is the BasicDatastore implementation for AzureBlobDatastore. +func (abd AzureBlobDatastore) AsAzureDataLakeGen2Datastore() (*AzureDataLakeGen2Datastore, bool) { + return nil, false +} + +// AsAzureFileDatastore is the BasicDatastore implementation for AzureBlobDatastore. +func (abd AzureBlobDatastore) AsAzureFileDatastore() (*AzureFileDatastore, bool) { + return nil, false +} + +// AsDatastore is the BasicDatastore implementation for AzureBlobDatastore. +func (abd AzureBlobDatastore) AsDatastore() (*Datastore, bool) { + return nil, false +} + +// AsBasicDatastore is the BasicDatastore implementation for AzureBlobDatastore. +func (abd AzureBlobDatastore) AsBasicDatastore() (BasicDatastore, bool) { + return &abd, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureBlobDatastore struct. +func (abd *AzureBlobDatastore) 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 + } + abd.AccountName = &accountName + } + case "containerName": + if v != nil { + var containerName string + err = json.Unmarshal(*v, &containerName) + if err != nil { + return err + } + abd.ContainerName = &containerName + } + case "endpoint": + if v != nil { + var endpoint string + err = json.Unmarshal(*v, &endpoint) + if err != nil { + return err + } + abd.Endpoint = &endpoint + } + case "protocol": + if v != nil { + var protocol string + err = json.Unmarshal(*v, &protocol) + if err != nil { + return err + } + abd.Protocol = &protocol + } + case "serviceDataAccessAuthIdentity": + if v != nil { + var serviceDataAccessAuthIdentity ServiceDataAccessAuthIdentity + err = json.Unmarshal(*v, &serviceDataAccessAuthIdentity) + if err != nil { + return err + } + abd.ServiceDataAccessAuthIdentity = serviceDataAccessAuthIdentity + } + case "credentials": + if v != nil { + credentials, err := unmarshalBasicDatastoreCredentials(*v) + if err != nil { + return err + } + abd.Credentials = credentials + } + case "isDefault": + if v != nil { + var isDefault bool + err = json.Unmarshal(*v, &isDefault) + if err != nil { + return err + } + abd.IsDefault = &isDefault + } + case "datastoreType": + if v != nil { + var datastoreType DatastoreTypeBasicDatastore + err = json.Unmarshal(*v, &datastoreType) + if err != nil { + return err + } + abd.DatastoreType = datastoreType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + abd.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + abd.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + abd.Tags = tags + } + } + } + + return nil +} + +// AzureDataLakeGen1Datastore azure Data Lake Gen1 datastore configuration. +type AzureDataLakeGen1Datastore struct { + // ServiceDataAccessAuthIdentity - Indicates which identity to use to authenticate service data access to customer's storage. Possible values include: 'ServiceDataAccessAuthIdentityNone', 'ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity', 'ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity' + ServiceDataAccessAuthIdentity ServiceDataAccessAuthIdentity `json:"serviceDataAccessAuthIdentity,omitempty"` + // StoreName - [Required] Azure Data Lake store name. + StoreName *string `json:"storeName,omitempty"` + // Credentials - [Required] Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // IsDefault - READ-ONLY; Readonly property to indicate if datastore is the workspace default datastore + IsDefault *bool `json:"isDefault,omitempty"` + // DatastoreType - Possible values include: 'DatastoreTypeDatastore', 'DatastoreTypeAzureBlob', 'DatastoreTypeAzureDataLakeGen1', 'DatastoreTypeAzureDataLakeGen2', 'DatastoreTypeAzureFile' + DatastoreType DatastoreTypeBasicDatastore `json:"datastoreType,omitempty"` + // 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 AzureDataLakeGen1Datastore. +func (adlg1d AzureDataLakeGen1Datastore) MarshalJSON() ([]byte, error) { + adlg1d.DatastoreType = DatastoreTypeAzureDataLakeGen1 + objectMap := make(map[string]interface{}) + if adlg1d.ServiceDataAccessAuthIdentity != "" { + objectMap["serviceDataAccessAuthIdentity"] = adlg1d.ServiceDataAccessAuthIdentity + } + if adlg1d.StoreName != nil { + objectMap["storeName"] = adlg1d.StoreName + } + objectMap["credentials"] = adlg1d.Credentials + if adlg1d.DatastoreType != "" { + objectMap["datastoreType"] = adlg1d.DatastoreType + } + if adlg1d.Description != nil { + objectMap["description"] = adlg1d.Description + } + if adlg1d.Properties != nil { + objectMap["properties"] = adlg1d.Properties + } + if adlg1d.Tags != nil { + objectMap["tags"] = adlg1d.Tags + } + return json.Marshal(objectMap) +} + +// AsAzureBlobDatastore is the BasicDatastore implementation for AzureDataLakeGen1Datastore. +func (adlg1d AzureDataLakeGen1Datastore) AsAzureBlobDatastore() (*AzureBlobDatastore, bool) { + return nil, false +} + +// AsAzureDataLakeGen1Datastore is the BasicDatastore implementation for AzureDataLakeGen1Datastore. +func (adlg1d AzureDataLakeGen1Datastore) AsAzureDataLakeGen1Datastore() (*AzureDataLakeGen1Datastore, bool) { + return &adlg1d, true +} + +// AsAzureDataLakeGen2Datastore is the BasicDatastore implementation for AzureDataLakeGen1Datastore. +func (adlg1d AzureDataLakeGen1Datastore) AsAzureDataLakeGen2Datastore() (*AzureDataLakeGen2Datastore, bool) { + return nil, false +} + +// AsAzureFileDatastore is the BasicDatastore implementation for AzureDataLakeGen1Datastore. +func (adlg1d AzureDataLakeGen1Datastore) AsAzureFileDatastore() (*AzureFileDatastore, bool) { + return nil, false +} + +// AsDatastore is the BasicDatastore implementation for AzureDataLakeGen1Datastore. +func (adlg1d AzureDataLakeGen1Datastore) AsDatastore() (*Datastore, bool) { + return nil, false +} + +// AsBasicDatastore is the BasicDatastore implementation for AzureDataLakeGen1Datastore. +func (adlg1d AzureDataLakeGen1Datastore) AsBasicDatastore() (BasicDatastore, bool) { + return &adlg1d, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureDataLakeGen1Datastore struct. +func (adlg1d *AzureDataLakeGen1Datastore) 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 "serviceDataAccessAuthIdentity": + if v != nil { + var serviceDataAccessAuthIdentity ServiceDataAccessAuthIdentity + err = json.Unmarshal(*v, &serviceDataAccessAuthIdentity) + if err != nil { + return err + } + adlg1d.ServiceDataAccessAuthIdentity = serviceDataAccessAuthIdentity + } + case "storeName": + if v != nil { + var storeName string + err = json.Unmarshal(*v, &storeName) + if err != nil { + return err + } + adlg1d.StoreName = &storeName + } + case "credentials": + if v != nil { + credentials, err := unmarshalBasicDatastoreCredentials(*v) + if err != nil { + return err + } + adlg1d.Credentials = credentials + } + case "isDefault": + if v != nil { + var isDefault bool + err = json.Unmarshal(*v, &isDefault) + if err != nil { + return err + } + adlg1d.IsDefault = &isDefault + } + case "datastoreType": + if v != nil { + var datastoreType DatastoreTypeBasicDatastore + err = json.Unmarshal(*v, &datastoreType) + if err != nil { + return err + } + adlg1d.DatastoreType = datastoreType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + adlg1d.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + adlg1d.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + adlg1d.Tags = tags + } + } + } + + return nil +} + +// AzureDataLakeGen2Datastore azure Data Lake Gen2 datastore configuration. +type AzureDataLakeGen2Datastore struct { + // AccountName - [Required] Storage account name. + AccountName *string `json:"accountName,omitempty"` + // Endpoint - Azure cloud endpoint for the storage account. + Endpoint *string `json:"endpoint,omitempty"` + // Filesystem - [Required] The name of the Data Lake Gen2 filesystem. + Filesystem *string `json:"filesystem,omitempty"` + // Protocol - Protocol used to communicate with the storage account. + Protocol *string `json:"protocol,omitempty"` + // ServiceDataAccessAuthIdentity - Indicates which identity to use to authenticate service data access to customer's storage. Possible values include: 'ServiceDataAccessAuthIdentityNone', 'ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity', 'ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity' + ServiceDataAccessAuthIdentity ServiceDataAccessAuthIdentity `json:"serviceDataAccessAuthIdentity,omitempty"` + // Credentials - [Required] Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // IsDefault - READ-ONLY; Readonly property to indicate if datastore is the workspace default datastore + IsDefault *bool `json:"isDefault,omitempty"` + // DatastoreType - Possible values include: 'DatastoreTypeDatastore', 'DatastoreTypeAzureBlob', 'DatastoreTypeAzureDataLakeGen1', 'DatastoreTypeAzureDataLakeGen2', 'DatastoreTypeAzureFile' + DatastoreType DatastoreTypeBasicDatastore `json:"datastoreType,omitempty"` + // 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 AzureDataLakeGen2Datastore. +func (adlg2d AzureDataLakeGen2Datastore) MarshalJSON() ([]byte, error) { + adlg2d.DatastoreType = DatastoreTypeAzureDataLakeGen2 + objectMap := make(map[string]interface{}) + if adlg2d.AccountName != nil { + objectMap["accountName"] = adlg2d.AccountName + } + if adlg2d.Endpoint != nil { + objectMap["endpoint"] = adlg2d.Endpoint + } + if adlg2d.Filesystem != nil { + objectMap["filesystem"] = adlg2d.Filesystem + } + if adlg2d.Protocol != nil { + objectMap["protocol"] = adlg2d.Protocol + } + if adlg2d.ServiceDataAccessAuthIdentity != "" { + objectMap["serviceDataAccessAuthIdentity"] = adlg2d.ServiceDataAccessAuthIdentity + } + objectMap["credentials"] = adlg2d.Credentials + if adlg2d.DatastoreType != "" { + objectMap["datastoreType"] = adlg2d.DatastoreType + } + if adlg2d.Description != nil { + objectMap["description"] = adlg2d.Description + } + if adlg2d.Properties != nil { + objectMap["properties"] = adlg2d.Properties + } + if adlg2d.Tags != nil { + objectMap["tags"] = adlg2d.Tags + } + return json.Marshal(objectMap) +} + +// AsAzureBlobDatastore is the BasicDatastore implementation for AzureDataLakeGen2Datastore. +func (adlg2d AzureDataLakeGen2Datastore) AsAzureBlobDatastore() (*AzureBlobDatastore, bool) { + return nil, false +} + +// AsAzureDataLakeGen1Datastore is the BasicDatastore implementation for AzureDataLakeGen2Datastore. +func (adlg2d AzureDataLakeGen2Datastore) AsAzureDataLakeGen1Datastore() (*AzureDataLakeGen1Datastore, bool) { + return nil, false +} + +// AsAzureDataLakeGen2Datastore is the BasicDatastore implementation for AzureDataLakeGen2Datastore. +func (adlg2d AzureDataLakeGen2Datastore) AsAzureDataLakeGen2Datastore() (*AzureDataLakeGen2Datastore, bool) { + return &adlg2d, true +} + +// AsAzureFileDatastore is the BasicDatastore implementation for AzureDataLakeGen2Datastore. +func (adlg2d AzureDataLakeGen2Datastore) AsAzureFileDatastore() (*AzureFileDatastore, bool) { + return nil, false +} + +// AsDatastore is the BasicDatastore implementation for AzureDataLakeGen2Datastore. +func (adlg2d AzureDataLakeGen2Datastore) AsDatastore() (*Datastore, bool) { + return nil, false +} + +// AsBasicDatastore is the BasicDatastore implementation for AzureDataLakeGen2Datastore. +func (adlg2d AzureDataLakeGen2Datastore) AsBasicDatastore() (BasicDatastore, bool) { + return &adlg2d, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureDataLakeGen2Datastore struct. +func (adlg2d *AzureDataLakeGen2Datastore) 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 + } + adlg2d.AccountName = &accountName + } + case "endpoint": + if v != nil { + var endpoint string + err = json.Unmarshal(*v, &endpoint) + if err != nil { + return err + } + adlg2d.Endpoint = &endpoint + } + case "filesystem": + if v != nil { + var filesystem string + err = json.Unmarshal(*v, &filesystem) + if err != nil { + return err + } + adlg2d.Filesystem = &filesystem + } + case "protocol": + if v != nil { + var protocol string + err = json.Unmarshal(*v, &protocol) + if err != nil { + return err + } + adlg2d.Protocol = &protocol + } + case "serviceDataAccessAuthIdentity": + if v != nil { + var serviceDataAccessAuthIdentity ServiceDataAccessAuthIdentity + err = json.Unmarshal(*v, &serviceDataAccessAuthIdentity) + if err != nil { + return err + } + adlg2d.ServiceDataAccessAuthIdentity = serviceDataAccessAuthIdentity + } + case "credentials": + if v != nil { + credentials, err := unmarshalBasicDatastoreCredentials(*v) + if err != nil { + return err + } + adlg2d.Credentials = credentials + } + case "isDefault": + if v != nil { + var isDefault bool + err = json.Unmarshal(*v, &isDefault) + if err != nil { + return err + } + adlg2d.IsDefault = &isDefault + } + case "datastoreType": + if v != nil { + var datastoreType DatastoreTypeBasicDatastore + err = json.Unmarshal(*v, &datastoreType) + if err != nil { + return err + } + adlg2d.DatastoreType = datastoreType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + adlg2d.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + adlg2d.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + adlg2d.Tags = tags + } + } + } + + 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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureFileDatastore azure File datastore configuration. +type AzureFileDatastore struct { + // AccountName - [Required] Storage account name. + AccountName *string `json:"accountName,omitempty"` + // Endpoint - Azure cloud endpoint for the storage account. + Endpoint *string `json:"endpoint,omitempty"` + // FileShareName - [Required] The name of the Azure file share that the datastore points to. + FileShareName *string `json:"fileShareName,omitempty"` + // Protocol - Protocol used to communicate with the storage account. + Protocol *string `json:"protocol,omitempty"` + // ServiceDataAccessAuthIdentity - Indicates which identity to use to authenticate service data access to customer's storage. Possible values include: 'ServiceDataAccessAuthIdentityNone', 'ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity', 'ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity' + ServiceDataAccessAuthIdentity ServiceDataAccessAuthIdentity `json:"serviceDataAccessAuthIdentity,omitempty"` + // Credentials - [Required] Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // IsDefault - READ-ONLY; Readonly property to indicate if datastore is the workspace default datastore + IsDefault *bool `json:"isDefault,omitempty"` + // DatastoreType - Possible values include: 'DatastoreTypeDatastore', 'DatastoreTypeAzureBlob', 'DatastoreTypeAzureDataLakeGen1', 'DatastoreTypeAzureDataLakeGen2', 'DatastoreTypeAzureFile' + DatastoreType DatastoreTypeBasicDatastore `json:"datastoreType,omitempty"` + // 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 AzureFileDatastore. +func (afd AzureFileDatastore) MarshalJSON() ([]byte, error) { + afd.DatastoreType = DatastoreTypeAzureFile + objectMap := make(map[string]interface{}) + if afd.AccountName != nil { + objectMap["accountName"] = afd.AccountName + } + if afd.Endpoint != nil { + objectMap["endpoint"] = afd.Endpoint + } + if afd.FileShareName != nil { + objectMap["fileShareName"] = afd.FileShareName + } + if afd.Protocol != nil { + objectMap["protocol"] = afd.Protocol + } + if afd.ServiceDataAccessAuthIdentity != "" { + objectMap["serviceDataAccessAuthIdentity"] = afd.ServiceDataAccessAuthIdentity + } + objectMap["credentials"] = afd.Credentials + if afd.DatastoreType != "" { + objectMap["datastoreType"] = afd.DatastoreType + } + if afd.Description != nil { + objectMap["description"] = afd.Description + } + if afd.Properties != nil { + objectMap["properties"] = afd.Properties + } + if afd.Tags != nil { + objectMap["tags"] = afd.Tags + } + return json.Marshal(objectMap) +} + +// AsAzureBlobDatastore is the BasicDatastore implementation for AzureFileDatastore. +func (afd AzureFileDatastore) AsAzureBlobDatastore() (*AzureBlobDatastore, bool) { + return nil, false +} + +// AsAzureDataLakeGen1Datastore is the BasicDatastore implementation for AzureFileDatastore. +func (afd AzureFileDatastore) AsAzureDataLakeGen1Datastore() (*AzureDataLakeGen1Datastore, bool) { + return nil, false +} + +// AsAzureDataLakeGen2Datastore is the BasicDatastore implementation for AzureFileDatastore. +func (afd AzureFileDatastore) AsAzureDataLakeGen2Datastore() (*AzureDataLakeGen2Datastore, bool) { + return nil, false +} + +// AsAzureFileDatastore is the BasicDatastore implementation for AzureFileDatastore. +func (afd AzureFileDatastore) AsAzureFileDatastore() (*AzureFileDatastore, bool) { + return &afd, true +} + +// AsDatastore is the BasicDatastore implementation for AzureFileDatastore. +func (afd AzureFileDatastore) AsDatastore() (*Datastore, bool) { + return nil, false +} + +// AsBasicDatastore is the BasicDatastore implementation for AzureFileDatastore. +func (afd AzureFileDatastore) AsBasicDatastore() (BasicDatastore, bool) { + return &afd, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureFileDatastore struct. +func (afd *AzureFileDatastore) 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 + } + afd.AccountName = &accountName + } + case "endpoint": + if v != nil { + var endpoint string + err = json.Unmarshal(*v, &endpoint) + if err != nil { + return err + } + afd.Endpoint = &endpoint + } + case "fileShareName": + if v != nil { + var fileShareName string + err = json.Unmarshal(*v, &fileShareName) + if err != nil { + return err + } + afd.FileShareName = &fileShareName + } + case "protocol": + if v != nil { + var protocol string + err = json.Unmarshal(*v, &protocol) + if err != nil { + return err + } + afd.Protocol = &protocol + } + case "serviceDataAccessAuthIdentity": + if v != nil { + var serviceDataAccessAuthIdentity ServiceDataAccessAuthIdentity + err = json.Unmarshal(*v, &serviceDataAccessAuthIdentity) + if err != nil { + return err + } + afd.ServiceDataAccessAuthIdentity = serviceDataAccessAuthIdentity + } + case "credentials": + if v != nil { + credentials, err := unmarshalBasicDatastoreCredentials(*v) + if err != nil { + return err + } + afd.Credentials = credentials + } + case "isDefault": + if v != nil { + var isDefault bool + err = json.Unmarshal(*v, &isDefault) + if err != nil { + return err + } + afd.IsDefault = &isDefault + } + case "datastoreType": + if v != nil { + var datastoreType DatastoreTypeBasicDatastore + err = json.Unmarshal(*v, &datastoreType) + if err != nil { + return err + } + afd.DatastoreType = datastoreType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + afd.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + afd.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + afd.Tags = tags + } + } + } + + return nil +} + +// BanditPolicy defines an early termination policy based on slack criteria, and a frequency and delay +// interval for evaluation +type BanditPolicy struct { + // SlackAmount - Absolute distance allowed from the best performing run. + SlackAmount *float64 `json:"slackAmount,omitempty"` + // SlackFactor - Ratio of the allowed distance from the best performing run. + SlackFactor *float64 `json:"slackFactor,omitempty"` + // DelayEvaluation - Number of intervals by which to delay the first evaluation. + DelayEvaluation *int32 `json:"delayEvaluation,omitempty"` + // EvaluationInterval - Interval (number of runs) between policy evaluations. + 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 { + // Compute - Compute target for batch inference operation. + Compute *string `json:"compute,omitempty"` + // 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"` + // MaxConcurrencyPerInstance - Indicates maximum number of parallelism per instance. + MaxConcurrencyPerInstance *int32 `json:"maxConcurrencyPerInstance,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"` + // OutputAction - Indicates how the output will be organized. Possible values include: 'SummaryOnly', 'AppendRow' + OutputAction BatchOutputAction `json:"outputAction,omitempty"` + // OutputFileName - Customized output file name for append_row output action. + OutputFileName *string `json:"outputFileName,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state for the endpoint deployment. Possible values include: 'DeploymentProvisioningStateCreating', 'DeploymentProvisioningStateDeleting', 'DeploymentProvisioningStateScaling', 'DeploymentProvisioningStateUpdating', 'DeploymentProvisioningStateSucceeded', 'DeploymentProvisioningStateFailed', 'DeploymentProvisioningStateCanceled' + ProvisioningState DeploymentProvisioningState `json:"provisioningState,omitempty"` + // Resources - Indicates compute configuration for the job. + // If not provided, will default to the defaults defined in ResourceConfiguration. + Resources *ResourceConfiguration `json:"resources,omitempty"` + // RetrySettings - Retry Settings for the batch inference operation. + // If not provided, will default to the defaults defined in BatchRetrySettings. + RetrySettings *BatchRetrySettings `json:"retrySettings,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 or AssetId 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"` + // Properties - Property dictionary. Properties can be added, but not removed or altered. + Properties map[string]*string `json:"properties"` +} + +// MarshalJSON is the custom marshaler for BatchDeployment. +func (bd BatchDeployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bd.Compute != nil { + objectMap["compute"] = bd.Compute + } + if bd.ErrorThreshold != nil { + objectMap["errorThreshold"] = bd.ErrorThreshold + } + if bd.LoggingLevel != "" { + objectMap["loggingLevel"] = bd.LoggingLevel + } + if bd.MaxConcurrencyPerInstance != nil { + objectMap["maxConcurrencyPerInstance"] = bd.MaxConcurrencyPerInstance + } + if bd.MiniBatchSize != nil { + objectMap["miniBatchSize"] = bd.MiniBatchSize + } + objectMap["model"] = bd.Model + if bd.OutputAction != "" { + objectMap["outputAction"] = bd.OutputAction + } + if bd.OutputFileName != nil { + objectMap["outputFileName"] = bd.OutputFileName + } + if bd.Resources != nil { + objectMap["resources"] = bd.Resources + } + if bd.RetrySettings != nil { + objectMap["retrySettings"] = bd.RetrySettings + } + if bd.CodeConfiguration != nil { + objectMap["codeConfiguration"] = bd.CodeConfiguration + } + 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.Properties != nil { + objectMap["properties"] = bd.Properties + } + 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 "compute": + if v != nil { + var compute string + err = json.Unmarshal(*v, &compute) + if err != nil { + return err + } + bd.Compute = &compute + } + 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 "maxConcurrencyPerInstance": + if v != nil { + var maxConcurrencyPerInstance int32 + err = json.Unmarshal(*v, &maxConcurrencyPerInstance) + if err != nil { + return err + } + bd.MaxConcurrencyPerInstance = &maxConcurrencyPerInstance + } + 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 "outputAction": + if v != nil { + var outputAction BatchOutputAction + err = json.Unmarshal(*v, &outputAction) + if err != nil { + return err + } + bd.OutputAction = outputAction + } + case "outputFileName": + if v != nil { + var outputFileName string + err = json.Unmarshal(*v, &outputFileName) + if err != nil { + return err + } + bd.OutputFileName = &outputFileName + } + case "provisioningState": + if v != nil { + var provisioningState DeploymentProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + bd.ProvisioningState = provisioningState + } + case "resources": + if v != nil { + var resources ResourceConfiguration + err = json.Unmarshal(*v, &resources) + if err != nil { + return err + } + bd.Resources = &resources + } + case "retrySettings": + if v != nil { + var retrySettings BatchRetrySettings + err = json.Unmarshal(*v, &retrySettings) + if err != nil { + return err + } + bd.RetrySettings = &retrySettings + } + case "codeConfiguration": + if v != nil { + var codeConfiguration CodeConfiguration + err = json.Unmarshal(*v, &codeConfiguration) + if err != nil { + return err + } + bd.CodeConfiguration = &codeConfiguration + } + 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 "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + bd.Properties = properties + } + } + } + + return nil +} + +// BatchDeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BatchDeploymentsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BatchDeploymentsClient) (BatchDeploymentTrackedResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BatchDeploymentsCreateOrUpdateFuture) 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 BatchDeploymentsCreateOrUpdateFuture.Result. +func (future *BatchDeploymentsCreateOrUpdateFuture) result(client BatchDeploymentsClient) (bdtr BatchDeploymentTrackedResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bdtr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.BatchDeploymentsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bdtr.Response.Response, err = future.GetResult(sender); err == nil && bdtr.Response.Response.StatusCode != http.StatusNoContent { + bdtr, err = client.CreateOrUpdateResponder(bdtr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsCreateOrUpdateFuture", "Result", bdtr.Response.Response, "Failure responding to request") + } + } + return +} + +// BatchDeploymentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BatchDeploymentsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BatchDeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BatchDeploymentsDeleteFuture) 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 BatchDeploymentsDeleteFuture.Result. +func (future *BatchDeploymentsDeleteFuture) result(client BatchDeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.BatchDeploymentsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BatchDeploymentsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BatchDeploymentsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BatchDeploymentsClient) (BatchDeploymentTrackedResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BatchDeploymentsUpdateFuture) 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 BatchDeploymentsUpdateFuture.Result. +func (future *BatchDeploymentsUpdateFuture) result(client BatchDeploymentsClient) (bdtr BatchDeploymentTrackedResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bdtr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.BatchDeploymentsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bdtr.Response.Response, err = future.GetResult(sender); err == nil && bdtr.Response.Response.StatusCode != http.StatusNoContent { + bdtr, err = client.UpdateResponder(bdtr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsUpdateFuture", "Result", bdtr.Response.Response, "Failure responding to request") + } + } + return +} + +// BatchDeploymentTrackedResource ... +type BatchDeploymentTrackedResource struct { + autorest.Response `json:"-"` + // Identity - Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Properties - [Required] Additional attributes of the entity. + Properties *BatchDeployment `json:"properties,omitempty"` + // Sku - Sku details required for ARM contract for Autoscaling. + Sku *Sku `json:"sku,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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.Sku != nil { + objectMap["sku"] = bdtr.Sku + } + 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 - The link to the next page of BatchDeployment objects. If null, there are no additional pages. + 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 { + // Defaults - Default values for Batch Endpoint + Defaults *BatchEndpointDefaults `json:"defaults,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state for the endpoint. Possible values include: 'EndpointProvisioningStateCreating', 'EndpointProvisioningStateDeleting', 'EndpointProvisioningStateSucceeded', 'EndpointProvisioningStateFailed', 'EndpointProvisioningStateUpdating', 'EndpointProvisioningStateCanceled' + ProvisioningState EndpointProvisioningState `json:"provisioningState,omitempty"` + // AuthMode - [Required] Use 'Key' for key based authentication and 'AMLToken' for Azure Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' does. 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"` +} + +// MarshalJSON is the custom marshaler for BatchEndpoint. +func (be BatchEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if be.Defaults != nil { + objectMap["defaults"] = be.Defaults + } + 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 + } + return json.Marshal(objectMap) +} + +// BatchEndpointDefaults batch endpoint default values +type BatchEndpointDefaults struct { + // DeploymentName - Name of the deployment that will be default for the endpoint. + // This deployment will end up getting 100% traffic when the endpoint scoring URL is invoked. + DeploymentName *string `json:"deploymentName,omitempty"` +} + +// BatchEndpointsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BatchEndpointsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BatchEndpointsClient) (BatchEndpointTrackedResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BatchEndpointsCreateOrUpdateFuture) 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 BatchEndpointsCreateOrUpdateFuture.Result. +func (future *BatchEndpointsCreateOrUpdateFuture) result(client BatchEndpointsClient) (betr BatchEndpointTrackedResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + betr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.BatchEndpointsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if betr.Response.Response, err = future.GetResult(sender); err == nil && betr.Response.Response.StatusCode != http.StatusNoContent { + betr, err = client.CreateOrUpdateResponder(betr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsCreateOrUpdateFuture", "Result", betr.Response.Response, "Failure responding to request") + } + } + return +} + +// BatchEndpointsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BatchEndpointsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BatchEndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BatchEndpointsDeleteFuture) 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 BatchEndpointsDeleteFuture.Result. +func (future *BatchEndpointsDeleteFuture) result(client BatchEndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.BatchEndpointsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BatchEndpointsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BatchEndpointsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BatchEndpointsClient) (BatchEndpointTrackedResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BatchEndpointsUpdateFuture) 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 BatchEndpointsUpdateFuture.Result. +func (future *BatchEndpointsUpdateFuture) result(client BatchEndpointsClient) (betr BatchEndpointTrackedResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + betr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.BatchEndpointsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if betr.Response.Response, err = future.GetResult(sender); err == nil && betr.Response.Response.StatusCode != http.StatusNoContent { + betr, err = client.UpdateResponder(betr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsUpdateFuture", "Result", betr.Response.Response, "Failure responding to request") + } + } + return +} + +// BatchEndpointTrackedResource ... +type BatchEndpointTrackedResource struct { + autorest.Response `json:"-"` + // Identity - Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Properties - [Required] Additional attributes of the entity. + Properties *BatchEndpoint `json:"properties,omitempty"` + // Sku - Sku details required for ARM contract for Autoscaling. + Sku *Sku `json:"sku,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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.Sku != nil { + objectMap["sku"] = betr.Sku + } + 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 - The link to the next page of BatchEndpoint objects. If null, there are no additional pages. + 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, + } +} + +// 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"` +} + +// BayesianSamplingAlgorithm defines a Sampling Algorithm that generates values based on previous values +type BayesianSamplingAlgorithm struct { + // SamplingAlgorithmType - Possible values include: 'SamplingAlgorithmTypeSamplingAlgorithm', 'SamplingAlgorithmTypeBayesian1', 'SamplingAlgorithmTypeGrid1', 'SamplingAlgorithmTypeRandom1' + SamplingAlgorithmType SamplingAlgorithmTypeBasicSamplingAlgorithm `json:"samplingAlgorithmType,omitempty"` +} + +// MarshalJSON is the custom marshaler for BayesianSamplingAlgorithm. +func (bsa BayesianSamplingAlgorithm) MarshalJSON() ([]byte, error) { + bsa.SamplingAlgorithmType = SamplingAlgorithmTypeBayesian1 + objectMap := make(map[string]interface{}) + if bsa.SamplingAlgorithmType != "" { + objectMap["samplingAlgorithmType"] = bsa.SamplingAlgorithmType + } + return json.Marshal(objectMap) +} + +// AsBayesianSamplingAlgorithm is the BasicSamplingAlgorithm implementation for BayesianSamplingAlgorithm. +func (bsa BayesianSamplingAlgorithm) AsBayesianSamplingAlgorithm() (*BayesianSamplingAlgorithm, bool) { + return &bsa, true +} + +// AsGridSamplingAlgorithm is the BasicSamplingAlgorithm implementation for BayesianSamplingAlgorithm. +func (bsa BayesianSamplingAlgorithm) AsGridSamplingAlgorithm() (*GridSamplingAlgorithm, bool) { + return nil, false +} + +// AsRandomSamplingAlgorithm is the BasicSamplingAlgorithm implementation for BayesianSamplingAlgorithm. +func (bsa BayesianSamplingAlgorithm) AsRandomSamplingAlgorithm() (*RandomSamplingAlgorithm, bool) { + return nil, false +} + +// AsSamplingAlgorithm is the BasicSamplingAlgorithm implementation for BayesianSamplingAlgorithm. +func (bsa BayesianSamplingAlgorithm) AsSamplingAlgorithm() (*SamplingAlgorithm, bool) { + return nil, false +} + +// AsBasicSamplingAlgorithm is the BasicSamplingAlgorithm implementation for BayesianSamplingAlgorithm. +func (bsa BayesianSamplingAlgorithm) AsBasicSamplingAlgorithm() (BasicSamplingAlgorithm, bool) { + return &bsa, true +} + +// BuildContext configuration settings for Docker build context +type BuildContext struct { + // ContextURI - [Required] URI of the Docker build context used to build the image. Supports blob URIs on environment creation and may return blob or Git URIs. + // + ContextURI *string `json:"contextUri,omitempty"` + // DockerfilePath - Path to the Dockerfile in the build context. + // + DockerfilePath *string `json:"dockerfilePath,omitempty"` +} + +// CertificateDatastoreCredentials certificate datastore credentials configuration. +type CertificateDatastoreCredentials struct { + // AuthorityURL - Authority URL used for authentication. + AuthorityURL *string `json:"authorityUrl,omitempty"` + // ClientID - [Required] Service principal client ID. + ClientID *uuid.UUID `json:"clientId,omitempty"` + // ResourceURL - Resource the service principal has access to. + ResourceURL *string `json:"resourceUrl,omitempty"` + // Secrets - [Required] Service principal secrets. + Secrets *CertificateDatastoreSecrets `json:"secrets,omitempty"` + // TenantID - [Required] ID of the tenant to which the service principal belongs. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // Thumbprint - [Required] Thumbprint of the certificate used for authentication. + Thumbprint *string `json:"thumbprint,omitempty"` + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey1', 'CredentialsTypeCertificate1', 'CredentialsTypeNone1', 'CredentialsTypeSas1', 'CredentialsTypeServicePrincipal1' + CredentialsType CredentialsTypeBasicDatastoreCredentials `json:"credentialsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateDatastoreCredentials. +func (cdc CertificateDatastoreCredentials) MarshalJSON() ([]byte, error) { + cdc.CredentialsType = CredentialsTypeCertificate1 + objectMap := make(map[string]interface{}) + if cdc.AuthorityURL != nil { + objectMap["authorityUrl"] = cdc.AuthorityURL + } + if cdc.ClientID != nil { + objectMap["clientId"] = cdc.ClientID + } + if cdc.ResourceURL != nil { + objectMap["resourceUrl"] = cdc.ResourceURL + } + 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 +} + +// 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', 'SecretsTypeAccountKey', 'SecretsTypeCertificate', 'SecretsTypeSas', 'SecretsTypeServicePrincipal' + SecretsType SecretsTypeBasicDatastoreSecrets `json:"secretsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateDatastoreSecrets. +func (cds CertificateDatastoreSecrets) MarshalJSON() ([]byte, error) { + cds.SecretsType = SecretsTypeCertificate + 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 +} + +// 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 +} + +// 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 { + // Properties - Properties of ClusterUpdate + Properties *ScaleSettingsInformation `json:"properties,omitempty"` +} + +// CodeConfiguration configuration for a scoring code asset. +type CodeConfiguration struct { + // CodeID - ARM resource ID of the code asset. + CodeID *string `json:"codeId,omitempty"` + // ScoringScript - [Required] The script to execute on startup. eg. "score.py" + ScoringScript *string `json:"scoringScript,omitempty"` +} + +// CodeContainer container for code asset versions. +type CodeContainer struct { + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // LatestVersion - READ-ONLY; The latest version inside this container. + LatestVersion *string `json:"latestVersion,omitempty"` + // NextVersion - READ-ONLY; The next auto incremental version + NextVersion *string `json:"nextVersion,omitempty"` + // 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.IsArchived != nil { + objectMap["isArchived"] = cc.IsArchived + } + 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 - [Required] Additional attributes of the entity. + Properties *CodeContainer `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 - The link to the next page of CodeContainer objects. If null, there are no additional pages. + 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 { + // CodeURI - Uri where code is located + CodeURI *string `json:"codeUri,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // 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 CodeVersion. +func (cv CodeVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cv.CodeURI != nil { + objectMap["codeUri"] = cv.CodeURI + } + if cv.IsAnonymous != nil { + objectMap["isAnonymous"] = cv.IsAnonymous + } + if cv.IsArchived != nil { + objectMap["isArchived"] = cv.IsArchived + } + if cv.Description != nil { + objectMap["description"] = cv.Description + } + 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 - [Required] Additional attributes of the entity. + Properties *CodeVersion `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 - The link to the next page of CodeVersion objects. If null, there are no additional pages. + 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 - [Required] 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 - [Required] 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"` + // Inputs - Mapping of input data bindings used in the job. + Inputs map[string]BasicJobInput `json:"inputs"` + // Limits - Command Job limit. + Limits *CommandJobLimits `json:"limits,omitempty"` + // Outputs - Mapping of output data bindings used in the job. + Outputs map[string]BasicJobOutput `json:"outputs"` + // Parameters - READ-ONLY; Input parameters. + Parameters interface{} `json:"parameters,omitempty"` + // Resources - Compute Resource configuration for the job. + Resources *ResourceConfiguration `json:"resources,omitempty"` + // ComputeID - ARM resource ID of the compute resource. + ComputeID *string `json:"computeId,omitempty"` + // DisplayName - Display name of job. + DisplayName *string `json:"displayName,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, UserIdentity or null. + // Defaults to AmlToken if null. + Identity BasicIdentityConfiguration `json:"identity,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // Services - List of JobEndpoints. + // For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + Services map[string]*JobService `json:"services"` + // 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"` + // 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"` + // JobType - Possible values include: 'JobTypeJobBase', 'JobTypeCommand1', 'JobTypePipeline1', 'JobTypeSweep1' + JobType JobTypeBasicJobBase `json:"jobType,omitempty"` +} + +// MarshalJSON is the custom marshaler for CommandJob. +func (cj CommandJob) MarshalJSON() ([]byte, error) { + cj.JobType = JobTypeCommand1 + objectMap := make(map[string]interface{}) + if cj.CodeID != nil { + objectMap["codeId"] = cj.CodeID + } + if cj.Command != nil { + objectMap["command"] = cj.Command + } + objectMap["distribution"] = cj.Distribution + if cj.EnvironmentID != nil { + objectMap["environmentId"] = cj.EnvironmentID + } + if cj.EnvironmentVariables != nil { + objectMap["environmentVariables"] = cj.EnvironmentVariables + } + if cj.Inputs != nil { + objectMap["inputs"] = cj.Inputs + } + if cj.Limits != nil { + objectMap["limits"] = cj.Limits + } + if cj.Outputs != nil { + objectMap["outputs"] = cj.Outputs + } + if cj.Resources != nil { + objectMap["resources"] = cj.Resources + } + if cj.ComputeID != nil { + objectMap["computeId"] = cj.ComputeID + } + if cj.DisplayName != nil { + objectMap["displayName"] = cj.DisplayName + } + if cj.ExperimentName != nil { + objectMap["experimentName"] = cj.ExperimentName + } + objectMap["identity"] = cj.Identity + if cj.IsArchived != nil { + objectMap["isArchived"] = cj.IsArchived + } + if cj.Services != nil { + objectMap["services"] = cj.Services + } + if cj.JobType != "" { + objectMap["jobType"] = cj.JobType + } + if cj.Description != nil { + objectMap["description"] = cj.Description + } + if cj.Properties != nil { + objectMap["properties"] = cj.Properties + } + if cj.Tags != nil { + objectMap["tags"] = cj.Tags + } + return json.Marshal(objectMap) +} + +// AsCommandJob is the BasicJobBase implementation for CommandJob. +func (cj CommandJob) AsCommandJob() (*CommandJob, bool) { + return &cj, true +} + +// AsPipelineJob is the BasicJobBase implementation for CommandJob. +func (cj CommandJob) AsPipelineJob() (*PipelineJob, bool) { + return nil, false +} + +// 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 "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 "inputs": + if v != nil { + var inputs map[string]BasicJobInput + err = json.Unmarshal(*v, &inputs) + if err != nil { + return err + } + cj.Inputs = inputs + } + case "limits": + if v != nil { + var limits CommandJobLimits + err = json.Unmarshal(*v, &limits) + if err != nil { + return err + } + cj.Limits = &limits + } + case "outputs": + if v != nil { + var outputs map[string]BasicJobOutput + err = json.Unmarshal(*v, &outputs) + if err != nil { + return err + } + cj.Outputs = outputs + } + case "parameters": + if v != nil { + var parameters interface{} + err = json.Unmarshal(*v, ¶meters) + if err != nil { + return err + } + cj.Parameters = parameters + } + case "resources": + if v != nil { + var resources ResourceConfiguration + err = json.Unmarshal(*v, &resources) + if err != nil { + return err + } + cj.Resources = &resources + } + case "computeId": + if v != nil { + var computeID string + err = json.Unmarshal(*v, &computeID) + if err != nil { + return err + } + cj.ComputeID = &computeID + } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + cj.DisplayName = &displayName + } + 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 "isArchived": + if v != nil { + var isArchived bool + err = json.Unmarshal(*v, &isArchived) + if err != nil { + return err + } + cj.IsArchived = &isArchived + } + case "services": + if v != nil { + var services map[string]*JobService + err = json.Unmarshal(*v, &services) + if err != nil { + return err + } + cj.Services = services + } + case "status": + if v != nil { + var status JobStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + cj.Status = status + } + case "jobType": + if v != nil { + var jobType JobTypeBasicJobBase + err = json.Unmarshal(*v, &jobType) + if err != nil { + return err + } + cj.JobType = jobType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + cj.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + cj.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cj.Tags = tags + } + } + } + + return nil +} + +// CommandJobLimits command Job limit class. +type CommandJobLimits struct { + // 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"` + // JobLimitsType - Possible values include: 'JobLimitsTypeJobLimits', 'JobLimitsTypeCommand', 'JobLimitsTypeSweep' + JobLimitsType JobLimitsTypeBasicJobLimits `json:"jobLimitsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for CommandJobLimits. +func (cjl CommandJobLimits) MarshalJSON() ([]byte, error) { + cjl.JobLimitsType = JobLimitsTypeCommand + objectMap := make(map[string]interface{}) + if cjl.Timeout != nil { + objectMap["timeout"] = cjl.Timeout + } + if cjl.JobLimitsType != "" { + objectMap["jobLimitsType"] = cjl.JobLimitsType + } + return json.Marshal(objectMap) +} + +// AsCommandJobLimits is the BasicJobLimits implementation for CommandJobLimits. +func (cjl CommandJobLimits) AsCommandJobLimits() (*CommandJobLimits, bool) { + return &cjl, true +} + +// AsSweepJobLimits is the BasicJobLimits implementation for CommandJobLimits. +func (cjl CommandJobLimits) AsSweepJobLimits() (*SweepJobLimits, bool) { + return nil, false +} + +// AsJobLimits is the BasicJobLimits implementation for CommandJobLimits. +func (cjl CommandJobLimits) AsJobLimits() (*JobLimits, bool) { + return nil, false +} + +// AsBasicJobLimits is the BasicJobLimits implementation for CommandJobLimits. +func (cjl CommandJobLimits) AsBasicJobLimits() (BasicJobLimits, bool) { + return &cjl, true +} + +// ComponentContainer component container definition. +// +type ComponentContainer struct { + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // LatestVersion - READ-ONLY; The latest version inside this container. + LatestVersion *string `json:"latestVersion,omitempty"` + // NextVersion - READ-ONLY; The next auto incremental version + NextVersion *string `json:"nextVersion,omitempty"` + // 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 ComponentContainer. +func (cc ComponentContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cc.IsArchived != nil { + objectMap["isArchived"] = cc.IsArchived + } + 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) +} + +// ComponentContainerResource azure Resource Manager resource envelope. +type ComponentContainerResource struct { + autorest.Response `json:"-"` + // Properties - [Required] Additional attributes of the entity. + Properties *ComponentContainer `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComponentContainerResource. +func (ccr ComponentContainerResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ccr.Properties != nil { + objectMap["properties"] = ccr.Properties + } + return json.Marshal(objectMap) +} + +// ComponentContainerResourceArmPaginatedResult a paginated list of ComponentContainer entities. +type ComponentContainerResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + // NextLink - The link to the next page of ComponentContainer objects. If null, there are no additional pages. + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type ComponentContainer. + Value *[]ComponentContainerResource `json:"value,omitempty"` +} + +// ComponentContainerResourceArmPaginatedResultIterator provides access to a complete listing of +// ComponentContainerResource values. +type ComponentContainerResourceArmPaginatedResultIterator struct { + i int + page ComponentContainerResourceArmPaginatedResultPage +} + +// 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 *ComponentContainerResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentContainerResourceArmPaginatedResultIterator.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 *ComponentContainerResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ComponentContainerResourceArmPaginatedResultIterator) 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 ComponentContainerResourceArmPaginatedResultIterator) Response() ComponentContainerResourceArmPaginatedResult { + 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 ComponentContainerResourceArmPaginatedResultIterator) Value() ComponentContainerResource { + if !iter.page.NotDone() { + return ComponentContainerResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ComponentContainerResourceArmPaginatedResultIterator type. +func NewComponentContainerResourceArmPaginatedResultIterator(page ComponentContainerResourceArmPaginatedResultPage) ComponentContainerResourceArmPaginatedResultIterator { + return ComponentContainerResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ccrapr ComponentContainerResourceArmPaginatedResult) IsEmpty() bool { + return ccrapr.Value == nil || len(*ccrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ccrapr ComponentContainerResourceArmPaginatedResult) hasNextLink() bool { + return ccrapr.NextLink != nil && len(*ccrapr.NextLink) != 0 +} + +// componentContainerResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ccrapr ComponentContainerResourceArmPaginatedResult) componentContainerResourceArmPaginatedResultPreparer(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))) +} + +// ComponentContainerResourceArmPaginatedResultPage contains a page of ComponentContainerResource values. +type ComponentContainerResourceArmPaginatedResultPage struct { + fn func(context.Context, ComponentContainerResourceArmPaginatedResult) (ComponentContainerResourceArmPaginatedResult, error) + ccrapr ComponentContainerResourceArmPaginatedResult +} + +// 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 *ComponentContainerResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentContainerResourceArmPaginatedResultPage.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 *ComponentContainerResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ComponentContainerResourceArmPaginatedResultPage) NotDone() bool { + return !page.ccrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ComponentContainerResourceArmPaginatedResultPage) Response() ComponentContainerResourceArmPaginatedResult { + return page.ccrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ComponentContainerResourceArmPaginatedResultPage) Values() []ComponentContainerResource { + if page.ccrapr.IsEmpty() { + return nil + } + return *page.ccrapr.Value +} + +// Creates a new instance of the ComponentContainerResourceArmPaginatedResultPage type. +func NewComponentContainerResourceArmPaginatedResultPage(cur ComponentContainerResourceArmPaginatedResult, getNextPage func(context.Context, ComponentContainerResourceArmPaginatedResult) (ComponentContainerResourceArmPaginatedResult, error)) ComponentContainerResourceArmPaginatedResultPage { + return ComponentContainerResourceArmPaginatedResultPage{ + fn: getNextPage, + ccrapr: cur, + } +} + +// ComponentVersion definition of a component version: defines resources that span component types. +type ComponentVersion struct { + // ComponentSpec - Defines Component definition details. + // + ComponentSpec interface{} `json:"componentSpec,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // 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 ComponentVersion. +func (cv ComponentVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cv.ComponentSpec != nil { + objectMap["componentSpec"] = cv.ComponentSpec + } + if cv.IsAnonymous != nil { + objectMap["isAnonymous"] = cv.IsAnonymous + } + if cv.IsArchived != nil { + objectMap["isArchived"] = cv.IsArchived + } + if cv.Description != nil { + objectMap["description"] = cv.Description + } + if cv.Properties != nil { + objectMap["properties"] = cv.Properties + } + if cv.Tags != nil { + objectMap["tags"] = cv.Tags + } + return json.Marshal(objectMap) +} + +// ComponentVersionResource azure Resource Manager resource envelope. +type ComponentVersionResource struct { + autorest.Response `json:"-"` + // Properties - [Required] Additional attributes of the entity. + Properties *ComponentVersion `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComponentVersionResource. +func (cvr ComponentVersionResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cvr.Properties != nil { + objectMap["properties"] = cvr.Properties + } + return json.Marshal(objectMap) +} + +// ComponentVersionResourceArmPaginatedResult a paginated list of ComponentVersion entities. +type ComponentVersionResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + // NextLink - The link to the next page of ComponentVersion objects. If null, there are no additional pages. + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type ComponentVersion. + Value *[]ComponentVersionResource `json:"value,omitempty"` +} + +// ComponentVersionResourceArmPaginatedResultIterator provides access to a complete listing of +// ComponentVersionResource values. +type ComponentVersionResourceArmPaginatedResultIterator struct { + i int + page ComponentVersionResourceArmPaginatedResultPage +} + +// 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 *ComponentVersionResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentVersionResourceArmPaginatedResultIterator.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 *ComponentVersionResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ComponentVersionResourceArmPaginatedResultIterator) 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 ComponentVersionResourceArmPaginatedResultIterator) Response() ComponentVersionResourceArmPaginatedResult { + 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 ComponentVersionResourceArmPaginatedResultIterator) Value() ComponentVersionResource { + if !iter.page.NotDone() { + return ComponentVersionResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ComponentVersionResourceArmPaginatedResultIterator type. +func NewComponentVersionResourceArmPaginatedResultIterator(page ComponentVersionResourceArmPaginatedResultPage) ComponentVersionResourceArmPaginatedResultIterator { + return ComponentVersionResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cvrapr ComponentVersionResourceArmPaginatedResult) IsEmpty() bool { + return cvrapr.Value == nil || len(*cvrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cvrapr ComponentVersionResourceArmPaginatedResult) hasNextLink() bool { + return cvrapr.NextLink != nil && len(*cvrapr.NextLink) != 0 +} + +// componentVersionResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cvrapr ComponentVersionResourceArmPaginatedResult) componentVersionResourceArmPaginatedResultPreparer(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))) +} + +// ComponentVersionResourceArmPaginatedResultPage contains a page of ComponentVersionResource values. +type ComponentVersionResourceArmPaginatedResultPage struct { + fn func(context.Context, ComponentVersionResourceArmPaginatedResult) (ComponentVersionResourceArmPaginatedResult, error) + cvrapr ComponentVersionResourceArmPaginatedResult +} + +// 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 *ComponentVersionResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentVersionResourceArmPaginatedResultPage.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 *ComponentVersionResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ComponentVersionResourceArmPaginatedResultPage) NotDone() bool { + return !page.cvrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ComponentVersionResourceArmPaginatedResultPage) Response() ComponentVersionResourceArmPaginatedResult { + return page.cvrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ComponentVersionResourceArmPaginatedResultPage) Values() []ComponentVersionResource { + if page.cvrapr.IsEmpty() { + return nil + } + return *page.cvrapr.Value +} + +// Creates a new instance of the ComponentVersionResourceArmPaginatedResultPage type. +func NewComponentVersionResourceArmPaginatedResultPage(cur ComponentVersionResourceArmPaginatedResult, getNextPage func(context.Context, ComponentVersionResourceArmPaginatedResult) (ComponentVersionResourceArmPaginatedResult, error)) ComponentVersionResourceArmPaginatedResultPage { + return ComponentVersionResourceArmPaginatedResultPage{ + fn: getNextPage, + cvrapr: cur, + } +} + +// BasicCompute machine Learning compute object. +type BasicCompute interface { + AsDataFactory() (*DataFactory, bool) + AsSynapseSpark() (*SynapseSpark, bool) + AsCompute() (*Compute, bool) +} + +// Compute machine Learning compute object. +type Compute struct { + // ComputeLocation - READ-ONLY; 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', 'ComputeTypeDataFactory1', 'ComputeTypeSynapseSpark1' + 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(ComputeTypeDataFactory1): + var df DataFactory + err := json.Unmarshal(body, &df) + return df, err + case string(ComputeTypeSynapseSpark1): + var ss SynapseSpark + err := json.Unmarshal(body, &ss) + return ss, 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.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) +} + +// AsDataFactory is the BasicCompute implementation for Compute. +func (c Compute) AsDataFactory() (*DataFactory, bool) { + return nil, false +} + +// AsSynapseSpark is the BasicCompute implementation for Compute. +func (c Compute) AsSynapseSpark() (*SynapseSpark, 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 +} + +// 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 { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // ComputeLocation - READ-ONLY; 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 - Properties of ComputeInstance + Properties *ComputeInstanceProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComputeInstance. +func (ci ComputeInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ci.ComputeType != "" { + objectMap["computeType"] = ci.ComputeType + } + 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.Properties != nil { + objectMap["properties"] = ci.Properties + } + return json.Marshal(objectMap) +} + +// 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) +} + +// ComputeInstanceContainer defines an Aml Instance container. +type ComputeInstanceContainer struct { + // Name - Name of the ComputeInstance container. + Name *string `json:"name,omitempty"` + // Autosave - Auto save settings. Possible values include: 'None', 'Local', 'Remote' + Autosave Autosave `json:"autosave,omitempty"` + // Gpu - Information of GPU. + Gpu *string `json:"gpu,omitempty"` + // Network - network of this container. Possible values include: 'Bridge', 'Host' + Network Network `json:"network,omitempty"` + // Environment - Environment information of this container. + Environment *ComputeInstanceEnvironmentInfo `json:"environment,omitempty"` + // Services - READ-ONLY; services of this containers. + Services *[]interface{} `json:"services,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComputeInstanceContainer. +func (cic ComputeInstanceContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cic.Name != nil { + objectMap["name"] = cic.Name + } + if cic.Autosave != "" { + objectMap["autosave"] = cic.Autosave + } + if cic.Gpu != nil { + objectMap["gpu"] = cic.Gpu + } + if cic.Network != "" { + objectMap["network"] = cic.Network + } + if cic.Environment != nil { + objectMap["environment"] = cic.Environment + } + 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) +} + +// ComputeInstanceDataDisk defines an Aml Instance DataDisk. +type ComputeInstanceDataDisk struct { + // Caching - Caching type of Data Disk. Possible values include: 'CachingNone', 'CachingReadOnly', 'CachingReadWrite' + Caching Caching `json:"caching,omitempty"` + // DiskSizeGB - The initial disk size in gigabytes. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // Lun - The lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinct lun. + Lun *int32 `json:"lun,omitempty"` + // StorageAccountType - type of this storage account. Possible values include: 'StandardLRS', 'PremiumLRS' + StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` +} + +// ComputeInstanceDataMount defines an Aml Instance DataMount. +type ComputeInstanceDataMount struct { + // Source - Source of the ComputeInstance data mount. + Source *string `json:"source,omitempty"` + // SourceType - Data source type. Possible values include: 'SourceTypeDataset', 'SourceTypeDatastore', 'SourceTypeURI' + SourceType SourceType `json:"sourceType,omitempty"` + // MountName - name of the ComputeInstance data mount. + MountName *string `json:"mountName,omitempty"` + // MountAction - Mount Action. Possible values include: 'Mount', 'Unmount' + MountAction MountAction `json:"mountAction,omitempty"` + // CreatedBy - who this data mount created by. + CreatedBy *string `json:"createdBy,omitempty"` + // MountPath - Path of this data mount. + MountPath *string `json:"mountPath,omitempty"` + // MountState - Mount state. Possible values include: 'MountRequested', 'Mounted', 'MountFailed', 'UnmountRequested', 'UnmountFailed', 'Unmounted' + MountState MountState `json:"mountState,omitempty"` + // MountedOn - The time when the disk mounted. + MountedOn *date.Time `json:"mountedOn,omitempty"` + // Error - Error of this data mount. + Error *string `json:"error,omitempty"` +} + +// ComputeInstanceEnvironmentInfo environment information +type ComputeInstanceEnvironmentInfo struct { + // Name - name of environment. + Name *string `json:"name,omitempty"` + // Version - version of environment. + Version *string `json:"version,omitempty"` +} + +// 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"` + // OperationTrigger - Trigger of operation. Possible values include: 'User', 'Schedule', 'IdleShutdown' + OperationTrigger OperationTrigger `json:"operationTrigger,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 - READ-ONLY; The list of schedules to be applied on the computes. + Schedules *ComputeSchedules `json:"schedules,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"` + // Containers - READ-ONLY; Describes informations of containers on this ComputeInstance. + Containers *[]ComputeInstanceContainer `json:"containers,omitempty"` + // DataDisks - READ-ONLY; Describes informations of dataDisks on this ComputeInstance. + DataDisks *[]ComputeInstanceDataDisk `json:"dataDisks,omitempty"` + // DataMounts - READ-ONLY; Describes informations of dataMounts on this ComputeInstance. + DataMounts *[]ComputeInstanceDataMount `json:"dataMounts,omitempty"` + // Versions - READ-ONLY; ComputeInstance version. + Versions *ComputeInstanceVersion `json:"versions,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComputeInstanceProperties. +func (cip ComputeInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cip.VMSize != nil { + objectMap["vmSize"] = cip.VMSize + } + if cip.Subnet != nil { + objectMap["subnet"] = cip.Subnet + } + if cip.ApplicationSharingPolicy != "" { + objectMap["applicationSharingPolicy"] = cip.ApplicationSharingPolicy + } + if cip.SSHSettings != nil { + objectMap["sshSettings"] = cip.SSHSettings + } + if cip.ComputeInstanceAuthorizationType != "" { + objectMap["computeInstanceAuthorizationType"] = cip.ComputeInstanceAuthorizationType + } + if cip.PersonalComputeInstanceSettings != nil { + objectMap["personalComputeInstanceSettings"] = cip.PersonalComputeInstanceSettings + } + if cip.SetupScripts != nil { + objectMap["setupScripts"] = cip.SetupScripts + } + if cip.EnableNodePublicIP != nil { + objectMap["enableNodePublicIp"] = cip.EnableNodePublicIP + } + return json.Marshal(objectMap) +} + +// ComputeInstanceSchema properties(top level) of ComputeInstance +type ComputeInstanceSchema struct { + // Properties - Properties of ComputeInstance + Properties *ComputeInstanceProperties `json:"properties,omitempty"` +} + +// 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) +} + +// ComputeInstanceVersion version of computeInstance. +type ComputeInstanceVersion struct { + // Runtime - Runtime of compute instance. + Runtime *string `json:"runtime,omitempty"` +} + +// ComputeResource machine Learning compute object wrapped into ARM resource envelope. +type ComputeResource struct { + autorest.Response `json:"-"` + // 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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` + // Properties - Compute properties + Properties BasicCompute `json:"properties,omitempty"` + // Identity - The identity of the resource. + Identity *ManagedServiceIdentity `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"` +} + +// 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 + } + 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 "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 + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + cr.SystemData = &systemData + } + case "properties": + if v != nil { + properties, err := unmarshalBasicCompute(*v) + if err != nil { + return err + } + cr.Properties = properties + } + case "identity": + if v != nil { + var identity ManagedServiceIdentity + 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 + } + } + } + + return nil +} + +// ComputeResourceSchema ... +type ComputeResourceSchema struct { + // Properties - Compute properties + Properties BasicCompute `json:"properties,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for ComputeResourceSchema struct. +func (crs *ComputeResourceSchema) 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 + } + crs.Properties = properties + } + } + } + + return nil +} + +// ComputeRestartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ComputeRestartFuture 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 *ComputeRestartFuture) 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 ComputeRestartFuture.Result. +func (future *ComputeRestartFuture) 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.ComputeRestartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.ComputeRestartFuture") + return + } + ar.Response = future.Response() + return +} + +// 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 { + 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: 'ComputeTypeComputeSecrets' + 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"] { + 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 = ComputeTypeComputeSecrets + objectMap := make(map[string]interface{}) + if cs.ComputeType != "" { + objectMap["computeType"] = cs.ComputeType + } + return json.Marshal(objectMap) +} + +// 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: 'Completed', 'Provisioning', 'Failed' + ProvisioningStatus ProvisioningStatus `json:"provisioningStatus,omitempty"` + // Action - Possible values include: 'Start', 'Stop' + Action ComputePowerAction `json:"action,omitempty"` + Schedule *ScheduleBase `json:"schedule,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComputeStartStopSchedule. +func (csss ComputeStartStopSchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csss.Action != "" { + objectMap["action"] = csss.Action + } + if csss.Schedule != nil { + objectMap["schedule"] = csss.Schedule + } + 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 resource requirements for each container instance within an online +// deployment. +type ContainerResourceRequirements struct { + // ContainerResourceLimits - Container resource limit info: + ContainerResourceLimits *ContainerResourceSettings `json:"containerResourceLimits,omitempty"` + // ContainerResourceRequests - Container resource request info: + ContainerResourceRequests *ContainerResourceSettings `json:"containerResourceRequests,omitempty"` +} + +// ContainerResourceSettings ... +type ContainerResourceSettings struct { + // CPU - Number of vCPUs request/limit for container. More info: + // https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + CPU *string `json:"cpu,omitempty"` + // Gpu - Number of Nvidia GPU cards request/limit for container. More info: + // https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + Gpu *string `json:"gpu,omitempty"` + // Memory - Memory size request/limit for container. More info: + // https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + Memory *string `json:"memory,omitempty"` +} + +// CosmosDbSettings ... +type CosmosDbSettings struct { + // CollectionsThroughput - The throughput of the collections in cosmosdb database + CollectionsThroughput *int32 `json:"collectionsThroughput,omitempty"` +} + +// CustomModelJobInput ... +type CustomModelJobInput struct { + // Mode - Input Asset Delivery Mode. Possible values include: 'ReadOnlyMount', 'ReadWriteMount', 'Download', 'Direct', 'EvalMount', 'EvalDownload' + Mode InputDeliveryMode `json:"mode,omitempty"` + // URI - [Required] Input Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the input. + Description *string `json:"description,omitempty"` + // JobInputType - [Required] Specifies the type of job. Possible values include: 'JobInputTypeLiteral', 'JobInputTypeURIFile', 'JobInputTypeURIFolder', 'JobInputTypeMltable', 'JobInputTypeCustomModel', 'JobInputTypeMlflowModel', 'JobInputTypeTritonModel' + JobInputType JobInputType `json:"jobInputType,omitempty"` +} + +// CustomModelJobOutput ... +type CustomModelJobOutput struct { + // Mode - Output Asset Delivery Mode. Possible values include: 'OutputDeliveryModeReadWriteMount', 'OutputDeliveryModeUpload' + Mode OutputDeliveryMode `json:"mode,omitempty"` + // URI - Output Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the output. + Description *string `json:"description,omitempty"` + // JobOutputType - [Required] Specifies the type of job. Possible values include: 'JobOutputTypeURIFile', 'JobOutputTypeURIFolder', 'JobOutputTypeMltable', 'JobOutputTypeCustomModel', 'JobOutputTypeMlflowModel', 'JobOutputTypeTritonModel' + JobOutputType JobOutputType `json:"jobOutputType,omitempty"` +} + +// Databricks a DataFactory compute. +type Databricks struct { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // ComputeLocation - READ-ONLY; 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 *DatabricksProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Databricks. +func (d Databricks) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.ComputeType != "" { + objectMap["computeType"] = d.ComputeType + } + 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.Properties != nil { + objectMap["properties"] = d.Properties + } + return json.Marshal(objectMap) +} + +// DatabricksComputeSecrets secrets related to a Machine Learning compute based on Databricks. +type DatabricksComputeSecrets struct { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // DatabricksAccessToken - access token for databricks account. + DatabricksAccessToken *string `json:"databricksAccessToken,omitempty"` +} + +// DatabricksComputeSecretsProperties properties of Databricks Compute Secrets +type DatabricksComputeSecretsProperties struct { + // DatabricksAccessToken - access token for databricks account. + DatabricksAccessToken *string `json:"databricksAccessToken,omitempty"` +} + +// DatabricksProperties properties of Databricks +type DatabricksProperties struct { + // DatabricksAccessToken - Databricks access token + DatabricksAccessToken *string `json:"databricksAccessToken,omitempty"` + // WorkspaceURL - Workspace Url + WorkspaceURL *string `json:"workspaceUrl,omitempty"` +} + +// DatabricksSchema ... +type DatabricksSchema struct { + Properties *DatabricksProperties `json:"properties,omitempty"` +} + +// DataContainer container for data asset versions. +type DataContainer struct { + // DataType - [Required] Specifies the type of data. Possible values include: 'URIFile', 'URIFolder', 'Mltable' + DataType DataType `json:"dataType,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // LatestVersion - READ-ONLY; The latest version inside this container. + LatestVersion *string `json:"latestVersion,omitempty"` + // NextVersion - READ-ONLY; The next auto incremental version + NextVersion *string `json:"nextVersion,omitempty"` + // 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.DataType != "" { + objectMap["dataType"] = dc.DataType + } + if dc.IsArchived != nil { + objectMap["isArchived"] = dc.IsArchived + } + 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 - [Required] Additional attributes of the entity. + Properties *DataContainer `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 - The link to the next page of DataContainer objects. If null, there are no additional pages. + 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 - READ-ONLY; 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', 'ComputeTypeDataFactory1', 'ComputeTypeSynapseSpark1' + 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.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) +} + +// AsDataFactory is the BasicCompute implementation for DataFactory. +func (df DataFactory) AsDataFactory() (*DataFactory, bool) { + return &df, true +} + +// AsSynapseSpark is the BasicCompute implementation for DataFactory. +func (df DataFactory) AsSynapseSpark() (*SynapseSpark, 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 { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // ComputeLocation - READ-ONLY; 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 *DataLakeAnalyticsProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataLakeAnalytics. +func (dla DataLakeAnalytics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dla.ComputeType != "" { + objectMap["computeType"] = dla.ComputeType + } + 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.Properties != nil { + objectMap["properties"] = dla.Properties + } + return json.Marshal(objectMap) +} + +// DataLakeAnalyticsProperties ... +type DataLakeAnalyticsProperties struct { + // DataLakeStoreAccountName - DataLake Store Account Name + DataLakeStoreAccountName *string `json:"dataLakeStoreAccountName,omitempty"` +} + +// DataLakeAnalyticsSchema ... +type DataLakeAnalyticsSchema struct { + Properties *DataLakeAnalyticsProperties `json:"properties,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 +} + +// BasicDatastore base definition for datastore contents configuration. +type BasicDatastore interface { + AsAzureBlobDatastore() (*AzureBlobDatastore, bool) + AsAzureDataLakeGen1Datastore() (*AzureDataLakeGen1Datastore, bool) + AsAzureDataLakeGen2Datastore() (*AzureDataLakeGen2Datastore, bool) + AsAzureFileDatastore() (*AzureFileDatastore, bool) + AsDatastore() (*Datastore, bool) +} + +// Datastore base definition for datastore contents configuration. +type Datastore struct { + // Credentials - [Required] Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // IsDefault - READ-ONLY; Readonly property to indicate if datastore is the workspace default datastore + IsDefault *bool `json:"isDefault,omitempty"` + // DatastoreType - Possible values include: 'DatastoreTypeDatastore', 'DatastoreTypeAzureBlob', 'DatastoreTypeAzureDataLakeGen1', 'DatastoreTypeAzureDataLakeGen2', 'DatastoreTypeAzureFile' + DatastoreType DatastoreTypeBasicDatastore `json:"datastoreType,omitempty"` + // 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"` +} + +func unmarshalBasicDatastore(body []byte) (BasicDatastore, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["datastoreType"] { + case string(DatastoreTypeAzureBlob): + var abd AzureBlobDatastore + err := json.Unmarshal(body, &abd) + return abd, err + case string(DatastoreTypeAzureDataLakeGen1): + var adlg1d AzureDataLakeGen1Datastore + err := json.Unmarshal(body, &adlg1d) + return adlg1d, err + case string(DatastoreTypeAzureDataLakeGen2): + var adlg2d AzureDataLakeGen2Datastore + err := json.Unmarshal(body, &adlg2d) + return adlg2d, err + case string(DatastoreTypeAzureFile): + var afd AzureFileDatastore + err := json.Unmarshal(body, &afd) + return afd, err + default: + var d Datastore + err := json.Unmarshal(body, &d) + return d, err + } +} +func unmarshalBasicDatastoreArray(body []byte) ([]BasicDatastore, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + dArray := make([]BasicDatastore, len(rawMessages)) + + for index, rawMessage := range rawMessages { + d, err := unmarshalBasicDatastore(*rawMessage) + if err != nil { + return nil, err + } + dArray[index] = d + } + return dArray, nil +} + +// MarshalJSON is the custom marshaler for Datastore. +func (d Datastore) MarshalJSON() ([]byte, error) { + d.DatastoreType = DatastoreTypeDatastore + objectMap := make(map[string]interface{}) + objectMap["credentials"] = d.Credentials + if d.DatastoreType != "" { + objectMap["datastoreType"] = d.DatastoreType + } + if d.Description != nil { + objectMap["description"] = d.Description + } + if d.Properties != nil { + objectMap["properties"] = d.Properties + } + if d.Tags != nil { + objectMap["tags"] = d.Tags + } + return json.Marshal(objectMap) +} + +// AsAzureBlobDatastore is the BasicDatastore implementation for Datastore. +func (d Datastore) AsAzureBlobDatastore() (*AzureBlobDatastore, bool) { + return nil, false +} + +// AsAzureDataLakeGen1Datastore is the BasicDatastore implementation for Datastore. +func (d Datastore) AsAzureDataLakeGen1Datastore() (*AzureDataLakeGen1Datastore, bool) { + return nil, false +} + +// AsAzureDataLakeGen2Datastore is the BasicDatastore implementation for Datastore. +func (d Datastore) AsAzureDataLakeGen2Datastore() (*AzureDataLakeGen2Datastore, bool) { + return nil, false +} + +// AsAzureFileDatastore is the BasicDatastore implementation for Datastore. +func (d Datastore) AsAzureFileDatastore() (*AzureFileDatastore, bool) { + return nil, false +} + +// AsDatastore is the BasicDatastore implementation for Datastore. +func (d Datastore) AsDatastore() (*Datastore, bool) { + return &d, true +} + +// AsBasicDatastore is the BasicDatastore implementation for Datastore. +func (d Datastore) AsBasicDatastore() (BasicDatastore, bool) { + return &d, true +} + +// UnmarshalJSON is the custom unmarshaler for Datastore struct. +func (d *Datastore) 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 + } + d.Credentials = credentials + } + case "isDefault": + if v != nil { + var isDefault bool + err = json.Unmarshal(*v, &isDefault) + if err != nil { + return err + } + d.IsDefault = &isDefault + } + case "datastoreType": + if v != nil { + var datastoreType DatastoreTypeBasicDatastore + err = json.Unmarshal(*v, &datastoreType) + if err != nil { + return err + } + d.DatastoreType = datastoreType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + d.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + d.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + d.Tags = tags + } + } + } + + return nil +} + +// BasicDatastoreCredentials base definition for datastore credentials. +type BasicDatastoreCredentials interface { + AsAccountKeyDatastoreCredentials() (*AccountKeyDatastoreCredentials, bool) + AsCertificateDatastoreCredentials() (*CertificateDatastoreCredentials, bool) + AsNoneDatastoreCredentials() (*NoneDatastoreCredentials, bool) + AsSasDatastoreCredentials() (*SasDatastoreCredentials, bool) + AsServicePrincipalDatastoreCredentials() (*ServicePrincipalDatastoreCredentials, bool) + AsDatastoreCredentials() (*DatastoreCredentials, bool) +} + +// DatastoreCredentials base definition for datastore credentials. +type DatastoreCredentials struct { + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey1', 'CredentialsTypeCertificate1', 'CredentialsTypeNone1', 'CredentialsTypeSas1', 'CredentialsTypeServicePrincipal1' + 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(CredentialsTypeAccountKey1): + var akdc AccountKeyDatastoreCredentials + err := json.Unmarshal(body, &akdc) + return akdc, err + case string(CredentialsTypeCertificate1): + var cdc CertificateDatastoreCredentials + err := json.Unmarshal(body, &cdc) + return cdc, err + case string(CredentialsTypeNone1): + var ndc NoneDatastoreCredentials + err := json.Unmarshal(body, &ndc) + return ndc, err + case string(CredentialsTypeSas1): + var sdc SasDatastoreCredentials + err := json.Unmarshal(body, &sdc) + return sdc, err + case string(CredentialsTypeServicePrincipal1): + var spdc ServicePrincipalDatastoreCredentials + err := json.Unmarshal(body, &spdc) + return spdc, 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 +} + +// 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 +} + +// DatastoreResource azure Resource Manager resource envelope. +type DatastoreResource struct { + autorest.Response `json:"-"` + // Properties - [Required] Additional attributes of the entity. + Properties BasicDatastore `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for DatastoreResource. +func (dr DatastoreResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = dr.Properties + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DatastoreResource struct. +func (dr *DatastoreResource) 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 := unmarshalBasicDatastore(*v) + if err != nil { + return err + } + dr.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dr.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + dr.SystemData = &systemData + } + } + } + + return nil +} + +// DatastoreResourceArmPaginatedResult a paginated list of Datastore entities. +type DatastoreResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + // NextLink - The link to the next page of Datastore objects. If null, there are no additional pages. + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type Datastore. + Value *[]DatastoreResource `json:"value,omitempty"` +} + +// DatastoreResourceArmPaginatedResultIterator provides access to a complete listing of DatastoreResource +// values. +type DatastoreResourceArmPaginatedResultIterator struct { + i int + page DatastoreResourceArmPaginatedResultPage +} + +// 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 *DatastoreResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatastoreResourceArmPaginatedResultIterator.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 *DatastoreResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DatastoreResourceArmPaginatedResultIterator) 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 DatastoreResourceArmPaginatedResultIterator) Response() DatastoreResourceArmPaginatedResult { + 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 DatastoreResourceArmPaginatedResultIterator) Value() DatastoreResource { + if !iter.page.NotDone() { + return DatastoreResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DatastoreResourceArmPaginatedResultIterator type. +func NewDatastoreResourceArmPaginatedResultIterator(page DatastoreResourceArmPaginatedResultPage) DatastoreResourceArmPaginatedResultIterator { + return DatastoreResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (drapr DatastoreResourceArmPaginatedResult) IsEmpty() bool { + return drapr.Value == nil || len(*drapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (drapr DatastoreResourceArmPaginatedResult) hasNextLink() bool { + return drapr.NextLink != nil && len(*drapr.NextLink) != 0 +} + +// datastoreResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (drapr DatastoreResourceArmPaginatedResult) datastoreResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !drapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(drapr.NextLink))) +} + +// DatastoreResourceArmPaginatedResultPage contains a page of DatastoreResource values. +type DatastoreResourceArmPaginatedResultPage struct { + fn func(context.Context, DatastoreResourceArmPaginatedResult) (DatastoreResourceArmPaginatedResult, error) + drapr DatastoreResourceArmPaginatedResult +} + +// 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 *DatastoreResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatastoreResourceArmPaginatedResultPage.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.drapr) + if err != nil { + return err + } + page.drapr = 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 *DatastoreResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DatastoreResourceArmPaginatedResultPage) NotDone() bool { + return !page.drapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DatastoreResourceArmPaginatedResultPage) Response() DatastoreResourceArmPaginatedResult { + return page.drapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DatastoreResourceArmPaginatedResultPage) Values() []DatastoreResource { + if page.drapr.IsEmpty() { + return nil + } + return *page.drapr.Value +} + +// Creates a new instance of the DatastoreResourceArmPaginatedResultPage type. +func NewDatastoreResourceArmPaginatedResultPage(cur DatastoreResourceArmPaginatedResult, getNextPage func(context.Context, DatastoreResourceArmPaginatedResult) (DatastoreResourceArmPaginatedResult, error)) DatastoreResourceArmPaginatedResultPage { + return DatastoreResourceArmPaginatedResultPage{ + fn: getNextPage, + drapr: cur, + } +} + +// BasicDatastoreSecrets base definition for datastore secrets. +type BasicDatastoreSecrets interface { + AsAccountKeyDatastoreSecrets() (*AccountKeyDatastoreSecrets, bool) + AsCertificateDatastoreSecrets() (*CertificateDatastoreSecrets, bool) + AsSasDatastoreSecrets() (*SasDatastoreSecrets, bool) + AsServicePrincipalDatastoreSecrets() (*ServicePrincipalDatastoreSecrets, bool) + AsDatastoreSecrets() (*DatastoreSecrets, bool) +} + +// DatastoreSecrets base definition for datastore secrets. +type DatastoreSecrets struct { + autorest.Response `json:"-"` + // SecretsType - Possible values include: 'SecretsTypeDatastoreSecrets', 'SecretsTypeAccountKey', 'SecretsTypeCertificate', 'SecretsTypeSas', 'SecretsTypeServicePrincipal' + 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(SecretsTypeAccountKey): + var akds AccountKeyDatastoreSecrets + err := json.Unmarshal(body, &akds) + return akds, err + case string(SecretsTypeCertificate): + var cds CertificateDatastoreSecrets + err := json.Unmarshal(body, &cds) + return cds, err + case string(SecretsTypeSas): + var sds SasDatastoreSecrets + err := json.Unmarshal(body, &sds) + return sds, err + case string(SecretsTypeServicePrincipal): + var spds ServicePrincipalDatastoreSecrets + err := json.Unmarshal(body, &spds) + return spds, 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 +} + +// 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 +} + +// 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 +} + +// BasicDataVersionBase data version base definition +type BasicDataVersionBase interface { + AsMLTableData() (*MLTableData, bool) + AsURIFileDataVersion() (*URIFileDataVersion, bool) + AsURIFolderDataVersion() (*URIFolderDataVersion, bool) + AsDataVersionBase() (*DataVersionBase, bool) +} + +// DataVersionBase data version base definition +type DataVersionBase struct { + // DataURI - [Required] Uri of the data. Usage/meaning depends on Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20220501.Assets.DataVersionBase.DataType + DataURI *string `json:"dataUri,omitempty"` + // DataType - Possible values include: 'DataTypeDataVersionBase', 'DataTypeMltable', 'DataTypeURIFile', 'DataTypeURIFolder' + DataType DataTypeBasicDataVersionBase `json:"dataType,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // 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"` +} + +func unmarshalBasicDataVersionBase(body []byte) (BasicDataVersionBase, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["dataType"] { + case string(DataTypeMltable): + var mtd MLTableData + err := json.Unmarshal(body, &mtd) + return mtd, err + case string(DataTypeURIFile): + var ufdv URIFileDataVersion + err := json.Unmarshal(body, &ufdv) + return ufdv, err + case string(DataTypeURIFolder): + var ufdv URIFolderDataVersion + err := json.Unmarshal(body, &ufdv) + return ufdv, err + default: + var dvb DataVersionBase + err := json.Unmarshal(body, &dvb) + return dvb, err + } +} +func unmarshalBasicDataVersionBaseArray(body []byte) ([]BasicDataVersionBase, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + dvbArray := make([]BasicDataVersionBase, len(rawMessages)) + + for index, rawMessage := range rawMessages { + dvb, err := unmarshalBasicDataVersionBase(*rawMessage) + if err != nil { + return nil, err + } + dvbArray[index] = dvb + } + return dvbArray, nil +} + +// MarshalJSON is the custom marshaler for DataVersionBase. +func (dvb DataVersionBase) MarshalJSON() ([]byte, error) { + dvb.DataType = DataTypeDataVersionBase + objectMap := make(map[string]interface{}) + if dvb.DataURI != nil { + objectMap["dataUri"] = dvb.DataURI + } + if dvb.DataType != "" { + objectMap["dataType"] = dvb.DataType + } + if dvb.IsAnonymous != nil { + objectMap["isAnonymous"] = dvb.IsAnonymous + } + if dvb.IsArchived != nil { + objectMap["isArchived"] = dvb.IsArchived + } + if dvb.Description != nil { + objectMap["description"] = dvb.Description + } + if dvb.Properties != nil { + objectMap["properties"] = dvb.Properties + } + if dvb.Tags != nil { + objectMap["tags"] = dvb.Tags + } + return json.Marshal(objectMap) +} + +// AsMLTableData is the BasicDataVersionBase implementation for DataVersionBase. +func (dvb DataVersionBase) AsMLTableData() (*MLTableData, bool) { + return nil, false +} + +// AsURIFileDataVersion is the BasicDataVersionBase implementation for DataVersionBase. +func (dvb DataVersionBase) AsURIFileDataVersion() (*URIFileDataVersion, bool) { + return nil, false +} + +// AsURIFolderDataVersion is the BasicDataVersionBase implementation for DataVersionBase. +func (dvb DataVersionBase) AsURIFolderDataVersion() (*URIFolderDataVersion, bool) { + return nil, false +} + +// AsDataVersionBase is the BasicDataVersionBase implementation for DataVersionBase. +func (dvb DataVersionBase) AsDataVersionBase() (*DataVersionBase, bool) { + return &dvb, true +} + +// AsBasicDataVersionBase is the BasicDataVersionBase implementation for DataVersionBase. +func (dvb DataVersionBase) AsBasicDataVersionBase() (BasicDataVersionBase, bool) { + return &dvb, true +} + +// DataVersionBaseResource azure Resource Manager resource envelope. +type DataVersionBaseResource struct { + autorest.Response `json:"-"` + // Properties - [Required] Additional attributes of the entity. + Properties BasicDataVersionBase `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataVersionBaseResource. +func (dvbr DataVersionBaseResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = dvbr.Properties + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DataVersionBaseResource struct. +func (dvbr *DataVersionBaseResource) 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 := unmarshalBasicDataVersionBase(*v) + if err != nil { + return err + } + dvbr.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dvbr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dvbr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dvbr.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + dvbr.SystemData = &systemData + } + } + } + + return nil +} + +// DataVersionBaseResourceArmPaginatedResult a paginated list of DataVersionBase entities. +type DataVersionBaseResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + // NextLink - The link to the next page of DataVersionBase objects. If null, there are no additional pages. + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type DataVersionBase. + Value *[]DataVersionBaseResource `json:"value,omitempty"` +} + +// DataVersionBaseResourceArmPaginatedResultIterator provides access to a complete listing of +// DataVersionBaseResource values. +type DataVersionBaseResourceArmPaginatedResultIterator struct { + i int + page DataVersionBaseResourceArmPaginatedResultPage +} + +// 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 *DataVersionBaseResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataVersionBaseResourceArmPaginatedResultIterator.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 *DataVersionBaseResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DataVersionBaseResourceArmPaginatedResultIterator) 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 DataVersionBaseResourceArmPaginatedResultIterator) Response() DataVersionBaseResourceArmPaginatedResult { + 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 DataVersionBaseResourceArmPaginatedResultIterator) Value() DataVersionBaseResource { + if !iter.page.NotDone() { + return DataVersionBaseResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DataVersionBaseResourceArmPaginatedResultIterator type. +func NewDataVersionBaseResourceArmPaginatedResultIterator(page DataVersionBaseResourceArmPaginatedResultPage) DataVersionBaseResourceArmPaginatedResultIterator { + return DataVersionBaseResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dvbrapr DataVersionBaseResourceArmPaginatedResult) IsEmpty() bool { + return dvbrapr.Value == nil || len(*dvbrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dvbrapr DataVersionBaseResourceArmPaginatedResult) hasNextLink() bool { + return dvbrapr.NextLink != nil && len(*dvbrapr.NextLink) != 0 +} + +// dataVersionBaseResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dvbrapr DataVersionBaseResourceArmPaginatedResult) dataVersionBaseResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !dvbrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dvbrapr.NextLink))) +} + +// DataVersionBaseResourceArmPaginatedResultPage contains a page of DataVersionBaseResource values. +type DataVersionBaseResourceArmPaginatedResultPage struct { + fn func(context.Context, DataVersionBaseResourceArmPaginatedResult) (DataVersionBaseResourceArmPaginatedResult, error) + dvbrapr DataVersionBaseResourceArmPaginatedResult +} + +// 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 *DataVersionBaseResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataVersionBaseResourceArmPaginatedResultPage.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.dvbrapr) + if err != nil { + return err + } + page.dvbrapr = 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 *DataVersionBaseResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DataVersionBaseResourceArmPaginatedResultPage) NotDone() bool { + return !page.dvbrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DataVersionBaseResourceArmPaginatedResultPage) Response() DataVersionBaseResourceArmPaginatedResult { + return page.dvbrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DataVersionBaseResourceArmPaginatedResultPage) Values() []DataVersionBaseResource { + if page.dvbrapr.IsEmpty() { + return nil + } + return *page.dvbrapr.Value +} + +// Creates a new instance of the DataVersionBaseResourceArmPaginatedResultPage type. +func NewDataVersionBaseResourceArmPaginatedResultPage(cur DataVersionBaseResourceArmPaginatedResult, getNextPage func(context.Context, DataVersionBaseResourceArmPaginatedResult) (DataVersionBaseResourceArmPaginatedResult, error)) DataVersionBaseResourceArmPaginatedResultPage { + return DataVersionBaseResourceArmPaginatedResultPage{ + fn: getNextPage, + dvbrapr: cur, + } +} + +// DefaultScaleSettings ... +type DefaultScaleSettings struct { + // ScaleType - Possible values include: 'ScaleTypeOnlineScaleSettings', 'ScaleTypeDefault', 'ScaleTypeTargetUtilization' + ScaleType ScaleTypeBasicOnlineScaleSettings `json:"scaleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for DefaultScaleSettings. +func (dss DefaultScaleSettings) MarshalJSON() ([]byte, error) { + dss.ScaleType = ScaleTypeDefault + objectMap := make(map[string]interface{}) + if dss.ScaleType != "" { + objectMap["scaleType"] = dss.ScaleType + } + return json.Marshal(objectMap) +} + +// AsDefaultScaleSettings is the BasicOnlineScaleSettings implementation for DefaultScaleSettings. +func (dss DefaultScaleSettings) AsDefaultScaleSettings() (*DefaultScaleSettings, bool) { + return &dss, true +} + +// AsTargetUtilizationScaleSettings is the BasicOnlineScaleSettings implementation for DefaultScaleSettings. +func (dss DefaultScaleSettings) AsTargetUtilizationScaleSettings() (*TargetUtilizationScaleSettings, bool) { + return nil, false +} + +// AsOnlineScaleSettings is the BasicOnlineScaleSettings implementation for DefaultScaleSettings. +func (dss DefaultScaleSettings) AsOnlineScaleSettings() (*OnlineScaleSettings, bool) { + return nil, false +} + +// AsBasicOnlineScaleSettings is the BasicOnlineScaleSettings implementation for DefaultScaleSettings. +func (dss DefaultScaleSettings) AsBasicOnlineScaleSettings() (BasicOnlineScaleSettings, bool) { + return &dss, true +} + +// DeploymentLogs ... +type DeploymentLogs struct { + autorest.Response `json:"-"` + // Content - The retrieved online deployment logs. + 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"` +} + +// DiagnoseRequestProperties ... +type DiagnoseRequestProperties struct { + // Udr - Setting for diagnosing user defined routing + Udr map[string]interface{} `json:"udr"` + // Nsg - Setting for diagnosing network security group + Nsg map[string]interface{} `json:"nsg"` + // ResourceLock - Setting for diagnosing resource lock + ResourceLock map[string]interface{} `json:"resourceLock"` + // DNSResolution - Setting for diagnosing dns resolution + DNSResolution map[string]interface{} `json:"dnsResolution"` + // StorageAccount - Setting for diagnosing dependent storage account + StorageAccount map[string]interface{} `json:"storageAccount"` + // KeyVault - Setting for diagnosing dependent key vault + KeyVault map[string]interface{} `json:"keyVault"` + // ContainerRegistry - Setting for diagnosing dependent container registry + ContainerRegistry map[string]interface{} `json:"containerRegistry"` + // ApplicationInsights - Setting for diagnosing dependent application insights + ApplicationInsights map[string]interface{} `json:"applicationInsights"` + // Others - Setting for diagnosing unclassified category of problems + Others map[string]interface{} `json:"others"` +} + +// MarshalJSON is the custom marshaler for DiagnoseRequestProperties. +func (drp DiagnoseRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if drp.Udr != nil { + objectMap["udr"] = drp.Udr + } + if drp.Nsg != nil { + objectMap["nsg"] = drp.Nsg + } + if drp.ResourceLock != nil { + objectMap["resourceLock"] = drp.ResourceLock + } + if drp.DNSResolution != nil { + objectMap["dnsResolution"] = drp.DNSResolution + } + if drp.StorageAccount != nil { + objectMap["storageAccount"] = drp.StorageAccount + } + if drp.KeyVault != nil { + objectMap["keyVault"] = drp.KeyVault + } + if drp.ContainerRegistry != nil { + objectMap["containerRegistry"] = drp.ContainerRegistry + } + if drp.ApplicationInsights != nil { + objectMap["applicationInsights"] = drp.ApplicationInsights + } + if drp.Others != nil { + objectMap["others"] = drp.Others + } + return json.Marshal(objectMap) +} + +// DiagnoseResponseResult ... +type DiagnoseResponseResult struct { + autorest.Response `json:"-"` + Value *DiagnoseResponseResultValue `json:"value,omitempty"` +} + +// DiagnoseResponseResultValue ... +type DiagnoseResponseResultValue struct { + UserDefinedRouteResults *[]DiagnoseResult `json:"userDefinedRouteResults,omitempty"` + NetworkSecurityRuleResults *[]DiagnoseResult `json:"networkSecurityRuleResults,omitempty"` + ResourceLockResults *[]DiagnoseResult `json:"resourceLockResults,omitempty"` + DNSResolutionResults *[]DiagnoseResult `json:"dnsResolutionResults,omitempty"` + StorageAccountResults *[]DiagnoseResult `json:"storageAccountResults,omitempty"` + KeyVaultResults *[]DiagnoseResult `json:"keyVaultResults,omitempty"` + ContainerRegistryResults *[]DiagnoseResult `json:"containerRegistryResults,omitempty"` + ApplicationInsightsResults *[]DiagnoseResult `json:"applicationInsightsResults,omitempty"` + OtherResults *[]DiagnoseResult `json:"otherResults,omitempty"` +} + +// DiagnoseResult result of Diagnose +type DiagnoseResult struct { + // Code - READ-ONLY; Code for workspace setup error + Code *string `json:"code,omitempty"` + // Level - READ-ONLY; Level of workspace setup error. Possible values include: 'DiagnoseResultLevelWarning', 'DiagnoseResultLevelError', 'DiagnoseResultLevelInformation' + Level DiagnoseResultLevel `json:"level,omitempty"` + // Message - READ-ONLY; Message of workspace setup error + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for DiagnoseResult. +func (dr DiagnoseResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DiagnoseWorkspaceParameters parameters to diagnose a workspace +type DiagnoseWorkspaceParameters struct { + // Value - Value of Parameters + Value *DiagnoseRequestProperties `json:"value,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 +} + +// 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 - Number of intervals by which to delay the first evaluation. + DelayEvaluation *int32 `json:"delayEvaluation,omitempty"` + // EvaluationInterval - Interval (number of runs) between policy evaluations. + 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 +} + +// EncryptionKeyVaultProperties ... +type EncryptionKeyVaultProperties 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"` +} + +// 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 *EncryptionKeyVaultProperties `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 for endpoint authentication. + 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"` +} + +// EndpointDeploymentPropertiesBase base definition for endpoint deployment. +type EndpointDeploymentPropertiesBase struct { + // 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 or AssetId 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"` + // Properties - Property dictionary. Properties can be added, but not removed or altered. + Properties map[string]*string `json:"properties"` +} + +// MarshalJSON is the custom marshaler for EndpointDeploymentPropertiesBase. +func (edpb EndpointDeploymentPropertiesBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if edpb.CodeConfiguration != nil { + objectMap["codeConfiguration"] = edpb.CodeConfiguration + } + if edpb.Description != nil { + objectMap["description"] = edpb.Description + } + if edpb.EnvironmentID != nil { + objectMap["environmentId"] = edpb.EnvironmentID + } + if edpb.EnvironmentVariables != nil { + objectMap["environmentVariables"] = edpb.EnvironmentVariables + } + if edpb.Properties != nil { + objectMap["properties"] = edpb.Properties + } + return json.Marshal(objectMap) +} + +// EndpointPropertiesBase inference Endpoint base definition +type EndpointPropertiesBase struct { + // AuthMode - [Required] Use 'Key' for key based authentication and 'AMLToken' for Azure Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' does. 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"` +} + +// MarshalJSON is the custom marshaler for EndpointPropertiesBase. +func (epb EndpointPropertiesBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if epb.AuthMode != "" { + objectMap["authMode"] = epb.AuthMode + } + if epb.Description != nil { + objectMap["description"] = epb.Description + } + if epb.Keys != nil { + objectMap["keys"] = epb.Keys + } + if epb.Properties != nil { + objectMap["properties"] = epb.Properties + } + return json.Marshal(objectMap) +} + +// EnvironmentContainer container for environment specification versions. +type EnvironmentContainer struct { + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // LatestVersion - READ-ONLY; The latest version inside this container. + LatestVersion *string `json:"latestVersion,omitempty"` + // NextVersion - READ-ONLY; The next auto incremental version + NextVersion *string `json:"nextVersion,omitempty"` + // 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.IsArchived != nil { + objectMap["isArchived"] = ec.IsArchived + } + 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 - [Required] Additional attributes of the entity. + Properties *EnvironmentContainer `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 - The link to the next page of EnvironmentContainer objects. If null, there are no additional pages. + 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, + } +} + +// EnvironmentVersion environment version details. +type EnvironmentVersion struct { + // Build - Configuration settings for Docker build context. + Build *BuildContext `json:"build,omitempty"` + // 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"` + // EnvironmentType - READ-ONLY; Environment type is either user managed or curated by the Azure ML service + // . Possible values include: 'Curated', 'UserCreated' + EnvironmentType EnvironmentType `json:"environmentType,omitempty"` + // Image - Name of the image that will be used for the environment. + // + Image *string `json:"image,omitempty"` + // InferenceConfig - Defines configuration specific to inference. + InferenceConfig *InferenceContainerProperties `json:"inferenceConfig,omitempty"` + // OsType - The OS type of the environment. Possible values include: 'Linux', 'Windows' + OsType OperatingSystemType `json:"osType,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // 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 EnvironmentVersion. +func (ev EnvironmentVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ev.Build != nil { + objectMap["build"] = ev.Build + } + if ev.CondaFile != nil { + objectMap["condaFile"] = ev.CondaFile + } + if ev.Image != nil { + objectMap["image"] = ev.Image + } + if ev.InferenceConfig != nil { + objectMap["inferenceConfig"] = ev.InferenceConfig + } + if ev.OsType != "" { + objectMap["osType"] = ev.OsType + } + if ev.IsAnonymous != nil { + objectMap["isAnonymous"] = ev.IsAnonymous + } + if ev.IsArchived != nil { + objectMap["isArchived"] = ev.IsArchived + } + if ev.Description != nil { + objectMap["description"] = ev.Description + } + if ev.Properties != nil { + objectMap["properties"] = ev.Properties + } + if ev.Tags != nil { + objectMap["tags"] = ev.Tags + } + return json.Marshal(objectMap) +} + +// EnvironmentVersionResource azure Resource Manager resource envelope. +type EnvironmentVersionResource struct { + autorest.Response `json:"-"` + // Properties - [Required] Additional attributes of the entity. + Properties *EnvironmentVersion `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for EnvironmentVersionResource. +func (evr EnvironmentVersionResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if evr.Properties != nil { + objectMap["properties"] = evr.Properties + } + return json.Marshal(objectMap) +} + +// EnvironmentVersionResourceArmPaginatedResult a paginated list of EnvironmentVersion entities. +type EnvironmentVersionResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + // NextLink - The link to the next page of EnvironmentVersion objects. If null, there are no additional pages. + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type EnvironmentVersion. + Value *[]EnvironmentVersionResource `json:"value,omitempty"` +} + +// EnvironmentVersionResourceArmPaginatedResultIterator provides access to a complete listing of +// EnvironmentVersionResource values. +type EnvironmentVersionResourceArmPaginatedResultIterator struct { + i int + page EnvironmentVersionResourceArmPaginatedResultPage +} + +// 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 *EnvironmentVersionResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentVersionResourceArmPaginatedResultIterator.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 *EnvironmentVersionResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EnvironmentVersionResourceArmPaginatedResultIterator) 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 EnvironmentVersionResourceArmPaginatedResultIterator) Response() EnvironmentVersionResourceArmPaginatedResult { + 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 EnvironmentVersionResourceArmPaginatedResultIterator) Value() EnvironmentVersionResource { + if !iter.page.NotDone() { + return EnvironmentVersionResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EnvironmentVersionResourceArmPaginatedResultIterator type. +func NewEnvironmentVersionResourceArmPaginatedResultIterator(page EnvironmentVersionResourceArmPaginatedResultPage) EnvironmentVersionResourceArmPaginatedResultIterator { + return EnvironmentVersionResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (evrapr EnvironmentVersionResourceArmPaginatedResult) IsEmpty() bool { + return evrapr.Value == nil || len(*evrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (evrapr EnvironmentVersionResourceArmPaginatedResult) hasNextLink() bool { + return evrapr.NextLink != nil && len(*evrapr.NextLink) != 0 +} + +// environmentVersionResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (evrapr EnvironmentVersionResourceArmPaginatedResult) environmentVersionResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !evrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(evrapr.NextLink))) +} + +// EnvironmentVersionResourceArmPaginatedResultPage contains a page of EnvironmentVersionResource values. +type EnvironmentVersionResourceArmPaginatedResultPage struct { + fn func(context.Context, EnvironmentVersionResourceArmPaginatedResult) (EnvironmentVersionResourceArmPaginatedResult, error) + evrapr EnvironmentVersionResourceArmPaginatedResult +} + +// 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 *EnvironmentVersionResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentVersionResourceArmPaginatedResultPage.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.evrapr) + if err != nil { + return err + } + page.evrapr = 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 *EnvironmentVersionResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EnvironmentVersionResourceArmPaginatedResultPage) NotDone() bool { + return !page.evrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EnvironmentVersionResourceArmPaginatedResultPage) Response() EnvironmentVersionResourceArmPaginatedResult { + return page.evrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EnvironmentVersionResourceArmPaginatedResultPage) Values() []EnvironmentVersionResource { + if page.evrapr.IsEmpty() { + return nil + } + return *page.evrapr.Value +} + +// Creates a new instance of the EnvironmentVersionResourceArmPaginatedResultPage type. +func NewEnvironmentVersionResourceArmPaginatedResultPage(cur EnvironmentVersionResourceArmPaginatedResult, getNextPage func(context.Context, EnvironmentVersionResourceArmPaginatedResult) (EnvironmentVersionResourceArmPaginatedResult, error)) EnvironmentVersionResourceArmPaginatedResultPage { + return EnvironmentVersionResourceArmPaginatedResultPage{ + fn: getNextPage, + evrapr: 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"` +} + +// ExternalFQDNResponse ... +type ExternalFQDNResponse struct { + autorest.Response `json:"-"` + Value *[]FQDNEndpoints `json:"value,omitempty"` +} + +// FlavorData ... +type FlavorData struct { + // Data - Model flavor-specific data. + 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) +} + +// FQDNEndpoint ... +type FQDNEndpoint struct { + DomainName *string `json:"domainName,omitempty"` + EndpointDetails *[]FQDNEndpointDetail `json:"endpointDetails,omitempty"` +} + +// FQDNEndpointDetail ... +type FQDNEndpointDetail struct { + Port *int32 `json:"port,omitempty"` +} + +// FQDNEndpoints ... +type FQDNEndpoints struct { + Properties *FQDNEndpointsProperties `json:"properties,omitempty"` +} + +// FQDNEndpointsProperties ... +type FQDNEndpointsProperties struct { + Category *string `json:"category,omitempty"` + Endpoints *[]FQDNEndpoint `json:"endpoints,omitempty"` +} + +// GridSamplingAlgorithm defines a Sampling Algorithm that exhaustively generates every value combination +// in the space +type GridSamplingAlgorithm struct { + // SamplingAlgorithmType - Possible values include: 'SamplingAlgorithmTypeSamplingAlgorithm', 'SamplingAlgorithmTypeBayesian1', 'SamplingAlgorithmTypeGrid1', 'SamplingAlgorithmTypeRandom1' + SamplingAlgorithmType SamplingAlgorithmTypeBasicSamplingAlgorithm `json:"samplingAlgorithmType,omitempty"` +} + +// MarshalJSON is the custom marshaler for GridSamplingAlgorithm. +func (gsa GridSamplingAlgorithm) MarshalJSON() ([]byte, error) { + gsa.SamplingAlgorithmType = SamplingAlgorithmTypeGrid1 + objectMap := make(map[string]interface{}) + if gsa.SamplingAlgorithmType != "" { + objectMap["samplingAlgorithmType"] = gsa.SamplingAlgorithmType + } + return json.Marshal(objectMap) +} + +// AsBayesianSamplingAlgorithm is the BasicSamplingAlgorithm implementation for GridSamplingAlgorithm. +func (gsa GridSamplingAlgorithm) AsBayesianSamplingAlgorithm() (*BayesianSamplingAlgorithm, bool) { + return nil, false +} + +// AsGridSamplingAlgorithm is the BasicSamplingAlgorithm implementation for GridSamplingAlgorithm. +func (gsa GridSamplingAlgorithm) AsGridSamplingAlgorithm() (*GridSamplingAlgorithm, bool) { + return &gsa, true +} + +// AsRandomSamplingAlgorithm is the BasicSamplingAlgorithm implementation for GridSamplingAlgorithm. +func (gsa GridSamplingAlgorithm) AsRandomSamplingAlgorithm() (*RandomSamplingAlgorithm, bool) { + return nil, false +} + +// AsSamplingAlgorithm is the BasicSamplingAlgorithm implementation for GridSamplingAlgorithm. +func (gsa GridSamplingAlgorithm) AsSamplingAlgorithm() (*SamplingAlgorithm, bool) { + return nil, false +} + +// AsBasicSamplingAlgorithm is the BasicSamplingAlgorithm implementation for GridSamplingAlgorithm. +func (gsa GridSamplingAlgorithm) AsBasicSamplingAlgorithm() (BasicSamplingAlgorithm, bool) { + return &gsa, true +} + +// HDInsight a HDInsight compute. +type HDInsight struct { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // ComputeLocation - READ-ONLY; 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 *HDInsightProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for HDInsight. +func (hi HDInsight) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hi.ComputeType != "" { + objectMap["computeType"] = hi.ComputeType + } + 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.Properties != nil { + objectMap["properties"] = hi.Properties + } + return json.Marshal(objectMap) +} + +// HDInsightProperties hDInsight compute properties +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"` +} + +// HDInsightSchema ... +type HDInsightSchema struct { + Properties *HDInsightProperties `json:"properties,omitempty"` +} + +// IDAssetReference reference to an asset via its ARM resource ID. +type IDAssetReference struct { + // AssetID - [Required] 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: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// 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 + } + return json.Marshal(objectMap) +} + +// BasicIdentityConfiguration base definition for identity configuration. +type BasicIdentityConfiguration interface { + AsAmlToken() (*AmlToken, bool) + AsManagedIdentity() (*ManagedIdentity, bool) + AsUserIdentity() (*UserIdentity, bool) + AsIdentityConfiguration() (*IdentityConfiguration, bool) +} + +// IdentityConfiguration base definition for identity configuration. +type IdentityConfiguration struct { + // IdentityType - Possible values include: 'IdentityTypeIdentityConfiguration', 'IdentityTypeAMLToken', 'IdentityTypeManaged', 'IdentityTypeUserIdentity' + 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 + case string(IdentityTypeUserIdentity): + var UI UserIdentity + err := json.Unmarshal(body, &UI) + return UI, 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 +} + +// AsUserIdentity is the BasicIdentityConfiguration implementation for IdentityConfiguration. +func (ic IdentityConfiguration) AsUserIdentity() (*UserIdentity, 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"` +} + +// InstanceTypeSchema instance type schema. +type InstanceTypeSchema struct { + // NodeSelector - Node Selector + NodeSelector map[string]*string `json:"nodeSelector"` + // Resources - Resource requests/limits for this instance type + Resources *InstanceTypeSchemaResources `json:"resources,omitempty"` +} + +// MarshalJSON is the custom marshaler for InstanceTypeSchema. +func (its InstanceTypeSchema) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if its.NodeSelector != nil { + objectMap["nodeSelector"] = its.NodeSelector + } + if its.Resources != nil { + objectMap["resources"] = its.Resources + } + return json.Marshal(objectMap) +} + +// InstanceTypeSchemaResources resource requests/limits for this instance type +type InstanceTypeSchemaResources struct { + // Requests - Resource requests for this instance type + Requests map[string]*string `json:"requests"` + // Limits - Resource limits for this instance type + Limits map[string]*string `json:"limits"` +} + +// MarshalJSON is the custom marshaler for InstanceTypeSchemaResources. +func (its InstanceTypeSchemaResources) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if its.Requests != nil { + objectMap["requests"] = its.Requests + } + if its.Limits != nil { + objectMap["limits"] = its.Limits + } + return json.Marshal(objectMap) +} + +// BasicJobBase base definition for a job. +type BasicJobBase interface { + AsCommandJob() (*CommandJob, bool) + AsPipelineJob() (*PipelineJob, bool) + AsSweepJob() (*SweepJob, bool) + AsJobBase() (*JobBase, bool) +} + +// JobBase base definition for a job. +type JobBase struct { + // ComputeID - ARM resource ID of the compute resource. + ComputeID *string `json:"computeId,omitempty"` + // DisplayName - Display name of job. + DisplayName *string `json:"displayName,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, UserIdentity or null. + // Defaults to AmlToken if null. + Identity BasicIdentityConfiguration `json:"identity,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // Services - List of JobEndpoints. + // For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + Services map[string]*JobService `json:"services"` + // 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"` + // JobType - Possible values include: 'JobTypeJobBase', 'JobTypeCommand1', 'JobTypePipeline1', 'JobTypeSweep1' + JobType JobTypeBasicJobBase `json:"jobType,omitempty"` + // 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"` +} + +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(JobTypeCommand1): + var cj CommandJob + err := json.Unmarshal(body, &cj) + return cj, err + case string(JobTypePipeline1): + var pj PipelineJob + err := json.Unmarshal(body, &pj) + return pj, err + case string(JobTypeSweep1): + 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.ComputeID != nil { + objectMap["computeId"] = jb.ComputeID + } + if jb.DisplayName != nil { + objectMap["displayName"] = jb.DisplayName + } + if jb.ExperimentName != nil { + objectMap["experimentName"] = jb.ExperimentName + } + objectMap["identity"] = jb.Identity + if jb.IsArchived != nil { + objectMap["isArchived"] = jb.IsArchived + } + if jb.Services != nil { + objectMap["services"] = jb.Services + } + if jb.JobType != "" { + objectMap["jobType"] = jb.JobType + } + if jb.Description != nil { + objectMap["description"] = jb.Description + } + if jb.Properties != nil { + objectMap["properties"] = jb.Properties + } + if jb.Tags != nil { + objectMap["tags"] = jb.Tags + } + return json.Marshal(objectMap) +} + +// AsCommandJob is the BasicJobBase implementation for JobBase. +func (jb JobBase) AsCommandJob() (*CommandJob, bool) { + return nil, false +} + +// AsPipelineJob is the BasicJobBase implementation for JobBase. +func (jb JobBase) AsPipelineJob() (*PipelineJob, 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 +} + +// UnmarshalJSON is the custom unmarshaler for JobBase struct. +func (jb *JobBase) 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 "computeId": + if v != nil { + var computeID string + err = json.Unmarshal(*v, &computeID) + if err != nil { + return err + } + jb.ComputeID = &computeID + } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + jb.DisplayName = &displayName + } + case "experimentName": + if v != nil { + var experimentName string + err = json.Unmarshal(*v, &experimentName) + if err != nil { + return err + } + jb.ExperimentName = &experimentName + } + case "identity": + if v != nil { + identity, err := unmarshalBasicIdentityConfiguration(*v) + if err != nil { + return err + } + jb.Identity = identity + } + case "isArchived": + if v != nil { + var isArchived bool + err = json.Unmarshal(*v, &isArchived) + if err != nil { + return err + } + jb.IsArchived = &isArchived + } + case "services": + if v != nil { + var services map[string]*JobService + err = json.Unmarshal(*v, &services) + if err != nil { + return err + } + jb.Services = services + } + case "status": + if v != nil { + var status JobStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + jb.Status = status + } + case "jobType": + if v != nil { + var jobType JobTypeBasicJobBase + err = json.Unmarshal(*v, &jobType) + if err != nil { + return err + } + jb.JobType = jobType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + jb.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + jb.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + jb.Tags = tags + } + } + } + + return nil +} + +// JobBaseResource azure Resource Manager resource envelope. +type JobBaseResource struct { + autorest.Response `json:"-"` + // Properties - [Required] Additional attributes of the entity. + Properties BasicJobBase `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 "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 + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + jbr.SystemData = &systemData + } + } + } + + return nil +} + +// JobBaseResourceArmPaginatedResult a paginated list of JobBase entities. +type JobBaseResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + // NextLink - The link to the next page of JobBase objects. If null, there are no additional pages. + 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, + } +} + +// BasicJobInput command job definition. +type BasicJobInput interface { + AsLiteralJobInput() (*LiteralJobInput, bool) + AsJobInput() (*JobInput, bool) +} + +// JobInput command job definition. +type JobInput struct { + // Description - Description for the input. + Description *string `json:"description,omitempty"` + // JobInputType - Possible values include: 'JobInputTypeJobInput', 'JobInputTypeLiteral1' + JobInputType JobInputTypeBasicJobInput `json:"jobInputType,omitempty"` +} + +func unmarshalBasicJobInput(body []byte) (BasicJobInput, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["jobInputType"] { + case string(JobInputTypeLiteral1): + var lji LiteralJobInput + err := json.Unmarshal(body, &lji) + return lji, err + default: + var ji JobInput + err := json.Unmarshal(body, &ji) + return ji, err + } +} +func unmarshalBasicJobInputArray(body []byte) ([]BasicJobInput, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + jiArray := make([]BasicJobInput, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ji, err := unmarshalBasicJobInput(*rawMessage) + if err != nil { + return nil, err + } + jiArray[index] = ji + } + return jiArray, nil +} + +// MarshalJSON is the custom marshaler for JobInput. +func (ji JobInput) MarshalJSON() ([]byte, error) { + ji.JobInputType = JobInputTypeJobInput + objectMap := make(map[string]interface{}) + if ji.Description != nil { + objectMap["description"] = ji.Description + } + if ji.JobInputType != "" { + objectMap["jobInputType"] = ji.JobInputType + } + return json.Marshal(objectMap) +} + +// AsLiteralJobInput is the BasicJobInput implementation for JobInput. +func (ji JobInput) AsLiteralJobInput() (*LiteralJobInput, bool) { + return nil, false +} + +// AsJobInput is the BasicJobInput implementation for JobInput. +func (ji JobInput) AsJobInput() (*JobInput, bool) { + return &ji, true +} + +// AsBasicJobInput is the BasicJobInput implementation for JobInput. +func (ji JobInput) AsBasicJobInput() (BasicJobInput, bool) { + return &ji, true +} + +// BasicJobLimits ... +type BasicJobLimits interface { + AsCommandJobLimits() (*CommandJobLimits, bool) + AsSweepJobLimits() (*SweepJobLimits, bool) + AsJobLimits() (*JobLimits, bool) +} + +// JobLimits ... +type JobLimits struct { + // 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"` + // JobLimitsType - Possible values include: 'JobLimitsTypeJobLimits', 'JobLimitsTypeCommand', 'JobLimitsTypeSweep' + JobLimitsType JobLimitsTypeBasicJobLimits `json:"jobLimitsType,omitempty"` +} + +func unmarshalBasicJobLimits(body []byte) (BasicJobLimits, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["jobLimitsType"] { + case string(JobLimitsTypeCommand): + var cjl CommandJobLimits + err := json.Unmarshal(body, &cjl) + return cjl, err + case string(JobLimitsTypeSweep): + var sjl SweepJobLimits + err := json.Unmarshal(body, &sjl) + return sjl, err + default: + var jl JobLimits + err := json.Unmarshal(body, &jl) + return jl, err + } +} +func unmarshalBasicJobLimitsArray(body []byte) ([]BasicJobLimits, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + jlArray := make([]BasicJobLimits, len(rawMessages)) + + for index, rawMessage := range rawMessages { + jl, err := unmarshalBasicJobLimits(*rawMessage) + if err != nil { + return nil, err + } + jlArray[index] = jl + } + return jlArray, nil +} + +// MarshalJSON is the custom marshaler for JobLimits. +func (jl JobLimits) MarshalJSON() ([]byte, error) { + jl.JobLimitsType = JobLimitsTypeJobLimits + objectMap := make(map[string]interface{}) + if jl.Timeout != nil { + objectMap["timeout"] = jl.Timeout + } + if jl.JobLimitsType != "" { + objectMap["jobLimitsType"] = jl.JobLimitsType + } + return json.Marshal(objectMap) +} + +// AsCommandJobLimits is the BasicJobLimits implementation for JobLimits. +func (jl JobLimits) AsCommandJobLimits() (*CommandJobLimits, bool) { + return nil, false +} + +// AsSweepJobLimits is the BasicJobLimits implementation for JobLimits. +func (jl JobLimits) AsSweepJobLimits() (*SweepJobLimits, bool) { + return nil, false +} + +// AsJobLimits is the BasicJobLimits implementation for JobLimits. +func (jl JobLimits) AsJobLimits() (*JobLimits, bool) { + return &jl, true +} + +// AsBasicJobLimits is the BasicJobLimits implementation for JobLimits. +func (jl JobLimits) AsBasicJobLimits() (BasicJobLimits, bool) { + return &jl, true +} + +// BasicJobOutput job output definition container information on where to find job output/logs. +type BasicJobOutput interface { + AsJobOutput() (*JobOutput, bool) +} + +// JobOutput job output definition container information on where to find job output/logs. +type JobOutput struct { + // Description - Description for the output. + Description *string `json:"description,omitempty"` + // JobOutputType - Possible values include: 'JobOutputTypeJobOutput' + JobOutputType JobOutputTypeBasicJobOutput `json:"jobOutputType,omitempty"` +} + +func unmarshalBasicJobOutput(body []byte) (BasicJobOutput, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["jobOutputType"] { + default: + var jo JobOutput + err := json.Unmarshal(body, &jo) + return jo, err + } +} +func unmarshalBasicJobOutputArray(body []byte) ([]BasicJobOutput, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + joArray := make([]BasicJobOutput, len(rawMessages)) + + for index, rawMessage := range rawMessages { + jo, err := unmarshalBasicJobOutput(*rawMessage) + if err != nil { + return nil, err + } + joArray[index] = jo + } + return joArray, nil +} + +// MarshalJSON is the custom marshaler for JobOutput. +func (jo JobOutput) MarshalJSON() ([]byte, error) { + jo.JobOutputType = JobOutputTypeJobOutput + objectMap := make(map[string]interface{}) + if jo.Description != nil { + objectMap["description"] = jo.Description + } + if jo.JobOutputType != "" { + objectMap["jobOutputType"] = jo.JobOutputType + } + return json.Marshal(objectMap) +} + +// AsJobOutput is the BasicJobOutput implementation for JobOutput. +func (jo JobOutput) AsJobOutput() (*JobOutput, bool) { + return &jo, true +} + +// AsBasicJobOutput is the BasicJobOutput implementation for JobOutput. +func (jo JobOutput) AsBasicJobOutput() (BasicJobOutput, bool) { + return &jo, true +} + +// JobsCancelFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type JobsCancelFuture 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 *JobsCancelFuture) 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 JobsCancelFuture.Result. +func (future *JobsCancelFuture) 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.JobsCancelFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.JobsCancelFuture") + return + } + ar.Response = future.Response() + return +} + +// 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 +} + +// JobService job endpoint definition +type JobService struct { + // Endpoint - Url for endpoint. + Endpoint *string `json:"endpoint,omitempty"` + // ErrorMessage - READ-ONLY; Any error in the service. + ErrorMessage *string `json:"errorMessage,omitempty"` + // JobServiceType - Endpoint type. + JobServiceType *string `json:"jobServiceType,omitempty"` + // Port - Port for endpoint. + Port *int32 `json:"port,omitempty"` + // Properties - Additional properties to set on the endpoint. + Properties map[string]*string `json:"properties"` + // Status - READ-ONLY; Status of endpoint. + Status *string `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for JobService. +func (js JobService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if js.Endpoint != nil { + objectMap["endpoint"] = js.Endpoint + } + if js.JobServiceType != nil { + objectMap["jobServiceType"] = js.JobServiceType + } + if js.Port != nil { + objectMap["port"] = js.Port + } + if js.Properties != nil { + objectMap["properties"] = js.Properties + } + return json.Marshal(objectMap) +} + +// Kubernetes a Machine Learning compute based on Kubernetes Compute. +type Kubernetes struct { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // ComputeLocation - READ-ONLY; 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 - Properties of Kubernetes + Properties *KubernetesProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Kubernetes. +func (kVar Kubernetes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kVar.ComputeType != "" { + objectMap["computeType"] = kVar.ComputeType + } + if kVar.Description != nil { + objectMap["description"] = kVar.Description + } + if kVar.ResourceID != nil { + objectMap["resourceId"] = kVar.ResourceID + } + if kVar.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = kVar.DisableLocalAuth + } + if kVar.Properties != nil { + objectMap["properties"] = kVar.Properties + } + return json.Marshal(objectMap) +} + +// KubernetesOnlineDeployment properties specific to a KubernetesOnlineDeployment. +type KubernetesOnlineDeployment struct { + // ContainerResourceRequirements - The resource requirements for the container (cpu and memory). + ContainerResourceRequirements *ContainerResourceRequirements `json:"containerResourceRequirements,omitempty"` + // AppInsightsEnabled - If true, enables Application Insights logging. + AppInsightsEnabled *bool `json:"appInsightsEnabled,omitempty"` + // InstanceType - Compute instance type. + InstanceType *string `json:"instanceType,omitempty"` + // LivenessProbe - Liveness probe monitors the health of the container regularly. + LivenessProbe *ProbeSettings `json:"livenessProbe,omitempty"` + // Model - The URI path to the model. + Model *string `json:"model,omitempty"` + // ModelMountPath - The path to mount the model in custom container. + ModelMountPath *string `json:"modelMountPath,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state for the endpoint deployment. Possible values include: 'DeploymentProvisioningStateCreating', 'DeploymentProvisioningStateDeleting', 'DeploymentProvisioningStateScaling', 'DeploymentProvisioningStateUpdating', 'DeploymentProvisioningStateSucceeded', 'DeploymentProvisioningStateFailed', 'DeploymentProvisioningStateCanceled' + ProvisioningState DeploymentProvisioningState `json:"provisioningState,omitempty"` + // ReadinessProbe - Readiness probe validates if the container is ready to serve traffic. The properties and defaults are the same as liveness probe. + ReadinessProbe *ProbeSettings `json:"readinessProbe,omitempty"` + // RequestSettings - Request settings for the deployment. + RequestSettings *OnlineRequestSettings `json:"requestSettings,omitempty"` + // ScaleSettings - Scale settings for the deployment. + // If it is null or not provided, + // it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + // and to DefaultScaleSettings for ManagedOnlineDeployment. + ScaleSettings BasicOnlineScaleSettings `json:"scaleSettings,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 or AssetId 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"` + // Properties - Property dictionary. Properties can be added, but not removed or altered. + Properties map[string]*string `json:"properties"` + // EndpointComputeType - Possible values include: 'EndpointComputeTypeOnlineDeployment', 'EndpointComputeTypeKubernetes1', 'EndpointComputeTypeManaged1' + EndpointComputeType EndpointComputeTypeBasicOnlineDeployment `json:"endpointComputeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for KubernetesOnlineDeployment. +func (kod KubernetesOnlineDeployment) MarshalJSON() ([]byte, error) { + kod.EndpointComputeType = EndpointComputeTypeKubernetes1 + objectMap := make(map[string]interface{}) + if kod.ContainerResourceRequirements != nil { + objectMap["containerResourceRequirements"] = kod.ContainerResourceRequirements + } + if kod.AppInsightsEnabled != nil { + objectMap["appInsightsEnabled"] = kod.AppInsightsEnabled + } + if kod.InstanceType != nil { + objectMap["instanceType"] = kod.InstanceType + } + if kod.LivenessProbe != nil { + objectMap["livenessProbe"] = kod.LivenessProbe + } + if kod.Model != nil { + objectMap["model"] = kod.Model + } + if kod.ModelMountPath != nil { + objectMap["modelMountPath"] = kod.ModelMountPath + } + if kod.ReadinessProbe != nil { + objectMap["readinessProbe"] = kod.ReadinessProbe + } + if kod.RequestSettings != nil { + objectMap["requestSettings"] = kod.RequestSettings + } + objectMap["scaleSettings"] = kod.ScaleSettings + if kod.EndpointComputeType != "" { + objectMap["endpointComputeType"] = kod.EndpointComputeType + } + 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.Properties != nil { + objectMap["properties"] = kod.Properties + } + return json.Marshal(objectMap) +} + +// AsKubernetesOnlineDeployment is the BasicOnlineDeployment implementation for KubernetesOnlineDeployment. +func (kod KubernetesOnlineDeployment) AsKubernetesOnlineDeployment() (*KubernetesOnlineDeployment, bool) { + return &kod, true +} + +// AsManagedOnlineDeployment is the BasicOnlineDeployment implementation for KubernetesOnlineDeployment. +func (kod KubernetesOnlineDeployment) AsManagedOnlineDeployment() (*ManagedOnlineDeployment, bool) { + return nil, false +} + +// AsOnlineDeployment is the BasicOnlineDeployment implementation for KubernetesOnlineDeployment. +func (kod KubernetesOnlineDeployment) AsOnlineDeployment() (*OnlineDeployment, bool) { + return nil, false +} + +// AsBasicOnlineDeployment is the BasicOnlineDeployment implementation for KubernetesOnlineDeployment. +func (kod KubernetesOnlineDeployment) AsBasicOnlineDeployment() (BasicOnlineDeployment, bool) { + return &kod, true +} + +// UnmarshalJSON is the custom unmarshaler for KubernetesOnlineDeployment struct. +func (kod *KubernetesOnlineDeployment) 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 "instanceType": + if v != nil { + var instanceType string + err = json.Unmarshal(*v, &instanceType) + if err != nil { + return err + } + kod.InstanceType = &instanceType + } + 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 { + var model string + err = json.Unmarshal(*v, &model) + if err != nil { + return err + } + kod.Model = &model + } + case "modelMountPath": + if v != nil { + var modelMountPath string + err = json.Unmarshal(*v, &modelMountPath) + if err != nil { + return err + } + kod.ModelMountPath = &modelMountPath + } + case "provisioningState": + if v != nil { + var provisioningState DeploymentProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + kod.ProvisioningState = provisioningState + } + case "readinessProbe": + if v != nil { + var readinessProbe ProbeSettings + err = json.Unmarshal(*v, &readinessProbe) + if err != nil { + return err + } + kod.ReadinessProbe = &readinessProbe + } + 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 + } + 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 "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + kod.Properties = properties + } + } + } + + return nil +} + +// KubernetesProperties kubernetes properties +type KubernetesProperties struct { + // RelayConnectionString - Relay connection string. + RelayConnectionString *string `json:"relayConnectionString,omitempty"` + // ServiceBusConnectionString - ServiceBus connection string. + ServiceBusConnectionString *string `json:"serviceBusConnectionString,omitempty"` + // ExtensionPrincipalID - Extension principal-id. + ExtensionPrincipalID *string `json:"extensionPrincipalId,omitempty"` + // ExtensionInstanceReleaseTrain - Extension instance release train. + ExtensionInstanceReleaseTrain *string `json:"extensionInstanceReleaseTrain,omitempty"` + // VcName - VC name. + VcName *string `json:"vcName,omitempty"` + // Namespace - Compute namespace + Namespace *string `json:"namespace,omitempty"` + // DefaultInstanceType - Default instance type + DefaultInstanceType *string `json:"defaultInstanceType,omitempty"` + // InstanceTypes - Instance Type Schema + InstanceTypes map[string]*InstanceTypeSchema `json:"instanceTypes"` +} + +// MarshalJSON is the custom marshaler for KubernetesProperties. +func (kp KubernetesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kp.RelayConnectionString != nil { + objectMap["relayConnectionString"] = kp.RelayConnectionString + } + if kp.ServiceBusConnectionString != nil { + objectMap["serviceBusConnectionString"] = kp.ServiceBusConnectionString + } + if kp.ExtensionPrincipalID != nil { + objectMap["extensionPrincipalId"] = kp.ExtensionPrincipalID + } + if kp.ExtensionInstanceReleaseTrain != nil { + objectMap["extensionInstanceReleaseTrain"] = kp.ExtensionInstanceReleaseTrain + } + if kp.VcName != nil { + objectMap["vcName"] = kp.VcName + } + if kp.Namespace != nil { + objectMap["namespace"] = kp.Namespace + } + if kp.DefaultInstanceType != nil { + objectMap["defaultInstanceType"] = kp.DefaultInstanceType + } + if kp.InstanceTypes != nil { + objectMap["instanceTypes"] = kp.InstanceTypes + } + return json.Marshal(objectMap) +} + +// KubernetesSchema kubernetes Compute Schema +type KubernetesSchema struct { + // Properties - Properties of Kubernetes + Properties *KubernetesProperties `json:"properties,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, + } +} + +// LiteralJobInput literal input type. +type LiteralJobInput struct { + // Value - [Required] Literal value for the input. + Value *string `json:"value,omitempty"` + // Description - Description for the input. + Description *string `json:"description,omitempty"` + // JobInputType - Possible values include: 'JobInputTypeJobInput', 'JobInputTypeLiteral1' + JobInputType JobInputTypeBasicJobInput `json:"jobInputType,omitempty"` +} + +// MarshalJSON is the custom marshaler for LiteralJobInput. +func (lji LiteralJobInput) MarshalJSON() ([]byte, error) { + lji.JobInputType = JobInputTypeLiteral1 + objectMap := make(map[string]interface{}) + if lji.Value != nil { + objectMap["value"] = lji.Value + } + if lji.Description != nil { + objectMap["description"] = lji.Description + } + if lji.JobInputType != "" { + objectMap["jobInputType"] = lji.JobInputType + } + return json.Marshal(objectMap) +} + +// AsLiteralJobInput is the BasicJobInput implementation for LiteralJobInput. +func (lji LiteralJobInput) AsLiteralJobInput() (*LiteralJobInput, bool) { + return &lji, true +} + +// AsJobInput is the BasicJobInput implementation for LiteralJobInput. +func (lji LiteralJobInput) AsJobInput() (*JobInput, bool) { + return nil, false +} + +// AsBasicJobInput is the BasicJobInput implementation for LiteralJobInput. +func (lji LiteralJobInput) AsBasicJobInput() (BasicJobInput, bool) { + return &lji, true +} + +// 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', 'IdentityTypeUserIdentity' + 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 +} + +// AsUserIdentity is the BasicIdentityConfiguration implementation for ManagedIdentity. +func (mi ManagedIdentity) AsUserIdentity() (*UserIdentity, bool) { + return nil, false +} + +// 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 +} + +// ManagedIdentityAuthTypeWorkspaceConnectionProperties ... +type ManagedIdentityAuthTypeWorkspaceConnectionProperties struct { + Credentials *WorkspaceConnectionManagedIdentity `json:"credentials,omitempty"` + // Category - Possible values include: 'PythonFeed', 'ContainerRegistry', 'Git' + Category ConnectionCategory `json:"category,omitempty"` + Target *string `json:"target,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"` + // AuthType - Possible values include: 'AuthTypeWorkspaceConnectionPropertiesV2', 'AuthTypePAT', 'AuthTypeSAS', 'AuthTypeUsernamePassword', 'AuthTypeNone', 'AuthTypeManagedIdentity' + AuthType AuthType `json:"authType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedIdentityAuthTypeWorkspaceConnectionProperties. +func (miatwcp ManagedIdentityAuthTypeWorkspaceConnectionProperties) MarshalJSON() ([]byte, error) { + miatwcp.AuthType = AuthTypeManagedIdentity + objectMap := make(map[string]interface{}) + if miatwcp.Credentials != nil { + objectMap["credentials"] = miatwcp.Credentials + } + if miatwcp.Category != "" { + objectMap["category"] = miatwcp.Category + } + if miatwcp.Target != nil { + objectMap["target"] = miatwcp.Target + } + if miatwcp.Value != nil { + objectMap["value"] = miatwcp.Value + } + if miatwcp.ValueFormat != "" { + objectMap["valueFormat"] = miatwcp.ValueFormat + } + if miatwcp.AuthType != "" { + objectMap["authType"] = miatwcp.AuthType + } + return json.Marshal(objectMap) +} + +// AsPATAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for ManagedIdentityAuthTypeWorkspaceConnectionProperties. +func (miatwcp ManagedIdentityAuthTypeWorkspaceConnectionProperties) AsPATAuthTypeWorkspaceConnectionProperties() (*PATAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsSASAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for ManagedIdentityAuthTypeWorkspaceConnectionProperties. +func (miatwcp ManagedIdentityAuthTypeWorkspaceConnectionProperties) AsSASAuthTypeWorkspaceConnectionProperties() (*SASAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsUsernamePasswordAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for ManagedIdentityAuthTypeWorkspaceConnectionProperties. +func (miatwcp ManagedIdentityAuthTypeWorkspaceConnectionProperties) AsUsernamePasswordAuthTypeWorkspaceConnectionProperties() (*UsernamePasswordAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsNoneAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for ManagedIdentityAuthTypeWorkspaceConnectionProperties. +func (miatwcp ManagedIdentityAuthTypeWorkspaceConnectionProperties) AsNoneAuthTypeWorkspaceConnectionProperties() (*NoneAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsManagedIdentityAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for ManagedIdentityAuthTypeWorkspaceConnectionProperties. +func (miatwcp ManagedIdentityAuthTypeWorkspaceConnectionProperties) AsManagedIdentityAuthTypeWorkspaceConnectionProperties() (*ManagedIdentityAuthTypeWorkspaceConnectionProperties, bool) { + return &miatwcp, true +} + +// AsWorkspaceConnectionPropertiesV2 is the BasicWorkspaceConnectionPropertiesV2 implementation for ManagedIdentityAuthTypeWorkspaceConnectionProperties. +func (miatwcp ManagedIdentityAuthTypeWorkspaceConnectionProperties) AsWorkspaceConnectionPropertiesV2() (*WorkspaceConnectionPropertiesV2, bool) { + return nil, false +} + +// AsBasicWorkspaceConnectionPropertiesV2 is the BasicWorkspaceConnectionPropertiesV2 implementation for ManagedIdentityAuthTypeWorkspaceConnectionProperties. +func (miatwcp ManagedIdentityAuthTypeWorkspaceConnectionProperties) AsBasicWorkspaceConnectionPropertiesV2() (BasicWorkspaceConnectionPropertiesV2, bool) { + return &miatwcp, true +} + +// ManagedOnlineDeployment properties specific to a ManagedOnlineDeployment. +type ManagedOnlineDeployment struct { + // AppInsightsEnabled - If true, enables Application Insights logging. + AppInsightsEnabled *bool `json:"appInsightsEnabled,omitempty"` + // InstanceType - Compute instance type. + InstanceType *string `json:"instanceType,omitempty"` + // LivenessProbe - Liveness probe monitors the health of the container regularly. + LivenessProbe *ProbeSettings `json:"livenessProbe,omitempty"` + // Model - The URI path to the model. + Model *string `json:"model,omitempty"` + // ModelMountPath - The path to mount the model in custom container. + ModelMountPath *string `json:"modelMountPath,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state for the endpoint deployment. Possible values include: 'DeploymentProvisioningStateCreating', 'DeploymentProvisioningStateDeleting', 'DeploymentProvisioningStateScaling', 'DeploymentProvisioningStateUpdating', 'DeploymentProvisioningStateSucceeded', 'DeploymentProvisioningStateFailed', 'DeploymentProvisioningStateCanceled' + ProvisioningState DeploymentProvisioningState `json:"provisioningState,omitempty"` + // ReadinessProbe - Readiness probe validates if the container is ready to serve traffic. The properties and defaults are the same as liveness probe. + ReadinessProbe *ProbeSettings `json:"readinessProbe,omitempty"` + // RequestSettings - Request settings for the deployment. + RequestSettings *OnlineRequestSettings `json:"requestSettings,omitempty"` + // ScaleSettings - Scale settings for the deployment. + // If it is null or not provided, + // it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + // and to DefaultScaleSettings for ManagedOnlineDeployment. + ScaleSettings BasicOnlineScaleSettings `json:"scaleSettings,omitempty"` + // EndpointComputeType - Possible values include: 'EndpointComputeTypeOnlineDeployment', 'EndpointComputeTypeKubernetes1', 'EndpointComputeTypeManaged1' + EndpointComputeType EndpointComputeTypeBasicOnlineDeployment `json:"endpointComputeType,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 or AssetId 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"` + // Properties - Property dictionary. Properties can be added, but not removed or altered. + Properties map[string]*string `json:"properties"` +} + +// MarshalJSON is the custom marshaler for ManagedOnlineDeployment. +func (mod ManagedOnlineDeployment) MarshalJSON() ([]byte, error) { + mod.EndpointComputeType = EndpointComputeTypeManaged1 + objectMap := make(map[string]interface{}) + if mod.AppInsightsEnabled != nil { + objectMap["appInsightsEnabled"] = mod.AppInsightsEnabled + } + if mod.InstanceType != nil { + objectMap["instanceType"] = mod.InstanceType + } + if mod.LivenessProbe != nil { + objectMap["livenessProbe"] = mod.LivenessProbe + } + if mod.Model != nil { + objectMap["model"] = mod.Model + } + if mod.ModelMountPath != nil { + objectMap["modelMountPath"] = mod.ModelMountPath + } + if mod.ReadinessProbe != nil { + objectMap["readinessProbe"] = mod.ReadinessProbe + } + if mod.RequestSettings != nil { + objectMap["requestSettings"] = mod.RequestSettings + } + objectMap["scaleSettings"] = mod.ScaleSettings + if mod.EndpointComputeType != "" { + objectMap["endpointComputeType"] = mod.EndpointComputeType + } + 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.Properties != nil { + objectMap["properties"] = mod.Properties + } + return json.Marshal(objectMap) +} + +// AsKubernetesOnlineDeployment is the BasicOnlineDeployment implementation for ManagedOnlineDeployment. +func (mod ManagedOnlineDeployment) AsKubernetesOnlineDeployment() (*KubernetesOnlineDeployment, 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 "appInsightsEnabled": + if v != nil { + var appInsightsEnabled bool + err = json.Unmarshal(*v, &appInsightsEnabled) + if err != nil { + return err + } + mod.AppInsightsEnabled = &appInsightsEnabled + } + case "instanceType": + if v != nil { + var instanceType string + err = json.Unmarshal(*v, &instanceType) + if err != nil { + return err + } + mod.InstanceType = &instanceType + } + 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 { + var model string + err = json.Unmarshal(*v, &model) + if err != nil { + return err + } + mod.Model = &model + } + case "modelMountPath": + if v != nil { + var modelMountPath string + err = json.Unmarshal(*v, &modelMountPath) + if err != nil { + return err + } + mod.ModelMountPath = &modelMountPath + } + case "provisioningState": + if v != nil { + var provisioningState DeploymentProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + mod.ProvisioningState = provisioningState + } + case "readinessProbe": + if v != nil { + var readinessProbe ProbeSettings + err = json.Unmarshal(*v, &readinessProbe) + if err != nil { + return err + } + mod.ReadinessProbe = &readinessProbe + } + 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 + } + 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 "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + mod.Properties = properties + } + } + } + + return nil +} + +// ManagedServiceIdentity managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentity struct { + // PrincipalID - READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. + PrincipalID *uuid.UUID `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // Type - Possible values include: 'ManagedServiceIdentityTypeNone', 'ManagedServiceIdentityTypeSystemAssigned', 'ManagedServiceIdentityTypeUserAssigned', 'ManagedServiceIdentityTypeSystemAssignedUserAssigned' + Type ManagedServiceIdentityType `json:"type,omitempty"` + UserAssignedIdentities map[string]*UserAssignedIdentity `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for ManagedServiceIdentity. +func (msi ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if msi.Type != "" { + objectMap["type"] = msi.Type + } + if msi.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = msi.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// MedianStoppingPolicy defines an early termination policy based on running averages of the primary metric +// of all runs +type MedianStoppingPolicy struct { + // DelayEvaluation - Number of intervals by which to delay the first evaluation. + DelayEvaluation *int32 `json:"delayEvaluation,omitempty"` + // EvaluationInterval - Interval (number of runs) between policy evaluations. + 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 +} + +// MLFlowModelJobInput ... +type MLFlowModelJobInput struct { + // Mode - Input Asset Delivery Mode. Possible values include: 'ReadOnlyMount', 'ReadWriteMount', 'Download', 'Direct', 'EvalMount', 'EvalDownload' + Mode InputDeliveryMode `json:"mode,omitempty"` + // URI - [Required] Input Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the input. + Description *string `json:"description,omitempty"` + // JobInputType - [Required] Specifies the type of job. Possible values include: 'JobInputTypeLiteral', 'JobInputTypeURIFile', 'JobInputTypeURIFolder', 'JobInputTypeMltable', 'JobInputTypeCustomModel', 'JobInputTypeMlflowModel', 'JobInputTypeTritonModel' + JobInputType JobInputType `json:"jobInputType,omitempty"` +} + +// MLFlowModelJobOutput ... +type MLFlowModelJobOutput struct { + // Mode - Output Asset Delivery Mode. Possible values include: 'OutputDeliveryModeReadWriteMount', 'OutputDeliveryModeUpload' + Mode OutputDeliveryMode `json:"mode,omitempty"` + // URI - Output Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the output. + Description *string `json:"description,omitempty"` + // JobOutputType - [Required] Specifies the type of job. Possible values include: 'JobOutputTypeURIFile', 'JobOutputTypeURIFolder', 'JobOutputTypeMltable', 'JobOutputTypeCustomModel', 'JobOutputTypeMlflowModel', 'JobOutputTypeTritonModel' + JobOutputType JobOutputType `json:"jobOutputType,omitempty"` +} + +// MLTableData mLTable data definition +type MLTableData struct { + // ReferencedUris - Uris referenced in the MLTable definition (required for lineage) + ReferencedUris *[]string `json:"referencedUris,omitempty"` + // DataURI - [Required] Uri of the data. Usage/meaning depends on Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20220501.Assets.DataVersionBase.DataType + DataURI *string `json:"dataUri,omitempty"` + // DataType - Possible values include: 'DataTypeDataVersionBase', 'DataTypeMltable', 'DataTypeURIFile', 'DataTypeURIFolder' + DataType DataTypeBasicDataVersionBase `json:"dataType,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // 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 MLTableData. +func (mtd MLTableData) MarshalJSON() ([]byte, error) { + mtd.DataType = DataTypeMltable + objectMap := make(map[string]interface{}) + if mtd.ReferencedUris != nil { + objectMap["referencedUris"] = mtd.ReferencedUris + } + if mtd.DataURI != nil { + objectMap["dataUri"] = mtd.DataURI + } + if mtd.DataType != "" { + objectMap["dataType"] = mtd.DataType + } + if mtd.IsAnonymous != nil { + objectMap["isAnonymous"] = mtd.IsAnonymous + } + if mtd.IsArchived != nil { + objectMap["isArchived"] = mtd.IsArchived + } + if mtd.Description != nil { + objectMap["description"] = mtd.Description + } + if mtd.Properties != nil { + objectMap["properties"] = mtd.Properties + } + if mtd.Tags != nil { + objectMap["tags"] = mtd.Tags + } + return json.Marshal(objectMap) +} + +// AsMLTableData is the BasicDataVersionBase implementation for MLTableData. +func (mtd MLTableData) AsMLTableData() (*MLTableData, bool) { + return &mtd, true +} + +// AsURIFileDataVersion is the BasicDataVersionBase implementation for MLTableData. +func (mtd MLTableData) AsURIFileDataVersion() (*URIFileDataVersion, bool) { + return nil, false +} + +// AsURIFolderDataVersion is the BasicDataVersionBase implementation for MLTableData. +func (mtd MLTableData) AsURIFolderDataVersion() (*URIFolderDataVersion, bool) { + return nil, false +} + +// AsDataVersionBase is the BasicDataVersionBase implementation for MLTableData. +func (mtd MLTableData) AsDataVersionBase() (*DataVersionBase, bool) { + return nil, false +} + +// AsBasicDataVersionBase is the BasicDataVersionBase implementation for MLTableData. +func (mtd MLTableData) AsBasicDataVersionBase() (BasicDataVersionBase, bool) { + return &mtd, true +} + +// MLTableJobInput ... +type MLTableJobInput struct { + // Mode - Input Asset Delivery Mode. Possible values include: 'ReadOnlyMount', 'ReadWriteMount', 'Download', 'Direct', 'EvalMount', 'EvalDownload' + Mode InputDeliveryMode `json:"mode,omitempty"` + // URI - [Required] Input Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the input. + Description *string `json:"description,omitempty"` + // JobInputType - [Required] Specifies the type of job. Possible values include: 'JobInputTypeLiteral', 'JobInputTypeURIFile', 'JobInputTypeURIFolder', 'JobInputTypeMltable', 'JobInputTypeCustomModel', 'JobInputTypeMlflowModel', 'JobInputTypeTritonModel' + JobInputType JobInputType `json:"jobInputType,omitempty"` +} + +// MLTableJobOutput ... +type MLTableJobOutput struct { + // Mode - Output Asset Delivery Mode. Possible values include: 'OutputDeliveryModeReadWriteMount', 'OutputDeliveryModeUpload' + Mode OutputDeliveryMode `json:"mode,omitempty"` + // URI - Output Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the output. + Description *string `json:"description,omitempty"` + // JobOutputType - [Required] Specifies the type of job. Possible values include: 'JobOutputTypeURIFile', 'JobOutputTypeURIFolder', 'JobOutputTypeMltable', 'JobOutputTypeCustomModel', 'JobOutputTypeMlflowModel', 'JobOutputTypeTritonModel' + JobOutputType JobOutputType `json:"jobOutputType,omitempty"` +} + +// ModelContainer ... +type ModelContainer struct { + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // LatestVersion - READ-ONLY; The latest version inside this container. + LatestVersion *string `json:"latestVersion,omitempty"` + // NextVersion - READ-ONLY; The next auto incremental version + NextVersion *string `json:"nextVersion,omitempty"` + // 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.IsArchived != nil { + objectMap["isArchived"] = mc.IsArchived + } + 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 - [Required] Additional attributes of the entity. + Properties *ModelContainer `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 - The link to the next page of ModelContainer objects. If null, there are no additional pages. + 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 { + // Flavors - Mapping of model flavors to their properties. + Flavors map[string]*FlavorData `json:"flavors"` + // JobName - Name of the training job which produced this model + JobName *string `json:"jobName,omitempty"` + // ModelType - The storage format for this entity. Used for NCD. + ModelType *string `json:"modelType,omitempty"` + // ModelURI - The URI path to the model contents. + ModelURI *string `json:"modelUri,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // 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 ModelVersion. +func (mv ModelVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mv.Flavors != nil { + objectMap["flavors"] = mv.Flavors + } + if mv.JobName != nil { + objectMap["jobName"] = mv.JobName + } + if mv.ModelType != nil { + objectMap["modelType"] = mv.ModelType + } + if mv.ModelURI != nil { + objectMap["modelUri"] = mv.ModelURI + } + if mv.IsAnonymous != nil { + objectMap["isAnonymous"] = mv.IsAnonymous + } + if mv.IsArchived != nil { + objectMap["isArchived"] = mv.IsArchived + } + if mv.Description != nil { + objectMap["description"] = mv.Description + } + 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 - [Required] Additional attributes of the entity. + Properties *ModelVersion `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 - The link to the next page of ModelVersion objects. If null, there are no additional pages. + 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 - Number of processes per MPI node. + 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) +} + +// NoneAuthTypeWorkspaceConnectionProperties ... +type NoneAuthTypeWorkspaceConnectionProperties struct { + // Category - Possible values include: 'PythonFeed', 'ContainerRegistry', 'Git' + Category ConnectionCategory `json:"category,omitempty"` + Target *string `json:"target,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"` + // AuthType - Possible values include: 'AuthTypeWorkspaceConnectionPropertiesV2', 'AuthTypePAT', 'AuthTypeSAS', 'AuthTypeUsernamePassword', 'AuthTypeNone', 'AuthTypeManagedIdentity' + AuthType AuthType `json:"authType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NoneAuthTypeWorkspaceConnectionProperties. +func (natwcp NoneAuthTypeWorkspaceConnectionProperties) MarshalJSON() ([]byte, error) { + natwcp.AuthType = AuthTypeNone + objectMap := make(map[string]interface{}) + if natwcp.Category != "" { + objectMap["category"] = natwcp.Category + } + if natwcp.Target != nil { + objectMap["target"] = natwcp.Target + } + if natwcp.Value != nil { + objectMap["value"] = natwcp.Value + } + if natwcp.ValueFormat != "" { + objectMap["valueFormat"] = natwcp.ValueFormat + } + if natwcp.AuthType != "" { + objectMap["authType"] = natwcp.AuthType + } + return json.Marshal(objectMap) +} + +// AsPATAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for NoneAuthTypeWorkspaceConnectionProperties. +func (natwcp NoneAuthTypeWorkspaceConnectionProperties) AsPATAuthTypeWorkspaceConnectionProperties() (*PATAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsSASAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for NoneAuthTypeWorkspaceConnectionProperties. +func (natwcp NoneAuthTypeWorkspaceConnectionProperties) AsSASAuthTypeWorkspaceConnectionProperties() (*SASAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsUsernamePasswordAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for NoneAuthTypeWorkspaceConnectionProperties. +func (natwcp NoneAuthTypeWorkspaceConnectionProperties) AsUsernamePasswordAuthTypeWorkspaceConnectionProperties() (*UsernamePasswordAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsNoneAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for NoneAuthTypeWorkspaceConnectionProperties. +func (natwcp NoneAuthTypeWorkspaceConnectionProperties) AsNoneAuthTypeWorkspaceConnectionProperties() (*NoneAuthTypeWorkspaceConnectionProperties, bool) { + return &natwcp, true +} + +// AsManagedIdentityAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for NoneAuthTypeWorkspaceConnectionProperties. +func (natwcp NoneAuthTypeWorkspaceConnectionProperties) AsManagedIdentityAuthTypeWorkspaceConnectionProperties() (*ManagedIdentityAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsWorkspaceConnectionPropertiesV2 is the BasicWorkspaceConnectionPropertiesV2 implementation for NoneAuthTypeWorkspaceConnectionProperties. +func (natwcp NoneAuthTypeWorkspaceConnectionProperties) AsWorkspaceConnectionPropertiesV2() (*WorkspaceConnectionPropertiesV2, bool) { + return nil, false +} + +// AsBasicWorkspaceConnectionPropertiesV2 is the BasicWorkspaceConnectionPropertiesV2 implementation for NoneAuthTypeWorkspaceConnectionProperties. +func (natwcp NoneAuthTypeWorkspaceConnectionProperties) AsBasicWorkspaceConnectionPropertiesV2() (BasicWorkspaceConnectionPropertiesV2, bool) { + return &natwcp, true +} + +// NoneDatastoreCredentials empty/none datastore credentials. +type NoneDatastoreCredentials struct { + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey1', 'CredentialsTypeCertificate1', 'CredentialsTypeNone1', 'CredentialsTypeSas1', 'CredentialsTypeServicePrincipal1' + CredentialsType CredentialsTypeBasicDatastoreCredentials `json:"credentialsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NoneDatastoreCredentials. +func (ndc NoneDatastoreCredentials) MarshalJSON() ([]byte, error) { + ndc.CredentialsType = CredentialsTypeNone1 + objectMap := make(map[string]interface{}) + 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 +} + +// 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 +} + +// 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 optimization objective. +type Objective struct { + // Goal - [Required] Defines supported metric goals for hyperparameter tuning. Possible values include: 'Minimize', 'Maximize' + Goal Goal `json:"goal,omitempty"` + // PrimaryMetric - [Required] Name of the metric to optimize. + PrimaryMetric *string `json:"primaryMetric,omitempty"` +} + +// BasicOnlineDeployment ... +type BasicOnlineDeployment interface { + AsKubernetesOnlineDeployment() (*KubernetesOnlineDeployment, bool) + AsManagedOnlineDeployment() (*ManagedOnlineDeployment, bool) + AsOnlineDeployment() (*OnlineDeployment, bool) +} + +// OnlineDeployment ... +type OnlineDeployment struct { + // AppInsightsEnabled - If true, enables Application Insights logging. + AppInsightsEnabled *bool `json:"appInsightsEnabled,omitempty"` + // InstanceType - Compute instance type. + InstanceType *string `json:"instanceType,omitempty"` + // LivenessProbe - Liveness probe monitors the health of the container regularly. + LivenessProbe *ProbeSettings `json:"livenessProbe,omitempty"` + // Model - The URI path to the model. + Model *string `json:"model,omitempty"` + // ModelMountPath - The path to mount the model in custom container. + ModelMountPath *string `json:"modelMountPath,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state for the endpoint deployment. Possible values include: 'DeploymentProvisioningStateCreating', 'DeploymentProvisioningStateDeleting', 'DeploymentProvisioningStateScaling', 'DeploymentProvisioningStateUpdating', 'DeploymentProvisioningStateSucceeded', 'DeploymentProvisioningStateFailed', 'DeploymentProvisioningStateCanceled' + ProvisioningState DeploymentProvisioningState `json:"provisioningState,omitempty"` + // ReadinessProbe - Readiness probe validates if the container is ready to serve traffic. The properties and defaults are the same as liveness probe. + ReadinessProbe *ProbeSettings `json:"readinessProbe,omitempty"` + // RequestSettings - Request settings for the deployment. + RequestSettings *OnlineRequestSettings `json:"requestSettings,omitempty"` + // ScaleSettings - Scale settings for the deployment. + // If it is null or not provided, + // it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + // and to DefaultScaleSettings for ManagedOnlineDeployment. + ScaleSettings BasicOnlineScaleSettings `json:"scaleSettings,omitempty"` + // EndpointComputeType - Possible values include: 'EndpointComputeTypeOnlineDeployment', 'EndpointComputeTypeKubernetes1', 'EndpointComputeTypeManaged1' + EndpointComputeType EndpointComputeTypeBasicOnlineDeployment `json:"endpointComputeType,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 or AssetId 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"` + // Properties - Property dictionary. Properties can be added, but not removed or altered. + Properties map[string]*string `json:"properties"` +} + +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(EndpointComputeTypeKubernetes1): + var kod KubernetesOnlineDeployment + err := json.Unmarshal(body, &kod) + return kod, err + case string(EndpointComputeTypeManaged1): + 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.InstanceType != nil { + objectMap["instanceType"] = od.InstanceType + } + if od.LivenessProbe != nil { + objectMap["livenessProbe"] = od.LivenessProbe + } + if od.Model != nil { + objectMap["model"] = od.Model + } + if od.ModelMountPath != nil { + objectMap["modelMountPath"] = od.ModelMountPath + } + if od.ReadinessProbe != nil { + objectMap["readinessProbe"] = od.ReadinessProbe + } + if od.RequestSettings != nil { + objectMap["requestSettings"] = od.RequestSettings + } + objectMap["scaleSettings"] = od.ScaleSettings + if od.EndpointComputeType != "" { + objectMap["endpointComputeType"] = od.EndpointComputeType + } + 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.Properties != nil { + objectMap["properties"] = od.Properties + } + return json.Marshal(objectMap) +} + +// AsKubernetesOnlineDeployment is the BasicOnlineDeployment implementation for OnlineDeployment. +func (od OnlineDeployment) AsKubernetesOnlineDeployment() (*KubernetesOnlineDeployment, 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 "instanceType": + if v != nil { + var instanceType string + err = json.Unmarshal(*v, &instanceType) + if err != nil { + return err + } + od.InstanceType = &instanceType + } + 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 { + var model string + err = json.Unmarshal(*v, &model) + if err != nil { + return err + } + od.Model = &model + } + case "modelMountPath": + if v != nil { + var modelMountPath string + err = json.Unmarshal(*v, &modelMountPath) + if err != nil { + return err + } + od.ModelMountPath = &modelMountPath + } + case "provisioningState": + if v != nil { + var provisioningState DeploymentProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + od.ProvisioningState = provisioningState + } + case "readinessProbe": + if v != nil { + var readinessProbe ProbeSettings + err = json.Unmarshal(*v, &readinessProbe) + if err != nil { + return err + } + od.ReadinessProbe = &readinessProbe + } + 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 + } + 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 "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + od.Properties = properties + } + } + } + + 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 - Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Properties - [Required] Additional attributes of the entity. + Properties BasicOnlineDeployment `json:"properties,omitempty"` + // Sku - Sku details required for ARM contract for Autoscaling. + Sku *Sku `json:"sku,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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.Sku != nil { + objectMap["sku"] = odtr.Sku + } + 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 ManagedServiceIdentity + 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 "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + odtr.Sku = &sku + } + 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 + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + odtr.SystemData = &systemData + } + } + } + + return nil +} + +// OnlineDeploymentTrackedResourceArmPaginatedResult a paginated list of OnlineDeployment entities. +type OnlineDeploymentTrackedResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + // NextLink - The link to the next page of OnlineDeployment objects. If null, there are no additional pages. + 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 { + // Compute - ARM resource ID of the compute if it exists. + // optional + Compute *string `json:"compute,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state for the endpoint. Possible values include: 'EndpointProvisioningStateCreating', 'EndpointProvisioningStateDeleting', 'EndpointProvisioningStateSucceeded', 'EndpointProvisioningStateFailed', 'EndpointProvisioningStateUpdating', 'EndpointProvisioningStateCanceled' + ProvisioningState EndpointProvisioningState `json:"provisioningState,omitempty"` + // Traffic - Percentage of traffic from endpoint to divert to each deployment. Traffic values need to sum to 100. + Traffic map[string]*int32 `json:"traffic"` + // AuthMode - [Required] Use 'Key' for key based authentication and 'AMLToken' for Azure Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' does. 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"` +} + +// MarshalJSON is the custom marshaler for OnlineEndpoint. +func (oe OnlineEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oe.Compute != nil { + objectMap["compute"] = oe.Compute + } + if oe.Traffic != nil { + objectMap["traffic"] = oe.Traffic + } + 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 + } + 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 - Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Properties - [Required] Additional attributes of the entity. + Properties *OnlineEndpoint `json:"properties,omitempty"` + // Sku - Sku details required for ARM contract for Autoscaling. + Sku *Sku `json:"sku,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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.Sku != nil { + objectMap["sku"] = oetr.Sku + } + 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 - The link to the next page of OnlineEndpoint objects. If null, there are no additional pages. + 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 online deployment scoring requests configuration. +type OnlineRequestSettings struct { + // MaxConcurrentRequestsPerInstance - The number of maximum concurrent requests per node allowed per deployment. Defaults to 1. + MaxConcurrentRequestsPerInstance *int32 `json:"maxConcurrentRequestsPerInstance,omitempty"` + // MaxQueueWait - The maximum amount of time a request will stay in the queue in ISO 8601 format. + // Defaults to 500ms. + MaxQueueWait *string `json:"maxQueueWait,omitempty"` + // RequestTimeout - The scoring timeout in ISO 8601 format. + // Defaults to 5000ms. + RequestTimeout *string `json:"requestTimeout,omitempty"` +} + +// BasicOnlineScaleSettings online deployment scaling configuration. +type BasicOnlineScaleSettings interface { + AsDefaultScaleSettings() (*DefaultScaleSettings, bool) + AsTargetUtilizationScaleSettings() (*TargetUtilizationScaleSettings, bool) + AsOnlineScaleSettings() (*OnlineScaleSettings, bool) +} + +// OnlineScaleSettings online deployment scaling configuration. +type OnlineScaleSettings struct { + // ScaleType - Possible values include: 'ScaleTypeOnlineScaleSettings', 'ScaleTypeDefault', 'ScaleTypeTargetUtilization' + 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(ScaleTypeDefault): + var dss DefaultScaleSettings + err := json.Unmarshal(body, &dss) + return dss, err + case string(ScaleTypeTargetUtilization): + var tuss TargetUtilizationScaleSettings + err := json.Unmarshal(body, &tuss) + return tuss, 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.ScaleType != "" { + objectMap["scaleType"] = oss.ScaleType + } + return json.Marshal(objectMap) +} + +// AsDefaultScaleSettings is the BasicOnlineScaleSettings implementation for OnlineScaleSettings. +func (oss OnlineScaleSettings) AsDefaultScaleSettings() (*DefaultScaleSettings, bool) { + return nil, false +} + +// AsTargetUtilizationScaleSettings is the BasicOnlineScaleSettings implementation for OnlineScaleSettings. +func (oss OnlineScaleSettings) AsTargetUtilizationScaleSettings() (*TargetUtilizationScaleSettings, 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 +} + +// 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, + } +} + +// PartialBatchDeployment mutable batch inference settings per deployment. +type PartialBatchDeployment struct { + // Description - Description of the endpoint deployment. + Description *string `json:"description,omitempty"` +} + +// PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties strictly used in update requests. +type PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties struct { + // Properties - Additional attributes of the entity. + Properties *PartialBatchDeployment `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties. +func (pbdpmtrwp PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pbdpmtrwp.Properties != nil { + objectMap["properties"] = pbdpmtrwp.Properties + } + if pbdpmtrwp.Tags != nil { + objectMap["tags"] = pbdpmtrwp.Tags + } + return json.Marshal(objectMap) +} + +// PartialManagedServiceIdentity managed service identity (system assigned and/or user assigned identities) +type PartialManagedServiceIdentity struct { + // Type - Managed service identity (system assigned and/or user assigned identities). Possible values include: 'ManagedServiceIdentityTypeNone', 'ManagedServiceIdentityTypeSystemAssigned', 'ManagedServiceIdentityTypeUserAssigned', 'ManagedServiceIdentityTypeSystemAssignedUserAssigned' + Type ManagedServiceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. + UserAssignedIdentities map[string]interface{} `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for PartialManagedServiceIdentity. +func (pmsi PartialManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pmsi.Type != "" { + objectMap["type"] = pmsi.Type + } + if pmsi.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = pmsi.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// PartialMinimalTrackedResource strictly used in update requests. +type PartialMinimalTrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PartialMinimalTrackedResource. +func (pmtr PartialMinimalTrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pmtr.Tags != nil { + objectMap["tags"] = pmtr.Tags + } + return json.Marshal(objectMap) +} + +// PartialMinimalTrackedResourceWithIdentity strictly used in update requests. +type PartialMinimalTrackedResourceWithIdentity struct { + // Identity - Managed service identity (system assigned and/or user assigned identities) + Identity *PartialManagedServiceIdentity `json:"identity,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PartialMinimalTrackedResourceWithIdentity. +func (pmtrwi PartialMinimalTrackedResourceWithIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pmtrwi.Identity != nil { + objectMap["identity"] = pmtrwi.Identity + } + if pmtrwi.Tags != nil { + objectMap["tags"] = pmtrwi.Tags + } + return json.Marshal(objectMap) +} + +// PartialMinimalTrackedResourceWithSku strictly used in update requests. +type PartialMinimalTrackedResourceWithSku struct { + // Sku - Sku details required for ARM contract for Autoscaling. + Sku *PartialSku `json:"sku,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PartialMinimalTrackedResourceWithSku. +func (pmtrws PartialMinimalTrackedResourceWithSku) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pmtrws.Sku != nil { + objectMap["sku"] = pmtrws.Sku + } + if pmtrws.Tags != nil { + objectMap["tags"] = pmtrws.Tags + } + return json.Marshal(objectMap) +} + +// PartialSku common SKU definition. +type PartialSku struct { + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code. + Name *string `json:"name,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` +} + +// 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) +} + +// PATAuthTypeWorkspaceConnectionProperties ... +type PATAuthTypeWorkspaceConnectionProperties struct { + Credentials *WorkspaceConnectionPersonalAccessToken `json:"credentials,omitempty"` + // Category - Possible values include: 'PythonFeed', 'ContainerRegistry', 'Git' + Category ConnectionCategory `json:"category,omitempty"` + Target *string `json:"target,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"` + // AuthType - Possible values include: 'AuthTypeWorkspaceConnectionPropertiesV2', 'AuthTypePAT', 'AuthTypeSAS', 'AuthTypeUsernamePassword', 'AuthTypeNone', 'AuthTypeManagedIdentity' + AuthType AuthType `json:"authType,omitempty"` +} + +// MarshalJSON is the custom marshaler for PATAuthTypeWorkspaceConnectionProperties. +func (patwcp PATAuthTypeWorkspaceConnectionProperties) MarshalJSON() ([]byte, error) { + patwcp.AuthType = AuthTypePAT + objectMap := make(map[string]interface{}) + if patwcp.Credentials != nil { + objectMap["credentials"] = patwcp.Credentials + } + if patwcp.Category != "" { + objectMap["category"] = patwcp.Category + } + if patwcp.Target != nil { + objectMap["target"] = patwcp.Target + } + if patwcp.Value != nil { + objectMap["value"] = patwcp.Value + } + if patwcp.ValueFormat != "" { + objectMap["valueFormat"] = patwcp.ValueFormat + } + if patwcp.AuthType != "" { + objectMap["authType"] = patwcp.AuthType + } + return json.Marshal(objectMap) +} + +// AsPATAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for PATAuthTypeWorkspaceConnectionProperties. +func (patwcp PATAuthTypeWorkspaceConnectionProperties) AsPATAuthTypeWorkspaceConnectionProperties() (*PATAuthTypeWorkspaceConnectionProperties, bool) { + return &patwcp, true +} + +// AsSASAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for PATAuthTypeWorkspaceConnectionProperties. +func (patwcp PATAuthTypeWorkspaceConnectionProperties) AsSASAuthTypeWorkspaceConnectionProperties() (*SASAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsUsernamePasswordAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for PATAuthTypeWorkspaceConnectionProperties. +func (patwcp PATAuthTypeWorkspaceConnectionProperties) AsUsernamePasswordAuthTypeWorkspaceConnectionProperties() (*UsernamePasswordAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsNoneAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for PATAuthTypeWorkspaceConnectionProperties. +func (patwcp PATAuthTypeWorkspaceConnectionProperties) AsNoneAuthTypeWorkspaceConnectionProperties() (*NoneAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsManagedIdentityAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for PATAuthTypeWorkspaceConnectionProperties. +func (patwcp PATAuthTypeWorkspaceConnectionProperties) AsManagedIdentityAuthTypeWorkspaceConnectionProperties() (*ManagedIdentityAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsWorkspaceConnectionPropertiesV2 is the BasicWorkspaceConnectionPropertiesV2 implementation for PATAuthTypeWorkspaceConnectionProperties. +func (patwcp PATAuthTypeWorkspaceConnectionProperties) AsWorkspaceConnectionPropertiesV2() (*WorkspaceConnectionPropertiesV2, bool) { + return nil, false +} + +// AsBasicWorkspaceConnectionPropertiesV2 is the BasicWorkspaceConnectionPropertiesV2 implementation for PATAuthTypeWorkspaceConnectionProperties. +func (patwcp PATAuthTypeWorkspaceConnectionProperties) AsBasicWorkspaceConnectionPropertiesV2() (BasicWorkspaceConnectionPropertiesV2, bool) { + return &patwcp, true +} + +// 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"` +} + +// PipelineJob pipeline Job definition: defines generic to MFE attributes. +type PipelineJob struct { + // Inputs - Inputs for the pipeline job. + Inputs map[string]BasicJobInput `json:"inputs"` + // Jobs - Jobs construct the Pipeline Job. + Jobs map[string]interface{} `json:"jobs"` + // Outputs - Outputs for the pipeline job + Outputs map[string]BasicJobOutput `json:"outputs"` + // Settings - Pipeline settings, for things like ContinueRunOnStepFailure etc. + Settings interface{} `json:"settings,omitempty"` + // ComputeID - ARM resource ID of the compute resource. + ComputeID *string `json:"computeId,omitempty"` + // DisplayName - Display name of job. + DisplayName *string `json:"displayName,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, UserIdentity or null. + // Defaults to AmlToken if null. + Identity BasicIdentityConfiguration `json:"identity,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // Services - List of JobEndpoints. + // For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + Services map[string]*JobService `json:"services"` + // 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"` + // JobType - Possible values include: 'JobTypeJobBase', 'JobTypeCommand1', 'JobTypePipeline1', 'JobTypeSweep1' + JobType JobTypeBasicJobBase `json:"jobType,omitempty"` + // 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 PipelineJob. +func (pj PipelineJob) MarshalJSON() ([]byte, error) { + pj.JobType = JobTypePipeline1 + objectMap := make(map[string]interface{}) + if pj.Inputs != nil { + objectMap["inputs"] = pj.Inputs + } + if pj.Jobs != nil { + objectMap["jobs"] = pj.Jobs + } + if pj.Outputs != nil { + objectMap["outputs"] = pj.Outputs + } + if pj.Settings != nil { + objectMap["settings"] = pj.Settings + } + if pj.ComputeID != nil { + objectMap["computeId"] = pj.ComputeID + } + if pj.DisplayName != nil { + objectMap["displayName"] = pj.DisplayName + } + if pj.ExperimentName != nil { + objectMap["experimentName"] = pj.ExperimentName + } + objectMap["identity"] = pj.Identity + if pj.IsArchived != nil { + objectMap["isArchived"] = pj.IsArchived + } + if pj.Services != nil { + objectMap["services"] = pj.Services + } + if pj.JobType != "" { + objectMap["jobType"] = pj.JobType + } + if pj.Description != nil { + objectMap["description"] = pj.Description + } + if pj.Properties != nil { + objectMap["properties"] = pj.Properties + } + if pj.Tags != nil { + objectMap["tags"] = pj.Tags + } + return json.Marshal(objectMap) +} + +// AsCommandJob is the BasicJobBase implementation for PipelineJob. +func (pj PipelineJob) AsCommandJob() (*CommandJob, bool) { + return nil, false +} + +// AsPipelineJob is the BasicJobBase implementation for PipelineJob. +func (pj PipelineJob) AsPipelineJob() (*PipelineJob, bool) { + return &pj, true +} + +// AsSweepJob is the BasicJobBase implementation for PipelineJob. +func (pj PipelineJob) AsSweepJob() (*SweepJob, bool) { + return nil, false +} + +// AsJobBase is the BasicJobBase implementation for PipelineJob. +func (pj PipelineJob) AsJobBase() (*JobBase, bool) { + return nil, false +} + +// AsBasicJobBase is the BasicJobBase implementation for PipelineJob. +func (pj PipelineJob) AsBasicJobBase() (BasicJobBase, bool) { + return &pj, true +} + +// UnmarshalJSON is the custom unmarshaler for PipelineJob struct. +func (pj *PipelineJob) 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 "inputs": + if v != nil { + var inputs map[string]BasicJobInput + err = json.Unmarshal(*v, &inputs) + if err != nil { + return err + } + pj.Inputs = inputs + } + case "jobs": + if v != nil { + var jobs map[string]interface{} + err = json.Unmarshal(*v, &jobs) + if err != nil { + return err + } + pj.Jobs = jobs + } + case "outputs": + if v != nil { + var outputs map[string]BasicJobOutput + err = json.Unmarshal(*v, &outputs) + if err != nil { + return err + } + pj.Outputs = outputs + } + case "settings": + if v != nil { + var settings interface{} + err = json.Unmarshal(*v, &settings) + if err != nil { + return err + } + pj.Settings = settings + } + case "computeId": + if v != nil { + var computeID string + err = json.Unmarshal(*v, &computeID) + if err != nil { + return err + } + pj.ComputeID = &computeID + } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + pj.DisplayName = &displayName + } + case "experimentName": + if v != nil { + var experimentName string + err = json.Unmarshal(*v, &experimentName) + if err != nil { + return err + } + pj.ExperimentName = &experimentName + } + case "identity": + if v != nil { + identity, err := unmarshalBasicIdentityConfiguration(*v) + if err != nil { + return err + } + pj.Identity = identity + } + case "isArchived": + if v != nil { + var isArchived bool + err = json.Unmarshal(*v, &isArchived) + if err != nil { + return err + } + pj.IsArchived = &isArchived + } + case "services": + if v != nil { + var services map[string]*JobService + err = json.Unmarshal(*v, &services) + if err != nil { + return err + } + pj.Services = services + } + case "status": + if v != nil { + var status JobStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + pj.Status = status + } + case "jobType": + if v != nil { + var jobType JobTypeBasicJobBase + err = json.Unmarshal(*v, &jobType) + if err != nil { + return err + } + pj.JobType = jobType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + pj.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + pj.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pj.Tags = tags + } + } + } + + return nil +} + +// Plan plan for the resource. +type Plan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,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 *ManagedServiceIdentity `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"` + // 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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 + } + 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 ManagedServiceIdentity + 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 "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 + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + pec.SystemData = &systemData + } + } + } + + 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 *ManagedServiceIdentity `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"` + // 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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 + } + 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 ManagedServiceIdentity + 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 "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 + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + plr.SystemData = &systemData + } + } + } + + 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 deployment container liveness/readiness probe configuration. +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"` +} + +// 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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 { + // ProcessCountPerInstance - Number of processes per node. + ProcessCountPerInstance *int32 `json:"processCountPerInstance,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.ProcessCountPerInstance != nil { + objectMap["processCountPerInstance"] = pt.ProcessCountPerInstance + } + 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"` +} + +// RandomSamplingAlgorithm defines a Sampling Algorithm that generates values randomly +type RandomSamplingAlgorithm struct { + // Rule - The specific type of random algorithm. Possible values include: 'Random', 'Sobol' + Rule RandomSamplingAlgorithmRule `json:"rule,omitempty"` + // Seed - An optional integer to use as the seed for random number generation + Seed *int32 `json:"seed,omitempty"` + // SamplingAlgorithmType - Possible values include: 'SamplingAlgorithmTypeSamplingAlgorithm', 'SamplingAlgorithmTypeBayesian1', 'SamplingAlgorithmTypeGrid1', 'SamplingAlgorithmTypeRandom1' + SamplingAlgorithmType SamplingAlgorithmTypeBasicSamplingAlgorithm `json:"samplingAlgorithmType,omitempty"` +} + +// MarshalJSON is the custom marshaler for RandomSamplingAlgorithm. +func (rsaVar RandomSamplingAlgorithm) MarshalJSON() ([]byte, error) { + rsaVar.SamplingAlgorithmType = SamplingAlgorithmTypeRandom1 + objectMap := make(map[string]interface{}) + if rsaVar.Rule != "" { + objectMap["rule"] = rsaVar.Rule + } + if rsaVar.Seed != nil { + objectMap["seed"] = rsaVar.Seed + } + if rsaVar.SamplingAlgorithmType != "" { + objectMap["samplingAlgorithmType"] = rsaVar.SamplingAlgorithmType + } + return json.Marshal(objectMap) +} + +// AsBayesianSamplingAlgorithm is the BasicSamplingAlgorithm implementation for RandomSamplingAlgorithm. +func (rsaVar RandomSamplingAlgorithm) AsBayesianSamplingAlgorithm() (*BayesianSamplingAlgorithm, bool) { + return nil, false +} + +// AsGridSamplingAlgorithm is the BasicSamplingAlgorithm implementation for RandomSamplingAlgorithm. +func (rsaVar RandomSamplingAlgorithm) AsGridSamplingAlgorithm() (*GridSamplingAlgorithm, bool) { + return nil, false +} + +// AsRandomSamplingAlgorithm is the BasicSamplingAlgorithm implementation for RandomSamplingAlgorithm. +func (rsaVar RandomSamplingAlgorithm) AsRandomSamplingAlgorithm() (*RandomSamplingAlgorithm, bool) { + return &rsaVar, true +} + +// AsSamplingAlgorithm is the BasicSamplingAlgorithm implementation for RandomSamplingAlgorithm. +func (rsaVar RandomSamplingAlgorithm) AsSamplingAlgorithm() (*SamplingAlgorithm, bool) { + return nil, false +} + +// AsBasicSamplingAlgorithm is the BasicSamplingAlgorithm implementation for RandomSamplingAlgorithm. +func (rsaVar RandomSamplingAlgorithm) AsBasicSamplingAlgorithm() (BasicSamplingAlgorithm, bool) { + return &rsaVar, true +} + +// RegenerateEndpointKeysRequest ... +type RegenerateEndpointKeysRequest struct { + // KeyType - [Required] 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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceBase ... +type ResourceBase 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 ResourceBase. +func (rb ResourceBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rb.Description != nil { + objectMap["description"] = rb.Description + } + if rb.Properties != nil { + objectMap["properties"] = rb.Properties + } + if rb.Tags != nil { + objectMap["tags"] = rb.Tags + } + return json.Marshal(objectMap) +} + +// ResourceConfiguration ... +type ResourceConfiguration struct { + // InstanceCount - Optional number of instances or nodes used by the compute target. + InstanceCount *int32 `json:"instanceCount,omitempty"` + // InstanceType - Optional type of VM used as supported by the compute target. + InstanceType *string `json:"instanceType,omitempty"` + // Properties - Additional properties bag. + Properties map[string]interface{} `json:"properties"` +} + +// MarshalJSON is the custom marshaler for ResourceConfiguration. +func (rc ResourceConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rc.InstanceCount != nil { + objectMap["instanceCount"] = rc.InstanceCount + } + if rc.InstanceType != nil { + objectMap["instanceType"] = rc.InstanceType + } + if rc.Properties != nil { + objectMap["properties"] = rc.Properties + } + 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"` +} + +// ResourceModelWithAllowedPropertySet the resource model definition containing the full set of allowed +// properties for a resource. Except properties bag, there cannot be a top level property outside of this +// set. +type ResourceModelWithAllowedPropertySet struct { + // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. + ManagedBy *string `json:"managedBy,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` + Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` + Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` + Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet. +func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.ManagedBy != nil { + objectMap["managedBy"] = rmwaps.ManagedBy + } + if rmwaps.Kind != nil { + objectMap["kind"] = rmwaps.Kind + } + if rmwaps.Identity != nil { + objectMap["identity"] = rmwaps.Identity + } + if rmwaps.Sku != nil { + objectMap["sku"] = rmwaps.Sku + } + if rmwaps.Plan != nil { + objectMap["plan"] = rmwaps.Plan + } + if rmwaps.Tags != nil { + objectMap["tags"] = rmwaps.Tags + } + if rmwaps.Location != nil { + objectMap["location"] = rmwaps.Location + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetIdentity ... +type ResourceModelWithAllowedPropertySetIdentity 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: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySetIdentity. +func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.Type != "" { + objectMap["type"] = rmwaps.Type + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetPlan ... +type ResourceModelWithAllowedPropertySetPlan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// ResourceModelWithAllowedPropertySetSku ... +type ResourceModelWithAllowedPropertySetSku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// 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) +} + +// Route ... +type Route struct { + // Path - [Required] The path for the route. + Path *string `json:"path,omitempty"` + // Port - [Required] The port for the route. + Port *int32 `json:"port,omitempty"` +} + +// BasicSamplingAlgorithm the Sampling Algorithm used to generate hyperparameter values, along with properties to +// configure the algorithm +type BasicSamplingAlgorithm interface { + AsBayesianSamplingAlgorithm() (*BayesianSamplingAlgorithm, bool) + AsGridSamplingAlgorithm() (*GridSamplingAlgorithm, bool) + AsRandomSamplingAlgorithm() (*RandomSamplingAlgorithm, bool) + AsSamplingAlgorithm() (*SamplingAlgorithm, bool) +} + +// SamplingAlgorithm the Sampling Algorithm used to generate hyperparameter values, along with properties to +// configure the algorithm +type SamplingAlgorithm struct { + // SamplingAlgorithmType - Possible values include: 'SamplingAlgorithmTypeSamplingAlgorithm', 'SamplingAlgorithmTypeBayesian1', 'SamplingAlgorithmTypeGrid1', 'SamplingAlgorithmTypeRandom1' + SamplingAlgorithmType SamplingAlgorithmTypeBasicSamplingAlgorithm `json:"samplingAlgorithmType,omitempty"` +} + +func unmarshalBasicSamplingAlgorithm(body []byte) (BasicSamplingAlgorithm, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["samplingAlgorithmType"] { + case string(SamplingAlgorithmTypeBayesian1): + var bsa BayesianSamplingAlgorithm + err := json.Unmarshal(body, &bsa) + return bsa, err + case string(SamplingAlgorithmTypeGrid1): + var gsa GridSamplingAlgorithm + err := json.Unmarshal(body, &gsa) + return gsa, err + case string(SamplingAlgorithmTypeRandom1): + var rsaVar RandomSamplingAlgorithm + err := json.Unmarshal(body, &rsaVar) + return rsaVar, err + default: + var sa SamplingAlgorithm + err := json.Unmarshal(body, &sa) + return sa, err + } +} +func unmarshalBasicSamplingAlgorithmArray(body []byte) ([]BasicSamplingAlgorithm, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + saArray := make([]BasicSamplingAlgorithm, len(rawMessages)) + + for index, rawMessage := range rawMessages { + sa, err := unmarshalBasicSamplingAlgorithm(*rawMessage) + if err != nil { + return nil, err + } + saArray[index] = sa + } + return saArray, nil +} + +// MarshalJSON is the custom marshaler for SamplingAlgorithm. +func (sa SamplingAlgorithm) MarshalJSON() ([]byte, error) { + sa.SamplingAlgorithmType = SamplingAlgorithmTypeSamplingAlgorithm + objectMap := make(map[string]interface{}) + if sa.SamplingAlgorithmType != "" { + objectMap["samplingAlgorithmType"] = sa.SamplingAlgorithmType + } + return json.Marshal(objectMap) +} + +// AsBayesianSamplingAlgorithm is the BasicSamplingAlgorithm implementation for SamplingAlgorithm. +func (sa SamplingAlgorithm) AsBayesianSamplingAlgorithm() (*BayesianSamplingAlgorithm, bool) { + return nil, false +} + +// AsGridSamplingAlgorithm is the BasicSamplingAlgorithm implementation for SamplingAlgorithm. +func (sa SamplingAlgorithm) AsGridSamplingAlgorithm() (*GridSamplingAlgorithm, bool) { + return nil, false +} + +// AsRandomSamplingAlgorithm is the BasicSamplingAlgorithm implementation for SamplingAlgorithm. +func (sa SamplingAlgorithm) AsRandomSamplingAlgorithm() (*RandomSamplingAlgorithm, bool) { + return nil, false +} + +// AsSamplingAlgorithm is the BasicSamplingAlgorithm implementation for SamplingAlgorithm. +func (sa SamplingAlgorithm) AsSamplingAlgorithm() (*SamplingAlgorithm, bool) { + return &sa, true +} + +// AsBasicSamplingAlgorithm is the BasicSamplingAlgorithm implementation for SamplingAlgorithm. +func (sa SamplingAlgorithm) AsBasicSamplingAlgorithm() (BasicSamplingAlgorithm, bool) { + return &sa, true +} + +// SASAuthTypeWorkspaceConnectionProperties ... +type SASAuthTypeWorkspaceConnectionProperties struct { + Credentials *WorkspaceConnectionSharedAccessSignature `json:"credentials,omitempty"` + // Category - Possible values include: 'PythonFeed', 'ContainerRegistry', 'Git' + Category ConnectionCategory `json:"category,omitempty"` + Target *string `json:"target,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"` + // AuthType - Possible values include: 'AuthTypeWorkspaceConnectionPropertiesV2', 'AuthTypePAT', 'AuthTypeSAS', 'AuthTypeUsernamePassword', 'AuthTypeNone', 'AuthTypeManagedIdentity' + AuthType AuthType `json:"authType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SASAuthTypeWorkspaceConnectionProperties. +func (satwcp SASAuthTypeWorkspaceConnectionProperties) MarshalJSON() ([]byte, error) { + satwcp.AuthType = AuthTypeSAS + objectMap := make(map[string]interface{}) + if satwcp.Credentials != nil { + objectMap["credentials"] = satwcp.Credentials + } + if satwcp.Category != "" { + objectMap["category"] = satwcp.Category + } + if satwcp.Target != nil { + objectMap["target"] = satwcp.Target + } + if satwcp.Value != nil { + objectMap["value"] = satwcp.Value + } + if satwcp.ValueFormat != "" { + objectMap["valueFormat"] = satwcp.ValueFormat + } + if satwcp.AuthType != "" { + objectMap["authType"] = satwcp.AuthType + } + return json.Marshal(objectMap) +} + +// AsPATAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for SASAuthTypeWorkspaceConnectionProperties. +func (satwcp SASAuthTypeWorkspaceConnectionProperties) AsPATAuthTypeWorkspaceConnectionProperties() (*PATAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsSASAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for SASAuthTypeWorkspaceConnectionProperties. +func (satwcp SASAuthTypeWorkspaceConnectionProperties) AsSASAuthTypeWorkspaceConnectionProperties() (*SASAuthTypeWorkspaceConnectionProperties, bool) { + return &satwcp, true +} + +// AsUsernamePasswordAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for SASAuthTypeWorkspaceConnectionProperties. +func (satwcp SASAuthTypeWorkspaceConnectionProperties) AsUsernamePasswordAuthTypeWorkspaceConnectionProperties() (*UsernamePasswordAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsNoneAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for SASAuthTypeWorkspaceConnectionProperties. +func (satwcp SASAuthTypeWorkspaceConnectionProperties) AsNoneAuthTypeWorkspaceConnectionProperties() (*NoneAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsManagedIdentityAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for SASAuthTypeWorkspaceConnectionProperties. +func (satwcp SASAuthTypeWorkspaceConnectionProperties) AsManagedIdentityAuthTypeWorkspaceConnectionProperties() (*ManagedIdentityAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsWorkspaceConnectionPropertiesV2 is the BasicWorkspaceConnectionPropertiesV2 implementation for SASAuthTypeWorkspaceConnectionProperties. +func (satwcp SASAuthTypeWorkspaceConnectionProperties) AsWorkspaceConnectionPropertiesV2() (*WorkspaceConnectionPropertiesV2, bool) { + return nil, false +} + +// AsBasicWorkspaceConnectionPropertiesV2 is the BasicWorkspaceConnectionPropertiesV2 implementation for SASAuthTypeWorkspaceConnectionProperties. +func (satwcp SASAuthTypeWorkspaceConnectionProperties) AsBasicWorkspaceConnectionPropertiesV2() (BasicWorkspaceConnectionPropertiesV2, bool) { + return &satwcp, true +} + +// SasDatastoreCredentials SAS datastore credentials configuration. +type SasDatastoreCredentials struct { + // Secrets - [Required] Storage container secrets. + Secrets *SasDatastoreSecrets `json:"secrets,omitempty"` + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey1', 'CredentialsTypeCertificate1', 'CredentialsTypeNone1', 'CredentialsTypeSas1', 'CredentialsTypeServicePrincipal1' + CredentialsType CredentialsTypeBasicDatastoreCredentials `json:"credentialsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SasDatastoreCredentials. +func (sdc SasDatastoreCredentials) MarshalJSON() ([]byte, error) { + sdc.CredentialsType = CredentialsTypeSas1 + 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 +} + +// 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', 'SecretsTypeAccountKey', 'SecretsTypeCertificate', 'SecretsTypeSas', 'SecretsTypeServicePrincipal' + SecretsType SecretsTypeBasicDatastoreSecrets `json:"secretsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SasDatastoreSecrets. +func (sds SasDatastoreSecrets) MarshalJSON() ([]byte, error) { + sds.SecretsType = SecretsTypeSas + 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 +} + +// 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 +} + +// 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"` +} + +// ScaleSettingsInformation desired scale settings for the amlCompute. +type ScaleSettingsInformation struct { + ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` +} + +// ScheduleBase ... +type ScheduleBase struct { + ID *string `json:"id,omitempty"` + // ProvisioningStatus - Possible values include: 'ScheduleProvisioningStateCompleted', 'ScheduleProvisioningStateProvisioning', 'ScheduleProvisioningStateFailed' + ProvisioningStatus ScheduleProvisioningState `json:"provisioningStatus,omitempty"` + // Status - Possible values include: 'ScheduleStatusEnabled', 'ScheduleStatusDisabled' + Status ScheduleStatus `json:"status,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"` +} + +// ServicePrincipalDatastoreCredentials service Principal datastore credentials configuration. +type ServicePrincipalDatastoreCredentials struct { + // AuthorityURL - Authority URL used for authentication. + AuthorityURL *string `json:"authorityUrl,omitempty"` + // ClientID - [Required] Service principal client ID. + ClientID *uuid.UUID `json:"clientId,omitempty"` + // ResourceURL - Resource the service principal has access to. + ResourceURL *string `json:"resourceUrl,omitempty"` + // Secrets - [Required] Service principal secrets. + Secrets *ServicePrincipalDatastoreSecrets `json:"secrets,omitempty"` + // TenantID - [Required] ID of the tenant to which the service principal belongs. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey1', 'CredentialsTypeCertificate1', 'CredentialsTypeNone1', 'CredentialsTypeSas1', 'CredentialsTypeServicePrincipal1' + CredentialsType CredentialsTypeBasicDatastoreCredentials `json:"credentialsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServicePrincipalDatastoreCredentials. +func (spdc ServicePrincipalDatastoreCredentials) MarshalJSON() ([]byte, error) { + spdc.CredentialsType = CredentialsTypeServicePrincipal1 + objectMap := make(map[string]interface{}) + if spdc.AuthorityURL != nil { + objectMap["authorityUrl"] = spdc.AuthorityURL + } + if spdc.ClientID != nil { + objectMap["clientId"] = spdc.ClientID + } + if spdc.ResourceURL != nil { + objectMap["resourceUrl"] = spdc.ResourceURL + } + 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 +} + +// 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', 'SecretsTypeAccountKey', 'SecretsTypeCertificate', 'SecretsTypeSas', 'SecretsTypeServicePrincipal' + SecretsType SecretsTypeBasicDatastoreSecrets `json:"secretsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServicePrincipalDatastoreSecrets. +func (spds ServicePrincipalDatastoreSecrets) MarshalJSON() ([]byte, error) { + spds.SecretsType = SecretsTypeServicePrincipal + 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 +} + +// 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 +} + +// 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 the resource model definition representing SKU +type Sku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// SkuCapacity SKU capacity information +type SkuCapacity struct { + // Default - Gets or sets the default capacity. + Default *int32 `json:"default,omitempty"` + // Maximum - Gets or sets the maximum. + Maximum *int32 `json:"maximum,omitempty"` + // Minimum - Gets or sets the minimum. + Minimum *int32 `json:"minimum,omitempty"` + // ScaleType - Gets or sets the type of the scale. Possible values include: 'SkuScaleTypeAutomatic', 'SkuScaleTypeManual', 'SkuScaleTypeNone' + ScaleType SkuScaleType `json:"scaleType,omitempty"` +} + +// SkuResource fulfills ARM Contract requirement to list all available SKUS for a resource. +type SkuResource struct { + // Capacity - Gets or sets the Sku Capacity. + Capacity *SkuCapacity `json:"capacity,omitempty"` + // ResourceType - READ-ONLY; The resource type name. + ResourceType *string `json:"resourceType,omitempty"` + // Sku - Gets or sets the Sku. + Sku *SkuSetting `json:"sku,omitempty"` +} + +// MarshalJSON is the custom marshaler for SkuResource. +func (sr SkuResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.Capacity != nil { + objectMap["capacity"] = sr.Capacity + } + if sr.Sku != nil { + objectMap["sku"] = sr.Sku + } + return json.Marshal(objectMap) +} + +// SkuResourceArmPaginatedResult a paginated list of SkuResource entities. +type SkuResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + // NextLink - The link to the next page of SkuResource objects. If null, there are no additional pages. + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type SkuResource. + Value *[]SkuResource `json:"value,omitempty"` +} + +// SkuResourceArmPaginatedResultIterator provides access to a complete listing of SkuResource values. +type SkuResourceArmPaginatedResultIterator struct { + i int + page SkuResourceArmPaginatedResultPage +} + +// 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 *SkuResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkuResourceArmPaginatedResultIterator.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 *SkuResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SkuResourceArmPaginatedResultIterator) 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 SkuResourceArmPaginatedResultIterator) Response() SkuResourceArmPaginatedResult { + 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 SkuResourceArmPaginatedResultIterator) Value() SkuResource { + if !iter.page.NotDone() { + return SkuResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SkuResourceArmPaginatedResultIterator type. +func NewSkuResourceArmPaginatedResultIterator(page SkuResourceArmPaginatedResultPage) SkuResourceArmPaginatedResultIterator { + return SkuResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (srapr SkuResourceArmPaginatedResult) IsEmpty() bool { + return srapr.Value == nil || len(*srapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (srapr SkuResourceArmPaginatedResult) hasNextLink() bool { + return srapr.NextLink != nil && len(*srapr.NextLink) != 0 +} + +// skuResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (srapr SkuResourceArmPaginatedResult) skuResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !srapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(srapr.NextLink))) +} + +// SkuResourceArmPaginatedResultPage contains a page of SkuResource values. +type SkuResourceArmPaginatedResultPage struct { + fn func(context.Context, SkuResourceArmPaginatedResult) (SkuResourceArmPaginatedResult, error) + srapr SkuResourceArmPaginatedResult +} + +// 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 *SkuResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkuResourceArmPaginatedResultPage.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.srapr) + if err != nil { + return err + } + page.srapr = 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 *SkuResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SkuResourceArmPaginatedResultPage) NotDone() bool { + return !page.srapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SkuResourceArmPaginatedResultPage) Response() SkuResourceArmPaginatedResult { + return page.srapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SkuResourceArmPaginatedResultPage) Values() []SkuResource { + if page.srapr.IsEmpty() { + return nil + } + return *page.srapr.Value +} + +// Creates a new instance of the SkuResourceArmPaginatedResultPage type. +func NewSkuResourceArmPaginatedResultPage(cur SkuResourceArmPaginatedResult, getNextPage func(context.Context, SkuResourceArmPaginatedResult) (SkuResourceArmPaginatedResult, error)) SkuResourceArmPaginatedResultPage { + return SkuResourceArmPaginatedResultPage{ + fn: getNextPage, + srapr: cur, + } +} + +// SkuSetting skuSetting fulfills the need for stripped down SKU info in ARM contract. +type SkuSetting struct { + // Name - [Required] The name of the SKU. Ex - P3. It is typically a letter+number code. + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` +} + +// SslConfiguration the ssl configuration for scoring +type SslConfiguration struct { + // Status - Enable or disable ssl for scoring. Possible values include: 'SslConfigStatusDisabled', 'SslConfigStatusEnabled', 'SslConfigStatusAuto' + Status SslConfigStatus `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"` +} + +// SweepJob sweep job definition. +type SweepJob struct { + // EarlyTermination - Early termination policies enable canceling poor-performing runs before they complete + EarlyTermination BasicEarlyTerminationPolicy `json:"earlyTermination,omitempty"` + // Inputs - Mapping of input data bindings used in the job. + Inputs map[string]BasicJobInput `json:"inputs"` + // Limits - Sweep Job limit. + Limits *SweepJobLimits `json:"limits,omitempty"` + // Objective - [Required] Optimization objective. + Objective *Objective `json:"objective,omitempty"` + // Outputs - Mapping of output data bindings used in the job. + Outputs map[string]BasicJobOutput `json:"outputs"` + // SamplingAlgorithm - [Required] The hyperparameter sampling algorithm + SamplingAlgorithm BasicSamplingAlgorithm `json:"samplingAlgorithm,omitempty"` + // SearchSpace - [Required] A dictionary containing each parameter and its distribution. The dictionary key is the name of the parameter + SearchSpace interface{} `json:"searchSpace,omitempty"` + // Trial - [Required] Trial component definition. + Trial *TrialComponent `json:"trial,omitempty"` + // ComputeID - ARM resource ID of the compute resource. + ComputeID *string `json:"computeId,omitempty"` + // DisplayName - Display name of job. + DisplayName *string `json:"displayName,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, UserIdentity or null. + // Defaults to AmlToken if null. + Identity BasicIdentityConfiguration `json:"identity,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // Services - List of JobEndpoints. + // For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + Services map[string]*JobService `json:"services"` + // 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"` + // JobType - Possible values include: 'JobTypeJobBase', 'JobTypeCommand1', 'JobTypePipeline1', 'JobTypeSweep1' + JobType JobTypeBasicJobBase `json:"jobType,omitempty"` + // 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 SweepJob. +func (sj SweepJob) MarshalJSON() ([]byte, error) { + sj.JobType = JobTypeSweep1 + objectMap := make(map[string]interface{}) + objectMap["earlyTermination"] = sj.EarlyTermination + if sj.Inputs != nil { + objectMap["inputs"] = sj.Inputs + } + if sj.Limits != nil { + objectMap["limits"] = sj.Limits + } + if sj.Objective != nil { + objectMap["objective"] = sj.Objective + } + if sj.Outputs != nil { + objectMap["outputs"] = sj.Outputs + } + objectMap["samplingAlgorithm"] = sj.SamplingAlgorithm + if sj.SearchSpace != nil { + objectMap["searchSpace"] = sj.SearchSpace + } + if sj.Trial != nil { + objectMap["trial"] = sj.Trial + } + if sj.ComputeID != nil { + objectMap["computeId"] = sj.ComputeID + } + if sj.DisplayName != nil { + objectMap["displayName"] = sj.DisplayName + } + if sj.ExperimentName != nil { + objectMap["experimentName"] = sj.ExperimentName + } + objectMap["identity"] = sj.Identity + if sj.IsArchived != nil { + objectMap["isArchived"] = sj.IsArchived + } + if sj.Services != nil { + objectMap["services"] = sj.Services + } + if sj.JobType != "" { + objectMap["jobType"] = sj.JobType + } + if sj.Description != nil { + objectMap["description"] = sj.Description + } + if sj.Properties != nil { + objectMap["properties"] = sj.Properties + } + if sj.Tags != nil { + objectMap["tags"] = sj.Tags + } + return json.Marshal(objectMap) +} + +// AsCommandJob is the BasicJobBase implementation for SweepJob. +func (sj SweepJob) AsCommandJob() (*CommandJob, bool) { + return nil, false +} + +// AsPipelineJob is the BasicJobBase implementation for SweepJob. +func (sj SweepJob) AsPipelineJob() (*PipelineJob, 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 "earlyTermination": + if v != nil { + earlyTermination, err := unmarshalBasicEarlyTerminationPolicy(*v) + if err != nil { + return err + } + sj.EarlyTermination = earlyTermination + } + case "inputs": + if v != nil { + var inputs map[string]BasicJobInput + err = json.Unmarshal(*v, &inputs) + if err != nil { + return err + } + sj.Inputs = inputs + } + case "limits": + if v != nil { + var limits SweepJobLimits + err = json.Unmarshal(*v, &limits) + if err != nil { + return err + } + sj.Limits = &limits + } + case "objective": + if v != nil { + var objective Objective + err = json.Unmarshal(*v, &objective) + if err != nil { + return err + } + sj.Objective = &objective + } + case "outputs": + if v != nil { + var outputs map[string]BasicJobOutput + err = json.Unmarshal(*v, &outputs) + if err != nil { + return err + } + sj.Outputs = outputs + } + case "samplingAlgorithm": + if v != nil { + samplingAlgorithm, err := unmarshalBasicSamplingAlgorithm(*v) + if err != nil { + return err + } + sj.SamplingAlgorithm = samplingAlgorithm + } + case "searchSpace": + if v != nil { + var searchSpace interface{} + err = json.Unmarshal(*v, &searchSpace) + if err != nil { + return err + } + sj.SearchSpace = searchSpace + } + case "trial": + if v != nil { + var trial TrialComponent + err = json.Unmarshal(*v, &trial) + if err != nil { + return err + } + sj.Trial = &trial + } + case "computeId": + if v != nil { + var computeID string + err = json.Unmarshal(*v, &computeID) + if err != nil { + return err + } + sj.ComputeID = &computeID + } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + sj.DisplayName = &displayName + } + 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 "isArchived": + if v != nil { + var isArchived bool + err = json.Unmarshal(*v, &isArchived) + if err != nil { + return err + } + sj.IsArchived = &isArchived + } + case "services": + if v != nil { + var services map[string]*JobService + err = json.Unmarshal(*v, &services) + if err != nil { + return err + } + sj.Services = services + } + case "status": + if v != nil { + var status JobStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + sj.Status = status + } + case "jobType": + if v != nil { + var jobType JobTypeBasicJobBase + err = json.Unmarshal(*v, &jobType) + if err != nil { + return err + } + sj.JobType = jobType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + sj.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + sj.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + sj.Tags = tags + } + } + } + + return nil +} + +// SweepJobLimits sweep Job limit class. +type SweepJobLimits struct { + // MaxConcurrentTrials - Sweep Job max concurrent trials. + MaxConcurrentTrials *int32 `json:"maxConcurrentTrials,omitempty"` + // MaxTotalTrials - Sweep Job max total trials. + MaxTotalTrials *int32 `json:"maxTotalTrials,omitempty"` + // TrialTimeout - Sweep Job Trial timeout value. + TrialTimeout *string `json:"trialTimeout,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"` + // JobLimitsType - Possible values include: 'JobLimitsTypeJobLimits', 'JobLimitsTypeCommand', 'JobLimitsTypeSweep' + JobLimitsType JobLimitsTypeBasicJobLimits `json:"jobLimitsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SweepJobLimits. +func (sjl SweepJobLimits) MarshalJSON() ([]byte, error) { + sjl.JobLimitsType = JobLimitsTypeSweep + objectMap := make(map[string]interface{}) + if sjl.MaxConcurrentTrials != nil { + objectMap["maxConcurrentTrials"] = sjl.MaxConcurrentTrials + } + if sjl.MaxTotalTrials != nil { + objectMap["maxTotalTrials"] = sjl.MaxTotalTrials + } + if sjl.TrialTimeout != nil { + objectMap["trialTimeout"] = sjl.TrialTimeout + } + if sjl.Timeout != nil { + objectMap["timeout"] = sjl.Timeout + } + if sjl.JobLimitsType != "" { + objectMap["jobLimitsType"] = sjl.JobLimitsType + } + return json.Marshal(objectMap) +} + +// AsCommandJobLimits is the BasicJobLimits implementation for SweepJobLimits. +func (sjl SweepJobLimits) AsCommandJobLimits() (*CommandJobLimits, bool) { + return nil, false +} + +// AsSweepJobLimits is the BasicJobLimits implementation for SweepJobLimits. +func (sjl SweepJobLimits) AsSweepJobLimits() (*SweepJobLimits, bool) { + return &sjl, true +} + +// AsJobLimits is the BasicJobLimits implementation for SweepJobLimits. +func (sjl SweepJobLimits) AsJobLimits() (*JobLimits, bool) { + return nil, false +} + +// AsBasicJobLimits is the BasicJobLimits implementation for SweepJobLimits. +func (sjl SweepJobLimits) AsBasicJobLimits() (BasicJobLimits, bool) { + return &sjl, true +} + +// SynapseSpark a SynapseSpark compute. +type SynapseSpark struct { + Properties *SynapseSparkProperties `json:"properties,omitempty"` + // ComputeLocation - READ-ONLY; 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', 'ComputeTypeDataFactory1', 'ComputeTypeSynapseSpark1' + ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SynapseSpark. +func (ss SynapseSpark) MarshalJSON() ([]byte, error) { + ss.ComputeType = ComputeTypeSynapseSpark1 + objectMap := make(map[string]interface{}) + if ss.Properties != nil { + objectMap["properties"] = ss.Properties + } + 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.ComputeType != "" { + objectMap["computeType"] = ss.ComputeType + } + return json.Marshal(objectMap) +} + +// AsDataFactory is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsDataFactory() (*DataFactory, bool) { + return nil, false +} + +// AsSynapseSpark is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsSynapseSpark() (*SynapseSpark, bool) { + return &ss, true +} + +// AsCompute is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsCompute() (*Compute, bool) { + return nil, false +} + +// AsBasicCompute is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsBasicCompute() (BasicCompute, bool) { + return &ss, true +} + +// SynapseSparkProperties ... +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) +} + +// TargetUtilizationScaleSettings ... +type TargetUtilizationScaleSettings struct { + // MaxInstances - The maximum number of instances that the deployment can scale to. The quota will be reserved for max_instances. + MaxInstances *int32 `json:"maxInstances,omitempty"` + // MinInstances - The minimum number of instances to always be present. + MinInstances *int32 `json:"minInstances,omitempty"` + // PollingInterval - The polling interval in ISO 8691 format. Only supports duration with precision as low as Seconds. + PollingInterval *string `json:"pollingInterval,omitempty"` + // TargetUtilizationPercentage - Target CPU usage for the autoscaler. + TargetUtilizationPercentage *int32 `json:"targetUtilizationPercentage,omitempty"` + // ScaleType - Possible values include: 'ScaleTypeOnlineScaleSettings', 'ScaleTypeDefault', 'ScaleTypeTargetUtilization' + ScaleType ScaleTypeBasicOnlineScaleSettings `json:"scaleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for TargetUtilizationScaleSettings. +func (tuss TargetUtilizationScaleSettings) MarshalJSON() ([]byte, error) { + tuss.ScaleType = ScaleTypeTargetUtilization + objectMap := make(map[string]interface{}) + if tuss.MaxInstances != nil { + objectMap["maxInstances"] = tuss.MaxInstances + } + if tuss.MinInstances != nil { + objectMap["minInstances"] = tuss.MinInstances + } + if tuss.PollingInterval != nil { + objectMap["pollingInterval"] = tuss.PollingInterval + } + if tuss.TargetUtilizationPercentage != nil { + objectMap["targetUtilizationPercentage"] = tuss.TargetUtilizationPercentage + } + if tuss.ScaleType != "" { + objectMap["scaleType"] = tuss.ScaleType + } + return json.Marshal(objectMap) +} + +// AsDefaultScaleSettings is the BasicOnlineScaleSettings implementation for TargetUtilizationScaleSettings. +func (tuss TargetUtilizationScaleSettings) AsDefaultScaleSettings() (*DefaultScaleSettings, bool) { + return nil, false +} + +// AsTargetUtilizationScaleSettings is the BasicOnlineScaleSettings implementation for TargetUtilizationScaleSettings. +func (tuss TargetUtilizationScaleSettings) AsTargetUtilizationScaleSettings() (*TargetUtilizationScaleSettings, bool) { + return &tuss, true +} + +// AsOnlineScaleSettings is the BasicOnlineScaleSettings implementation for TargetUtilizationScaleSettings. +func (tuss TargetUtilizationScaleSettings) AsOnlineScaleSettings() (*OnlineScaleSettings, bool) { + return nil, false +} + +// AsBasicOnlineScaleSettings is the BasicOnlineScaleSettings implementation for TargetUtilizationScaleSettings. +func (tuss TargetUtilizationScaleSettings) AsBasicOnlineScaleSettings() (BasicOnlineScaleSettings, bool) { + return &tuss, true +} + +// TensorFlow tensorFlow distribution configuration. +type TensorFlow struct { + // ParameterServerCount - Number of parameter server tasks. + ParameterServerCount *int32 `json:"parameterServerCount,omitempty"` + // WorkerCount - Number of workers. If not specified, will default to the instance count. + 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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 - [Required] 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 - [Required] 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"` + // Resources - Compute Resource configuration for the job. + Resources *ResourceConfiguration `json:"resources,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.Resources != nil { + objectMap["resources"] = tc.Resources + } + 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 "resources": + if v != nil { + var resources ResourceConfiguration + err = json.Unmarshal(*v, &resources) + if err != nil { + return err + } + tc.Resources = &resources + } + } + } + + return nil +} + +// TritonModelJobInput ... +type TritonModelJobInput struct { + // Mode - Input Asset Delivery Mode. Possible values include: 'ReadOnlyMount', 'ReadWriteMount', 'Download', 'Direct', 'EvalMount', 'EvalDownload' + Mode InputDeliveryMode `json:"mode,omitempty"` + // URI - [Required] Input Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the input. + Description *string `json:"description,omitempty"` + // JobInputType - [Required] Specifies the type of job. Possible values include: 'JobInputTypeLiteral', 'JobInputTypeURIFile', 'JobInputTypeURIFolder', 'JobInputTypeMltable', 'JobInputTypeCustomModel', 'JobInputTypeMlflowModel', 'JobInputTypeTritonModel' + JobInputType JobInputType `json:"jobInputType,omitempty"` +} + +// TritonModelJobOutput ... +type TritonModelJobOutput struct { + // Mode - Output Asset Delivery Mode. Possible values include: 'OutputDeliveryModeReadWriteMount', 'OutputDeliveryModeUpload' + Mode OutputDeliveryMode `json:"mode,omitempty"` + // URI - Output Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the output. + Description *string `json:"description,omitempty"` + // JobOutputType - [Required] Specifies the type of job. Possible values include: 'JobOutputTypeURIFile', 'JobOutputTypeURIFolder', 'JobOutputTypeMltable', 'JobOutputTypeCustomModel', 'JobOutputTypeMlflowModel', 'JobOutputTypeTritonModel' + JobOutputType JobOutputType `json:"jobOutputType,omitempty"` +} + +// TruncationSelectionPolicy defines an early termination policy that cancels a given percentage of runs at +// each evaluation interval. +type TruncationSelectionPolicy struct { + // TruncationPercentage - The percentage of runs to cancel at each evaluation interval. + TruncationPercentage *int32 `json:"truncationPercentage,omitempty"` + // DelayEvaluation - Number of intervals by which to delay the first evaluation. + DelayEvaluation *int32 `json:"delayEvaluation,omitempty"` + // EvaluationInterval - Interval (number of runs) between policy evaluations. + 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) +} + +// URIFileDataVersion uri-file data version entity +type URIFileDataVersion struct { + // DataURI - [Required] Uri of the data. Usage/meaning depends on Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20220501.Assets.DataVersionBase.DataType + DataURI *string `json:"dataUri,omitempty"` + // DataType - Possible values include: 'DataTypeDataVersionBase', 'DataTypeMltable', 'DataTypeURIFile', 'DataTypeURIFolder' + DataType DataTypeBasicDataVersionBase `json:"dataType,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // 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 URIFileDataVersion. +func (ufdv URIFileDataVersion) MarshalJSON() ([]byte, error) { + ufdv.DataType = DataTypeURIFile + objectMap := make(map[string]interface{}) + if ufdv.DataURI != nil { + objectMap["dataUri"] = ufdv.DataURI + } + if ufdv.DataType != "" { + objectMap["dataType"] = ufdv.DataType + } + if ufdv.IsAnonymous != nil { + objectMap["isAnonymous"] = ufdv.IsAnonymous + } + if ufdv.IsArchived != nil { + objectMap["isArchived"] = ufdv.IsArchived + } + if ufdv.Description != nil { + objectMap["description"] = ufdv.Description + } + if ufdv.Properties != nil { + objectMap["properties"] = ufdv.Properties + } + if ufdv.Tags != nil { + objectMap["tags"] = ufdv.Tags + } + return json.Marshal(objectMap) +} + +// AsMLTableData is the BasicDataVersionBase implementation for URIFileDataVersion. +func (ufdv URIFileDataVersion) AsMLTableData() (*MLTableData, bool) { + return nil, false +} + +// AsURIFileDataVersion is the BasicDataVersionBase implementation for URIFileDataVersion. +func (ufdv URIFileDataVersion) AsURIFileDataVersion() (*URIFileDataVersion, bool) { + return &ufdv, true +} + +// AsURIFolderDataVersion is the BasicDataVersionBase implementation for URIFileDataVersion. +func (ufdv URIFileDataVersion) AsURIFolderDataVersion() (*URIFolderDataVersion, bool) { + return nil, false +} + +// AsDataVersionBase is the BasicDataVersionBase implementation for URIFileDataVersion. +func (ufdv URIFileDataVersion) AsDataVersionBase() (*DataVersionBase, bool) { + return nil, false +} + +// AsBasicDataVersionBase is the BasicDataVersionBase implementation for URIFileDataVersion. +func (ufdv URIFileDataVersion) AsBasicDataVersionBase() (BasicDataVersionBase, bool) { + return &ufdv, true +} + +// URIFileJobInput ... +type URIFileJobInput struct { + // Mode - Input Asset Delivery Mode. Possible values include: 'ReadOnlyMount', 'ReadWriteMount', 'Download', 'Direct', 'EvalMount', 'EvalDownload' + Mode InputDeliveryMode `json:"mode,omitempty"` + // URI - [Required] Input Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the input. + Description *string `json:"description,omitempty"` + // JobInputType - [Required] Specifies the type of job. Possible values include: 'JobInputTypeLiteral', 'JobInputTypeURIFile', 'JobInputTypeURIFolder', 'JobInputTypeMltable', 'JobInputTypeCustomModel', 'JobInputTypeMlflowModel', 'JobInputTypeTritonModel' + JobInputType JobInputType `json:"jobInputType,omitempty"` +} + +// URIFileJobOutput ... +type URIFileJobOutput struct { + // Mode - Output Asset Delivery Mode. Possible values include: 'OutputDeliveryModeReadWriteMount', 'OutputDeliveryModeUpload' + Mode OutputDeliveryMode `json:"mode,omitempty"` + // URI - Output Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the output. + Description *string `json:"description,omitempty"` + // JobOutputType - [Required] Specifies the type of job. Possible values include: 'JobOutputTypeURIFile', 'JobOutputTypeURIFolder', 'JobOutputTypeMltable', 'JobOutputTypeCustomModel', 'JobOutputTypeMlflowModel', 'JobOutputTypeTritonModel' + JobOutputType JobOutputType `json:"jobOutputType,omitempty"` +} + +// URIFolderDataVersion uri-folder data version entity +type URIFolderDataVersion struct { + // DataURI - [Required] Uri of the data. Usage/meaning depends on Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20220501.Assets.DataVersionBase.DataType + DataURI *string `json:"dataUri,omitempty"` + // DataType - Possible values include: 'DataTypeDataVersionBase', 'DataTypeMltable', 'DataTypeURIFile', 'DataTypeURIFolder' + DataType DataTypeBasicDataVersionBase `json:"dataType,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // 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 URIFolderDataVersion. +func (ufdv URIFolderDataVersion) MarshalJSON() ([]byte, error) { + ufdv.DataType = DataTypeURIFolder + objectMap := make(map[string]interface{}) + if ufdv.DataURI != nil { + objectMap["dataUri"] = ufdv.DataURI + } + if ufdv.DataType != "" { + objectMap["dataType"] = ufdv.DataType + } + if ufdv.IsAnonymous != nil { + objectMap["isAnonymous"] = ufdv.IsAnonymous + } + if ufdv.IsArchived != nil { + objectMap["isArchived"] = ufdv.IsArchived + } + if ufdv.Description != nil { + objectMap["description"] = ufdv.Description + } + if ufdv.Properties != nil { + objectMap["properties"] = ufdv.Properties + } + if ufdv.Tags != nil { + objectMap["tags"] = ufdv.Tags + } + return json.Marshal(objectMap) +} + +// AsMLTableData is the BasicDataVersionBase implementation for URIFolderDataVersion. +func (ufdv URIFolderDataVersion) AsMLTableData() (*MLTableData, bool) { + return nil, false +} + +// AsURIFileDataVersion is the BasicDataVersionBase implementation for URIFolderDataVersion. +func (ufdv URIFolderDataVersion) AsURIFileDataVersion() (*URIFileDataVersion, bool) { + return nil, false +} + +// AsURIFolderDataVersion is the BasicDataVersionBase implementation for URIFolderDataVersion. +func (ufdv URIFolderDataVersion) AsURIFolderDataVersion() (*URIFolderDataVersion, bool) { + return &ufdv, true +} + +// AsDataVersionBase is the BasicDataVersionBase implementation for URIFolderDataVersion. +func (ufdv URIFolderDataVersion) AsDataVersionBase() (*DataVersionBase, bool) { + return nil, false +} + +// AsBasicDataVersionBase is the BasicDataVersionBase implementation for URIFolderDataVersion. +func (ufdv URIFolderDataVersion) AsBasicDataVersionBase() (BasicDataVersionBase, bool) { + return &ufdv, true +} + +// URIFolderJobInput ... +type URIFolderJobInput struct { + // Mode - Input Asset Delivery Mode. Possible values include: 'ReadOnlyMount', 'ReadWriteMount', 'Download', 'Direct', 'EvalMount', 'EvalDownload' + Mode InputDeliveryMode `json:"mode,omitempty"` + // URI - [Required] Input Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the input. + Description *string `json:"description,omitempty"` + // JobInputType - [Required] Specifies the type of job. Possible values include: 'JobInputTypeLiteral', 'JobInputTypeURIFile', 'JobInputTypeURIFolder', 'JobInputTypeMltable', 'JobInputTypeCustomModel', 'JobInputTypeMlflowModel', 'JobInputTypeTritonModel' + JobInputType JobInputType `json:"jobInputType,omitempty"` +} + +// URIFolderJobOutput ... +type URIFolderJobOutput struct { + // Mode - Output Asset Delivery Mode. Possible values include: 'OutputDeliveryModeReadWriteMount', 'OutputDeliveryModeUpload' + Mode OutputDeliveryMode `json:"mode,omitempty"` + // URI - Output Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the output. + Description *string `json:"description,omitempty"` + // JobOutputType - [Required] Specifies the type of job. Possible values include: 'JobOutputTypeURIFile', 'JobOutputTypeURIFolder', 'JobOutputTypeMltable', 'JobOutputTypeCustomModel', 'JobOutputTypeMlflowModel', 'JobOutputTypeTritonModel' + JobOutputType JobOutputType `json:"jobOutputType,omitempty"` +} + +// 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 properties +type UserAssignedIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of the assigned identity. + PrincipalID *uuid.UUID `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client ID of the assigned identity. + ClientID *uuid.UUID `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) +} + +// UserIdentity user identity configuration. +type UserIdentity struct { + // IdentityType - Possible values include: 'IdentityTypeIdentityConfiguration', 'IdentityTypeAMLToken', 'IdentityTypeManaged', 'IdentityTypeUserIdentity' + IdentityType IdentityType `json:"identityType,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserIdentity. +func (UI UserIdentity) MarshalJSON() ([]byte, error) { + UI.IdentityType = IdentityTypeUserIdentity + objectMap := make(map[string]interface{}) + if UI.IdentityType != "" { + objectMap["identityType"] = UI.IdentityType + } + return json.Marshal(objectMap) +} + +// AsAmlToken is the BasicIdentityConfiguration implementation for UserIdentity. +func (UI UserIdentity) AsAmlToken() (*AmlToken, bool) { + return nil, false +} + +// AsManagedIdentity is the BasicIdentityConfiguration implementation for UserIdentity. +func (UI UserIdentity) AsManagedIdentity() (*ManagedIdentity, bool) { + return nil, false +} + +// AsUserIdentity is the BasicIdentityConfiguration implementation for UserIdentity. +func (UI UserIdentity) AsUserIdentity() (*UserIdentity, bool) { + return &UI, true +} + +// AsIdentityConfiguration is the BasicIdentityConfiguration implementation for UserIdentity. +func (UI UserIdentity) AsIdentityConfiguration() (*IdentityConfiguration, bool) { + return nil, false +} + +// AsBasicIdentityConfiguration is the BasicIdentityConfiguration implementation for UserIdentity. +func (UI UserIdentity) AsBasicIdentityConfiguration() (BasicIdentityConfiguration, bool) { + return &UI, true +} + +// UsernamePasswordAuthTypeWorkspaceConnectionProperties ... +type UsernamePasswordAuthTypeWorkspaceConnectionProperties struct { + Credentials *WorkspaceConnectionUsernamePassword `json:"credentials,omitempty"` + // Category - Possible values include: 'PythonFeed', 'ContainerRegistry', 'Git' + Category ConnectionCategory `json:"category,omitempty"` + Target *string `json:"target,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"` + // AuthType - Possible values include: 'AuthTypeWorkspaceConnectionPropertiesV2', 'AuthTypePAT', 'AuthTypeSAS', 'AuthTypeUsernamePassword', 'AuthTypeNone', 'AuthTypeManagedIdentity' + AuthType AuthType `json:"authType,omitempty"` +} + +// MarshalJSON is the custom marshaler for UsernamePasswordAuthTypeWorkspaceConnectionProperties. +func (upatwcp UsernamePasswordAuthTypeWorkspaceConnectionProperties) MarshalJSON() ([]byte, error) { + upatwcp.AuthType = AuthTypeUsernamePassword + objectMap := make(map[string]interface{}) + if upatwcp.Credentials != nil { + objectMap["credentials"] = upatwcp.Credentials + } + if upatwcp.Category != "" { + objectMap["category"] = upatwcp.Category + } + if upatwcp.Target != nil { + objectMap["target"] = upatwcp.Target + } + if upatwcp.Value != nil { + objectMap["value"] = upatwcp.Value + } + if upatwcp.ValueFormat != "" { + objectMap["valueFormat"] = upatwcp.ValueFormat + } + if upatwcp.AuthType != "" { + objectMap["authType"] = upatwcp.AuthType + } + return json.Marshal(objectMap) +} + +// AsPATAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for UsernamePasswordAuthTypeWorkspaceConnectionProperties. +func (upatwcp UsernamePasswordAuthTypeWorkspaceConnectionProperties) AsPATAuthTypeWorkspaceConnectionProperties() (*PATAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsSASAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for UsernamePasswordAuthTypeWorkspaceConnectionProperties. +func (upatwcp UsernamePasswordAuthTypeWorkspaceConnectionProperties) AsSASAuthTypeWorkspaceConnectionProperties() (*SASAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsUsernamePasswordAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for UsernamePasswordAuthTypeWorkspaceConnectionProperties. +func (upatwcp UsernamePasswordAuthTypeWorkspaceConnectionProperties) AsUsernamePasswordAuthTypeWorkspaceConnectionProperties() (*UsernamePasswordAuthTypeWorkspaceConnectionProperties, bool) { + return &upatwcp, true +} + +// AsNoneAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for UsernamePasswordAuthTypeWorkspaceConnectionProperties. +func (upatwcp UsernamePasswordAuthTypeWorkspaceConnectionProperties) AsNoneAuthTypeWorkspaceConnectionProperties() (*NoneAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsManagedIdentityAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for UsernamePasswordAuthTypeWorkspaceConnectionProperties. +func (upatwcp UsernamePasswordAuthTypeWorkspaceConnectionProperties) AsManagedIdentityAuthTypeWorkspaceConnectionProperties() (*ManagedIdentityAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsWorkspaceConnectionPropertiesV2 is the BasicWorkspaceConnectionPropertiesV2 implementation for UsernamePasswordAuthTypeWorkspaceConnectionProperties. +func (upatwcp UsernamePasswordAuthTypeWorkspaceConnectionProperties) AsWorkspaceConnectionPropertiesV2() (*WorkspaceConnectionPropertiesV2, bool) { + return nil, false +} + +// AsBasicWorkspaceConnectionPropertiesV2 is the BasicWorkspaceConnectionPropertiesV2 implementation for UsernamePasswordAuthTypeWorkspaceConnectionProperties. +func (upatwcp UsernamePasswordAuthTypeWorkspaceConnectionProperties) AsBasicWorkspaceConnectionPropertiesV2() (BasicWorkspaceConnectionPropertiesV2, bool) { + return &upatwcp, true +} + +// VirtualMachine a Machine Learning compute based on Azure Virtual Machines. +type VirtualMachine struct { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // ComputeLocation - READ-ONLY; 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 *VirtualMachineProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualMachine. +func (VM VirtualMachine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if VM.ComputeType != "" { + objectMap["computeType"] = VM.ComputeType + } + 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.Properties != nil { + objectMap["properties"] = VM.Properties + } + return json.Marshal(objectMap) +} + +// 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"` + // NotebookServerPort - Notebook server port open for ssh connections. + NotebookServerPort *int32 `json:"notebookServerPort,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"` +} + +// VirtualMachineSchema ... +type VirtualMachineSchema struct { + Properties *VirtualMachineProperties `json:"properties,omitempty"` +} + +// VirtualMachineSecrets secrets related to a Machine Learning compute based on AKS. +type VirtualMachineSecrets struct { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // AdministratorAccount - Admin credentials for virtual machine. + AdministratorAccount *VirtualMachineSSHCredentials `json:"administratorAccount,omitempty"` +} + +// VirtualMachineSecretsSchema ... +type VirtualMachineSecretsSchema struct { + // AdministratorAccount - Admin credentials for virtual machine. + AdministratorAccount *VirtualMachineSSHCredentials `json:"administratorAccount,omitempty"` +} + +// 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"` + // SupportedComputeTypes - Specifies the compute types supported by the virtual machine size. + SupportedComputeTypes *[]string `json:"supportedComputeTypes,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 + } + if vms.SupportedComputeTypes != nil { + objectMap["supportedComputeTypes"] = vms.SupportedComputeTypes + } + 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 *ManagedServiceIdentity `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"` + // 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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 + } + 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 ManagedServiceIdentity + 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 "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 + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + w.SystemData = &systemData + } + } + } + + return nil +} + +// WorkspaceConnectionManagedIdentity ... +type WorkspaceConnectionManagedIdentity struct { + ResourceID *string `json:"resourceId,omitempty"` + ClientID *string `json:"clientId,omitempty"` +} + +// WorkspaceConnectionPersonalAccessToken ... +type WorkspaceConnectionPersonalAccessToken struct { + Pat *string `json:"pat,omitempty"` +} + +// BasicWorkspaceConnectionPropertiesV2 ... +type BasicWorkspaceConnectionPropertiesV2 interface { + AsPATAuthTypeWorkspaceConnectionProperties() (*PATAuthTypeWorkspaceConnectionProperties, bool) + AsSASAuthTypeWorkspaceConnectionProperties() (*SASAuthTypeWorkspaceConnectionProperties, bool) + AsUsernamePasswordAuthTypeWorkspaceConnectionProperties() (*UsernamePasswordAuthTypeWorkspaceConnectionProperties, bool) + AsNoneAuthTypeWorkspaceConnectionProperties() (*NoneAuthTypeWorkspaceConnectionProperties, bool) + AsManagedIdentityAuthTypeWorkspaceConnectionProperties() (*ManagedIdentityAuthTypeWorkspaceConnectionProperties, bool) + AsWorkspaceConnectionPropertiesV2() (*WorkspaceConnectionPropertiesV2, bool) +} + +// WorkspaceConnectionPropertiesV2 ... +type WorkspaceConnectionPropertiesV2 struct { + // Category - Possible values include: 'PythonFeed', 'ContainerRegistry', 'Git' + Category ConnectionCategory `json:"category,omitempty"` + Target *string `json:"target,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"` + // AuthType - Possible values include: 'AuthTypeWorkspaceConnectionPropertiesV2', 'AuthTypePAT', 'AuthTypeSAS', 'AuthTypeUsernamePassword', 'AuthTypeNone', 'AuthTypeManagedIdentity' + AuthType AuthType `json:"authType,omitempty"` +} + +func unmarshalBasicWorkspaceConnectionPropertiesV2(body []byte) (BasicWorkspaceConnectionPropertiesV2, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["authType"] { + case string(AuthTypePAT): + var patwcp PATAuthTypeWorkspaceConnectionProperties + err := json.Unmarshal(body, &patwcp) + return patwcp, err + case string(AuthTypeSAS): + var satwcp SASAuthTypeWorkspaceConnectionProperties + err := json.Unmarshal(body, &satwcp) + return satwcp, err + case string(AuthTypeUsernamePassword): + var upatwcp UsernamePasswordAuthTypeWorkspaceConnectionProperties + err := json.Unmarshal(body, &upatwcp) + return upatwcp, err + case string(AuthTypeNone): + var natwcp NoneAuthTypeWorkspaceConnectionProperties + err := json.Unmarshal(body, &natwcp) + return natwcp, err + case string(AuthTypeManagedIdentity): + var miatwcp ManagedIdentityAuthTypeWorkspaceConnectionProperties + err := json.Unmarshal(body, &miatwcp) + return miatwcp, err + default: + var wcpv WorkspaceConnectionPropertiesV2 + err := json.Unmarshal(body, &wcpv) + return wcpv, err + } +} +func unmarshalBasicWorkspaceConnectionPropertiesV2Array(body []byte) ([]BasicWorkspaceConnectionPropertiesV2, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + wcpvArray := make([]BasicWorkspaceConnectionPropertiesV2, len(rawMessages)) + + for index, rawMessage := range rawMessages { + wcpv, err := unmarshalBasicWorkspaceConnectionPropertiesV2(*rawMessage) + if err != nil { + return nil, err + } + wcpvArray[index] = wcpv + } + return wcpvArray, nil +} + +// MarshalJSON is the custom marshaler for WorkspaceConnectionPropertiesV2. +func (wcpv WorkspaceConnectionPropertiesV2) MarshalJSON() ([]byte, error) { + wcpv.AuthType = AuthTypeWorkspaceConnectionPropertiesV2 + objectMap := make(map[string]interface{}) + if wcpv.Category != "" { + objectMap["category"] = wcpv.Category + } + if wcpv.Target != nil { + objectMap["target"] = wcpv.Target + } + if wcpv.Value != nil { + objectMap["value"] = wcpv.Value + } + if wcpv.ValueFormat != "" { + objectMap["valueFormat"] = wcpv.ValueFormat + } + if wcpv.AuthType != "" { + objectMap["authType"] = wcpv.AuthType + } + return json.Marshal(objectMap) +} + +// AsPATAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for WorkspaceConnectionPropertiesV2. +func (wcpv WorkspaceConnectionPropertiesV2) AsPATAuthTypeWorkspaceConnectionProperties() (*PATAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsSASAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for WorkspaceConnectionPropertiesV2. +func (wcpv WorkspaceConnectionPropertiesV2) AsSASAuthTypeWorkspaceConnectionProperties() (*SASAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsUsernamePasswordAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for WorkspaceConnectionPropertiesV2. +func (wcpv WorkspaceConnectionPropertiesV2) AsUsernamePasswordAuthTypeWorkspaceConnectionProperties() (*UsernamePasswordAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsNoneAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for WorkspaceConnectionPropertiesV2. +func (wcpv WorkspaceConnectionPropertiesV2) AsNoneAuthTypeWorkspaceConnectionProperties() (*NoneAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsManagedIdentityAuthTypeWorkspaceConnectionProperties is the BasicWorkspaceConnectionPropertiesV2 implementation for WorkspaceConnectionPropertiesV2. +func (wcpv WorkspaceConnectionPropertiesV2) AsManagedIdentityAuthTypeWorkspaceConnectionProperties() (*ManagedIdentityAuthTypeWorkspaceConnectionProperties, bool) { + return nil, false +} + +// AsWorkspaceConnectionPropertiesV2 is the BasicWorkspaceConnectionPropertiesV2 implementation for WorkspaceConnectionPropertiesV2. +func (wcpv WorkspaceConnectionPropertiesV2) AsWorkspaceConnectionPropertiesV2() (*WorkspaceConnectionPropertiesV2, bool) { + return &wcpv, true +} + +// AsBasicWorkspaceConnectionPropertiesV2 is the BasicWorkspaceConnectionPropertiesV2 implementation for WorkspaceConnectionPropertiesV2. +func (wcpv WorkspaceConnectionPropertiesV2) AsBasicWorkspaceConnectionPropertiesV2() (BasicWorkspaceConnectionPropertiesV2, bool) { + return &wcpv, true +} + +// WorkspaceConnectionPropertiesV2BasicResource ... +type WorkspaceConnectionPropertiesV2BasicResource struct { + autorest.Response `json:"-"` + Properties BasicWorkspaceConnectionPropertiesV2 `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkspaceConnectionPropertiesV2BasicResource. +func (wcpvbr WorkspaceConnectionPropertiesV2BasicResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = wcpvbr.Properties + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WorkspaceConnectionPropertiesV2BasicResource struct. +func (wcpvbr *WorkspaceConnectionPropertiesV2BasicResource) 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 := unmarshalBasicWorkspaceConnectionPropertiesV2(*v) + if err != nil { + return err + } + wcpvbr.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + wcpvbr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + wcpvbr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + wcpvbr.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + wcpvbr.SystemData = &systemData + } + } + } + + return nil +} + +// WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult ... +type WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + Value *[]WorkspaceConnectionPropertiesV2BasicResource `json:"value,omitempty"` + // NextLink - READ-ONLY + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult. +func (wcpvbrapr WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wcpvbrapr.Value != nil { + objectMap["value"] = wcpvbrapr.Value + } + return json.Marshal(objectMap) +} + +// WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultIterator provides access to a complete +// listing of WorkspaceConnectionPropertiesV2BasicResource values. +type WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultIterator struct { + i int + page WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPage +} + +// 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 *WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultIterator.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 *WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultIterator) 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 WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultIterator) Response() WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult { + 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 WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultIterator) Value() WorkspaceConnectionPropertiesV2BasicResource { + if !iter.page.NotDone() { + return WorkspaceConnectionPropertiesV2BasicResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultIterator type. +func NewWorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultIterator(page WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPage) WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultIterator { + return WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (wcpvbrapr WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult) IsEmpty() bool { + return wcpvbrapr.Value == nil || len(*wcpvbrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (wcpvbrapr WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult) hasNextLink() bool { + return wcpvbrapr.NextLink != nil && len(*wcpvbrapr.NextLink) != 0 +} + +// workspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (wcpvbrapr WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult) workspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !wcpvbrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(wcpvbrapr.NextLink))) +} + +// WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPage contains a page of +// WorkspaceConnectionPropertiesV2BasicResource values. +type WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPage struct { + fn func(context.Context, WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult) (WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult, error) + wcpvbrapr WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult +} + +// 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 *WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPage.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.wcpvbrapr) + if err != nil { + return err + } + page.wcpvbrapr = 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 *WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPage) NotDone() bool { + return !page.wcpvbrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPage) Response() WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult { + return page.wcpvbrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPage) Values() []WorkspaceConnectionPropertiesV2BasicResource { + if page.wcpvbrapr.IsEmpty() { + return nil + } + return *page.wcpvbrapr.Value +} + +// Creates a new instance of the WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPage type. +func NewWorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPage(cur WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult, getNextPage func(context.Context, WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult) (WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult, error)) WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPage { + return WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPage{ + fn: getNextPage, + wcpvbrapr: cur, + } +} + +// WorkspaceConnectionSharedAccessSignature ... +type WorkspaceConnectionSharedAccessSignature struct { + Sas *string `json:"sas,omitempty"` +} + +// WorkspaceConnectionUsernamePassword ... +type WorkspaceConnectionUsernamePassword struct { + Username *string `json:"username,omitempty"` + Password *string `json:"password,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. + ApplicationInsights *string `json:"applicationInsights,omitempty"` + // ContainerRegistry - ARM id of the container registry associated with this workspace. + 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"` + // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,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"` + // StorageHnsEnabled - READ-ONLY; If the storage associated with the workspace has hierarchical namespace(HNS) enabled. + StorageHnsEnabled *bool `json:"storageHnsEnabled,omitempty"` + // MlFlowTrackingURI - READ-ONLY; The URI associated with this workspace that machine learning flow must point at to set up tracking. + MlFlowTrackingURI *string `json:"mlFlowTrackingUri,omitempty"` + // V1LegacyMode - Enabling v1_legacy_mode may prevent you from using features provided by the v2 API. + V1LegacyMode *bool `json:"v1LegacyMode,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.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = wp.PublicNetworkAccess + } + if wp.SharedPrivateLinkResources != nil { + objectMap["sharedPrivateLinkResources"] = wp.SharedPrivateLinkResources + } + if wp.ServiceManagedResourcesSettings != nil { + objectMap["serviceManagedResourcesSettings"] = wp.ServiceManagedResourcesSettings + } + if wp.PrimaryUserAssignedIdentity != nil { + objectMap["primaryUserAssignedIdentity"] = wp.PrimaryUserAssignedIdentity + } + if wp.V1LegacyMode != nil { + objectMap["v1LegacyMode"] = wp.V1LegacyMode + } + 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"` + // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // ApplicationInsights - ARM id of the application insights associated with this workspace. + ApplicationInsights *string `json:"applicationInsights,omitempty"` + // ContainerRegistry - ARM id of the container registry associated with this workspace. + ContainerRegistry *string `json:"containerRegistry,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 +} + +// WorkspacesDiagnoseFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WorkspacesDiagnoseFuture 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) (DiagnoseResponseResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WorkspacesDiagnoseFuture) 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 WorkspacesDiagnoseFuture.Result. +func (future *WorkspacesDiagnoseFuture) result(client WorkspacesClient) (drr DiagnoseResponseResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesDiagnoseFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + drr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.WorkspacesDiagnoseFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if drr.Response.Response, err = future.GetResult(sender); err == nil && drr.Response.Response.StatusCode != http.StatusNoContent { + drr, err = client.DiagnoseResponder(drr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesDiagnoseFuture", "Result", drr.Response.Response, "Failure responding to request") + } + } + return +} + +// 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 +} + +// WorkspacesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WorkspacesUpdateFuture 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 *WorkspacesUpdateFuture) 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 WorkspacesUpdateFuture.Result. +func (future *WorkspacesUpdateFuture) 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.WorkspacesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + w.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.WorkspacesUpdateFuture") + 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.UpdateResponder(w.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesUpdateFuture", "Result", w.Response.Response, "Failure responding to request") + } + } + 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 *ManagedServiceIdentity `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 ManagedServiceIdentity + 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/machinelearningservices/mgmt/2022-05-01/machinelearningservices/modelversions.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/modelversions.go new file mode 100644 index 000000000000..83e79c580f5f --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/modelversions.go @@ -0,0 +1,476 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// version - version identifier. This is case-sensitive. +// body - version entity to create or update. +func (client ModelVersionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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: 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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ModelVersionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, name, version, 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, resourceGroupName string, workspaceName string, name string, version 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 = "2022-05-01" + 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}/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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// version - version identifier. This is case-sensitive. +func (client ModelVersionsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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, resourceGroupName, workspaceName, name, version) + 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, resourceGroupName string, workspaceName string, name string, version 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 = "2022-05-01" + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// version - version identifier. This is case-sensitive. +func (client ModelVersionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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, resourceGroupName, workspaceName, name, version) + 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, resourceGroupName string, workspaceName string, name string, version 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 = "2022-05-01" + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - model name. This is case-sensitive. +// 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 +// feed - name of the feed. +// listViewType - view type for including/excluding (for example) archived entities. +func (client ModelVersionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, name string, skip string, orderBy string, top *int32, version string, description string, offset *int32, tags string, properties string, feed string, listViewType ListViewType) (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, resourceGroupName, workspaceName, name, skip, orderBy, top, version, description, offset, tags, properties, feed, listViewType) + 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, resourceGroupName string, workspaceName string, name string, skip string, orderBy string, top *int32, version string, description string, offset *int32, tags string, properties string, feed string, listViewType ListViewType) (*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 = "2022-05-01" + 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) + } + if len(feed) > 0 { + queryParameters["feed"] = autorest.Encode("query", feed) + } + if len(string(listViewType)) > 0 { + queryParameters["listViewType"] = autorest.Encode("query", listViewType) + } else { + queryParameters["listViewType"] = autorest.Encode("query", "ActiveOnly") + } + + 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, resourceGroupName string, workspaceName string, name string, skip string, orderBy string, top *int32, version string, description string, offset *int32, tags string, properties string, feed string, listViewType ListViewType) (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, resourceGroupName, workspaceName, name, skip, orderBy, top, version, description, offset, tags, properties, feed, listViewType) + return +} diff --git a/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/onlinedeployments.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/onlinedeployments.go new file mode 100644 index 000000000000..3d8f843e9ef8 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/onlinedeployments.go @@ -0,0 +1,786 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference endpoint name. +// deploymentName - inference Endpoint Deployment name. +// body - inference Endpoint entity to apply during operation. +func (client OnlineDeploymentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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: 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: 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: body, + Constraints: []validation.Constraint{{Target: "body.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineDeploymentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, endpointName, deploymentName, 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", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client OnlineDeploymentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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 = "2022-05-01" + 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}/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 + future.FutureAPI = &azure.Future{} + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference endpoint name. +// deploymentName - inference Endpoint Deployment name. +func (client OnlineDeploymentsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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, resourceGroupName, workspaceName, endpointName, deploymentName) + 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", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client OnlineDeploymentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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 = "2022-05-01" + 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 + future.FutureAPI = &azure.Future{} + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference endpoint name. +// deploymentName - inference Endpoint Deployment name. +func (client OnlineDeploymentsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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, resourceGroupName, workspaceName, endpointName, deploymentName) + 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, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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 = "2022-05-01" + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference endpoint name. +// deploymentName - the name and identifier for the endpoint. +// body - the request containing parameters for retrieving logs. +func (client OnlineDeploymentsClient) GetLogs(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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, resourceGroupName, workspaceName, endpointName, deploymentName, 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, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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 = "2022-05-01" + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference endpoint name. +// orderBy - ordering of list. +// top - top of list. +// skip - continuation token for pagination. +func (client OnlineDeploymentsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName, 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, resourceGroupName string, workspaceName string, endpointName 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 = "2022-05-01" + 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, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName, orderBy, top, skip) + return +} + +// ListSkus sends the list skus request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference endpoint name. +// deploymentName - inference Endpoint Deployment name. +// count - number of Skus to be retrieved in a page of results. +// skip - continuation token for pagination. +func (client OnlineDeploymentsClient) ListSkus(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, count *int32, skip string) (result SkuResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineDeploymentsClient.ListSkus") + defer func() { + sc := -1 + if result.srapr.Response.Response != nil { + sc = result.srapr.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", "ListSkus", err.Error()) + } + + result.fn = client.listSkusNextResults + req, err := client.ListSkusPreparer(ctx, resourceGroupName, workspaceName, endpointName, deploymentName, count, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "ListSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.srapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "ListSkus", resp, "Failure sending request") + return + } + + result.srapr, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "ListSkus", resp, "Failure responding to request") + return + } + if result.srapr.hasNextLink() && result.srapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSkusPreparer prepares the ListSkus request. +func (client OnlineDeploymentsClient) ListSkusPreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, count *int32, skip 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 = "2022-05-01" + 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}/onlineEndpoints/{endpointName}/deployments/{deploymentName}/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSkusSender sends the ListSkus request. The method will close the +// http.Response Body if it receives an error. +func (client OnlineDeploymentsClient) ListSkusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSkusResponder handles the response to the ListSkus request. The method always +// closes the http.Response Body. +func (client OnlineDeploymentsClient) ListSkusResponder(resp *http.Response) (result SkuResourceArmPaginatedResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSkusNextResults retrieves the next set of results, if any. +func (client OnlineDeploymentsClient) listSkusNextResults(ctx context.Context, lastResults SkuResourceArmPaginatedResult) (result SkuResourceArmPaginatedResult, err error) { + req, err := lastResults.skuResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "listSkusNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "listSkusNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "listSkusNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSkusComplete enumerates all values, automatically crossing page boundaries as required. +func (client OnlineDeploymentsClient) ListSkusComplete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, count *int32, skip string) (result SkuResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineDeploymentsClient.ListSkus") + 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.ListSkus(ctx, resourceGroupName, workspaceName, endpointName, deploymentName, count, skip) + return +} + +// Update sends the update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - online Endpoint name. +// deploymentName - inference Endpoint Deployment name. +// body - online Endpoint entity to apply during operation. +func (client OnlineDeploymentsClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, body PartialMinimalTrackedResourceWithSku) (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: 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: 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}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineDeploymentsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, endpointName, deploymentName, 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", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client OnlineDeploymentsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, body PartialMinimalTrackedResourceWithSku) (*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 = "2022-05-01" + 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 + future.FutureAPI = &azure.Future{} + 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/machinelearningservices/mgmt/2022-05-01/machinelearningservices/onlineendpoints.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/onlineendpoints.go new file mode 100644 index 000000000000..8d621b52a3f7 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/onlineendpoints.go @@ -0,0 +1,823 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - online Endpoint name. +// body - online Endpoint entity to apply during operation. +func (client OnlineEndpointsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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: 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: endpointName, + Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineEndpointsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, endpointName, 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", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client OnlineEndpointsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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 = "2022-05-01" + 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}/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 + future.FutureAPI = &azure.Future{} + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - online Endpoint name. +func (client OnlineEndpointsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName) + 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", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client OnlineEndpointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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 = "2022-05-01" + 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 + future.FutureAPI = &azure.Future{} + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - online Endpoint name. +func (client OnlineEndpointsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName) + 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, resourceGroupName string, workspaceName string, endpointName 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 = "2022-05-01" + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - online Endpoint name. +func (client OnlineEndpointsClient) GetToken(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName) + 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, resourceGroupName string, workspaceName string, endpointName 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 = "2022-05-01" + 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 = "2022-05-01" + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - online Endpoint name. +func (client OnlineEndpointsClient) ListKeys(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName) + 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, resourceGroupName string, workspaceName string, endpointName 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 = "2022-05-01" + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - online Endpoint name. +// body - regenerateKeys request . +func (client OnlineEndpointsClient) RegenerateKeys(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName, 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", result.Response(), "Failure sending request") + return + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client OnlineEndpointsClient) RegenerateKeysPreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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 = "2022-05-01" + 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 + future.FutureAPI = &azure.Future{} + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - online Endpoint name. +// body - online Endpoint entity to apply during operation. +func (client OnlineEndpointsClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, body PartialMinimalTrackedResourceWithIdentity) (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, resourceGroupName, workspaceName, endpointName, 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", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client OnlineEndpointsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, body PartialMinimalTrackedResourceWithIdentity) (*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 = "2022-05-01" + 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 + future.FutureAPI = &azure.Future{} + 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/machinelearningservices/mgmt/2022-05-01/machinelearningservices/operations.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/operations.go new file mode 100644 index 000000000000..c0c34cfe8ab5 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/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 AmlOperationListResult, 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 = "2022-05-01" + 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 AmlOperationListResult, 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/machinelearningservices/mgmt/2022-05-01/machinelearningservices/privateendpointconnections.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/privateendpointconnections.go new file mode 100644 index 000000000000..b9506ca517df --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/privateendpointconnections.go @@ -0,0 +1,387 @@ +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}}}, + {Target: "properties.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "properties.Sku.Name", 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 = "2022-05-01" + 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 = "2022-05-01" + 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 = "2022-05-01" + 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 = "2022-05-01" + 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/machinelearningservices/mgmt/2022-05-01/machinelearningservices/privatelinkresources.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/privatelinkresources.go new file mode 100644 index 000000000000..0ca2fb7f7d0b --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/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 = "2022-05-01" + 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/machinelearningservices/mgmt/2022-05-01/machinelearningservices/quotas.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/quotas.go new file mode 100644 index 000000000000..8d49456b0495 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/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 = "2022-05-01" + 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 = "2022-05-01" + 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/machinelearningservices/mgmt/2022-05-01/machinelearningservices/usages.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/usages.go new file mode 100644 index 000000000000..7ba639fb7e17 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/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 = "2022-05-01" + 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/machinelearningservices/mgmt/2022-05-01/machinelearningservices/version.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/version.go new file mode 100644 index 000000000000..f297c1838adc --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/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/2022-05-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/virtualmachinesizes.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/virtualmachinesizes.go new file mode 100644 index 000000000000..28b1190e3236 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/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 = "2022-05-01" + 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/machinelearningservices/mgmt/2022-05-01/machinelearningservices/workspaceconnections.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/workspaceconnections.go new file mode 100644 index 000000000000..d1ea9468e7d8 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/workspaceconnections.go @@ -0,0 +1,432 @@ +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 sends the create request. +// 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 WorkspaceConnectionPropertiesV2BasicResource) (result WorkspaceConnectionPropertiesV2BasicResource, 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 WorkspaceConnectionPropertiesV2BasicResource) (*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 = "2022-05-01" + 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}/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 WorkspaceConnectionPropertiesV2BasicResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// 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 = "2022-05-01" + 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 sends the get request. +// 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 WorkspaceConnectionPropertiesV2BasicResource, 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 = "2022-05-01" + 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 WorkspaceConnectionPropertiesV2BasicResource, 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. +// 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 WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceConnectionsClient.List") + defer func() { + sc := -1 + if result.wcpvbrapr.Response.Response != nil { + sc = result.wcpvbrapr.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()) + } + + result.fn = client.listNextResults + 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.wcpvbrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceConnectionsClient", "List", resp, "Failure sending request") + return + } + + result.wcpvbrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceConnectionsClient", "List", resp, "Failure responding to request") + return + } + if result.wcpvbrapr.hasNextLink() && result.wcpvbrapr.IsEmpty() { + err = result.NextWithContext(ctx) + 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 = "2022-05-01" + 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 WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult, 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 WorkspaceConnectionsClient) listNextResults(ctx context.Context, lastResults WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult) (result WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult, err error) { + req, err := lastResults.workspaceConnectionPropertiesV2BasicResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceConnectionsClient", "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.WorkspaceConnectionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspaceConnectionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client WorkspaceConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, target string, category string) (result WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceConnectionsClient.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, target, category) + return +} diff --git a/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/workspacefeatures.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/workspacefeatures.go new file mode 100644 index 000000000000..4a6fac8284b5 --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/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 = "2022-05-01" + 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/machinelearningservices/mgmt/2022-05-01/machinelearningservices/workspaces.go b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/workspaces.go new file mode 100644 index 000000000000..f50d8982b7af --- /dev/null +++ b/services/machinelearningservices/mgmt/2022-05-01/machinelearningservices/workspaces.go @@ -0,0 +1,1346 @@ +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}, + }}, + }}, + }}, + {Target: "parameters.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Sku.Name", 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", result.Response(), "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 = "2022-05-01" + 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 + future.FutureAPI = &azure.Future{} + 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.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", result.Response(), "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 = "2022-05-01" + 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 + future.FutureAPI = &azure.Future{} + 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 +} + +// Diagnose sends the diagnose request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// parameters - the parameter of diagnosing workspace health +func (client WorkspacesClient) Diagnose(ctx context.Context, resourceGroupName string, workspaceName string, parameters *DiagnoseWorkspaceParameters) (result WorkspacesDiagnoseFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.Diagnose") + 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", "Diagnose", err.Error()) + } + + req, err := client.DiagnosePreparer(ctx, resourceGroupName, workspaceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "Diagnose", nil, "Failure preparing request") + return + } + + result, err = client.DiagnoseSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "Diagnose", result.Response(), "Failure sending request") + return + } + + return +} + +// DiagnosePreparer prepares the Diagnose request. +func (client WorkspacesClient) DiagnosePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters *DiagnoseWorkspaceParameters) (*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 = "2022-05-01" + 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}/diagnose", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DiagnoseSender sends the Diagnose request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) DiagnoseSender(req *http.Request) (future WorkspacesDiagnoseFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 +} + +// DiagnoseResponder handles the response to the Diagnose request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) DiagnoseResponder(resp *http.Response) (result DiagnoseResponseResult, 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 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 = "2022-05-01" + 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 = "2022-05-01" + 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 = "2022-05-01" + 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 = "2022-05-01" + 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 = "2022-05-01" + 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 list keys of a notebook. +// 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 = "2022-05-01" + 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 +} + +// ListOutboundNetworkDependenciesEndpoints sends the list outbound network dependencies endpoints request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client WorkspacesClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, workspaceName string) (result ExternalFQDNResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListOutboundNetworkDependenciesEndpoints") + 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", "ListOutboundNetworkDependenciesEndpoints", err.Error()) + } + + req, err := client.ListOutboundNetworkDependenciesEndpointsPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure sending request") + return + } + + result, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure responding to request") + return + } + + return +} + +// ListOutboundNetworkDependenciesEndpointsPreparer prepares the ListOutboundNetworkDependenciesEndpoints request. +func (client WorkspacesClient) ListOutboundNetworkDependenciesEndpointsPreparer(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 = "2022-05-01" + 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}/outboundNetworkDependenciesEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListOutboundNetworkDependenciesEndpointsSender sends the ListOutboundNetworkDependenciesEndpoints request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) ListOutboundNetworkDependenciesEndpointsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListOutboundNetworkDependenciesEndpointsResponder handles the response to the ListOutboundNetworkDependenciesEndpoints request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) ListOutboundNetworkDependenciesEndpointsResponder(resp *http.Response) (result ExternalFQDNResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListStorageAccountKeys list storage account keys of a workspace. +// 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 = "2022-05-01" + 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 prepare a notebook. +// 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", result.Response(), "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 = "2022-05-01" + 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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 = "2022-05-01" + 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 + future.FutureAPI = &azure.Future{} + 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 WorkspacesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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.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 + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "Update", result.Response(), "Failure sending 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 = "2022-05-01" + 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) (future WorkspacesUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 WorkspacesClient) UpdateResponder(resp *http.Response) (result Workspace, 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/machinelearning/mgmt/2016-05-01-preview/commitmentplans/CHANGELOG.md b/services/preview/machinelearning/mgmt/2016-05-01-preview/commitmentplans/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/machinelearning/mgmt/2016-05-01-preview/commitmentplans/CHANGELOG.md +++ b/services/preview/machinelearning/mgmt/2016-05-01-preview/commitmentplans/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/machinelearning/mgmt/2016-05-01-preview/commitmentplans/_meta.json b/services/preview/machinelearning/mgmt/2016-05-01-preview/commitmentplans/_meta.json index 1f17ddd2a5c5..f651fb39be5b 100644 --- a/services/preview/machinelearning/mgmt/2016-05-01-preview/commitmentplans/_meta.json +++ b/services/preview/machinelearning/mgmt/2016-05-01-preview/commitmentplans/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "1d8d2d736316b956adde1200f8cc31eaf73175eb", "readme": "/_/azure-rest-api-specs/specification/machinelearning/resource-manager/readme.md", "tag": "package-commitmentPlans-2016-05-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/machinelearning/mgmt/2016-05-01-preview/webservices/CHANGELOG.md b/services/preview/machinelearning/mgmt/2016-05-01-preview/webservices/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/machinelearning/mgmt/2016-05-01-preview/webservices/CHANGELOG.md +++ b/services/preview/machinelearning/mgmt/2016-05-01-preview/webservices/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/machinelearning/mgmt/2016-05-01-preview/webservices/_meta.json b/services/preview/machinelearning/mgmt/2016-05-01-preview/webservices/_meta.json index 2d610fced72d..464779e456e1 100644 --- a/services/preview/machinelearning/mgmt/2016-05-01-preview/webservices/_meta.json +++ b/services/preview/machinelearning/mgmt/2016-05-01-preview/webservices/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "1d8d2d736316b956adde1200f8cc31eaf73175eb", "readme": "/_/azure-rest-api-specs/specification/machinelearning/resource-manager/readme.md", "tag": "package-webservices-2016-05-preview", "use": "@microsoft.azure/autorest.go@2.1.187", 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 52911e4cc5e4..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,2 +1,2 @@ -# Change History +# Unreleased 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 f64ca6255ec3..0d6a48510da2 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": "1d8d2d736316b956adde1200f8cc31eaf73175eb", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2018-03-preview", "use": "@microsoft.azure/autorest.go@2.1.187", 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 52911e4cc5e4..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,2 +1,2 @@ -# Change History +# Unreleased 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 c95b0cb13521..698a9638e09e 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": "1d8d2d736316b956adde1200f8cc31eaf73175eb", "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", "tag": "package-2020-02-18-preview", "use": "@microsoft.azure/autorest.go@2.1.187", 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..2bcadaaafb03 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "1d8d2d736316b956adde1200f8cc31eaf73175eb", + "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", + "tag": "package-2021-03-01-preview", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-03-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --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=2.0.4421 --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..722987b488d8 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/compute.go @@ -0,0 +1,1103 @@ +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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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..4fad69b743b5 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/enums.go @@ -0,0 +1,1644 @@ +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 ( + // Direct ... + Direct DataBindingMode = "Direct" + // Download ... + Download DataBindingMode = "Download" + // EvalDownload ... + EvalDownload DataBindingMode = "EvalDownload" + // EvalMount ... + EvalMount DataBindingMode = "EvalMount" + // Mount ... + Mount DataBindingMode = "Mount" + // ReadOnlyMount ... + ReadOnlyMount DataBindingMode = "ReadOnlyMount" + // ReadWriteMount ... + ReadWriteMount DataBindingMode = "ReadWriteMount" + // Upload ... + Upload DataBindingMode = "Upload" +) + +// PossibleDataBindingModeValues returns an array of possible values for the DataBindingMode const type. +func PossibleDataBindingModeValues() []DataBindingMode { + return []DataBindingMode{Direct, Download, EvalDownload, EvalMount, Mount, ReadOnlyMount, ReadWriteMount, 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..975751282b05 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/jobs.go @@ -0,0 +1,530 @@ +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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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..06c7bc14dd99 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/labelingjobs.go @@ -0,0 +1,714 @@ +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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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.Value), + 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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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..d504e38f6b90 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/models.go @@ -0,0 +1,16164 @@ +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 - Target CPU usage for the autoscaler. + TargetUtilizationPercentage *int32 `json:"targetUtilizationPercentage,omitempty"` + // MaxInstances - Maximum number of instances for this deployment. + MaxInstances *int32 `json:"maxInstances,omitempty"` + // MinInstances - Minimum number of instances for this deployment. + 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 - [Required] Storage account name. + AccountName *string `json:"accountName,omitempty"` + // ContainerName - [Required] Storage account container name. + ContainerName *string `json:"containerName,omitempty"` + // Credentials - [Required] Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // Endpoint - [Required] Azure cloud endpoint for the storage account. + Endpoint *string `json:"endpoint,omitempty"` + // Protocol - [Required] 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 - [Required] Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // StoreName - [Required] 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 - [Required] Storage account name. + AccountName *string `json:"accountName,omitempty"` + // ContainerName - [Required] Storage account container name. + ContainerName *string `json:"containerName,omitempty"` + // Credentials - [Required] Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // Endpoint - [Required] Azure cloud endpoint for the storage account. + Endpoint *string `json:"endpoint,omitempty"` + // Protocol - [Required] 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 - [Required] Storage account name. + AccountName *string `json:"accountName,omitempty"` + // ContainerName - [Required] Storage account container name. + ContainerName *string `json:"containerName,omitempty"` + // Credentials - [Required] Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // Endpoint - [Required] Azure cloud endpoint for the storage account. + Endpoint *string `json:"endpoint,omitempty"` + // Protocol - [Required] 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 - [Required] Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // DatabaseName - [Required] Azure SQL database name. + DatabaseName *string `json:"databaseName,omitempty"` + // EnableSSL - Whether the Azure PostgreSQL server requires SSL. + EnableSSL *bool `json:"enableSSL,omitempty"` + // Endpoint - [Required] Azure cloud endpoint for the database. + Endpoint *string `json:"endpoint,omitempty"` + // PortNumber - [Required] Azure SQL server port. + PortNumber *int32 `json:"portNumber,omitempty"` + // ServerName - [Required] 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 - [Required] Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // DatabaseName - [Required] Azure SQL database name. + DatabaseName *string `json:"databaseName,omitempty"` + // Endpoint - [Required] Azure cloud endpoint for the database. + Endpoint *string `json:"endpoint,omitempty"` + // PortNumber - [Required] Azure SQL server port. + PortNumber *int32 `json:"portNumber,omitempty"` + // ServerName - [Required] 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 - Absolute distance allowed from the best performing run. + SlackAmount *float64 `json:"slackAmount,omitempty"` + // SlackFactor - Ratio of the allowed distance from the best performing run. + SlackFactor *float64 `json:"slackFactor,omitempty"` + // DelayEvaluation - Number of intervals by which to delay the first evaluation. + DelayEvaluation *int32 `json:"delayEvaluation,omitempty"` + // EvaluationInterval - Interval (number of runs) between policy evaluations. + 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 - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Properties - [Required] 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 - The link to the next page of BatchDeployment objects. If null, there are no additional pages. + 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 - [Required] 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"` + // 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 - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Properties - [Required] 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 - The link to the next page of BatchEndpoint objects. If null, there are no additional pages. + 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 - [Required] 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 - [Required] ID of the tenant to which the service principal belongs. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // Thumbprint - [Required] 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 - [Required] 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 - [Required] 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 - The link to the next page of CodeContainer objects. If null, there are no additional pages. + 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 - [Required] 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 - [Required] 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 - The link to the next page of CodeVersion objects. If null, there are no additional pages. + 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 - [Required] The command to execute on startup of the job. eg. "python train.py" + Command *string `json:"command,omitempty"` + // Compute - [Required] 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; Specifies the job provisioning state. 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 you are targeting. If not provided the resource will be deployed as Managed. + 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"` + // EnableNodePublicIP - Enable or disable node public IP address provisioning. 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 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 + } + if ci.EnableNodePublicIP != nil { + objectMap["enableNodePublicIp"] = ci.EnableNodePublicIP + } + 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 - [Required] 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 - The link to the next page of DataContainer objects. If null, there are no additional pages. + 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 - [Required] 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 - [Required] 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 - The link to the next page of DatastoreProperties objects. If null, there are no additional pages. + 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 - [Required] 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 - [Required] 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 - The link to the next page of DataVersion objects. If null, there are no additional pages. + 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 - The retrieved online deployment logs. + 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 - [Required] 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 - [Required] 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 - Number of intervals by which to delay the first evaluation. + DelayEvaluation *int32 `json:"delayEvaluation,omitempty"` + // EvaluationInterval - Interval (number of runs) between policy evaluations. + 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 - [Required] 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 - The link to the next page of EnvironmentContainer objects. If null, there are no additional pages. + 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 - [Required] 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 - The link to the next page of EnvironmentSpecificationVersion objects. If null, there are no additional pages. + 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 - Model flavor-specific data. + 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 - [Required] GlusterFS server address (can be the IP address or server name). + ServerAddress *string `json:"serverAddress,omitempty"` + // VolumeName - [Required] 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 - [Required] 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', 'ReadOnlyMount', 'ReadWriteMount', 'Direct', 'EvalMount', 'EvalDownload' + 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; Specifies the job provisioning state. 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 - [Required] 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 - The link to the next page of JobBase objects. If null, there are no additional pages. + 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 - Additional properties to set on the endpoint. + 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 - Resource requirements for each container instance within an online deployment. + 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 - Deployment container liveness/readiness probe configuration. + 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 - Online deployment scoring requests configuration. + RequestSettings *OnlineRequestSettings `json:"requestSettings,omitempty"` + // ScaleSettings - Online deployment scaling configuration. + 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 - [Required] 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; Specifies the labeling job provisioning state. 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 - [Required] 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 - The link to the next page of LabelingJob objects. If null, there are no additional pages. + 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 - Compute instance type. + InstanceType *string `json:"instanceType,omitempty"` + // ReadinessProbe - Deployment container liveness/readiness probe configuration. + 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 - Deployment container liveness/readiness probe configuration. + 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 - Online deployment scoring requests configuration. + RequestSettings *OnlineRequestSettings `json:"requestSettings,omitempty"` + // ScaleSettings - Online deployment scaling configuration. + 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 - Fixed number of instances for this deployment. + InstanceCount *int32 `json:"instanceCount,omitempty"` + // MaxInstances - Maximum number of instances for this deployment. + MaxInstances *int32 `json:"maxInstances,omitempty"` + // MinInstances - Minimum number of instances for this deployment. + 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 - Number of intervals by which to delay the first evaluation. + DelayEvaluation *int32 `json:"delayEvaluation,omitempty"` + // EvaluationInterval - Interval (number of runs) between policy evaluations. + 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 - [Required] 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 - The link to the next page of ModelContainer objects. If null, there are no additional pages. + 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 - [Required] 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 - [Required] 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 - The link to the next page of ModelVersion objects. If null, there are no additional pages. + 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 - Number of processes per MPI node. + 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 optimization objective. +type Objective struct { + // Goal - [Required] Defines supported metric goals for hyperparameter tuning. Possible values include: 'Minimize', 'Maximize' + Goal Goal `json:"goal,omitempty"` + // PrimaryMetric - [Required] Name of the metric to optimize. + 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 - Deployment container liveness/readiness probe configuration. + 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 - Online deployment scoring requests configuration. + RequestSettings *OnlineRequestSettings `json:"requestSettings,omitempty"` + // ScaleSettings - Online deployment scaling configuration. + 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 - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Properties - [Required] 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 - The link to the next page of OnlineDeployment objects. If null, there are no additional pages. + 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 - [Required] 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 - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Properties - [Required] 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 - The link to the next page of OnlineEndpoint objects. If null, there are no additional pages. + 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 online deployment scoring requests configuration. +type OnlineRequestSettings struct { + // MaxConcurrentRequestsPerInstance - The number of requests allowed to queue at once for this deployment. + 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 online deployment scaling configuration. +type BasicOnlineScaleSettings interface { + AsAutoScaleSettings() (*AutoScaleSettings, bool) + AsManualScaleSettings() (*ManualScaleSettings, bool) + AsOnlineScaleSettings() (*OnlineScaleSettings, bool) +} + +// OnlineScaleSettings online deployment scaling configuration. +type OnlineScaleSettings struct { + // MaxInstances - Maximum number of instances for this deployment. + MaxInstances *int32 `json:"maxInstances,omitempty"` + // MinInstances - Minimum number of instances for this deployment. + 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', 'ReadOnlyMount', 'ReadWriteMount', 'Direct', 'EvalMount', 'EvalDownload' + 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 - Resource requirements for each container instance within an online deployment. + ContainerResourceRequirements *ContainerResourceRequirements `json:"containerResourceRequirements,omitempty"` + // AppInsightsEnabled - Whether AppInsights telemetry is enabled for this online deployment. + AppInsightsEnabled *bool `json:"appInsightsEnabled,omitempty"` + // LivenessProbe - Deployment container liveness/readiness probe configuration. + LivenessProbe *ProbeSettings `json:"livenessProbe,omitempty"` + // RequestSettings - Online deployment scoring requests configuration. + RequestSettings *OnlineRequestSettings `json:"requestSettings,omitempty"` + // ScaleSettings - Online deployment scaling configuration. + 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 - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Location - The geo-location where the resource lives. + Location *string `json:"location,omitempty"` + // Properties - Additional attributes of the entity. + Properties *PartialBatchDeployment `json:"properties,omitempty"` + // Tags - Resource tags. + 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 - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Location - The geo-location where the resource lives. + Location *string `json:"location,omitempty"` + // Properties - Additional attributes of the entity. + Properties *PartialBatchEndpoint `json:"properties,omitempty"` + // Tags - Resource tags. + 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 - Deployment container liveness/readiness probe configuration. + ReadinessProbe *ProbeSettings `json:"readinessProbe,omitempty"` + // AppInsightsEnabled - Whether AppInsights telemetry is enabled for this online deployment. + AppInsightsEnabled *bool `json:"appInsightsEnabled,omitempty"` + // LivenessProbe - Deployment container liveness/readiness probe configuration. + LivenessProbe *ProbeSettings `json:"livenessProbe,omitempty"` + // RequestSettings - Online deployment scoring requests configuration. + RequestSettings *OnlineRequestSettings `json:"requestSettings,omitempty"` + // ScaleSettings - Online deployment scaling configuration. + 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 - Whether AppInsights telemetry is enabled for this online deployment. + AppInsightsEnabled *bool `json:"appInsightsEnabled,omitempty"` + // LivenessProbe - Deployment container liveness/readiness probe configuration. + LivenessProbe *ProbeSettings `json:"livenessProbe,omitempty"` + // RequestSettings - Online deployment scoring requests configuration. + RequestSettings *OnlineRequestSettings `json:"requestSettings,omitempty"` + // ScaleSettings - Online deployment scaling configuration. + 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 - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Location - The geo-location where the resource lives. + Location *string `json:"location,omitempty"` + // Properties - Additional attributes of the entity. + Properties BasicPartialOnlineDeployment `json:"properties,omitempty"` + // Tags - Resource tags. + 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 - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Location - The geo-location where the resource lives. + Location *string `json:"location,omitempty"` + // Properties - Additional attributes of the entity. + Properties *PartialOnlineEndpoint `json:"properties,omitempty"` + // Tags - Resource tags. + 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 deployment container liveness/readiness probe configuration. +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 - [Required] 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 - [Required] The path for the route. + Path *string `json:"path,omitempty"` + // Port - [Required] 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 - [Required] 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 - [Required] 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 - [Required] 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 - [Required] Type of the hyperparameter sampling algorithms. Possible values include: 'Grid', 'Random', 'Bayesian' + Algorithm SamplingAlgorithm `json:"algorithm,omitempty"` + // Compute - [Required] 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 - An upper bound on the number of trials performed in parallel. + MaxConcurrentTrials *int32 `json:"maxConcurrentTrials,omitempty"` + // MaxTotalTrials - An upper bound on the number of trials to perform. + MaxTotalTrials *int32 `json:"maxTotalTrials,omitempty"` + // Objective - [Required] Optimization objective. + 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 - [Required] 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; Specifies the job provisioning state. 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 - Number of parameter server tasks. + 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 - [Required] 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 - The percentage of runs to cancel at each evaluation interval. + TruncationPercentage *int32 `json:"truncationPercentage,omitempty"` + // DelayEvaluation - Number of intervals by which to delay the first evaluation. + DelayEvaluation *int32 `json:"delayEvaluation,omitempty"` + // EvaluationInterval - Interval (number of runs) between policy evaluations. + 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..97f0393badc5 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/onlinedeployments.go @@ -0,0 +1,645 @@ +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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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..e558282962f3 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/onlineendpoints.go @@ -0,0 +1,822 @@ +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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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..8110c95a34a9 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2021-03-01-preview/machinelearningservices/workspaces.go @@ -0,0 +1,1162 @@ +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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 + future.FutureAPI = &azure.Future{} + 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 +} diff --git a/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/CHANGELOG.md b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/_meta.json b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/_meta.json new file mode 100644 index 000000000000..e564e171d875 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "1d8d2d736316b956adde1200f8cc31eaf73175eb", + "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", + "tag": "package-2022-01-01-preview", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2022-01-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --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=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/client.go b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/client.go new file mode 100644 index 000000000000..fc286cf09070 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/client.go @@ -0,0 +1,42 @@ +// Package machinelearningservices implements the Azure ARM Machinelearningservices service API version +// 2022-01-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/2022-01-01-preview/machinelearningservices/compute.go b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/compute.go new file mode 100644 index 000000000000..6d351a805beb --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/compute.go @@ -0,0 +1,1014 @@ +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", result.Response(), "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 = "2022-01-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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 = "2022-01-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 + future.FutureAPI = &azure.Future{} + 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 = "2022-01-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 = "2022-01-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 = "2022-01-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 = "2022-01-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 ComputeRestartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeClient.Restart") + 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", "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 + } + + result, err = client.RestartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "Restart", result.Response(), "Failure sending 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 = "2022-01-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) (future ComputeRestartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 +} + +// 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, http.StatusAccepted), + 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", result.Response(), "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 = "2022-01-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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 = "2022-01-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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 = "2022-01-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 + future.FutureAPI = &azure.Future{} + 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 +} diff --git a/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/enums.go b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/enums.go new file mode 100644 index 000000000000..d953187ed7a0 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/enums.go @@ -0,0 +1,663 @@ +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} +} + +// AllowRecoverSoftDeletedWorkspace enumerates the values for allow recover soft deleted workspace. +type AllowRecoverSoftDeletedWorkspace string + +const ( + // False ... + False AllowRecoverSoftDeletedWorkspace = "False" + // True ... + True AllowRecoverSoftDeletedWorkspace = "True" +) + +// PossibleAllowRecoverSoftDeletedWorkspaceValues returns an array of possible values for the AllowRecoverSoftDeletedWorkspace const type. +func PossibleAllowRecoverSoftDeletedWorkspaceValues() []AllowRecoverSoftDeletedWorkspace { + return []AllowRecoverSoftDeletedWorkspace{False, True} +} + +// 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} +} + +// 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} +} + +// 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" + // ComputeTypeKubernetes ... + ComputeTypeKubernetes ComputeType = "Kubernetes" + // 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, ComputeTypeKubernetes, 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" + // ComputeTypeSynapseSpark1 ... + ComputeTypeSynapseSpark1 ComputeTypeBasicCompute = "SynapseSpark" + // 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, ComputeTypeSynapseSpark1, ComputeTypeVirtualMachine1} +} + +// ComputeTypeBasicComputeSecrets enumerates the values for compute type basic compute secrets. +type ComputeTypeBasicComputeSecrets string + +const ( + // ComputeTypeBasicComputeSecretsComputeTypeComputeSecrets ... + ComputeTypeBasicComputeSecretsComputeTypeComputeSecrets ComputeTypeBasicComputeSecrets = "ComputeSecrets" + // ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine ... + ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine ComputeTypeBasicComputeSecrets = "VirtualMachine" +) + +// PossibleComputeTypeBasicComputeSecretsValues returns an array of possible values for the ComputeTypeBasicComputeSecrets const type. +func PossibleComputeTypeBasicComputeSecretsValues() []ComputeTypeBasicComputeSecrets { + return []ComputeTypeBasicComputeSecrets{ComputeTypeBasicComputeSecretsComputeTypeComputeSecrets, ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + +// DiagnoseResultLevel enumerates the values for diagnose result level. +type DiagnoseResultLevel string + +const ( + // Error ... + Error DiagnoseResultLevel = "Error" + // Information ... + Information DiagnoseResultLevel = "Information" + // Warning ... + Warning DiagnoseResultLevel = "Warning" +) + +// PossibleDiagnoseResultLevelValues returns an array of possible values for the DiagnoseResultLevel const type. +func PossibleDiagnoseResultLevelValues() []DiagnoseResultLevel { + return []DiagnoseResultLevel{Error, Information, Warning} +} + +// 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} +} + +// 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} +} + +// 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} +} + +// OperationName enumerates the values for operation name. +type OperationName string + +const ( + // Create ... + Create OperationName = "Create" + // Delete ... + Delete OperationName = "Delete" + // Reimage ... + Reimage OperationName = "Reimage" + // Restart ... + Restart OperationName = "Restart" + // Start ... + Start OperationName = "Start" + // Stop ... + Stop OperationName = "Stop" +) + +// PossibleOperationNameValues returns an array of possible values for the OperationName const type. +func PossibleOperationNameValues() []OperationName { + return []OperationName{Create, Delete, Reimage, Restart, Start, Stop} +} + +// 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} +} + +// OsType enumerates the values for os type. +type OsType string + +const ( + // Linux ... + Linux OsType = "Linux" + // Windows ... + Windows OsType = "Windows" +) + +// PossibleOsTypeValues returns an array of possible values for the OsType const type. +func PossibleOsTypeValues() []OsType { + return []OsType{Linux, Windows} +} + +// 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} +} + +// PublicNetworkAccess enumerates the values for public network access. +type PublicNetworkAccess string + +const ( + // PublicNetworkAccessDisabled ... + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + // PublicNetworkAccessEnabled ... + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} +} + +// 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} +} + +// 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} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // None ... + None ResourceIdentityType = "None" + // SystemAssigned ... + SystemAssigned ResourceIdentityType = "SystemAssigned" + // SystemAssignedUserAssigned ... + SystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned,UserAssigned" + // UserAssigned ... + UserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned} +} + +// SoftDeleteEnabled enumerates the values for soft delete enabled. +type SoftDeleteEnabled string + +const ( + // SoftDeleteEnabledFalse ... + SoftDeleteEnabledFalse SoftDeleteEnabled = "False" + // SoftDeleteEnabledTrue ... + SoftDeleteEnabledTrue SoftDeleteEnabled = "True" +) + +// PossibleSoftDeleteEnabledValues returns an array of possible values for the SoftDeleteEnabled const type. +func PossibleSoftDeleteEnabledValues() []SoftDeleteEnabled { + return []SoftDeleteEnabled{SoftDeleteEnabledFalse, SoftDeleteEnabledTrue} +} + +// 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} +} + +// UnderlyingResourceAction enumerates the values for underlying resource action. +type UnderlyingResourceAction string + +const ( + // UnderlyingResourceActionDelete ... + UnderlyingResourceActionDelete UnderlyingResourceAction = "Delete" + // UnderlyingResourceActionDetach ... + UnderlyingResourceActionDetach UnderlyingResourceAction = "Detach" +) + +// PossibleUnderlyingResourceActionValues returns an array of possible values for the UnderlyingResourceAction const type. +func PossibleUnderlyingResourceActionValues() []UnderlyingResourceAction { + return []UnderlyingResourceAction{UnderlyingResourceActionDelete, UnderlyingResourceActionDetach} +} + +// 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/2022-01-01-preview/machinelearningservices/machinelearningservicesapi/interfaces.go b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/machinelearningservicesapi/interfaces.go new file mode 100644 index 000000000000..a77b66a28be7 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/machinelearningservicesapi/interfaces.go @@ -0,0 +1,127 @@ +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/2022-01-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) + Diagnose(ctx context.Context, resourceGroupName string, workspaceName string, parameters *machinelearningservices.DiagnoseWorkspaceParameters) (result machinelearningservices.WorkspacesDiagnoseFuture, 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) + ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, workspaceName string) (result machinelearningservices.ExternalFQDNResponse, 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 machinelearningservices.ComputeRestartFuture, 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) +} + +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) + +// 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/2022-01-01-preview/machinelearningservices/models.go b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/models.go new file mode 100644 index 000000000000..d8be4ef53b00 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/models.go @@ -0,0 +1,5416 @@ +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" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices" + +// 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', 'ComputeTypeSynapseSpark1' + 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 +} + +// AsSynapseSpark is the BasicCompute implementation for AKS. +func (a AKS) AsSynapseSpark() (*SynapseSpark, 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 { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // 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"` +} + +// AksComputeSecretsProperties properties of AksComputeSecrets +type AksComputeSecretsProperties 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"` +} + +// 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 - Properties of AmlCompute + 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', 'ComputeTypeSynapseSpark1' + 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 +} + +// AsSynapseSpark is the BasicCompute implementation for AmlCompute. +func (ac AmlCompute) AsSynapseSpark() (*SynapseSpark, 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 result of AmlCompute Nodes +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"` +} + +// MarshalJSON is the custom marshaler for AmlComputeNodesInformation. +func (acni AmlComputeNodesInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// 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: 'Linux', 'Windows' + 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 (acp AmlComputeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if acp.OsType != "" { + objectMap["osType"] = acp.OsType + } + if acp.VMSize != nil { + objectMap["vmSize"] = acp.VMSize + } + if acp.VMPriority != "" { + objectMap["vmPriority"] = acp.VMPriority + } + if acp.VirtualMachineImage != nil { + objectMap["virtualMachineImage"] = acp.VirtualMachineImage + } + if acp.IsolatedNetwork != nil { + objectMap["isolatedNetwork"] = acp.IsolatedNetwork + } + if acp.ScaleSettings != nil { + objectMap["scaleSettings"] = acp.ScaleSettings + } + if acp.UserAccountCredentials != nil { + objectMap["userAccountCredentials"] = acp.UserAccountCredentials + } + if acp.Subnet != nil { + objectMap["subnet"] = acp.Subnet + } + if acp.RemoteLoginPortPublicAccess != "" { + objectMap["remoteLoginPortPublicAccess"] = acp.RemoteLoginPortPublicAccess + } + if acp.EnableNodePublicIP != nil { + objectMap["enableNodePublicIp"] = acp.EnableNodePublicIP + } + return json.Marshal(objectMap) +} + +// 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"` +} + +// 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"` +} + +// 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) +} + +// 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 { + // Properties - Properties of ClusterUpdate + Properties *ScaleSettingsInformation `json:"properties,omitempty"` +} + +// 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) + AsSynapseSpark() (*SynapseSpark, 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', 'ComputeTypeSynapseSpark1' + 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 + case string(ComputeTypeSynapseSpark1): + var ss SynapseSpark + err := json.Unmarshal(body, &ss) + return ss, 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 +} + +// AsSynapseSpark is the BasicCompute implementation for Compute. +func (c Compute) AsSynapseSpark() (*SynapseSpark, 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 +} + +// 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 - Properties of ComputeInstance + 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', 'ComputeTypeSynapseSpark1' + 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 +} + +// AsSynapseSpark is the BasicCompute implementation for ComputeInstance. +func (ci ComputeInstance) AsSynapseSpark() (*SynapseSpark, 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: 'Create', 'Start', 'Stop', 'Restart', 'Reimage', 'Delete' + 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"` +} + +// MarshalJSON is the custom marshaler for ComputeInstanceProperties. +func (cip ComputeInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cip.VMSize != nil { + objectMap["vmSize"] = cip.VMSize + } + if cip.Subnet != nil { + objectMap["subnet"] = cip.Subnet + } + if cip.ApplicationSharingPolicy != "" { + objectMap["applicationSharingPolicy"] = cip.ApplicationSharingPolicy + } + if cip.SSHSettings != nil { + objectMap["sshSettings"] = cip.SSHSettings + } + if cip.ComputeInstanceAuthorizationType != "" { + objectMap["computeInstanceAuthorizationType"] = cip.ComputeInstanceAuthorizationType + } + if cip.PersonalComputeInstanceSettings != nil { + objectMap["personalComputeInstanceSettings"] = cip.PersonalComputeInstanceSettings + } + if cip.SetupScripts != nil { + objectMap["setupScripts"] = cip.SetupScripts + } + 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) +} + +// 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 - System data + 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 +} + +// ComputeRestartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ComputeRestartFuture 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 *ComputeRestartFuture) 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 ComputeRestartFuture.Result. +func (future *ComputeRestartFuture) 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.ComputeRestartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.ComputeRestartFuture") + return + } + ar.Response = future.Response() + return +} + +// BasicComputeSecrets secrets related to a Machine Learning compute. Might differ for every type of compute. +type BasicComputeSecrets interface { + AsVirtualMachineSecrets() (*VirtualMachineSecrets, 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', 'ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine' + 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(ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine): + var vms VirtualMachineSecrets + err := json.Unmarshal(body, &vms) + return vms, 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) +} + +// AsVirtualMachineSecrets is the BasicComputeSecrets implementation for ComputeSecrets. +func (cs ComputeSecrets) AsVirtualMachineSecrets() (*VirtualMachineSecrets, 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 +} + +// 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"` +} + +// 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', 'ComputeTypeSynapseSpark1' + 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 +} + +// AsSynapseSpark is the BasicCompute implementation for Databricks. +func (d Databricks) AsSynapseSpark() (*SynapseSpark, 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 { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // DatabricksAccessToken - access token for databricks account. + DatabricksAccessToken *string `json:"databricksAccessToken,omitempty"` +} + +// DatabricksComputeSecretsProperties properties of Databricks Compute Secrets +type DatabricksComputeSecretsProperties struct { + // DatabricksAccessToken - access token for databricks account. + DatabricksAccessToken *string `json:"databricksAccessToken,omitempty"` +} + +// DatabricksProperties properties of Databricks +type DatabricksProperties struct { + // DatabricksAccessToken - Databricks access token + DatabricksAccessToken *string `json:"databricksAccessToken,omitempty"` + // WorkspaceURL - Workspace Url + WorkspaceURL *string `json:"workspaceUrl,omitempty"` +} + +// 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', 'ComputeTypeSynapseSpark1' + 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 +} + +// AsSynapseSpark is the BasicCompute implementation for DataFactory. +func (df DataFactory) AsSynapseSpark() (*SynapseSpark, 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', 'ComputeTypeSynapseSpark1' + 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 +} + +// AsSynapseSpark is the BasicCompute implementation for DataLakeAnalytics. +func (dla DataLakeAnalytics) AsSynapseSpark() (*SynapseSpark, bool) { + return nil, false +} + +// 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"` +} + +// DiagnoseRequestProperties ... +type DiagnoseRequestProperties struct { + // Udr - Setting for diagnosing user defined routing + Udr map[string]interface{} `json:"udr"` + // Nsg - Setting for diagnosing network security group + Nsg map[string]interface{} `json:"nsg"` + // ResourceLock - Setting for diagnosing resource lock + ResourceLock map[string]interface{} `json:"resourceLock"` + // DNSResolution - Setting for diagnosing dns resolution + DNSResolution map[string]interface{} `json:"dnsResolution"` + // StorageAccount - Setting for diagnosing dependent storage account + StorageAccount map[string]interface{} `json:"storageAccount"` + // KeyVault - Setting for diagnosing dependent key vault + KeyVault map[string]interface{} `json:"keyVault"` + // ContainerRegistry - Setting for diagnosing dependent container registry + ContainerRegistry map[string]interface{} `json:"containerRegistry"` + // ApplicationInsights - Setting for diagnosing dependent application insights + ApplicationInsights map[string]interface{} `json:"applicationInsights"` + // Others - Setting for diagnosing unclassified category of problems + Others map[string]interface{} `json:"others"` +} + +// MarshalJSON is the custom marshaler for DiagnoseRequestProperties. +func (drp DiagnoseRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if drp.Udr != nil { + objectMap["udr"] = drp.Udr + } + if drp.Nsg != nil { + objectMap["nsg"] = drp.Nsg + } + if drp.ResourceLock != nil { + objectMap["resourceLock"] = drp.ResourceLock + } + if drp.DNSResolution != nil { + objectMap["dnsResolution"] = drp.DNSResolution + } + if drp.StorageAccount != nil { + objectMap["storageAccount"] = drp.StorageAccount + } + if drp.KeyVault != nil { + objectMap["keyVault"] = drp.KeyVault + } + if drp.ContainerRegistry != nil { + objectMap["containerRegistry"] = drp.ContainerRegistry + } + if drp.ApplicationInsights != nil { + objectMap["applicationInsights"] = drp.ApplicationInsights + } + if drp.Others != nil { + objectMap["others"] = drp.Others + } + return json.Marshal(objectMap) +} + +// DiagnoseResponseResult ... +type DiagnoseResponseResult struct { + autorest.Response `json:"-"` + Value *DiagnoseResponseResultValue `json:"value,omitempty"` +} + +// DiagnoseResponseResultValue ... +type DiagnoseResponseResultValue struct { + UserDefinedRouteResults *[]DiagnoseResult `json:"userDefinedRouteResults,omitempty"` + NetworkSecurityRuleResults *[]DiagnoseResult `json:"networkSecurityRuleResults,omitempty"` + ResourceLockResults *[]DiagnoseResult `json:"resourceLockResults,omitempty"` + DNSResolutionResults *[]DiagnoseResult `json:"dnsResolutionResults,omitempty"` + StorageAccountResults *[]DiagnoseResult `json:"storageAccountResults,omitempty"` + KeyVaultResults *[]DiagnoseResult `json:"keyVaultResults,omitempty"` + ContainerRegistryResults *[]DiagnoseResult `json:"containerRegistryResults,omitempty"` + ApplicationInsightsResults *[]DiagnoseResult `json:"applicationInsightsResults,omitempty"` + OtherResults *[]DiagnoseResult `json:"otherResults,omitempty"` +} + +// DiagnoseResult result of Diagnose +type DiagnoseResult struct { + // Code - READ-ONLY; Code for workspace setup error + Code *string `json:"code,omitempty"` + // Level - READ-ONLY; Level of workspace setup error. Possible values include: 'Warning', 'Error', 'Information' + Level DiagnoseResultLevel `json:"level,omitempty"` + // Message - READ-ONLY; Message of workspace setup error + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for DiagnoseResult. +func (dr DiagnoseResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DiagnoseWorkspaceParameters parameters to diagnose a workspace +type DiagnoseWorkspaceParameters struct { + // Value - Value of Parameters + Value *DiagnoseRequestProperties `json:"value,omitempty"` +} + +// 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"` + // CosmosDbResourceID - The Bring-Your-Own cosmosdb account that customer brings to store data + CosmosDbResourceID *string `json:"cosmosDbResourceId,omitempty"` + // StorageAccountResourceID - The Bring-Your-Own storage account that customer brings to store data + StorageAccountResourceID *string `json:"storageAccountResourceId,omitempty"` + // SearchAccountResourceID - The Bring-Your-Own search account that customer brings to store index + SearchAccountResourceID *string `json:"searchAccountResourceId,omitempty"` +} + +// 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"` +} + +// ExternalFQDNResponse ... +type ExternalFQDNResponse struct { + autorest.Response `json:"-"` + Value *[]FQDNEndpoints `json:"value,omitempty"` +} + +// FQDNEndpoint ... +type FQDNEndpoint struct { + DomainName *string `json:"domainName,omitempty"` + EndpointDetails *[]FQDNEndpointDetail `json:"endpointDetails,omitempty"` +} + +// FQDNEndpointDetail ... +type FQDNEndpointDetail struct { + Port *int32 `json:"port,omitempty"` +} + +// FQDNEndpoints ... +type FQDNEndpoints struct { + Properties *FQDNEndpointsProperties `json:"properties,omitempty"` +} + +// FQDNEndpointsProperties ... +type FQDNEndpointsProperties struct { + Category *string `json:"category,omitempty"` + Endpoints *[]FQDNEndpoint `json:"endpoints,omitempty"` +} + +// 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', 'ComputeTypeSynapseSpark1' + 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 +} + +// AsSynapseSpark is the BasicCompute implementation for HDInsight. +func (hi HDInsight) AsSynapseSpark() (*SynapseSpark, 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 hDInsight compute properties +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"` +} + +// 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: 'SystemAssigned', 'SystemAssignedUserAssigned', 'UserAssigned', 'None' + 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) +} + +// 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"` +} + +// InstanceTypeSchema instance type schema. +type InstanceTypeSchema struct { + // NodeSelector - Node Selector + NodeSelector map[string]*string `json:"nodeSelector"` + // Resources - Resource requests/limits for this instance type + Resources *InstanceTypeSchemaResources `json:"resources,omitempty"` +} + +// MarshalJSON is the custom marshaler for InstanceTypeSchema. +func (its InstanceTypeSchema) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if its.NodeSelector != nil { + objectMap["nodeSelector"] = its.NodeSelector + } + if its.Resources != nil { + objectMap["resources"] = its.Resources + } + return json.Marshal(objectMap) +} + +// InstanceTypeSchemaResources resource requests/limits for this instance type +type InstanceTypeSchemaResources struct { + // Requests - Resource requests for this instance type + Requests map[string]*string `json:"requests"` + // Limits - Resource limits for this instance type + Limits map[string]*string `json:"limits"` +} + +// MarshalJSON is the custom marshaler for InstanceTypeSchemaResources. +func (its InstanceTypeSchemaResources) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if its.Requests != nil { + objectMap["requests"] = its.Requests + } + if its.Limits != nil { + objectMap["limits"] = its.Limits + } + return json.Marshal(objectMap) +} + +// 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"` +} + +// Kubernetes a Machine Learning compute based on Kubernetes Compute. +type Kubernetes struct { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', '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 - Properties of Kubernetes + Properties *KubernetesProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Kubernetes. +func (kVar Kubernetes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kVar.ComputeType != "" { + objectMap["computeType"] = kVar.ComputeType + } + if kVar.ComputeLocation != nil { + objectMap["computeLocation"] = kVar.ComputeLocation + } + if kVar.Description != nil { + objectMap["description"] = kVar.Description + } + if kVar.ResourceID != nil { + objectMap["resourceId"] = kVar.ResourceID + } + if kVar.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = kVar.DisableLocalAuth + } + if kVar.Properties != nil { + objectMap["properties"] = kVar.Properties + } + return json.Marshal(objectMap) +} + +// KubernetesProperties kubernetes properties +type KubernetesProperties struct { + // RelayConnectionString - Relay connection string. + RelayConnectionString *string `json:"relayConnectionString,omitempty"` + // ServiceBusConnectionString - ServiceBus connection string. + ServiceBusConnectionString *string `json:"serviceBusConnectionString,omitempty"` + // ExtensionPrincipalID - Extension principal-id. + ExtensionPrincipalID *string `json:"extensionPrincipalId,omitempty"` + // ExtensionInstanceReleaseTrain - Extension instance release train. + ExtensionInstanceReleaseTrain *string `json:"extensionInstanceReleaseTrain,omitempty"` + // VcName - VC name. + VcName *string `json:"vcName,omitempty"` + // Namespace - Compute namespace + Namespace *string `json:"namespace,omitempty"` + // DefaultInstanceType - Default instance type + DefaultInstanceType *string `json:"defaultInstanceType,omitempty"` + // InstanceTypes - Instance Type Schema + InstanceTypes map[string]*InstanceTypeSchema `json:"instanceTypes"` +} + +// MarshalJSON is the custom marshaler for KubernetesProperties. +func (kp KubernetesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kp.RelayConnectionString != nil { + objectMap["relayConnectionString"] = kp.RelayConnectionString + } + if kp.ServiceBusConnectionString != nil { + objectMap["serviceBusConnectionString"] = kp.ServiceBusConnectionString + } + if kp.ExtensionPrincipalID != nil { + objectMap["extensionPrincipalId"] = kp.ExtensionPrincipalID + } + if kp.ExtensionInstanceReleaseTrain != nil { + objectMap["extensionInstanceReleaseTrain"] = kp.ExtensionInstanceReleaseTrain + } + if kp.VcName != nil { + objectMap["vcName"] = kp.VcName + } + if kp.Namespace != nil { + objectMap["namespace"] = kp.Namespace + } + if kp.DefaultInstanceType != nil { + objectMap["defaultInstanceType"] = kp.DefaultInstanceType + } + if kp.InstanceTypes != nil { + objectMap["instanceTypes"] = kp.InstanceTypes + } + return json.Marshal(objectMap) +} + +// KubernetesSchema kubernetes Compute Schema +type KubernetesSchema struct { + // Properties - Properties of Kubernetes + Properties *KubernetesProperties `json:"properties,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, + } +} + +// 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) +} + +// 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"` +} + +// 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"` +} + +// 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"` +} + +// 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 - System data + 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 - System data + 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"` +} + +// 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) +} + +// 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"` +} + +// 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"` +} + +// 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) +} + +// 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"` +} + +// ScaleSettingsInformation desired scale settings for the amlCompute. +type ScaleSettingsInformation struct { + ScaleSettings *ScaleSettings `json:"scaleSettings,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"` +} + +// 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, + } +} + +// 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"` +} + +// SynapseSpark a SynapseSpark compute. +type SynapseSpark struct { + Properties *SynapseSparkProperties `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', 'ComputeTypeSynapseSpark1' + ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SynapseSpark. +func (ss SynapseSpark) MarshalJSON() ([]byte, error) { + ss.ComputeType = ComputeTypeSynapseSpark1 + objectMap := make(map[string]interface{}) + if ss.Properties != nil { + objectMap["properties"] = ss.Properties + } + 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.ComputeType != "" { + objectMap["computeType"] = ss.ComputeType + } + return json.Marshal(objectMap) +} + +// AsAKS is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsAKS() (*AKS, bool) { + return nil, false +} + +// AsAmlCompute is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsAmlCompute() (*AmlCompute, bool) { + return nil, false +} + +// AsComputeInstance is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsComputeInstance() (*ComputeInstance, bool) { + return nil, false +} + +// AsVirtualMachine is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsVirtualMachine() (*VirtualMachine, bool) { + return nil, false +} + +// AsHDInsight is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsHDInsight() (*HDInsight, bool) { + return nil, false +} + +// AsDataFactory is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsDataFactory() (*DataFactory, bool) { + return nil, false +} + +// AsDatabricks is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsDatabricks() (*Databricks, bool) { + return nil, false +} + +// AsDataLakeAnalytics is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsDataLakeAnalytics() (*DataLakeAnalytics, bool) { + return nil, false +} + +// AsSynapseSpark is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsSynapseSpark() (*SynapseSpark, bool) { + return &ss, true +} + +// AsCompute is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsCompute() (*Compute, bool) { + return nil, false +} + +// AsBasicCompute is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsBasicCompute() (BasicCompute, bool) { + return &ss, true +} + +// SynapseSparkProperties ... +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: 'User', 'Application', 'ManagedIdentity', 'Key' + 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: 'User', 'Application', 'ManagedIdentity', 'Key' + 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) +} + +// 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) +} + +// 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) +} + +// 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', 'ComputeTypeSynapseSpark1' + 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 +} + +// AsSynapseSpark is the BasicCompute implementation for VirtualMachine. +func (VM VirtualMachine) AsSynapseSpark() (*SynapseSpark, 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', 'ComputeTypeBasicComputeSecretsComputeTypeVirtualMachine' + 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) +} + +// AsVirtualMachineSecrets is the BasicComputeSecrets implementation for VirtualMachineSecrets. +func (vms VirtualMachineSecrets) AsVirtualMachineSecrets() (*VirtualMachineSecrets, bool) { + return &vms, true +} + +// 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"` + // SupportedComputeTypes - Specifies the compute types supported by the virtual machine size. + SupportedComputeTypes *[]string `json:"supportedComputeTypes,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 + } + if vms.SupportedComputeTypes != nil { + objectMap["supportedComputeTypes"] = vms.SupportedComputeTypes + } + 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 - System data + 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"` + // SoftDeleteEnabled - create a workspace with soft delete capability. Possible values include: 'SoftDeleteEnabledTrue', 'SoftDeleteEnabledFalse' + SoftDeleteEnabled SoftDeleteEnabled `json:"softDeleteEnabled,omitempty"` + // AllowRecoverSoftDeletedWorkspace - Allow a soft deleted workspace to be recovered. Possible values include: 'True', 'False' + AllowRecoverSoftDeletedWorkspace AllowRecoverSoftDeletedWorkspace `json:"allowRecoverSoftDeletedWorkspace,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"` + // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,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"` + // StorageHnsEnabled - READ-ONLY; If the storage associated with the workspace has hierarchical namespace(HNS) enabled. + StorageHnsEnabled *bool `json:"storageHnsEnabled,omitempty"` + // MlFlowTrackingURI - READ-ONLY; The URI associated with this workspace that machine learning flow must point at to set up tracking. + MlFlowTrackingURI *string `json:"mlFlowTrackingUri,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.SoftDeleteEnabled != "" { + objectMap["softDeleteEnabled"] = wp.SoftDeleteEnabled + } + if wp.AllowRecoverSoftDeletedWorkspace != "" { + objectMap["allowRecoverSoftDeletedWorkspace"] = wp.AllowRecoverSoftDeletedWorkspace + } + if wp.ImageBuildCompute != nil { + objectMap["imageBuildCompute"] = wp.ImageBuildCompute + } + if wp.AllowPublicAccessWhenBehindVnet != nil { + objectMap["allowPublicAccessWhenBehindVnet"] = wp.AllowPublicAccessWhenBehindVnet + } + if wp.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = wp.PublicNetworkAccess + } + 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"` + // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,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 +} + +// WorkspacesDiagnoseFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WorkspacesDiagnoseFuture 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) (DiagnoseResponseResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WorkspacesDiagnoseFuture) 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 WorkspacesDiagnoseFuture.Result. +func (future *WorkspacesDiagnoseFuture) result(client WorkspacesClient) (drr DiagnoseResponseResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesDiagnoseFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + drr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.WorkspacesDiagnoseFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if drr.Response.Response, err = future.GetResult(sender); err == nil && drr.Response.Response.StatusCode != http.StatusNoContent { + drr, err = client.DiagnoseResponder(drr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesDiagnoseFuture", "Result", drr.Response.Response, "Failure responding to request") + } + } + 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/2022-01-01-preview/machinelearningservices/operations.go b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/operations.go new file mode 100644 index 000000000000..83f987fad6e9 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-01-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 = "2022-01-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/2022-01-01-preview/machinelearningservices/privateendpointconnections.go b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/privateendpointconnections.go new file mode 100644 index 000000000000..fadfb5d1fc20 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-01-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 = "2022-01-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 = "2022-01-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 = "2022-01-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 = "2022-01-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/2022-01-01-preview/machinelearningservices/privatelinkresources.go b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/privatelinkresources.go new file mode 100644 index 000000000000..81f2d7a18da5 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-01-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 = "2022-01-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/2022-01-01-preview/machinelearningservices/quotas.go b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/quotas.go new file mode 100644 index 000000000000..785b1f2798fa --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-01-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 = "2022-01-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 = "2022-01-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/2022-01-01-preview/machinelearningservices/usages.go b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/usages.go new file mode 100644 index 000000000000..7ac0529b878b --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-01-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 = "2022-01-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/2022-01-01-preview/machinelearningservices/version.go b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/version.go new file mode 100644 index 000000000000..061a81189d8f --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-01-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/2022-01-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/2022-01-01-preview/machinelearningservices/virtualmachinesizes.go b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/virtualmachinesizes.go new file mode 100644 index 000000000000..f59fd14827b8 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-01-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 = "2022-01-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/2022-01-01-preview/machinelearningservices/workspaceconnections.go b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/workspaceconnections.go new file mode 100644 index 000000000000..d4e6a9b9b270 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-01-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 = "2022-01-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 = "2022-01-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 = "2022-01-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 = "2022-01-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/2022-01-01-preview/machinelearningservices/workspacefeatures.go b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/workspacefeatures.go new file mode 100644 index 000000000000..5a400fb9bcb8 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-01-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 = "2022-01-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/2022-01-01-preview/machinelearningservices/workspaces.go b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/workspaces.go new file mode 100644 index 000000000000..16ba741baa33 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/workspaces.go @@ -0,0 +1,1341 @@ +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", result.Response(), "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 = "2022-01-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 + future.FutureAPI = &azure.Future{} + 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.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", result.Response(), "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 = "2022-01-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 + future.FutureAPI = &azure.Future{} + 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 +} + +// Diagnose sends the diagnose request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// parameters - the parameter of diagnosing workspace health +func (client WorkspacesClient) Diagnose(ctx context.Context, resourceGroupName string, workspaceName string, parameters *DiagnoseWorkspaceParameters) (result WorkspacesDiagnoseFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.Diagnose") + 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", "Diagnose", err.Error()) + } + + req, err := client.DiagnosePreparer(ctx, resourceGroupName, workspaceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "Diagnose", nil, "Failure preparing request") + return + } + + result, err = client.DiagnoseSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "Diagnose", result.Response(), "Failure sending request") + return + } + + return +} + +// DiagnosePreparer prepares the Diagnose request. +func (client WorkspacesClient) DiagnosePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters *DiagnoseWorkspaceParameters) (*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 = "2022-01-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}/diagnose", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DiagnoseSender sends the Diagnose request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) DiagnoseSender(req *http.Request) (future WorkspacesDiagnoseFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 +} + +// DiagnoseResponder handles the response to the Diagnose request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) DiagnoseResponder(resp *http.Response) (result DiagnoseResponseResult, 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 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 = "2022-01-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 = "2022-01-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 = "2022-01-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 = "2022-01-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 = "2022-01-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 list keys of a notebook. +// 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 = "2022-01-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 +} + +// ListOutboundNetworkDependenciesEndpoints sends the list outbound network dependencies endpoints request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client WorkspacesClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, workspaceName string) (result ExternalFQDNResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListOutboundNetworkDependenciesEndpoints") + 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", "ListOutboundNetworkDependenciesEndpoints", err.Error()) + } + + req, err := client.ListOutboundNetworkDependenciesEndpointsPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure sending request") + return + } + + result, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure responding to request") + return + } + + return +} + +// ListOutboundNetworkDependenciesEndpointsPreparer prepares the ListOutboundNetworkDependenciesEndpoints request. +func (client WorkspacesClient) ListOutboundNetworkDependenciesEndpointsPreparer(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 = "2022-01-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}/outboundNetworkDependenciesEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListOutboundNetworkDependenciesEndpointsSender sends the ListOutboundNetworkDependenciesEndpoints request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) ListOutboundNetworkDependenciesEndpointsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListOutboundNetworkDependenciesEndpointsResponder handles the response to the ListOutboundNetworkDependenciesEndpoints request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) ListOutboundNetworkDependenciesEndpointsResponder(resp *http.Response) (result ExternalFQDNResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListStorageAccountKeys list storage account keys of a workspace. +// 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 = "2022-01-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 prepare a notebook. +// 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", result.Response(), "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 = "2022-01-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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 = "2022-01-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 + future.FutureAPI = &azure.Future{} + 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 = "2022-01-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/2022-01-01-preview/machinelearningservices/workspaceskus.go b/services/preview/machinelearningservices/mgmt/2022-01-01-preview/machinelearningservices/workspaceskus.go new file mode 100644 index 000000000000..662dfeee8530 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-01-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 = "2022-01-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 +} diff --git a/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/CHANGELOG.md b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/_meta.json b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/_meta.json new file mode 100644 index 000000000000..ef6845018c45 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "1d8d2d736316b956adde1200f8cc31eaf73175eb", + "readme": "/_/azure-rest-api-specs/specification/machinelearningservices/resource-manager/readme.md", + "tag": "package-2022-02-01-preview", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2022-02-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --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=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/batchdeployments.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/batchdeployments.go new file mode 100644 index 000000000000..967195514687 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/batchdeployments.go @@ -0,0 +1,556 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference endpoint name +// deploymentName - the identifier for the Batch inference deployment. +// body - batch inference deployment definition object. +func (client BatchDeploymentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, body BatchDeploymentTrackedResource) (result BatchDeploymentsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchDeploymentsClient.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: 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: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchDeploymentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, endpointName, deploymentName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BatchDeploymentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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 = "2022-02-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}/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) (future BatchDeploymentsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - endpoint name +// deploymentName - inference deployment identifier. +func (client BatchDeploymentsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string) (result BatchDeploymentsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchDeploymentsClient.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.BatchDeploymentsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, endpointName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BatchDeploymentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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 = "2022-02-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) (future BatchDeploymentsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 BatchDeploymentsClient) 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - endpoint name +// deploymentName - the identifier for the Batch deployments. +func (client BatchDeploymentsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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, resourceGroupName, workspaceName, endpointName, deploymentName) + 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, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - endpoint name +// orderBy - ordering of list. +// top - top of list. +// skip - continuation token for pagination. +func (client BatchDeploymentsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName, 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, resourceGroupName string, workspaceName string, endpointName 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 = "2022-02-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, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName, orderBy, top, skip) + return +} + +// Update sends the update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference endpoint name +// deploymentName - the identifier for the Batch inference deployment. +// body - batch inference deployment definition object. +func (client BatchDeploymentsClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, body PartialBatchDeploymentPartialTrackedResource) (result BatchDeploymentsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchDeploymentsClient.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}}}, + {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}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchDeploymentsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, endpointName, deploymentName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client BatchDeploymentsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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 = "2022-02-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) (future BatchDeploymentsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 BatchDeploymentsClient) UpdateResponder(resp *http.Response) (result BatchDeploymentTrackedResource, 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/2022-02-01-preview/machinelearningservices/batchendpoints.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/batchendpoints.go new file mode 100644 index 000000000000..18f3d380c004 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/batchendpoints.go @@ -0,0 +1,624 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - name for the Batch inference endpoint. +// body - batch inference endpoint definition object. +func (client BatchEndpointsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, body BatchEndpointTrackedResource) (result BatchEndpointsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchEndpointsClient.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: endpointName, + Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchEndpointsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, endpointName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BatchEndpointsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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 = "2022-02-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}/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) (future BatchEndpointsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference Endpoint name. +func (client BatchEndpointsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string) (result BatchEndpointsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchEndpointsClient.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.BatchEndpointsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BatchEndpointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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 = "2022-02-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) (future BatchEndpointsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 BatchEndpointsClient) 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - name for the Batch Endpoint. +func (client BatchEndpointsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName) + 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, resourceGroupName string, workspaceName string, endpointName 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 = "2022-02-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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference Endpoint name. +func (client BatchEndpointsClient) ListKeys(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName) + 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, resourceGroupName string, workspaceName string, endpointName 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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - name for the Batch inference endpoint. +// body - mutable batch inference endpoint definition object. +func (client BatchEndpointsClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, body PartialBatchEndpointPartialTrackedResource) (result BatchEndpointsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BatchEndpointsClient.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}}}, + {TargetValue: endpointName, + Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.BatchEndpointsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, endpointName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client BatchEndpointsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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 = "2022-02-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) (future BatchEndpointsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 BatchEndpointsClient) UpdateResponder(resp *http.Response) (result BatchEndpointTrackedResource, 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/2022-02-01-preview/machinelearningservices/client.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/client.go new file mode 100644 index 000000000000..6ea92765c646 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/client.go @@ -0,0 +1,42 @@ +// Package machinelearningservices implements the Azure ARM Machinelearningservices service API version +// 2022-02-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/2022-02-01-preview/machinelearningservices/codecontainers.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/codecontainers.go new file mode 100644 index 000000000000..49de8a9b1a05 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/codecontainers.go @@ -0,0 +1,430 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// body - container entity to create or update. +func (client CodeContainersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name 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: 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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, 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, resourceGroupName, workspaceName, name, 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, resourceGroupName string, workspaceName string, name 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 = "2022-02-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}/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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +func (client CodeContainersClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +func (client CodeContainersClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-02-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 = "2022-02-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/2022-02-01-preview/machinelearningservices/codeversions.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/codeversions.go new file mode 100644 index 000000000000..a949dc0a18b6 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/codeversions.go @@ -0,0 +1,446 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// version - version identifier. This is case-sensitive. +// body - version entity to create or update. +func (client CodeVersionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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: 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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.CodeVersionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, name, version, 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, resourceGroupName string, workspaceName string, name string, version 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 = "2022-02-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}/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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// version - version identifier. This is case-sensitive. +func (client CodeVersionsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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, resourceGroupName, workspaceName, name, version) + 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, resourceGroupName string, workspaceName string, name string, version 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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// version - version identifier. This is case-sensitive. +func (client CodeVersionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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, resourceGroupName, workspaceName, name, version) + 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, resourceGroupName string, workspaceName string, name string, version 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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// orderBy - ordering of list. +// top - maximum number of records to return. +// skip - continuation token for pagination. +func (client CodeVersionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name, 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, resourceGroupName string, workspaceName string, name 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 = "2022-02-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, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name, orderBy, top, skip) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/componentcontainers.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/componentcontainers.go new file mode 100644 index 000000000000..0d4631daf5b9 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/componentcontainers.go @@ -0,0 +1,438 @@ +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" +) + +// ComponentContainersClient is the these APIs allow end users to operate on Azure Machine Learning Workspace +// resources. +type ComponentContainersClient struct { + BaseClient +} + +// NewComponentContainersClient creates an instance of the ComponentContainersClient client. +func NewComponentContainersClient(subscriptionID string) ComponentContainersClient { + return NewComponentContainersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewComponentContainersClientWithBaseURI creates an instance of the ComponentContainersClient 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 NewComponentContainersClientWithBaseURI(baseURI string, subscriptionID string) ComponentContainersClient { + return ComponentContainersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +// body - container entity to create or update. +func (client ComponentContainersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, body ComponentContainerResource) (result ComponentContainerResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentContainersClient.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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ComponentContainersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, name, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "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.ComponentContainersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ComponentContainersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, body ComponentContainerResource) (*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 = "2022-02-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}/components/{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 ComponentContainersClient) 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 ComponentContainersClient) CreateOrUpdateResponder(resp *http.Response) (result ComponentContainerResource, 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +func (client ComponentContainersClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentContainersClient.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.ComponentContainersClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ComponentContainersClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, name 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 = "2022-02-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}/components/{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 ComponentContainersClient) 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 ComponentContainersClient) 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +func (client ComponentContainersClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result ComponentContainerResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentContainersClient.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.ComponentContainersClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "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.ComponentContainersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComponentContainersClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, name 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 = "2022-02-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}/components/{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 ComponentContainersClient) 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 ComponentContainersClient) GetResponder(resp *http.Response) (result ComponentContainerResource, 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. +// listViewType - view type for including/excluding (for example) archived entities. +func (client ComponentContainersClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType ListViewType) (result ComponentContainerResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentContainersClient.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.ComponentContainersClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, skip, listViewType) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "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.ComponentContainersClient", "List", resp, "Failure sending request") + return + } + + result.ccrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "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 ComponentContainersClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType ListViewType) (*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 = "2022-02-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + if len(string(listViewType)) > 0 { + queryParameters["listViewType"] = autorest.Encode("query", listViewType) + } else { + queryParameters["listViewType"] = autorest.Encode("query", "ActiveOnly") + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components", 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 ComponentContainersClient) 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 ComponentContainersClient) ListResponder(resp *http.Response) (result ComponentContainerResourceArmPaginatedResult, 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 ComponentContainersClient) listNextResults(ctx context.Context, lastResults ComponentContainerResourceArmPaginatedResult) (result ComponentContainerResourceArmPaginatedResult, err error) { + req, err := lastResults.componentContainerResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "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.ComponentContainersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentContainersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ComponentContainersClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType ListViewType) (result ComponentContainerResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentContainersClient.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, listViewType) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/componentversions.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/componentversions.go new file mode 100644 index 000000000000..882f9f1266f2 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/componentversions.go @@ -0,0 +1,453 @@ +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" +) + +// ComponentVersionsClient is the these APIs allow end users to operate on Azure Machine Learning Workspace resources. +type ComponentVersionsClient struct { + BaseClient +} + +// NewComponentVersionsClient creates an instance of the ComponentVersionsClient client. +func NewComponentVersionsClient(subscriptionID string) ComponentVersionsClient { + return NewComponentVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewComponentVersionsClientWithBaseURI creates an instance of the ComponentVersionsClient 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 NewComponentVersionsClientWithBaseURI(baseURI string, subscriptionID string) ComponentVersionsClient { + return ComponentVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +// version - version identifier. +// body - version entity to create or update. +func (client ComponentVersionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string, body ComponentVersionResource) (result ComponentVersionResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentVersionsClient.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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ComponentVersionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, name, version, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "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.ComponentVersionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ComponentVersionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string, body ComponentVersionResource) (*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 = "2022-02-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}/components/{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 ComponentVersionsClient) 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 ComponentVersionsClient) CreateOrUpdateResponder(resp *http.Response) (result ComponentVersionResource, 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +// version - version identifier. +func (client ComponentVersionsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentVersionsClient.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.ComponentVersionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, name, version) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ComponentVersionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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 = "2022-02-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}/components/{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 ComponentVersionsClient) 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 ComponentVersionsClient) 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +// version - version identifier. +func (client ComponentVersionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result ComponentVersionResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentVersionsClient.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.ComponentVersionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, name, version) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "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.ComponentVersionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ComponentVersionsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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 = "2022-02-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}/components/{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 ComponentVersionsClient) 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 ComponentVersionsClient) GetResponder(resp *http.Response) (result ComponentVersionResource, 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 - component name. +// orderBy - ordering of list. +// top - maximum number of records to return. +// skip - continuation token for pagination. +// listViewType - view type for including/excluding (for example) archived entities. +func (client ComponentVersionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType ListViewType) (result ComponentVersionResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentVersionsClient.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.ComponentVersionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, name, orderBy, top, skip, listViewType) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "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.ComponentVersionsClient", "List", resp, "Failure sending request") + return + } + + result.cvrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "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 ComponentVersionsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType ListViewType) (*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 = "2022-02-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(string(listViewType)) > 0 { + queryParameters["listViewType"] = autorest.Encode("query", listViewType) + } else { + queryParameters["listViewType"] = autorest.Encode("query", "ActiveOnly") + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{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 ComponentVersionsClient) 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 ComponentVersionsClient) ListResponder(resp *http.Response) (result ComponentVersionResourceArmPaginatedResult, 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 ComponentVersionsClient) listNextResults(ctx context.Context, lastResults ComponentVersionResourceArmPaginatedResult) (result ComponentVersionResourceArmPaginatedResult, err error) { + req, err := lastResults.componentVersionResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "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.ComponentVersionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComponentVersionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ComponentVersionsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType ListViewType) (result ComponentVersionResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentVersionsClient.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, orderBy, top, skip, listViewType) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/compute.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/compute.go new file mode 100644 index 000000000000..6e2f8d5281d3 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/compute.go @@ -0,0 +1,1021 @@ +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}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, 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", result.Response(), "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 = "2022-02-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil + parameters.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}/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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 = "2022-02-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 + future.FutureAPI = &azure.Future{} + 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, http.StatusNoContent), + 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 = "2022-02-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 = "2022-02-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 = "2022-02-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 = "2022-02-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 ComputeRestartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComputeClient.Restart") + 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", "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 + } + + result, err = client.RestartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.ComputeClient", "Restart", result.Response(), "Failure sending 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 = "2022-02-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) (future ComputeRestartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 +} + +// 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, http.StatusAccepted), + 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", result.Response(), "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 = "2022-02-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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 = "2022-02-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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 = "2022-02-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 + future.FutureAPI = &azure.Future{} + 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 +} diff --git a/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/datacontainers.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/datacontainers.go new file mode 100644 index 000000000000..9b1b7b23ddb0 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/datacontainers.go @@ -0,0 +1,436 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +// body - container entity to create or update. +func (client DataContainersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name 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: 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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, 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, resourceGroupName, workspaceName, name, 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, resourceGroupName string, workspaceName string, name 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 = "2022-02-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}/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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +func (client DataContainersClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +func (client DataContainersClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-02-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. +// listViewType - view type for including/excluding (for example) archived entities. +func (client DataContainersClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType ListViewType) (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, listViewType) + 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, listViewType ListViewType) (*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 = "2022-02-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + if len(string(listViewType)) > 0 { + queryParameters["listViewType"] = autorest.Encode("query", listViewType) + } else { + queryParameters["listViewType"] = autorest.Encode("query", "ActiveOnly") + } + + 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, listViewType ListViewType) (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, listViewType) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/datastores.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/datastores.go new file mode 100644 index 000000000000..be70bc5ec6b2 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/datastores.go @@ -0,0 +1,549 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - datastore name. +// body - datastore entity to create or update. +// skipValidation - flag to skip validation. +func (client DatastoresClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, body DatastoreResource, skipValidation *bool) (result DatastoreResource, 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: 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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.DatastoresClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, name, 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, resourceGroupName string, workspaceName string, name string, body DatastoreResource, 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 = "2022-02-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) + } + + 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 DatastoreResource, 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - datastore name. +func (client DatastoresClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - datastore name. +func (client DatastoresClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result DatastoreResource, 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-02-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 DatastoreResource, 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 DatastoreResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatastoresClient.List") + defer func() { + sc := -1 + if result.drapr.Response.Response != nil { + sc = result.drapr.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.drapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "List", resp, "Failure sending request") + return + } + + result.drapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DatastoresClient", "List", resp, "Failure responding to request") + return + } + if result.drapr.hasNextLink() && result.drapr.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 = "2022-02-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 DatastoreResourceArmPaginatedResult, 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 DatastoreResourceArmPaginatedResult) (result DatastoreResourceArmPaginatedResult, err error) { + req, err := lastResults.datastoreResourceArmPaginatedResultPreparer(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 DatastoreResourceArmPaginatedResultIterator, 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - datastore name. +func (client DatastoresClient) ListSecrets(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-02-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/2022-02-01-preview/machinelearningservices/dataversions.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/dataversions.go new file mode 100644 index 000000000000..c356ac9e3cd1 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/dataversions.go @@ -0,0 +1,456 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +// version - version identifier. +// body - version entity to create or update. +func (client DataVersionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string, body DataVersionBaseResource) (result DataVersionBaseResource, 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: 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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.DataVersionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, name, version, 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, resourceGroupName string, workspaceName string, name string, version string, body DataVersionBaseResource) (*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 = "2022-02-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}/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 DataVersionBaseResource, 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +// version - version identifier. +func (client DataVersionsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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, resourceGroupName, workspaceName, name, version) + 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, resourceGroupName string, workspaceName string, name string, version 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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. +// version - version identifier. +func (client DataVersionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result DataVersionBaseResource, 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, resourceGroupName, workspaceName, name, version) + 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, resourceGroupName string, workspaceName string, name string, version 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 = "2022-02-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 DataVersionBaseResource, 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 - data container's name +// orderBy - please choose OrderBy value from ['createdtime', 'modifiedtime'] +// top - top count of results, top count cannot be greater than the page size. +// If topCount > page size, results with be default page size count will be returned +// skip - continuation token for pagination. +// tags - comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2 +// listViewType - [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, ListViewType.All]View type for +// including/excluding (for example) archived entities. +func (client DataVersionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, tags string, listViewType ListViewType) (result DataVersionBaseResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataVersionsClient.List") + defer func() { + sc := -1 + if result.dvbrapr.Response.Response != nil { + sc = result.dvbrapr.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, resourceGroupName, workspaceName, name, orderBy, top, skip, tags, listViewType) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dvbrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "List", resp, "Failure sending request") + return + } + + result.dvbrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.DataVersionsClient", "List", resp, "Failure responding to request") + return + } + if result.dvbrapr.hasNextLink() && result.dvbrapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DataVersionsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, tags string, listViewType ListViewType) (*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 = "2022-02-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) + } + if len(string(listViewType)) > 0 { + queryParameters["listViewType"] = autorest.Encode("query", listViewType) + } else { + queryParameters["listViewType"] = autorest.Encode("query", "ActiveOnly") + } + + 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 DataVersionBaseResourceArmPaginatedResult, 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 DataVersionBaseResourceArmPaginatedResult) (result DataVersionBaseResourceArmPaginatedResult, err error) { + req, err := lastResults.dataVersionBaseResourceArmPaginatedResultPreparer(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, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, tags string, listViewType ListViewType) (result DataVersionBaseResourceArmPaginatedResultIterator, 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, resourceGroupName, workspaceName, name, orderBy, top, skip, tags, listViewType) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/enums.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/enums.go new file mode 100644 index 000000000000..67b32e65f5ad --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/enums.go @@ -0,0 +1,2675 @@ +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} +} + +// Autosave enumerates the values for autosave. +type Autosave string + +const ( + // Local ... + Local Autosave = "Local" + // None ... + None Autosave = "None" + // Remote ... + Remote Autosave = "Remote" +) + +// PossibleAutosaveValues returns an array of possible values for the Autosave const type. +func PossibleAutosaveValues() []Autosave { + return []Autosave{Local, None, Remote} +} + +// 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} +} + +// Caching enumerates the values for caching. +type Caching string + +const ( + // CachingNone ... + CachingNone Caching = "None" + // CachingReadOnly ... + CachingReadOnly Caching = "ReadOnly" + // CachingReadWrite ... + CachingReadWrite Caching = "ReadWrite" +) + +// PossibleCachingValues returns an array of possible values for the Caching const type. +func PossibleCachingValues() []Caching { + return []Caching{CachingNone, CachingReadOnly, CachingReadWrite} +} + +// ClassificationModels enumerates the values for classification models. +type ClassificationModels string + +const ( + // BernoulliNaiveBayes Naive Bayes classifier for multivariate Bernoulli models. + BernoulliNaiveBayes ClassificationModels = "BernoulliNaiveBayes" + // DecisionTree Decision Trees are a non-parametric supervised learning method used for both classification + // and regression tasks. + // The goal is to create a model that predicts the value of a target variable by learning simple decision + // rules inferred from the data features. + DecisionTree ClassificationModels = "DecisionTree" + // ExtremeRandomTrees Extreme Trees is an ensemble machine learning algorithm that combines the predictions + // from many decision trees. It is related to the widely used random forest algorithm. + ExtremeRandomTrees ClassificationModels = "ExtremeRandomTrees" + // GradientBoosting The technique of transiting week learners into a strong learner is called Boosting. The + // gradient boosting algorithm process works on this theory of execution. + GradientBoosting ClassificationModels = "GradientBoosting" + // KNN K-nearest neighbors (KNN) algorithm uses 'feature similarity' to predict the values of new + // datapoints + // which further means that the new data point will be assigned a value based on how closely it matches the + // points in the training set. + KNN ClassificationModels = "KNN" + // LightGBM LightGBM is a gradient boosting framework that uses tree based learning algorithms. + LightGBM ClassificationModels = "LightGBM" + // LinearSVM A support vector machine (SVM) is a supervised machine learning model that uses classification + // algorithms for two-group classification problems. + // After giving an SVM model sets of labeled training data for each category, they're able to categorize + // new text. + // Linear SVM performs best when input data is linear, i.e., data can be easily classified by drawing the + // straight line between classified values on a plotted graph. + LinearSVM ClassificationModels = "LinearSVM" + // LogisticRegression Logistic regression is a fundamental classification technique. + // It belongs to the group of linear classifiers and is somewhat similar to polynomial and linear + // regression. + // Logistic regression is fast and relatively uncomplicated, and it's convenient for you to interpret the + // results. + // Although it's essentially a method for binary classification, it can also be applied to multiclass + // problems. + LogisticRegression ClassificationModels = "LogisticRegression" + // MultinomialNaiveBayes The multinomial Naive Bayes classifier is suitable for classification with + // discrete features (e.g., word counts for text classification). + // The multinomial distribution normally requires integer feature counts. However, in practice, fractional + // counts such as tf-idf may also work. + MultinomialNaiveBayes ClassificationModels = "MultinomialNaiveBayes" + // RandomForest Random forest is a supervised learning algorithm. + // The "forest" it builds, is an ensemble of decision trees, usually trained with the “bagging” method. + // The general idea of the bagging method is that a combination of learning models increases the overall + // result. + RandomForest ClassificationModels = "RandomForest" + // SGD SGD: Stochastic gradient descent is an optimization algorithm often used in machine learning + // applications + // to find the model parameters that correspond to the best fit between predicted and actual outputs. + SGD ClassificationModels = "SGD" + // SVM A support vector machine (SVM) is a supervised machine learning model that uses classification + // algorithms for two-group classification problems. + // After giving an SVM model sets of labeled training data for each category, they're able to categorize + // new text. + SVM ClassificationModels = "SVM" + // XGBoostClassifier XGBoost: Extreme Gradient Boosting Algorithm. This algorithm is used for structured + // data where target column values can be divided into distinct class values. + XGBoostClassifier ClassificationModels = "XGBoostClassifier" +) + +// PossibleClassificationModelsValues returns an array of possible values for the ClassificationModels const type. +func PossibleClassificationModelsValues() []ClassificationModels { + return []ClassificationModels{BernoulliNaiveBayes, DecisionTree, ExtremeRandomTrees, GradientBoosting, KNN, LightGBM, LinearSVM, LogisticRegression, MultinomialNaiveBayes, RandomForest, SGD, SVM, XGBoostClassifier} +} + +// ClassificationMultilabelPrimaryMetrics enumerates the values for classification multilabel primary metrics. +type ClassificationMultilabelPrimaryMetrics string + +const ( + // Accuracy Accuracy is the ratio of predictions that exactly match the true class labels. + Accuracy ClassificationMultilabelPrimaryMetrics = "Accuracy" + // AUCWeighted AUC is the Area under the curve. + // This metric represents arithmetic mean of the score for each class, + // weighted by the number of true instances in each class. + AUCWeighted ClassificationMultilabelPrimaryMetrics = "AUCWeighted" + // AveragePrecisionScoreWeighted The arithmetic mean of the average precision score for each class, + // weighted by + // the number of true instances in each class. + AveragePrecisionScoreWeighted ClassificationMultilabelPrimaryMetrics = "AveragePrecisionScoreWeighted" + // IOU Intersection Over Union. Intersection of predictions divided by union of predictions. + IOU ClassificationMultilabelPrimaryMetrics = "IOU" + // NormMacroRecall Normalized macro recall is recall macro-averaged and normalized, so that random + // performance has a score of 0, and perfect performance has a score of 1. + NormMacroRecall ClassificationMultilabelPrimaryMetrics = "NormMacroRecall" + // PrecisionScoreWeighted The arithmetic mean of precision for each class, weighted by number of true + // instances in each class. + PrecisionScoreWeighted ClassificationMultilabelPrimaryMetrics = "PrecisionScoreWeighted" +) + +// PossibleClassificationMultilabelPrimaryMetricsValues returns an array of possible values for the ClassificationMultilabelPrimaryMetrics const type. +func PossibleClassificationMultilabelPrimaryMetricsValues() []ClassificationMultilabelPrimaryMetrics { + return []ClassificationMultilabelPrimaryMetrics{Accuracy, AUCWeighted, AveragePrecisionScoreWeighted, IOU, NormMacroRecall, PrecisionScoreWeighted} +} + +// ClassificationPrimaryMetrics enumerates the values for classification primary metrics. +type ClassificationPrimaryMetrics string + +const ( + // ClassificationPrimaryMetricsAccuracy Accuracy is the ratio of predictions that exactly match the true + // class labels. + ClassificationPrimaryMetricsAccuracy ClassificationPrimaryMetrics = "Accuracy" + // ClassificationPrimaryMetricsAUCWeighted AUC is the Area under the curve. + // This metric represents arithmetic mean of the score for each class, + // weighted by the number of true instances in each class. + ClassificationPrimaryMetricsAUCWeighted ClassificationPrimaryMetrics = "AUCWeighted" + // ClassificationPrimaryMetricsAveragePrecisionScoreWeighted The arithmetic mean of the average precision + // score for each class, weighted by + // the number of true instances in each class. + ClassificationPrimaryMetricsAveragePrecisionScoreWeighted ClassificationPrimaryMetrics = "AveragePrecisionScoreWeighted" + // ClassificationPrimaryMetricsNormMacroRecall Normalized macro recall is recall macro-averaged and + // normalized, so that random + // performance has a score of 0, and perfect performance has a score of 1. + ClassificationPrimaryMetricsNormMacroRecall ClassificationPrimaryMetrics = "NormMacroRecall" + // ClassificationPrimaryMetricsPrecisionScoreWeighted The arithmetic mean of precision for each class, + // weighted by number of true instances in each class. + ClassificationPrimaryMetricsPrecisionScoreWeighted ClassificationPrimaryMetrics = "PrecisionScoreWeighted" +) + +// PossibleClassificationPrimaryMetricsValues returns an array of possible values for the ClassificationPrimaryMetrics const type. +func PossibleClassificationPrimaryMetricsValues() []ClassificationPrimaryMetrics { + return []ClassificationPrimaryMetrics{ClassificationPrimaryMetricsAccuracy, ClassificationPrimaryMetricsAUCWeighted, ClassificationPrimaryMetricsAveragePrecisionScoreWeighted, ClassificationPrimaryMetricsNormMacroRecall, ClassificationPrimaryMetricsPrecisionScoreWeighted} +} + +// 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" + // ComputeTypeKubernetes ... + ComputeTypeKubernetes ComputeType = "Kubernetes" + // 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, ComputeTypeKubernetes, ComputeTypeSynapseSpark, ComputeTypeVirtualMachine} +} + +// ComputeTypeBasicCompute enumerates the values for compute type basic compute. +type ComputeTypeBasicCompute string + +const ( + // ComputeTypeCompute ... + ComputeTypeCompute ComputeTypeBasicCompute = "Compute" + // ComputeTypeDataFactory1 ... + ComputeTypeDataFactory1 ComputeTypeBasicCompute = "DataFactory" + // ComputeTypeSynapseSpark1 ... + ComputeTypeSynapseSpark1 ComputeTypeBasicCompute = "SynapseSpark" +) + +// PossibleComputeTypeBasicComputeValues returns an array of possible values for the ComputeTypeBasicCompute const type. +func PossibleComputeTypeBasicComputeValues() []ComputeTypeBasicCompute { + return []ComputeTypeBasicCompute{ComputeTypeCompute, ComputeTypeDataFactory1, ComputeTypeSynapseSpark1} +} + +// ComputeTypeBasicComputeSecrets enumerates the values for compute type basic compute secrets. +type ComputeTypeBasicComputeSecrets string + +const ( + // ComputeTypeComputeSecrets ... + ComputeTypeComputeSecrets ComputeTypeBasicComputeSecrets = "ComputeSecrets" +) + +// PossibleComputeTypeBasicComputeSecretsValues returns an array of possible values for the ComputeTypeBasicComputeSecrets const type. +func PossibleComputeTypeBasicComputeSecretsValues() []ComputeTypeBasicComputeSecrets { + return []ComputeTypeBasicComputeSecrets{ComputeTypeComputeSecrets} +} + +// 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} +} + +// 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 ( + // CredentialsTypeAccountKey ... + CredentialsTypeAccountKey CredentialsType = "AccountKey" + // CredentialsTypeCertificate ... + CredentialsTypeCertificate CredentialsType = "Certificate" + // CredentialsTypeKerberosKeytab ... + CredentialsTypeKerberosKeytab CredentialsType = "KerberosKeytab" + // CredentialsTypeKerberosPassword ... + CredentialsTypeKerberosPassword CredentialsType = "KerberosPassword" + // CredentialsTypeNone ... + CredentialsTypeNone CredentialsType = "None" + // CredentialsTypeSas ... + CredentialsTypeSas CredentialsType = "Sas" + // CredentialsTypeServicePrincipal ... + CredentialsTypeServicePrincipal CredentialsType = "ServicePrincipal" +) + +// PossibleCredentialsTypeValues returns an array of possible values for the CredentialsType const type. +func PossibleCredentialsTypeValues() []CredentialsType { + return []CredentialsType{CredentialsTypeAccountKey, CredentialsTypeCertificate, CredentialsTypeKerberosKeytab, CredentialsTypeKerberosPassword, CredentialsTypeNone, CredentialsTypeSas, CredentialsTypeServicePrincipal} +} + +// CredentialsTypeBasicDatastoreCredentials enumerates the values for credentials type basic datastore +// credentials. +type CredentialsTypeBasicDatastoreCredentials string + +const ( + // CredentialsTypeAccountKey1 ... + CredentialsTypeAccountKey1 CredentialsTypeBasicDatastoreCredentials = "AccountKey" + // CredentialsTypeCertificate1 ... + CredentialsTypeCertificate1 CredentialsTypeBasicDatastoreCredentials = "Certificate" + // CredentialsTypeDatastoreCredentials ... + CredentialsTypeDatastoreCredentials CredentialsTypeBasicDatastoreCredentials = "DatastoreCredentials" + // CredentialsTypeNone1 ... + CredentialsTypeNone1 CredentialsTypeBasicDatastoreCredentials = "None" + // CredentialsTypeSas1 ... + CredentialsTypeSas1 CredentialsTypeBasicDatastoreCredentials = "Sas" + // CredentialsTypeServicePrincipal1 ... + CredentialsTypeServicePrincipal1 CredentialsTypeBasicDatastoreCredentials = "ServicePrincipal" +) + +// PossibleCredentialsTypeBasicDatastoreCredentialsValues returns an array of possible values for the CredentialsTypeBasicDatastoreCredentials const type. +func PossibleCredentialsTypeBasicDatastoreCredentialsValues() []CredentialsTypeBasicDatastoreCredentials { + return []CredentialsTypeBasicDatastoreCredentials{CredentialsTypeAccountKey1, CredentialsTypeCertificate1, CredentialsTypeDatastoreCredentials, CredentialsTypeNone1, CredentialsTypeSas1, CredentialsTypeServicePrincipal1} +} + +// DatastoreType enumerates the values for datastore type. +type DatastoreType string + +const ( + // AzureBlob ... + AzureBlob DatastoreType = "AzureBlob" + // AzureDataLakeGen1 ... + AzureDataLakeGen1 DatastoreType = "AzureDataLakeGen1" + // AzureDataLakeGen2 ... + AzureDataLakeGen2 DatastoreType = "AzureDataLakeGen2" + // AzureFile ... + AzureFile DatastoreType = "AzureFile" + // Hdfs ... + Hdfs DatastoreType = "Hdfs" +) + +// PossibleDatastoreTypeValues returns an array of possible values for the DatastoreType const type. +func PossibleDatastoreTypeValues() []DatastoreType { + return []DatastoreType{AzureBlob, AzureDataLakeGen1, AzureDataLakeGen2, AzureFile, Hdfs} +} + +// DatastoreTypeBasicDatastore enumerates the values for datastore type basic datastore. +type DatastoreTypeBasicDatastore string + +const ( + // DatastoreTypeAzureBlob ... + DatastoreTypeAzureBlob DatastoreTypeBasicDatastore = "AzureBlob" + // DatastoreTypeAzureDataLakeGen1 ... + DatastoreTypeAzureDataLakeGen1 DatastoreTypeBasicDatastore = "AzureDataLakeGen1" + // DatastoreTypeAzureDataLakeGen2 ... + DatastoreTypeAzureDataLakeGen2 DatastoreTypeBasicDatastore = "AzureDataLakeGen2" + // DatastoreTypeAzureFile ... + DatastoreTypeAzureFile DatastoreTypeBasicDatastore = "AzureFile" + // DatastoreTypeDatastore ... + DatastoreTypeDatastore DatastoreTypeBasicDatastore = "Datastore" + // DatastoreTypeHdfs ... + DatastoreTypeHdfs DatastoreTypeBasicDatastore = "Hdfs" +) + +// PossibleDatastoreTypeBasicDatastoreValues returns an array of possible values for the DatastoreTypeBasicDatastore const type. +func PossibleDatastoreTypeBasicDatastoreValues() []DatastoreTypeBasicDatastore { + return []DatastoreTypeBasicDatastore{DatastoreTypeAzureBlob, DatastoreTypeAzureDataLakeGen1, DatastoreTypeAzureDataLakeGen2, DatastoreTypeAzureFile, DatastoreTypeDatastore, DatastoreTypeHdfs} +} + +// DataType enumerates the values for data type. +type DataType string + +const ( + // MLTable ... + MLTable DataType = "MLTable" + // URIFile ... + URIFile DataType = "UriFile" + // URIFolder ... + URIFolder DataType = "UriFolder" +) + +// PossibleDataTypeValues returns an array of possible values for the DataType const type. +func PossibleDataTypeValues() []DataType { + return []DataType{MLTable, URIFile, URIFolder} +} + +// DataTypeBasicDataVersionBase enumerates the values for data type basic data version base. +type DataTypeBasicDataVersionBase string + +const ( + // DataTypeDataVersionBase ... + DataTypeDataVersionBase DataTypeBasicDataVersionBase = "DataVersionBase" + // DataTypeMLTable ... + DataTypeMLTable DataTypeBasicDataVersionBase = "MLTable" + // DataTypeURIFile ... + DataTypeURIFile DataTypeBasicDataVersionBase = "UriFile" + // DataTypeURIFolder ... + DataTypeURIFolder DataTypeBasicDataVersionBase = "UriFolder" +) + +// PossibleDataTypeBasicDataVersionBaseValues returns an array of possible values for the DataTypeBasicDataVersionBase const type. +func PossibleDataTypeBasicDataVersionBaseValues() []DataTypeBasicDataVersionBase { + return []DataTypeBasicDataVersionBase{DataTypeDataVersionBase, DataTypeMLTable, DataTypeURIFile, DataTypeURIFolder} +} + +// 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} +} + +// DiagnoseResultLevel enumerates the values for diagnose result level. +type DiagnoseResultLevel string + +const ( + // DiagnoseResultLevelError ... + DiagnoseResultLevelError DiagnoseResultLevel = "Error" + // DiagnoseResultLevelInformation ... + DiagnoseResultLevelInformation DiagnoseResultLevel = "Information" + // DiagnoseResultLevelWarning ... + DiagnoseResultLevelWarning DiagnoseResultLevel = "Warning" +) + +// PossibleDiagnoseResultLevelValues returns an array of possible values for the DiagnoseResultLevel const type. +func PossibleDiagnoseResultLevelValues() []DiagnoseResultLevel { + return []DiagnoseResultLevel{DiagnoseResultLevelError, DiagnoseResultLevelInformation, DiagnoseResultLevelWarning} +} + +// 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} +} + +// 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} +} + +// EgressPublicNetworkAccessType enumerates the values for egress public network access type. +type EgressPublicNetworkAccessType string + +const ( + // Disabled ... + Disabled EgressPublicNetworkAccessType = "Disabled" + // Enabled ... + Enabled EgressPublicNetworkAccessType = "Enabled" +) + +// PossibleEgressPublicNetworkAccessTypeValues returns an array of possible values for the EgressPublicNetworkAccessType const type. +func PossibleEgressPublicNetworkAccessTypeValues() []EgressPublicNetworkAccessType { + return []EgressPublicNetworkAccessType{Disabled, Enabled} +} + +// EncryptionStatus enumerates the values for encryption status. +type EncryptionStatus string + +const ( + // EncryptionStatusDisabled ... + EncryptionStatusDisabled EncryptionStatus = "Disabled" + // EncryptionStatusEnabled ... + EncryptionStatusEnabled EncryptionStatus = "Enabled" +) + +// PossibleEncryptionStatusValues returns an array of possible values for the EncryptionStatus const type. +func PossibleEncryptionStatusValues() []EncryptionStatus { + return []EncryptionStatus{EncryptionStatusDisabled, EncryptionStatusEnabled} +} + +// 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 ( + // EndpointComputeTypeAzureMLCompute ... + EndpointComputeTypeAzureMLCompute EndpointComputeType = "AzureMLCompute" + // EndpointComputeTypeKubernetes ... + EndpointComputeTypeKubernetes EndpointComputeType = "Kubernetes" + // EndpointComputeTypeManaged ... + EndpointComputeTypeManaged EndpointComputeType = "Managed" +) + +// PossibleEndpointComputeTypeValues returns an array of possible values for the EndpointComputeType const type. +func PossibleEndpointComputeTypeValues() []EndpointComputeType { + return []EndpointComputeType{EndpointComputeTypeAzureMLCompute, EndpointComputeTypeKubernetes, EndpointComputeTypeManaged} +} + +// EndpointComputeTypeBasicOnlineDeployment enumerates the values for endpoint compute type basic online +// deployment. +type EndpointComputeTypeBasicOnlineDeployment string + +const ( + // EndpointComputeTypeKubernetes1 ... + EndpointComputeTypeKubernetes1 EndpointComputeTypeBasicOnlineDeployment = "Kubernetes" + // EndpointComputeTypeManaged1 ... + EndpointComputeTypeManaged1 EndpointComputeTypeBasicOnlineDeployment = "Managed" + // EndpointComputeTypeOnlineDeployment ... + EndpointComputeTypeOnlineDeployment EndpointComputeTypeBasicOnlineDeployment = "OnlineDeployment" +) + +// PossibleEndpointComputeTypeBasicOnlineDeploymentValues returns an array of possible values for the EndpointComputeTypeBasicOnlineDeployment const type. +func PossibleEndpointComputeTypeBasicOnlineDeploymentValues() []EndpointComputeTypeBasicOnlineDeployment { + return []EndpointComputeTypeBasicOnlineDeployment{EndpointComputeTypeKubernetes1, EndpointComputeTypeManaged1, EndpointComputeTypeOnlineDeployment} +} + +// EndpointComputeTypeBasicPartialOnlineDeployment enumerates the values for endpoint compute type basic +// partial online deployment. +type EndpointComputeTypeBasicPartialOnlineDeployment string + +const ( + // EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeKubernetes ... + EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeKubernetes EndpointComputeTypeBasicPartialOnlineDeployment = "Kubernetes" + // 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{EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeKubernetes, 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} +} + +// EnvironmentType enumerates the values for environment type. +type EnvironmentType string + +const ( + // Curated ... + Curated EnvironmentType = "Curated" + // UserCreated ... + UserCreated EnvironmentType = "UserCreated" +) + +// PossibleEnvironmentTypeValues returns an array of possible values for the EnvironmentType const type. +func PossibleEnvironmentTypeValues() []EnvironmentType { + return []EnvironmentType{Curated, UserCreated} +} + +// FeatureLags enumerates the values for feature lags. +type FeatureLags string + +const ( + // FeatureLagsAuto System auto-generates feature lags. + FeatureLagsAuto FeatureLags = "Auto" + // FeatureLagsNone No feature lags generated. + FeatureLagsNone FeatureLags = "None" +) + +// PossibleFeatureLagsValues returns an array of possible values for the FeatureLags const type. +func PossibleFeatureLagsValues() []FeatureLags { + return []FeatureLags{FeatureLagsAuto, FeatureLagsNone} +} + +// FeaturizationMode enumerates the values for featurization mode. +type FeaturizationMode string + +const ( + // Auto Auto mode, system performs featurization without any custom featurization inputs. + Auto FeaturizationMode = "Auto" + // Custom Custom featurization. + Custom FeaturizationMode = "Custom" + // Off Featurization off. 'Forecasting' task cannot use this value. + Off FeaturizationMode = "Off" +) + +// PossibleFeaturizationModeValues returns an array of possible values for the FeaturizationMode const type. +func PossibleFeaturizationModeValues() []FeaturizationMode { + return []FeaturizationMode{Auto, Custom, Off} +} + +// ForecastHorizonMode enumerates the values for forecast horizon mode. +type ForecastHorizonMode string + +const ( + // ForecastHorizonModeAuto Forecast horizon to be determined automatically. + ForecastHorizonModeAuto ForecastHorizonMode = "Auto" + // ForecastHorizonModeCustom Use the custom forecast horizon. + ForecastHorizonModeCustom ForecastHorizonMode = "Custom" +) + +// PossibleForecastHorizonModeValues returns an array of possible values for the ForecastHorizonMode const type. +func PossibleForecastHorizonModeValues() []ForecastHorizonMode { + return []ForecastHorizonMode{ForecastHorizonModeAuto, ForecastHorizonModeCustom} +} + +// ForecastingModels enumerates the values for forecasting models. +type ForecastingModels string + +const ( + // ForecastingModelsArimax An Autoregressive Integrated Moving Average with Explanatory Variable (ARIMAX) + // model can be viewed as a multiple regression model with one or more autoregressive (AR) terms and/or one + // or more moving average (MA) terms. + // This method is suitable for forecasting when data is stationary/non stationary, and multivariate with + // any type of data pattern, i.e., level/trend /seasonality/cyclicity. + ForecastingModelsArimax ForecastingModels = "Arimax" + // ForecastingModelsAutoArima Auto-Autoregressive Integrated Moving Average (ARIMA) model uses time-series + // data and statistical analysis to interpret the data and make future predictions. + // This model aims to explain data by using time series data on its past values and uses linear regression + // to make predictions. + ForecastingModelsAutoArima ForecastingModels = "AutoArima" + // ForecastingModelsAverage The Average forecasting model makes predictions by carrying forward the average + // of the target values for each time-series in the training data. + ForecastingModelsAverage ForecastingModels = "Average" + // ForecastingModelsDecisionTree Decision Trees are a non-parametric supervised learning method used for + // both classification and regression tasks. + // The goal is to create a model that predicts the value of a target variable by learning simple decision + // rules inferred from the data features. + ForecastingModelsDecisionTree ForecastingModels = "DecisionTree" + // ForecastingModelsElasticNet Elastic net is a popular type of regularized linear regression that combines + // two popular penalties, specifically the L1 and L2 penalty functions. + ForecastingModelsElasticNet ForecastingModels = "ElasticNet" + // ForecastingModelsExponentialSmoothing Exponential smoothing is a time series forecasting method for + // univariate data that can be extended to support data with a systematic trend or seasonal component. + ForecastingModelsExponentialSmoothing ForecastingModels = "ExponentialSmoothing" + // ForecastingModelsExtremeRandomTrees Extreme Trees is an ensemble machine learning algorithm that + // combines the predictions from many decision trees. It is related to the widely used random forest + // algorithm. + ForecastingModelsExtremeRandomTrees ForecastingModels = "ExtremeRandomTrees" + // ForecastingModelsGradientBoosting The technique of transiting week learners into a strong learner is + // called Boosting. The gradient boosting algorithm process works on this theory of execution. + ForecastingModelsGradientBoosting ForecastingModels = "GradientBoosting" + // ForecastingModelsKNN K-nearest neighbors (KNN) algorithm uses 'feature similarity' to predict the values + // of new datapoints + // which further means that the new data point will be assigned a value based on how closely it matches the + // points in the training set. + ForecastingModelsKNN ForecastingModels = "KNN" + // ForecastingModelsLassoLars Lasso model fit with Least Angle Regression a.k.a. Lars. It is a Linear Model + // trained with an L1 prior as regularizer. + ForecastingModelsLassoLars ForecastingModels = "LassoLars" + // ForecastingModelsLightGBM LightGBM is a gradient boosting framework that uses tree based learning + // algorithms. + ForecastingModelsLightGBM ForecastingModels = "LightGBM" + // ForecastingModelsNaive The Naive forecasting model makes predictions by carrying forward the latest + // target value for each time-series in the training data. + ForecastingModelsNaive ForecastingModels = "Naive" + // ForecastingModelsProphet Prophet is a procedure for forecasting time series data based on an additive + // model where non-linear trends are fit with yearly, weekly, and daily seasonality, plus holiday effects. + // It works best with time series that have strong seasonal effects and several seasons of historical data. + // Prophet is robust to missing data and shifts in the trend, and typically handles outliers well. + ForecastingModelsProphet ForecastingModels = "Prophet" + // ForecastingModelsRandomForest Random forest is a supervised learning algorithm. + // The "forest" it builds, is an ensemble of decision trees, usually trained with the “bagging” method. + // The general idea of the bagging method is that a combination of learning models increases the overall + // result. + ForecastingModelsRandomForest ForecastingModels = "RandomForest" + // ForecastingModelsSeasonalAverage The Seasonal Average forecasting model makes predictions by carrying + // forward the average value of the latest season of data for each time-series in the training data. + ForecastingModelsSeasonalAverage ForecastingModels = "SeasonalAverage" + // ForecastingModelsSeasonalNaive The Seasonal Naive forecasting model makes predictions by carrying + // forward the latest season of target values for each time-series in the training data. + ForecastingModelsSeasonalNaive ForecastingModels = "SeasonalNaive" + // ForecastingModelsSGD SGD: Stochastic gradient descent is an optimization algorithm often used in machine + // learning applications + // to find the model parameters that correspond to the best fit between predicted and actual outputs. + // It's an inexact but powerful technique. + ForecastingModelsSGD ForecastingModels = "SGD" + // ForecastingModelsTCNForecaster TCNForecaster: Temporal Convolutional Networks Forecaster. //TODO: Ask + // forecasting team for brief intro. + ForecastingModelsTCNForecaster ForecastingModels = "TCNForecaster" + // ForecastingModelsXGBoostRegressor XGBoostRegressor: Extreme Gradient Boosting Regressor is a supervised + // machine learning model using ensemble of base learners. + ForecastingModelsXGBoostRegressor ForecastingModels = "XGBoostRegressor" +) + +// PossibleForecastingModelsValues returns an array of possible values for the ForecastingModels const type. +func PossibleForecastingModelsValues() []ForecastingModels { + return []ForecastingModels{ForecastingModelsArimax, ForecastingModelsAutoArima, ForecastingModelsAverage, ForecastingModelsDecisionTree, ForecastingModelsElasticNet, ForecastingModelsExponentialSmoothing, ForecastingModelsExtremeRandomTrees, ForecastingModelsGradientBoosting, ForecastingModelsKNN, ForecastingModelsLassoLars, ForecastingModelsLightGBM, ForecastingModelsNaive, ForecastingModelsProphet, ForecastingModelsRandomForest, ForecastingModelsSeasonalAverage, ForecastingModelsSeasonalNaive, ForecastingModelsSGD, ForecastingModelsTCNForecaster, ForecastingModelsXGBoostRegressor} +} + +// ForecastingPrimaryMetrics enumerates the values for forecasting primary metrics. +type ForecastingPrimaryMetrics string + +const ( + // NormalizedMeanAbsoluteError The Normalized Mean Absolute Error (NMAE) is a validation metric to compare + // the Mean Absolute Error (MAE) of (time) series with different scales. + NormalizedMeanAbsoluteError ForecastingPrimaryMetrics = "NormalizedMeanAbsoluteError" + // NormalizedRootMeanSquaredError The Normalized Root Mean Squared Error (NRMSE) the RMSE facilitates the + // comparison between models with different scales. + NormalizedRootMeanSquaredError ForecastingPrimaryMetrics = "NormalizedRootMeanSquaredError" + // R2Score The R2 score is one of the performance evaluation measures for forecasting-based machine + // learning models. + R2Score ForecastingPrimaryMetrics = "R2Score" + // SpearmanCorrelation The Spearman's rank coefficient of correlation is a non-parametric measure of rank + // correlation. + SpearmanCorrelation ForecastingPrimaryMetrics = "SpearmanCorrelation" +) + +// PossibleForecastingPrimaryMetricsValues returns an array of possible values for the ForecastingPrimaryMetrics const type. +func PossibleForecastingPrimaryMetricsValues() []ForecastingPrimaryMetrics { + return []ForecastingPrimaryMetrics{NormalizedMeanAbsoluteError, NormalizedRootMeanSquaredError, R2Score, SpearmanCorrelation} +} + +// 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" + // IdentityConfigurationTypeUserIdentity ... + IdentityConfigurationTypeUserIdentity IdentityConfigurationType = "UserIdentity" +) + +// PossibleIdentityConfigurationTypeValues returns an array of possible values for the IdentityConfigurationType const type. +func PossibleIdentityConfigurationTypeValues() []IdentityConfigurationType { + return []IdentityConfigurationType{IdentityConfigurationTypeAMLToken, IdentityConfigurationTypeManaged, IdentityConfigurationTypeUserIdentity} +} + +// IdentityType enumerates the values for identity type. +type IdentityType string + +const ( + // IdentityTypeAMLToken ... + IdentityTypeAMLToken IdentityType = "AMLToken" + // IdentityTypeIdentityConfiguration ... + IdentityTypeIdentityConfiguration IdentityType = "IdentityConfiguration" + // IdentityTypeManaged ... + IdentityTypeManaged IdentityType = "Managed" + // IdentityTypeUserIdentity ... + IdentityTypeUserIdentity IdentityType = "UserIdentity" +) + +// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{IdentityTypeAMLToken, IdentityTypeIdentityConfiguration, IdentityTypeManaged, IdentityTypeUserIdentity} +} + +// InputDeliveryMode enumerates the values for input delivery mode. +type InputDeliveryMode string + +const ( + // Direct ... + Direct InputDeliveryMode = "Direct" + // Download ... + Download InputDeliveryMode = "Download" + // EvalDownload ... + EvalDownload InputDeliveryMode = "EvalDownload" + // EvalMount ... + EvalMount InputDeliveryMode = "EvalMount" + // ReadOnlyMount ... + ReadOnlyMount InputDeliveryMode = "ReadOnlyMount" + // ReadWriteMount ... + ReadWriteMount InputDeliveryMode = "ReadWriteMount" +) + +// PossibleInputDeliveryModeValues returns an array of possible values for the InputDeliveryMode const type. +func PossibleInputDeliveryModeValues() []InputDeliveryMode { + return []InputDeliveryMode{Direct, Download, EvalDownload, EvalMount, ReadOnlyMount, ReadWriteMount} +} + +// InstanceSegmentationPrimaryMetrics enumerates the values for instance segmentation primary metrics. +type InstanceSegmentationPrimaryMetrics string + +const ( + // MeanAveragePrecision Mean Average Precision (MAP) is the average of AP (Average Precision). + // AP is calculated for each class and averaged to get the MAP. + MeanAveragePrecision InstanceSegmentationPrimaryMetrics = "MeanAveragePrecision" +) + +// PossibleInstanceSegmentationPrimaryMetricsValues returns an array of possible values for the InstanceSegmentationPrimaryMetrics const type. +func PossibleInstanceSegmentationPrimaryMetricsValues() []InstanceSegmentationPrimaryMetrics { + return []InstanceSegmentationPrimaryMetrics{MeanAveragePrecision} +} + +// JobInputType enumerates the values for job input type. +type JobInputType string + +const ( + // JobInputTypeCustomModel ... + JobInputTypeCustomModel JobInputType = "CustomModel" + // JobInputTypeLiteral ... + JobInputTypeLiteral JobInputType = "Literal" + // JobInputTypeMLFlowModel ... + JobInputTypeMLFlowModel JobInputType = "MLFlowModel" + // JobInputTypeMLTable ... + JobInputTypeMLTable JobInputType = "MLTable" + // JobInputTypeTritonModel ... + JobInputTypeTritonModel JobInputType = "TritonModel" + // JobInputTypeURIFile ... + JobInputTypeURIFile JobInputType = "UriFile" + // JobInputTypeURIFolder ... + JobInputTypeURIFolder JobInputType = "UriFolder" +) + +// PossibleJobInputTypeValues returns an array of possible values for the JobInputType const type. +func PossibleJobInputTypeValues() []JobInputType { + return []JobInputType{JobInputTypeCustomModel, JobInputTypeLiteral, JobInputTypeMLFlowModel, JobInputTypeMLTable, JobInputTypeTritonModel, JobInputTypeURIFile, JobInputTypeURIFolder} +} + +// JobInputTypeBasicJobInput enumerates the values for job input type basic job input. +type JobInputTypeBasicJobInput string + +const ( + // JobInputTypeJobInput ... + JobInputTypeJobInput JobInputTypeBasicJobInput = "JobInput" + // JobInputTypeLiteral1 ... + JobInputTypeLiteral1 JobInputTypeBasicJobInput = "Literal" +) + +// PossibleJobInputTypeBasicJobInputValues returns an array of possible values for the JobInputTypeBasicJobInput const type. +func PossibleJobInputTypeBasicJobInputValues() []JobInputTypeBasicJobInput { + return []JobInputTypeBasicJobInput{JobInputTypeJobInput, JobInputTypeLiteral1} +} + +// JobLimitsType enumerates the values for job limits type. +type JobLimitsType string + +const ( + // Command ... + Command JobLimitsType = "Command" + // Sweep ... + Sweep JobLimitsType = "Sweep" +) + +// PossibleJobLimitsTypeValues returns an array of possible values for the JobLimitsType const type. +func PossibleJobLimitsTypeValues() []JobLimitsType { + return []JobLimitsType{Command, Sweep} +} + +// JobLimitsTypeBasicJobLimits enumerates the values for job limits type basic job limits. +type JobLimitsTypeBasicJobLimits string + +const ( + // JobLimitsTypeCommand ... + JobLimitsTypeCommand JobLimitsTypeBasicJobLimits = "Command" + // JobLimitsTypeJobLimits ... + JobLimitsTypeJobLimits JobLimitsTypeBasicJobLimits = "JobLimits" + // JobLimitsTypeSweep ... + JobLimitsTypeSweep JobLimitsTypeBasicJobLimits = "Sweep" +) + +// PossibleJobLimitsTypeBasicJobLimitsValues returns an array of possible values for the JobLimitsTypeBasicJobLimits const type. +func PossibleJobLimitsTypeBasicJobLimitsValues() []JobLimitsTypeBasicJobLimits { + return []JobLimitsTypeBasicJobLimits{JobLimitsTypeCommand, JobLimitsTypeJobLimits, JobLimitsTypeSweep} +} + +// JobOutputType enumerates the values for job output type. +type JobOutputType string + +const ( + // JobOutputTypeCustomModel ... + JobOutputTypeCustomModel JobOutputType = "CustomModel" + // JobOutputTypeMLFlowModel ... + JobOutputTypeMLFlowModel JobOutputType = "MLFlowModel" + // JobOutputTypeMLTable ... + JobOutputTypeMLTable JobOutputType = "MLTable" + // JobOutputTypeTritonModel ... + JobOutputTypeTritonModel JobOutputType = "TritonModel" + // JobOutputTypeURIFile ... + JobOutputTypeURIFile JobOutputType = "UriFile" + // JobOutputTypeURIFolder ... + JobOutputTypeURIFolder JobOutputType = "UriFolder" +) + +// PossibleJobOutputTypeValues returns an array of possible values for the JobOutputType const type. +func PossibleJobOutputTypeValues() []JobOutputType { + return []JobOutputType{JobOutputTypeCustomModel, JobOutputTypeMLFlowModel, JobOutputTypeMLTable, JobOutputTypeTritonModel, JobOutputTypeURIFile, JobOutputTypeURIFolder} +} + +// JobOutputTypeBasicJobOutput enumerates the values for job output type basic job output. +type JobOutputTypeBasicJobOutput string + +const ( + // JobOutputTypeJobOutput ... + JobOutputTypeJobOutput JobOutputTypeBasicJobOutput = "JobOutput" +) + +// PossibleJobOutputTypeBasicJobOutputValues returns an array of possible values for the JobOutputTypeBasicJobOutput const type. +func PossibleJobOutputTypeBasicJobOutputValues() []JobOutputTypeBasicJobOutput { + return []JobOutputTypeBasicJobOutput{JobOutputTypeJobOutput} +} + +// JobStatus enumerates the values for job status. +type JobStatus string + +const ( + // JobStatusCanceled Following cancellation request, the job is now successfully canceled. + JobStatusCanceled JobStatus = "Canceled" + // JobStatusCancelRequested Cancellation has been requested for the job. + JobStatusCancelRequested JobStatus = "CancelRequested" + // JobStatusCompleted Job completed successfully. This reflects that both the job itself and output + // collection states completed successfully + JobStatusCompleted JobStatus = "Completed" + // JobStatusFailed Job failed. + JobStatusFailed JobStatus = "Failed" + // JobStatusFinalizing Job is completed in the target. It is in output collection state now. + JobStatusFinalizing JobStatus = "Finalizing" + // JobStatusNotResponding When heartbeat is enabled, if the run isn't updating any information to + // RunHistory then the run goes to NotResponding state. + // NotResponding is the only state that is exempt from strict transition orders. A run can go from + // NotResponding to any of the previous states. + JobStatusNotResponding JobStatus = "NotResponding" + // JobStatusNotStarted Run hasn't started yet. + JobStatusNotStarted JobStatus = "NotStarted" + // JobStatusPaused The job is paused by users. Some adjustment to labeling jobs can be made only in paused + // state. + JobStatusPaused JobStatus = "Paused" + // JobStatusPreparing The run environment is being prepared. + JobStatusPreparing JobStatus = "Preparing" + // JobStatusProvisioning (Not used currently) It will be used if ES is creating the compute target. + JobStatusProvisioning JobStatus = "Provisioning" + // JobStatusQueued The job is queued in the compute target. For example, in BatchAI the job is in queued + // state, while waiting for all required nodes to be ready. + JobStatusQueued JobStatus = "Queued" + // JobStatusRunning The job started to run in the compute target. + JobStatusRunning JobStatus = "Running" + // JobStatusScheduled The job is in a scheduled state. Job is not in any active state. + JobStatusScheduled JobStatus = "Scheduled" + // JobStatusStarting Run has started. The user has a run ID. + JobStatusStarting JobStatus = "Starting" + // JobStatusUnknown Default job status if not mapped to all other statuses + 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, JobStatusScheduled, JobStatusStarting, JobStatusUnknown} +} + +// JobType enumerates the values for job type. +type JobType string + +const ( + // JobTypeAutoML ... + JobTypeAutoML JobType = "AutoML" + // JobTypeCommand ... + JobTypeCommand JobType = "Command" + // JobTypePipeline ... + JobTypePipeline JobType = "Pipeline" + // JobTypeSweep ... + JobTypeSweep JobType = "Sweep" +) + +// PossibleJobTypeValues returns an array of possible values for the JobType const type. +func PossibleJobTypeValues() []JobType { + return []JobType{JobTypeAutoML, JobTypeCommand, JobTypePipeline, JobTypeSweep} +} + +// JobTypeBasicJobBase enumerates the values for job type basic job base. +type JobTypeBasicJobBase string + +const ( + // JobTypeAutoML1 ... + JobTypeAutoML1 JobTypeBasicJobBase = "AutoML" + // JobTypeCommand1 ... + JobTypeCommand1 JobTypeBasicJobBase = "Command" + // JobTypeJobBase ... + JobTypeJobBase JobTypeBasicJobBase = "JobBase" + // JobTypePipeline1 ... + JobTypePipeline1 JobTypeBasicJobBase = "Pipeline" + // JobTypeSweep1 ... + JobTypeSweep1 JobTypeBasicJobBase = "Sweep" +) + +// PossibleJobTypeBasicJobBaseValues returns an array of possible values for the JobTypeBasicJobBase const type. +func PossibleJobTypeBasicJobBaseValues() []JobTypeBasicJobBase { + return []JobTypeBasicJobBase{JobTypeAutoML1, JobTypeCommand1, JobTypeJobBase, JobTypePipeline1, JobTypeSweep1} +} + +// 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} +} + +// LearningRateScheduler enumerates the values for learning rate scheduler. +type LearningRateScheduler string + +const ( + // LearningRateSchedulerNone No learning rate scheduler selected. + LearningRateSchedulerNone LearningRateScheduler = "None" + // LearningRateSchedulerStep Step learning rate scheduler. + LearningRateSchedulerStep LearningRateScheduler = "Step" + // LearningRateSchedulerWarmupCosine Cosine Annealing With Warmup. + LearningRateSchedulerWarmupCosine LearningRateScheduler = "WarmupCosine" +) + +// PossibleLearningRateSchedulerValues returns an array of possible values for the LearningRateScheduler const type. +func PossibleLearningRateSchedulerValues() []LearningRateScheduler { + return []LearningRateScheduler{LearningRateSchedulerNone, LearningRateSchedulerStep, LearningRateSchedulerWarmupCosine} +} + +// ListViewType enumerates the values for list view type. +type ListViewType string + +const ( + // ActiveOnly ... + ActiveOnly ListViewType = "ActiveOnly" + // All ... + All ListViewType = "All" + // ArchivedOnly ... + ArchivedOnly ListViewType = "ArchivedOnly" +) + +// PossibleListViewTypeValues returns an array of possible values for the ListViewType const type. +func PossibleListViewTypeValues() []ListViewType { + return []ListViewType{ActiveOnly, All, ArchivedOnly} +} + +// 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} +} + +// LogVerbosity enumerates the values for log verbosity. +type LogVerbosity string + +const ( + // LogVerbosityCritical Only critical statements logged. + LogVerbosityCritical LogVerbosity = "Critical" + // LogVerbosityDebug Debug and above log statements logged. + LogVerbosityDebug LogVerbosity = "Debug" + // LogVerbosityError Error and above log statements logged. + LogVerbosityError LogVerbosity = "Error" + // LogVerbosityInfo Info and above log statements logged. + LogVerbosityInfo LogVerbosity = "Info" + // LogVerbosityNotSet No logs emitted. + LogVerbosityNotSet LogVerbosity = "NotSet" + // LogVerbosityWarning Warning and above log statements logged. + LogVerbosityWarning LogVerbosity = "Warning" +) + +// PossibleLogVerbosityValues returns an array of possible values for the LogVerbosity const type. +func PossibleLogVerbosityValues() []LogVerbosity { + return []LogVerbosity{LogVerbosityCritical, LogVerbosityDebug, LogVerbosityError, LogVerbosityInfo, LogVerbosityNotSet, LogVerbosityWarning} +} + +// ManagedServiceIdentityType enumerates the values for managed service identity type. +type ManagedServiceIdentityType string + +const ( + // ManagedServiceIdentityTypeNone ... + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + // ManagedServiceIdentityTypeSystemAssigned ... + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeSystemAssignedUserAssigned ... + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" + // ManagedServiceIdentityTypeUserAssigned ... + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns an array of possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ManagedServiceIdentityTypeNone, ManagedServiceIdentityTypeSystemAssigned, ManagedServiceIdentityTypeSystemAssignedUserAssigned, ManagedServiceIdentityTypeUserAssigned} +} + +// Mode enumerates the values for mode. +type Mode string + +const ( + // ModeAuto ... + ModeAuto Mode = "Auto" + // ModeCustom ... + ModeCustom Mode = "Custom" + // ModeNCrossValidations ... + ModeNCrossValidations Mode = "NCrossValidations" +) + +// PossibleModeValues returns an array of possible values for the Mode const type. +func PossibleModeValues() []Mode { + return []Mode{ModeAuto, ModeCustom, ModeNCrossValidations} +} + +// ModeBasicForecastHorizon enumerates the values for mode basic forecast horizon. +type ModeBasicForecastHorizon string + +const ( + // ModeBasicForecastHorizonModeAuto ... + ModeBasicForecastHorizonModeAuto ModeBasicForecastHorizon = "Auto" + // ModeBasicForecastHorizonModeCustom ... + ModeBasicForecastHorizonModeCustom ModeBasicForecastHorizon = "Custom" + // ModeBasicForecastHorizonModeForecastHorizon ... + ModeBasicForecastHorizonModeForecastHorizon ModeBasicForecastHorizon = "ForecastHorizon" +) + +// PossibleModeBasicForecastHorizonValues returns an array of possible values for the ModeBasicForecastHorizon const type. +func PossibleModeBasicForecastHorizonValues() []ModeBasicForecastHorizon { + return []ModeBasicForecastHorizon{ModeBasicForecastHorizonModeAuto, ModeBasicForecastHorizonModeCustom, ModeBasicForecastHorizonModeForecastHorizon} +} + +// ModeBasicSeasonality enumerates the values for mode basic seasonality. +type ModeBasicSeasonality string + +const ( + // ModeBasicSeasonalityModeAuto ... + ModeBasicSeasonalityModeAuto ModeBasicSeasonality = "Auto" + // ModeBasicSeasonalityModeCustom ... + ModeBasicSeasonalityModeCustom ModeBasicSeasonality = "Custom" + // ModeBasicSeasonalityModeSeasonality ... + ModeBasicSeasonalityModeSeasonality ModeBasicSeasonality = "Seasonality" +) + +// PossibleModeBasicSeasonalityValues returns an array of possible values for the ModeBasicSeasonality const type. +func PossibleModeBasicSeasonalityValues() []ModeBasicSeasonality { + return []ModeBasicSeasonality{ModeBasicSeasonalityModeAuto, ModeBasicSeasonalityModeCustom, ModeBasicSeasonalityModeSeasonality} +} + +// ModeBasicTargetLags enumerates the values for mode basic target lags. +type ModeBasicTargetLags string + +const ( + // ModeBasicTargetLagsModeAuto ... + ModeBasicTargetLagsModeAuto ModeBasicTargetLags = "Auto" + // ModeBasicTargetLagsModeCustom ... + ModeBasicTargetLagsModeCustom ModeBasicTargetLags = "Custom" + // ModeBasicTargetLagsModeTargetLags ... + ModeBasicTargetLagsModeTargetLags ModeBasicTargetLags = "TargetLags" +) + +// PossibleModeBasicTargetLagsValues returns an array of possible values for the ModeBasicTargetLags const type. +func PossibleModeBasicTargetLagsValues() []ModeBasicTargetLags { + return []ModeBasicTargetLags{ModeBasicTargetLagsModeAuto, ModeBasicTargetLagsModeCustom, ModeBasicTargetLagsModeTargetLags} +} + +// ModeBasicTargetRollingWindowSize enumerates the values for mode basic target rolling window size. +type ModeBasicTargetRollingWindowSize string + +const ( + // ModeBasicTargetRollingWindowSizeModeAuto ... + ModeBasicTargetRollingWindowSizeModeAuto ModeBasicTargetRollingWindowSize = "Auto" + // ModeBasicTargetRollingWindowSizeModeCustom ... + ModeBasicTargetRollingWindowSizeModeCustom ModeBasicTargetRollingWindowSize = "Custom" + // ModeBasicTargetRollingWindowSizeModeTargetRollingWindowSize ... + ModeBasicTargetRollingWindowSizeModeTargetRollingWindowSize ModeBasicTargetRollingWindowSize = "TargetRollingWindowSize" +) + +// PossibleModeBasicTargetRollingWindowSizeValues returns an array of possible values for the ModeBasicTargetRollingWindowSize const type. +func PossibleModeBasicTargetRollingWindowSizeValues() []ModeBasicTargetRollingWindowSize { + return []ModeBasicTargetRollingWindowSize{ModeBasicTargetRollingWindowSizeModeAuto, ModeBasicTargetRollingWindowSizeModeCustom, ModeBasicTargetRollingWindowSizeModeTargetRollingWindowSize} +} + +// ModelSize enumerates the values for model size. +type ModelSize string + +const ( + // ModelSizeExtraLarge Extra large size. + ModelSizeExtraLarge ModelSize = "ExtraLarge" + // ModelSizeLarge Large size. + ModelSizeLarge ModelSize = "Large" + // ModelSizeMedium Medium size. + ModelSizeMedium ModelSize = "Medium" + // ModelSizeNone No value selected. + ModelSizeNone ModelSize = "None" + // ModelSizeSmall Small size. + ModelSizeSmall ModelSize = "Small" +) + +// PossibleModelSizeValues returns an array of possible values for the ModelSize const type. +func PossibleModelSizeValues() []ModelSize { + return []ModelSize{ModelSizeExtraLarge, ModelSizeLarge, ModelSizeMedium, ModelSizeNone, ModelSizeSmall} +} + +// ModelType enumerates the values for model type. +type ModelType string + +const ( + // CustomModel ... + CustomModel ModelType = "CustomModel" + // MLFlowModel ... + MLFlowModel ModelType = "MLFlowModel" + // TritonModel ... + TritonModel ModelType = "TritonModel" +) + +// PossibleModelTypeValues returns an array of possible values for the ModelType const type. +func PossibleModelTypeValues() []ModelType { + return []ModelType{CustomModel, MLFlowModel, TritonModel} +} + +// MountAction enumerates the values for mount action. +type MountAction string + +const ( + // Mount ... + Mount MountAction = "Mount" + // Unmount ... + Unmount MountAction = "Unmount" +) + +// PossibleMountActionValues returns an array of possible values for the MountAction const type. +func PossibleMountActionValues() []MountAction { + return []MountAction{Mount, Unmount} +} + +// MountState enumerates the values for mount state. +type MountState string + +const ( + // Mounted ... + Mounted MountState = "Mounted" + // MountFailed ... + MountFailed MountState = "MountFailed" + // MountRequested ... + MountRequested MountState = "MountRequested" + // Unmounted ... + Unmounted MountState = "Unmounted" + // UnmountFailed ... + UnmountFailed MountState = "UnmountFailed" + // UnmountRequested ... + UnmountRequested MountState = "UnmountRequested" +) + +// PossibleMountStateValues returns an array of possible values for the MountState const type. +func PossibleMountStateValues() []MountState { + return []MountState{Mounted, MountFailed, MountRequested, Unmounted, UnmountFailed, UnmountRequested} +} + +// NCrossValidationsMode enumerates the values for n cross validations mode. +type NCrossValidationsMode string + +const ( + // NCrossValidationsModeAuto Determine N-Cross validations value automatically. Supported only for + // 'Forecasting' AutoML task. + NCrossValidationsModeAuto NCrossValidationsMode = "Auto" + // NCrossValidationsModeCustom Use custom N-Cross validations value. + NCrossValidationsModeCustom NCrossValidationsMode = "Custom" +) + +// PossibleNCrossValidationsModeValues returns an array of possible values for the NCrossValidationsMode const type. +func PossibleNCrossValidationsModeValues() []NCrossValidationsMode { + return []NCrossValidationsMode{NCrossValidationsModeAuto, NCrossValidationsModeCustom} +} + +// Network enumerates the values for network. +type Network string + +const ( + // Bridge ... + Bridge Network = "Bridge" + // Host ... + Host Network = "Host" +) + +// PossibleNetworkValues returns an array of possible values for the Network const type. +func PossibleNetworkValues() []Network { + return []Network{Bridge, Host} +} + +// 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} +} + +// ObjectDetectionPrimaryMetrics enumerates the values for object detection primary metrics. +type ObjectDetectionPrimaryMetrics string + +const ( + // ObjectDetectionPrimaryMetricsMeanAveragePrecision Mean Average Precision (MAP) is the average of AP + // (Average Precision). + // AP is calculated for each class and averaged to get the MAP. + ObjectDetectionPrimaryMetricsMeanAveragePrecision ObjectDetectionPrimaryMetrics = "MeanAveragePrecision" +) + +// PossibleObjectDetectionPrimaryMetricsValues returns an array of possible values for the ObjectDetectionPrimaryMetrics const type. +func PossibleObjectDetectionPrimaryMetricsValues() []ObjectDetectionPrimaryMetrics { + return []ObjectDetectionPrimaryMetrics{ObjectDetectionPrimaryMetricsMeanAveragePrecision} +} + +// 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} +} + +// OperationTrigger enumerates the values for operation trigger. +type OperationTrigger string + +const ( + // IdleShutdown ... + IdleShutdown OperationTrigger = "IdleShutdown" + // Schedule ... + Schedule OperationTrigger = "Schedule" + // User ... + User OperationTrigger = "User" +) + +// PossibleOperationTriggerValues returns an array of possible values for the OperationTrigger const type. +func PossibleOperationTriggerValues() []OperationTrigger { + return []OperationTrigger{IdleShutdown, Schedule, User} +} + +// 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} +} + +// 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} +} + +// OutputDeliveryMode enumerates the values for output delivery mode. +type OutputDeliveryMode string + +const ( + // OutputDeliveryModeReadWriteMount ... + OutputDeliveryModeReadWriteMount OutputDeliveryMode = "ReadWriteMount" + // OutputDeliveryModeUpload ... + OutputDeliveryModeUpload OutputDeliveryMode = "Upload" +) + +// PossibleOutputDeliveryModeValues returns an array of possible values for the OutputDeliveryMode const type. +func PossibleOutputDeliveryModeValues() []OutputDeliveryMode { + return []OutputDeliveryMode{OutputDeliveryModeReadWriteMount, OutputDeliveryModeUpload} +} + +// 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 ( + // Completed ... + Completed ProvisioningStatus = "Completed" + // Failed ... + Failed ProvisioningStatus = "Failed" + // Provisioning ... + Provisioning ProvisioningStatus = "Provisioning" +) + +// PossibleProvisioningStatusValues returns an array of possible values for the ProvisioningStatus const type. +func PossibleProvisioningStatusValues() []ProvisioningStatus { + return []ProvisioningStatus{Completed, Failed, Provisioning} +} + +// PublicNetworkAccess enumerates the values for public network access. +type PublicNetworkAccess string + +const ( + // PublicNetworkAccessDisabled ... + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + // PublicNetworkAccessEnabled ... + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} +} + +// PublicNetworkAccessType enumerates the values for public network access type. +type PublicNetworkAccessType string + +const ( + // PublicNetworkAccessTypeDisabled ... + PublicNetworkAccessTypeDisabled PublicNetworkAccessType = "Disabled" + // PublicNetworkAccessTypeEnabled ... + PublicNetworkAccessTypeEnabled PublicNetworkAccessType = "Enabled" +) + +// PossiblePublicNetworkAccessTypeValues returns an array of possible values for the PublicNetworkAccessType const type. +func PossiblePublicNetworkAccessTypeValues() []PublicNetworkAccessType { + return []PublicNetworkAccessType{PublicNetworkAccessTypeDisabled, PublicNetworkAccessTypeEnabled} +} + +// 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} +} + +// RandomSamplingAlgorithmRule enumerates the values for random sampling algorithm rule. +type RandomSamplingAlgorithmRule string + +const ( + // Random ... + Random RandomSamplingAlgorithmRule = "Random" + // Sobol ... + Sobol RandomSamplingAlgorithmRule = "Sobol" +) + +// PossibleRandomSamplingAlgorithmRuleValues returns an array of possible values for the RandomSamplingAlgorithmRule const type. +func PossibleRandomSamplingAlgorithmRuleValues() []RandomSamplingAlgorithmRule { + return []RandomSamplingAlgorithmRule{Random, Sobol} +} + +// RecurrenceFrequency enumerates the values for recurrence frequency. +type RecurrenceFrequency string + +const ( + // Day Day frequency + Day RecurrenceFrequency = "Day" + // Hour Hour frequency + Hour RecurrenceFrequency = "Hour" + // Minute Minute frequency + Minute RecurrenceFrequency = "Minute" + // Month Month frequency + Month RecurrenceFrequency = "Month" + // Week Week frequency + Week RecurrenceFrequency = "Week" +) + +// PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. +func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { + return []RecurrenceFrequency{Day, Hour, Minute, Month, Week} +} + +// 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} +} + +// ReferenceTypeBasicPartialAssetReferenceBase enumerates the values for reference type basic partial asset +// reference base. +type ReferenceTypeBasicPartialAssetReferenceBase string + +const ( + // ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeDataPath ... + ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeDataPath ReferenceTypeBasicPartialAssetReferenceBase = "DataPath" + // ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeID ... + ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeID ReferenceTypeBasicPartialAssetReferenceBase = "Id" + // ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeOutputPath ... + ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeOutputPath ReferenceTypeBasicPartialAssetReferenceBase = "OutputPath" + // ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypePartialAssetReferenceBase ... + ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypePartialAssetReferenceBase ReferenceTypeBasicPartialAssetReferenceBase = "PartialAssetReferenceBase" +) + +// PossibleReferenceTypeBasicPartialAssetReferenceBaseValues returns an array of possible values for the ReferenceTypeBasicPartialAssetReferenceBase const type. +func PossibleReferenceTypeBasicPartialAssetReferenceBaseValues() []ReferenceTypeBasicPartialAssetReferenceBase { + return []ReferenceTypeBasicPartialAssetReferenceBase{ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeDataPath, ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeID, ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeOutputPath, ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypePartialAssetReferenceBase} +} + +// RegressionModels enumerates the values for regression models. +type RegressionModels string + +const ( + // RegressionModelsDecisionTree Decision Trees are a non-parametric supervised learning method used for + // both classification and regression tasks. + // The goal is to create a model that predicts the value of a target variable by learning simple decision + // rules inferred from the data features. + RegressionModelsDecisionTree RegressionModels = "DecisionTree" + // RegressionModelsElasticNet Elastic net is a popular type of regularized linear regression that combines + // two popular penalties, specifically the L1 and L2 penalty functions. + RegressionModelsElasticNet RegressionModels = "ElasticNet" + // RegressionModelsExtremeRandomTrees Extreme Trees is an ensemble machine learning algorithm that combines + // the predictions from many decision trees. It is related to the widely used random forest algorithm. + RegressionModelsExtremeRandomTrees RegressionModels = "ExtremeRandomTrees" + // RegressionModelsGradientBoosting The technique of transiting week learners into a strong learner is + // called Boosting. The gradient boosting algorithm process works on this theory of execution. + RegressionModelsGradientBoosting RegressionModels = "GradientBoosting" + // RegressionModelsKNN K-nearest neighbors (KNN) algorithm uses 'feature similarity' to predict the values + // of new datapoints + // which further means that the new data point will be assigned a value based on how closely it matches the + // points in the training set. + RegressionModelsKNN RegressionModels = "KNN" + // RegressionModelsLassoLars Lasso model fit with Least Angle Regression a.k.a. Lars. It is a Linear Model + // trained with an L1 prior as regularizer. + RegressionModelsLassoLars RegressionModels = "LassoLars" + // RegressionModelsLightGBM LightGBM is a gradient boosting framework that uses tree based learning + // algorithms. + RegressionModelsLightGBM RegressionModels = "LightGBM" + // RegressionModelsRandomForest Random forest is a supervised learning algorithm. + // The "forest" it builds, is an ensemble of decision trees, usually trained with the “bagging” method. + // The general idea of the bagging method is that a combination of learning models increases the overall + // result. + RegressionModelsRandomForest RegressionModels = "RandomForest" + // RegressionModelsSGD SGD: Stochastic gradient descent is an optimization algorithm often used in machine + // learning applications + // to find the model parameters that correspond to the best fit between predicted and actual outputs. + // It's an inexact but powerful technique. + RegressionModelsSGD RegressionModels = "SGD" + // RegressionModelsXGBoostRegressor XGBoostRegressor: Extreme Gradient Boosting Regressor is a supervised + // machine learning model using ensemble of base learners. + RegressionModelsXGBoostRegressor RegressionModels = "XGBoostRegressor" +) + +// PossibleRegressionModelsValues returns an array of possible values for the RegressionModels const type. +func PossibleRegressionModelsValues() []RegressionModels { + return []RegressionModels{RegressionModelsDecisionTree, RegressionModelsElasticNet, RegressionModelsExtremeRandomTrees, RegressionModelsGradientBoosting, RegressionModelsKNN, RegressionModelsLassoLars, RegressionModelsLightGBM, RegressionModelsRandomForest, RegressionModelsSGD, RegressionModelsXGBoostRegressor} +} + +// RegressionPrimaryMetrics enumerates the values for regression primary metrics. +type RegressionPrimaryMetrics string + +const ( + // RegressionPrimaryMetricsNormalizedMeanAbsoluteError The Normalized Mean Absolute Error (NMAE) is a + // validation metric to compare the Mean Absolute Error (MAE) of (time) series with different scales. + RegressionPrimaryMetricsNormalizedMeanAbsoluteError RegressionPrimaryMetrics = "NormalizedMeanAbsoluteError" + // RegressionPrimaryMetricsNormalizedRootMeanSquaredError The Normalized Root Mean Squared Error (NRMSE) + // the RMSE facilitates the comparison between models with different scales. + RegressionPrimaryMetricsNormalizedRootMeanSquaredError RegressionPrimaryMetrics = "NormalizedRootMeanSquaredError" + // RegressionPrimaryMetricsR2Score The R2 score is one of the performance evaluation measures for + // forecasting-based machine learning models. + RegressionPrimaryMetricsR2Score RegressionPrimaryMetrics = "R2Score" + // RegressionPrimaryMetricsSpearmanCorrelation The Spearman's rank coefficient of correlation is a + // nonparametric measure of rank correlation. + RegressionPrimaryMetricsSpearmanCorrelation RegressionPrimaryMetrics = "SpearmanCorrelation" +) + +// PossibleRegressionPrimaryMetricsValues returns an array of possible values for the RegressionPrimaryMetrics const type. +func PossibleRegressionPrimaryMetricsValues() []RegressionPrimaryMetrics { + return []RegressionPrimaryMetrics{RegressionPrimaryMetricsNormalizedMeanAbsoluteError, RegressionPrimaryMetricsNormalizedRootMeanSquaredError, RegressionPrimaryMetricsR2Score, RegressionPrimaryMetricsSpearmanCorrelation} +} + +// 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} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // SystemAssigned ... + SystemAssigned ResourceIdentityType = "SystemAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{SystemAssigned} +} + +// SamplingAlgorithmType enumerates the values for sampling algorithm type. +type SamplingAlgorithmType string + +const ( + // SamplingAlgorithmTypeBayesian ... + SamplingAlgorithmTypeBayesian SamplingAlgorithmType = "Bayesian" + // SamplingAlgorithmTypeGrid ... + SamplingAlgorithmTypeGrid SamplingAlgorithmType = "Grid" + // SamplingAlgorithmTypeRandom ... + SamplingAlgorithmTypeRandom SamplingAlgorithmType = "Random" +) + +// PossibleSamplingAlgorithmTypeValues returns an array of possible values for the SamplingAlgorithmType const type. +func PossibleSamplingAlgorithmTypeValues() []SamplingAlgorithmType { + return []SamplingAlgorithmType{SamplingAlgorithmTypeBayesian, SamplingAlgorithmTypeGrid, SamplingAlgorithmTypeRandom} +} + +// SamplingAlgorithmTypeBasicSamplingAlgorithm enumerates the values for sampling algorithm type basic sampling +// algorithm. +type SamplingAlgorithmTypeBasicSamplingAlgorithm string + +const ( + // SamplingAlgorithmTypeBayesian1 ... + SamplingAlgorithmTypeBayesian1 SamplingAlgorithmTypeBasicSamplingAlgorithm = "Bayesian" + // SamplingAlgorithmTypeGrid1 ... + SamplingAlgorithmTypeGrid1 SamplingAlgorithmTypeBasicSamplingAlgorithm = "Grid" + // SamplingAlgorithmTypeRandom1 ... + SamplingAlgorithmTypeRandom1 SamplingAlgorithmTypeBasicSamplingAlgorithm = "Random" + // SamplingAlgorithmTypeSamplingAlgorithm ... + SamplingAlgorithmTypeSamplingAlgorithm SamplingAlgorithmTypeBasicSamplingAlgorithm = "SamplingAlgorithm" +) + +// PossibleSamplingAlgorithmTypeBasicSamplingAlgorithmValues returns an array of possible values for the SamplingAlgorithmTypeBasicSamplingAlgorithm const type. +func PossibleSamplingAlgorithmTypeBasicSamplingAlgorithmValues() []SamplingAlgorithmTypeBasicSamplingAlgorithm { + return []SamplingAlgorithmTypeBasicSamplingAlgorithm{SamplingAlgorithmTypeBayesian1, SamplingAlgorithmTypeGrid1, SamplingAlgorithmTypeRandom1, SamplingAlgorithmTypeSamplingAlgorithm} +} + +// ScaleType enumerates the values for scale type. +type ScaleType string + +const ( + // Default ... + Default ScaleType = "Default" + // TargetUtilization ... + TargetUtilization ScaleType = "TargetUtilization" +) + +// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. +func PossibleScaleTypeValues() []ScaleType { + return []ScaleType{Default, TargetUtilization} +} + +// ScaleTypeBasicOnlineScaleSettings enumerates the values for scale type basic online scale settings. +type ScaleTypeBasicOnlineScaleSettings string + +const ( + // ScaleTypeDefault ... + ScaleTypeDefault ScaleTypeBasicOnlineScaleSettings = "Default" + // ScaleTypeOnlineScaleSettings ... + ScaleTypeOnlineScaleSettings ScaleTypeBasicOnlineScaleSettings = "OnlineScaleSettings" + // ScaleTypeTargetUtilization ... + ScaleTypeTargetUtilization ScaleTypeBasicOnlineScaleSettings = "TargetUtilization" +) + +// PossibleScaleTypeBasicOnlineScaleSettingsValues returns an array of possible values for the ScaleTypeBasicOnlineScaleSettings const type. +func PossibleScaleTypeBasicOnlineScaleSettingsValues() []ScaleTypeBasicOnlineScaleSettings { + return []ScaleTypeBasicOnlineScaleSettings{ScaleTypeDefault, ScaleTypeOnlineScaleSettings, ScaleTypeTargetUtilization} +} + +// ScheduleStatus enumerates the values for schedule status. +type ScheduleStatus string + +const ( + // ScheduleStatusDisabled Schedule is disabled + ScheduleStatusDisabled ScheduleStatus = "Disabled" + // ScheduleStatusEnabled Schedule is enabled + 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 ( + // Cron Cron schedule type + Cron ScheduleType = "Cron" + // Recurrence Recurrence schedule type + Recurrence ScheduleType = "Recurrence" +) + +// PossibleScheduleTypeValues returns an array of possible values for the ScheduleType const type. +func PossibleScheduleTypeValues() []ScheduleType { + return []ScheduleType{Cron, Recurrence} +} + +// ScheduleTypeBasicScheduleBase enumerates the values for schedule type basic schedule base. +type ScheduleTypeBasicScheduleBase string + +const ( + // ScheduleTypeCron ... + ScheduleTypeCron ScheduleTypeBasicScheduleBase = "Cron" + // ScheduleTypeRecurrence ... + ScheduleTypeRecurrence ScheduleTypeBasicScheduleBase = "Recurrence" + // ScheduleTypeScheduleBase ... + ScheduleTypeScheduleBase ScheduleTypeBasicScheduleBase = "ScheduleBase" +) + +// PossibleScheduleTypeBasicScheduleBaseValues returns an array of possible values for the ScheduleTypeBasicScheduleBase const type. +func PossibleScheduleTypeBasicScheduleBaseValues() []ScheduleTypeBasicScheduleBase { + return []ScheduleTypeBasicScheduleBase{ScheduleTypeCron, ScheduleTypeRecurrence, ScheduleTypeScheduleBase} +} + +// SeasonalityMode enumerates the values for seasonality mode. +type SeasonalityMode string + +const ( + // SeasonalityModeAuto Seasonality to be determined automatically. + SeasonalityModeAuto SeasonalityMode = "Auto" + // SeasonalityModeCustom Use the custom seasonality value. + SeasonalityModeCustom SeasonalityMode = "Custom" +) + +// PossibleSeasonalityModeValues returns an array of possible values for the SeasonalityMode const type. +func PossibleSeasonalityModeValues() []SeasonalityMode { + return []SeasonalityMode{SeasonalityModeAuto, SeasonalityModeCustom} +} + +// SecretsType enumerates the values for secrets type. +type SecretsType string + +const ( + // AccountKey ... + AccountKey SecretsType = "AccountKey" + // Certificate ... + Certificate SecretsType = "Certificate" + // KerberosKeytab ... + KerberosKeytab SecretsType = "KerberosKeytab" + // KerberosPassword ... + KerberosPassword SecretsType = "KerberosPassword" + // Sas ... + Sas SecretsType = "Sas" + // ServicePrincipal ... + ServicePrincipal SecretsType = "ServicePrincipal" +) + +// PossibleSecretsTypeValues returns an array of possible values for the SecretsType const type. +func PossibleSecretsTypeValues() []SecretsType { + return []SecretsType{AccountKey, Certificate, KerberosKeytab, KerberosPassword, Sas, ServicePrincipal} +} + +// SecretsTypeBasicDatastoreSecrets enumerates the values for secrets type basic datastore secrets. +type SecretsTypeBasicDatastoreSecrets string + +const ( + // SecretsTypeAccountKey ... + SecretsTypeAccountKey SecretsTypeBasicDatastoreSecrets = "AccountKey" + // SecretsTypeCertificate ... + SecretsTypeCertificate SecretsTypeBasicDatastoreSecrets = "Certificate" + // SecretsTypeDatastoreSecrets ... + SecretsTypeDatastoreSecrets SecretsTypeBasicDatastoreSecrets = "DatastoreSecrets" + // SecretsTypeKerberosKeytab ... + SecretsTypeKerberosKeytab SecretsTypeBasicDatastoreSecrets = "KerberosKeytab" + // SecretsTypeKerberosPassword ... + SecretsTypeKerberosPassword SecretsTypeBasicDatastoreSecrets = "KerberosPassword" + // SecretsTypeSas ... + SecretsTypeSas SecretsTypeBasicDatastoreSecrets = "Sas" + // SecretsTypeServicePrincipal ... + SecretsTypeServicePrincipal SecretsTypeBasicDatastoreSecrets = "ServicePrincipal" +) + +// PossibleSecretsTypeBasicDatastoreSecretsValues returns an array of possible values for the SecretsTypeBasicDatastoreSecrets const type. +func PossibleSecretsTypeBasicDatastoreSecretsValues() []SecretsTypeBasicDatastoreSecrets { + return []SecretsTypeBasicDatastoreSecrets{SecretsTypeAccountKey, SecretsTypeCertificate, SecretsTypeDatastoreSecrets, SecretsTypeKerberosKeytab, SecretsTypeKerberosPassword, SecretsTypeSas, SecretsTypeServicePrincipal} +} + +// ServiceDataAccessAuthIdentity enumerates the values for service data access auth identity. +type ServiceDataAccessAuthIdentity string + +const ( + // ServiceDataAccessAuthIdentityNone Do not use any identity for service data access. + ServiceDataAccessAuthIdentityNone ServiceDataAccessAuthIdentity = "None" + // ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity Use the system assigned managed identity of + // the Workspace to authenticate service data access. + ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity ServiceDataAccessAuthIdentity = "WorkspaceSystemAssignedIdentity" + // ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity Use the user assigned managed identity of the + // Workspace to authenticate service data access. + ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity ServiceDataAccessAuthIdentity = "WorkspaceUserAssignedIdentity" +) + +// PossibleServiceDataAccessAuthIdentityValues returns an array of possible values for the ServiceDataAccessAuthIdentity const type. +func PossibleServiceDataAccessAuthIdentityValues() []ServiceDataAccessAuthIdentity { + return []ServiceDataAccessAuthIdentity{ServiceDataAccessAuthIdentityNone, ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity, ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity} +} + +// ShortSeriesHandlingConfiguration enumerates the values for short series handling configuration. +type ShortSeriesHandlingConfiguration string + +const ( + // ShortSeriesHandlingConfigurationAuto Short series will be padded if there are no long series, otherwise + // short series will be dropped. + ShortSeriesHandlingConfigurationAuto ShortSeriesHandlingConfiguration = "Auto" + // ShortSeriesHandlingConfigurationDrop All the short series will be dropped. + ShortSeriesHandlingConfigurationDrop ShortSeriesHandlingConfiguration = "Drop" + // ShortSeriesHandlingConfigurationNone Represents no/null value. + ShortSeriesHandlingConfigurationNone ShortSeriesHandlingConfiguration = "None" + // ShortSeriesHandlingConfigurationPad All the short series will be padded. + ShortSeriesHandlingConfigurationPad ShortSeriesHandlingConfiguration = "Pad" +) + +// PossibleShortSeriesHandlingConfigurationValues returns an array of possible values for the ShortSeriesHandlingConfiguration const type. +func PossibleShortSeriesHandlingConfigurationValues() []ShortSeriesHandlingConfiguration { + return []ShortSeriesHandlingConfiguration{ShortSeriesHandlingConfigurationAuto, ShortSeriesHandlingConfigurationDrop, ShortSeriesHandlingConfigurationNone, ShortSeriesHandlingConfigurationPad} +} + +// SkuScaleType enumerates the values for sku scale type. +type SkuScaleType string + +const ( + // SkuScaleTypeAutomatic ... + SkuScaleTypeAutomatic SkuScaleType = "Automatic" + // SkuScaleTypeManual ... + SkuScaleTypeManual SkuScaleType = "Manual" + // SkuScaleTypeNone ... + SkuScaleTypeNone SkuScaleType = "None" +) + +// PossibleSkuScaleTypeValues returns an array of possible values for the SkuScaleType const type. +func PossibleSkuScaleTypeValues() []SkuScaleType { + return []SkuScaleType{SkuScaleTypeAutomatic, SkuScaleTypeManual, SkuScaleTypeNone} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Basic ... + Basic SkuTier = "Basic" + // Free ... + Free SkuTier = "Free" + // Premium ... + Premium SkuTier = "Premium" + // Standard ... + Standard SkuTier = "Standard" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{Basic, Free, Premium, Standard} +} + +// SourceType enumerates the values for source type. +type SourceType string + +const ( + // SourceTypeDataset ... + SourceTypeDataset SourceType = "Dataset" + // SourceTypeDatastore ... + SourceTypeDatastore SourceType = "Datastore" + // SourceTypeURI ... + SourceTypeURI SourceType = "URI" +) + +// PossibleSourceTypeValues returns an array of possible values for the SourceType const type. +func PossibleSourceTypeValues() []SourceType { + return []SourceType{SourceTypeDataset, SourceTypeDatastore, SourceTypeURI} +} + +// 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} +} + +// StackMetaLearnerType enumerates the values for stack meta learner type. +type StackMetaLearnerType string + +const ( + // StackMetaLearnerTypeElasticNet Default meta-learners are LogisticRegression for regression task. + StackMetaLearnerTypeElasticNet StackMetaLearnerType = "ElasticNet" + // StackMetaLearnerTypeElasticNetCV Default meta-learners are LogisticRegression for regression task when + // CV is on. + StackMetaLearnerTypeElasticNetCV StackMetaLearnerType = "ElasticNetCV" + // StackMetaLearnerTypeLightGBMClassifier ... + StackMetaLearnerTypeLightGBMClassifier StackMetaLearnerType = "LightGBMClassifier" + // StackMetaLearnerTypeLightGBMRegressor ... + StackMetaLearnerTypeLightGBMRegressor StackMetaLearnerType = "LightGBMRegressor" + // StackMetaLearnerTypeLinearRegression ... + StackMetaLearnerTypeLinearRegression StackMetaLearnerType = "LinearRegression" + // StackMetaLearnerTypeLogisticRegression Default meta-learners are LogisticRegression for classification + // tasks. + StackMetaLearnerTypeLogisticRegression StackMetaLearnerType = "LogisticRegression" + // StackMetaLearnerTypeLogisticRegressionCV Default meta-learners are LogisticRegression for classification + // task when CV is on. + StackMetaLearnerTypeLogisticRegressionCV StackMetaLearnerType = "LogisticRegressionCV" + // StackMetaLearnerTypeNone ... + StackMetaLearnerTypeNone StackMetaLearnerType = "None" +) + +// PossibleStackMetaLearnerTypeValues returns an array of possible values for the StackMetaLearnerType const type. +func PossibleStackMetaLearnerTypeValues() []StackMetaLearnerType { + return []StackMetaLearnerType{StackMetaLearnerTypeElasticNet, StackMetaLearnerTypeElasticNetCV, StackMetaLearnerTypeLightGBMClassifier, StackMetaLearnerTypeLightGBMRegressor, StackMetaLearnerTypeLinearRegression, StackMetaLearnerTypeLogisticRegression, StackMetaLearnerTypeLogisticRegressionCV, StackMetaLearnerTypeNone} +} + +// 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} +} + +// StochasticOptimizer enumerates the values for stochastic optimizer. +type StochasticOptimizer string + +const ( + // StochasticOptimizerAdam Adam is algorithm the optimizes stochastic objective functions based on adaptive + // estimates of moments + StochasticOptimizerAdam StochasticOptimizer = "Adam" + // StochasticOptimizerAdamw AdamW is a variant of the optimizer Adam that has an improved implementation of + // weight decay. + StochasticOptimizerAdamw StochasticOptimizer = "Adamw" + // StochasticOptimizerNone No optimizer selected. + StochasticOptimizerNone StochasticOptimizer = "None" + // StochasticOptimizerSgd Stochastic Gradient Descent optimizer. + StochasticOptimizerSgd StochasticOptimizer = "Sgd" +) + +// PossibleStochasticOptimizerValues returns an array of possible values for the StochasticOptimizer const type. +func PossibleStochasticOptimizerValues() []StochasticOptimizer { + return []StochasticOptimizer{StochasticOptimizerAdam, StochasticOptimizerAdamw, StochasticOptimizerNone, StochasticOptimizerSgd} +} + +// StorageAccountType enumerates the values for storage account type. +type StorageAccountType string + +const ( + // PremiumLRS ... + PremiumLRS StorageAccountType = "Premium_LRS" + // StandardLRS ... + StandardLRS StorageAccountType = "Standard_LRS" +) + +// PossibleStorageAccountTypeValues returns an array of possible values for the StorageAccountType const type. +func PossibleStorageAccountTypeValues() []StorageAccountType { + return []StorageAccountType{PremiumLRS, StandardLRS} +} + +// TargetAggregationFunction enumerates the values for target aggregation function. +type TargetAggregationFunction string + +const ( + // TargetAggregationFunctionMax ... + TargetAggregationFunctionMax TargetAggregationFunction = "Max" + // TargetAggregationFunctionMean ... + TargetAggregationFunctionMean TargetAggregationFunction = "Mean" + // TargetAggregationFunctionMin ... + TargetAggregationFunctionMin TargetAggregationFunction = "Min" + // TargetAggregationFunctionNone Represent no value set. + TargetAggregationFunctionNone TargetAggregationFunction = "None" + // TargetAggregationFunctionSum ... + TargetAggregationFunctionSum TargetAggregationFunction = "Sum" +) + +// PossibleTargetAggregationFunctionValues returns an array of possible values for the TargetAggregationFunction const type. +func PossibleTargetAggregationFunctionValues() []TargetAggregationFunction { + return []TargetAggregationFunction{TargetAggregationFunctionMax, TargetAggregationFunctionMean, TargetAggregationFunctionMin, TargetAggregationFunctionNone, TargetAggregationFunctionSum} +} + +// TargetLagsMode enumerates the values for target lags mode. +type TargetLagsMode string + +const ( + // TargetLagsModeAuto Target lags to be determined automatically. + TargetLagsModeAuto TargetLagsMode = "Auto" + // TargetLagsModeCustom Use the custom target lags. + TargetLagsModeCustom TargetLagsMode = "Custom" +) + +// PossibleTargetLagsModeValues returns an array of possible values for the TargetLagsMode const type. +func PossibleTargetLagsModeValues() []TargetLagsMode { + return []TargetLagsMode{TargetLagsModeAuto, TargetLagsModeCustom} +} + +// TargetRollingWindowSizeMode enumerates the values for target rolling window size mode. +type TargetRollingWindowSizeMode string + +const ( + // TargetRollingWindowSizeModeAuto Determine rolling windows size automatically. + TargetRollingWindowSizeModeAuto TargetRollingWindowSizeMode = "Auto" + // TargetRollingWindowSizeModeCustom Use the specified rolling window size. + TargetRollingWindowSizeModeCustom TargetRollingWindowSizeMode = "Custom" +) + +// PossibleTargetRollingWindowSizeModeValues returns an array of possible values for the TargetRollingWindowSizeMode const type. +func PossibleTargetRollingWindowSizeModeValues() []TargetRollingWindowSizeMode { + return []TargetRollingWindowSizeMode{TargetRollingWindowSizeModeAuto, TargetRollingWindowSizeModeCustom} +} + +// TaskType enumerates the values for task type. +type TaskType string + +const ( + // TaskTypeClassification Classification in machine learning and statistics is a supervised learning + // approach in which + // the computer program learns from the data given to it and make new observations or classifications. + TaskTypeClassification TaskType = "Classification" + // TaskTypeForecasting Forecasting is a special kind of regression task that deals with time-series data + // and creates forecasting model + // that can be used to predict the near future values based on the inputs. + TaskTypeForecasting TaskType = "Forecasting" + // TaskTypeImageClassification Image Classification. Multi-class image classification is used when an image + // is classified with only a single label + // from a set of classes - e.g. each image is classified as either an image of a 'cat' or a 'dog' or a + // 'duck'. + TaskTypeImageClassification TaskType = "ImageClassification" + // TaskTypeImageClassificationMultilabel Image Classification Multilabel. Multi-label image classification + // is used when an image could have one or more labels + // from a set of labels - e.g. an image could be labeled with both 'cat' and 'dog'. + TaskTypeImageClassificationMultilabel TaskType = "ImageClassificationMultilabel" + // TaskTypeImageInstanceSegmentation Image Instance Segmentation. Instance segmentation is used to identify + // objects in an image at the pixel level, + // drawing a polygon around each object in the image. + TaskTypeImageInstanceSegmentation TaskType = "ImageInstanceSegmentation" + // TaskTypeImageObjectDetection Image Object Detection. Object detection is used to identify objects in an + // image and locate each object with a + // bounding box e.g. locate all dogs and cats in an image and draw a bounding box around each. + TaskTypeImageObjectDetection TaskType = "ImageObjectDetection" + // TaskTypeRegression Regression means to predict the value using the input data. Regression models are + // used to predict a continuous value. + TaskTypeRegression TaskType = "Regression" + // TaskTypeTextClassification Text classification (also known as text tagging or text categorization) is + // the process of sorting texts into categories. + // Categories are mutually exclusive. + TaskTypeTextClassification TaskType = "TextClassification" + // TaskTypeTextClassificationMultilabel Multilabel classification task assigns each sample to a group (zero + // or more) of target labels. + TaskTypeTextClassificationMultilabel TaskType = "TextClassificationMultilabel" + // TaskTypeTextNER Text Named Entity Recognition a.k.a. TextNER. + // Named Entity Recognition (NER) is the ability to take free-form text and identify the occurrences of + // entities such as people, locations, organizations, and more. + TaskTypeTextNER TaskType = "TextNER" +) + +// PossibleTaskTypeValues returns an array of possible values for the TaskType const type. +func PossibleTaskTypeValues() []TaskType { + return []TaskType{TaskTypeClassification, TaskTypeForecasting, TaskTypeImageClassification, TaskTypeImageClassificationMultilabel, TaskTypeImageInstanceSegmentation, TaskTypeImageObjectDetection, TaskTypeRegression, TaskTypeTextClassification, TaskTypeTextClassificationMultilabel, TaskTypeTextNER} +} + +// TaskTypeBasicAutoMLVertical enumerates the values for task type basic auto ml vertical. +type TaskTypeBasicAutoMLVertical string + +const ( + // TaskTypeAutoMLVertical ... + TaskTypeAutoMLVertical TaskTypeBasicAutoMLVertical = "AutoMLVertical" +) + +// PossibleTaskTypeBasicAutoMLVerticalValues returns an array of possible values for the TaskTypeBasicAutoMLVertical const type. +func PossibleTaskTypeBasicAutoMLVerticalValues() []TaskTypeBasicAutoMLVertical { + return []TaskTypeBasicAutoMLVertical{TaskTypeAutoMLVertical} +} + +// 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} +} + +// UseStl enumerates the values for use stl. +type UseStl string + +const ( + // UseStlNone No stl decomposition. + UseStlNone UseStl = "None" + // UseStlSeason ... + UseStlSeason UseStl = "Season" + // UseStlSeasonTrend ... + UseStlSeasonTrend UseStl = "SeasonTrend" +) + +// PossibleUseStlValues returns an array of possible values for the UseStl const type. +func PossibleUseStlValues() []UseStl { + return []UseStl{UseStlNone, UseStlSeason, UseStlSeasonTrend} +} + +// ValidationMetricType enumerates the values for validation metric type. +type ValidationMetricType string + +const ( + // ValidationMetricTypeCoco Coco metric. + ValidationMetricTypeCoco ValidationMetricType = "Coco" + // ValidationMetricTypeCocoVoc CocoVoc metric. + ValidationMetricTypeCocoVoc ValidationMetricType = "CocoVoc" + // ValidationMetricTypeNone No metric. + ValidationMetricTypeNone ValidationMetricType = "None" + // ValidationMetricTypeVoc Voc metric. + ValidationMetricTypeVoc ValidationMetricType = "Voc" +) + +// PossibleValidationMetricTypeValues returns an array of possible values for the ValidationMetricType const type. +func PossibleValidationMetricTypeValues() []ValidationMetricType { + return []ValidationMetricType{ValidationMetricTypeCoco, ValidationMetricTypeCocoVoc, ValidationMetricTypeNone, ValidationMetricTypeVoc} +} + +// 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} +} + +// Weekday enumerates the values for weekday. +type Weekday string + +const ( + // Friday Friday weekday + Friday Weekday = "Friday" + // Monday Monday weekday + Monday Weekday = "Monday" + // Saturday Saturday weekday + Saturday Weekday = "Saturday" + // Sunday Sunday weekday + Sunday Weekday = "Sunday" + // Thursday Thursday weekday + Thursday Weekday = "Thursday" + // Tuesday Tuesday weekday + Tuesday Weekday = "Tuesday" + // Wednesday Wednesday weekday + Wednesday Weekday = "Wednesday" +) + +// PossibleWeekdayValues returns an array of possible values for the Weekday const type. +func PossibleWeekdayValues() []Weekday { + return []Weekday{Friday, Monday, Saturday, Sunday, Thursday, Tuesday, Wednesday} +} diff --git a/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/environmentcontainers.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/environmentcontainers.go new file mode 100644 index 000000000000..b20ac6a0eb75 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/environmentcontainers.go @@ -0,0 +1,438 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// body - container entity to create or update. +func (client EnvironmentContainersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name 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: 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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, 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, resourceGroupName, workspaceName, name, 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, resourceGroupName string, workspaceName string, name 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 = "2022-02-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}/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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +func (client EnvironmentContainersClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +func (client EnvironmentContainersClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-02-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. +// listViewType - view type for including/excluding (for example) archived entities. +func (client EnvironmentContainersClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType ListViewType) (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, listViewType) + 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, listViewType ListViewType) (*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 = "2022-02-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(skip) > 0 { + queryParameters["$skip"] = autorest.Encode("query", skip) + } + if len(string(listViewType)) > 0 { + queryParameters["listViewType"] = autorest.Encode("query", listViewType) + } else { + queryParameters["listViewType"] = autorest.Encode("query", "ActiveOnly") + } + + 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, listViewType ListViewType) (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, listViewType) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/environmentversions.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/environmentversions.go new file mode 100644 index 000000000000..ee5da5ad3741 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/environmentversions.go @@ -0,0 +1,476 @@ +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" +) + +// EnvironmentVersionsClient is the these APIs allow end users to operate on Azure Machine Learning Workspace +// resources. +type EnvironmentVersionsClient struct { + BaseClient +} + +// NewEnvironmentVersionsClient creates an instance of the EnvironmentVersionsClient client. +func NewEnvironmentVersionsClient(subscriptionID string) EnvironmentVersionsClient { + return NewEnvironmentVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEnvironmentVersionsClientWithBaseURI creates an instance of the EnvironmentVersionsClient 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 NewEnvironmentVersionsClientWithBaseURI(baseURI string, subscriptionID string) EnvironmentVersionsClient { + return EnvironmentVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - name of EnvironmentVersion. This is case-sensitive. +// version - version of EnvironmentVersion. +// body - definition of EnvironmentVersion. +func (client EnvironmentVersionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string, body EnvironmentVersionResource) (result EnvironmentVersionResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentVersionsClient.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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.Build", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.Build.ContextURI", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.Build.ContextURI", Name: validation.Pattern, Rule: `[a-zA-Z0-9_]`, Chain: nil}}}, + }}, + {Target: "body.Properties.InferenceConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceConfig.LivenessRoute", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceConfig.LivenessRoute.Path", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceConfig.LivenessRoute.Path", Name: validation.Pattern, Rule: `[a-zA-Z0-9_]`, Chain: nil}}}, + {Target: "body.Properties.InferenceConfig.LivenessRoute.Port", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "body.Properties.InferenceConfig.ReadinessRoute", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceConfig.ReadinessRoute.Path", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceConfig.ReadinessRoute.Path", Name: validation.Pattern, Rule: `[a-zA-Z0-9_]`, Chain: nil}}}, + {Target: "body.Properties.InferenceConfig.ReadinessRoute.Port", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "body.Properties.InferenceConfig.ScoringRoute", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceConfig.ScoringRoute.Path", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "body.Properties.InferenceConfig.ScoringRoute.Path", Name: validation.Pattern, Rule: `[a-zA-Z0-9_]`, Chain: nil}}}, + {Target: "body.Properties.InferenceConfig.ScoringRoute.Port", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("machinelearningservices.EnvironmentVersionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, name, version, body) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "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.EnvironmentVersionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client EnvironmentVersionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string, body EnvironmentVersionResource) (*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 = "2022-02-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}/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 EnvironmentVersionsClient) 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 EnvironmentVersionsClient) CreateOrUpdateResponder(resp *http.Response) (result EnvironmentVersionResource, 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// version - version identifier. This is case-sensitive. +func (client EnvironmentVersionsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentVersionsClient.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.EnvironmentVersionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, name, version) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client EnvironmentVersionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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 = "2022-02-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 EnvironmentVersionsClient) 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 EnvironmentVersionsClient) 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// version - version identifier. This is case-sensitive. +func (client EnvironmentVersionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result EnvironmentVersionResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentVersionsClient.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.EnvironmentVersionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, name, version) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "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.EnvironmentVersionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client EnvironmentVersionsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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 = "2022-02-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 EnvironmentVersionsClient) 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 EnvironmentVersionsClient) GetResponder(resp *http.Response) (result EnvironmentVersionResource, 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 - container name. This is case-sensitive. +// orderBy - ordering of list. +// top - maximum number of records to return. +// skip - continuation token for pagination. +// listViewType - view type for including/excluding (for example) archived entities. +func (client EnvironmentVersionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType ListViewType) (result EnvironmentVersionResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentVersionsClient.List") + defer func() { + sc := -1 + if result.evrapr.Response.Response != nil { + sc = result.evrapr.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.EnvironmentVersionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName, name, orderBy, top, skip, listViewType) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.evrapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "List", resp, "Failure sending request") + return + } + + result.evrapr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "List", resp, "Failure responding to request") + return + } + if result.evrapr.hasNextLink() && result.evrapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client EnvironmentVersionsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType ListViewType) (*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 = "2022-02-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(string(listViewType)) > 0 { + queryParameters["listViewType"] = autorest.Encode("query", listViewType) + } else { + queryParameters["listViewType"] = autorest.Encode("query", "ActiveOnly") + } + + 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 EnvironmentVersionsClient) 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 EnvironmentVersionsClient) ListResponder(resp *http.Response) (result EnvironmentVersionResourceArmPaginatedResult, 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 EnvironmentVersionsClient) listNextResults(ctx context.Context, lastResults EnvironmentVersionResourceArmPaginatedResult) (result EnvironmentVersionResourceArmPaginatedResult, err error) { + req, err := lastResults.environmentVersionResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "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.EnvironmentVersionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.EnvironmentVersionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client EnvironmentVersionsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType ListViewType) (result EnvironmentVersionResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentVersionsClient.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, orderBy, top, skip, listViewType) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/jobs.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/jobs.go new file mode 100644 index 000000000000..ebedebcaa5a7 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/jobs.go @@ -0,0 +1,539 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// ID - the name and identifier for the Job. This is case-sensitive. +func (client JobsClient) Cancel(ctx context.Context, resourceGroupName string, workspaceName string, ID 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, resourceGroupName, workspaceName, ID) + 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, resourceGroupName string, workspaceName string, ID 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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// ID - the name and identifier for the Job. This is case-sensitive. +// body - job definition object. +func (client JobsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, ID 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: 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: ID, + Constraints: []validation.Constraint{{Target: "ID", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.JobsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, ID, 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, resourceGroupName string, workspaceName string, ID 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 = "2022-02-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}/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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// ID - the name and identifier for the Job. This is case-sensitive. +func (client JobsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, ID 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, resourceGroupName, workspaceName, ID) + 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", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client JobsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, ID 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 = "2022-02-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 + future.FutureAPI = &azure.Future{} + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// ID - the name and identifier for the Job. This is case-sensitive. +func (client JobsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, ID 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, resourceGroupName, workspaceName, ID) + 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, resourceGroupName string, workspaceName string, ID 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 = "2022-02-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. +// tag - jobs returned will have this tag key. +// listViewType - view type for including/excluding (for example) archived entities. +// scheduled - indicator whether the job is scheduled job. +// scheduleID - the scheduled id for listing the job triggered from +func (client JobsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, jobType string, tag string, listViewType ListViewType, scheduled *bool, scheduleID 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, tag, listViewType, scheduled, scheduleID) + 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, tag string, listViewType ListViewType, scheduled *bool, scheduleID 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 = "2022-02-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(tag) > 0 { + queryParameters["tag"] = autorest.Encode("query", tag) + } + if len(string(listViewType)) > 0 { + queryParameters["listViewType"] = autorest.Encode("query", listViewType) + } else { + queryParameters["listViewType"] = autorest.Encode("query", "ActiveOnly") + } + if scheduled != nil { + queryParameters["scheduled"] = autorest.Encode("query", *scheduled) + } + if len(scheduleID) > 0 { + queryParameters["scheduleId"] = autorest.Encode("query", scheduleID) + } + + 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, tag string, listViewType ListViewType, scheduled *bool, scheduleID 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, tag, listViewType, scheduled, scheduleID) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/machinelearningservicesapi/interfaces.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/machinelearningservicesapi/interfaces.go new file mode 100644 index 000000000000..428fdfd7722e --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/machinelearningservicesapi/interfaces.go @@ -0,0 +1,308 @@ +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/2022-02-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.AmlOperationListResult, 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) + Diagnose(ctx context.Context, resourceGroupName string, workspaceName string, parameters *machinelearningservices.DiagnoseWorkspaceParameters) (result machinelearningservices.WorkspacesDiagnoseFuture, 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) + ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, workspaceName string) (result machinelearningservices.ExternalFQDNResponse, 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.WorkspacesUpdateFuture, 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 machinelearningservices.ComputeRestartFuture, 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) +} + +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, resourceGroupName string, workspaceName string, endpointName string, body machinelearningservices.BatchEndpointTrackedResource) (result machinelearningservices.BatchEndpointsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string) (result machinelearningservices.BatchEndpointsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName string, workspaceName string, endpointName string) (result machinelearningservices.EndpointAuthKeys, err error) + Update(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, body machinelearningservices.PartialBatchEndpointPartialTrackedResource) (result machinelearningservices.BatchEndpointsUpdateFuture, err error) +} + +var _ BatchEndpointsClientAPI = (*machinelearningservices.BatchEndpointsClient)(nil) + +// BatchDeploymentsClientAPI contains the set of methods on the BatchDeploymentsClient type. +type BatchDeploymentsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, body machinelearningservices.BatchDeploymentTrackedResource) (result machinelearningservices.BatchDeploymentsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string) (result machinelearningservices.BatchDeploymentsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string) (result machinelearningservices.BatchDeploymentTrackedResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, orderBy string, top *int32, skip string) (result machinelearningservices.BatchDeploymentTrackedResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, orderBy string, top *int32, skip string) (result machinelearningservices.BatchDeploymentTrackedResourceArmPaginatedResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, body machinelearningservices.PartialBatchDeploymentPartialTrackedResource) (result machinelearningservices.BatchDeploymentsUpdateFuture, err error) +} + +var _ BatchDeploymentsClientAPI = (*machinelearningservices.BatchDeploymentsClient)(nil) + +// CodeContainersClientAPI contains the set of methods on the CodeContainersClient type. +type CodeContainersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, body machinelearningservices.CodeContainerResource) (result machinelearningservices.CodeContainerResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName string, workspaceName string, name string, version string, body machinelearningservices.CodeVersionResource) (result machinelearningservices.CodeVersionResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result machinelearningservices.CodeVersionResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string) (result machinelearningservices.CodeVersionResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string) (result machinelearningservices.CodeVersionResourceArmPaginatedResultIterator, err error) +} + +var _ CodeVersionsClientAPI = (*machinelearningservices.CodeVersionsClient)(nil) + +// ComponentContainersClientAPI contains the set of methods on the ComponentContainersClient type. +type ComponentContainersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, body machinelearningservices.ComponentContainerResource) (result machinelearningservices.ComponentContainerResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result machinelearningservices.ComponentContainerResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.ComponentContainerResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.ComponentContainerResourceArmPaginatedResultIterator, err error) +} + +var _ ComponentContainersClientAPI = (*machinelearningservices.ComponentContainersClient)(nil) + +// ComponentVersionsClientAPI contains the set of methods on the ComponentVersionsClient type. +type ComponentVersionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string, body machinelearningservices.ComponentVersionResource) (result machinelearningservices.ComponentVersionResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result machinelearningservices.ComponentVersionResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.ComponentVersionResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.ComponentVersionResourceArmPaginatedResultIterator, err error) +} + +var _ ComponentVersionsClientAPI = (*machinelearningservices.ComponentVersionsClient)(nil) + +// DataContainersClientAPI contains the set of methods on the DataContainersClient type. +type DataContainersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, body machinelearningservices.DataContainerResource) (result machinelearningservices.DataContainerResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result machinelearningservices.DataContainerResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.DataContainerResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType machinelearningservices.ListViewType) (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, resourceGroupName string, workspaceName string, name string, version string, body machinelearningservices.DataVersionBaseResource) (result machinelearningservices.DataVersionBaseResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result machinelearningservices.DataVersionBaseResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, tags string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.DataVersionBaseResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, tags string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.DataVersionBaseResourceArmPaginatedResultIterator, err error) +} + +var _ DataVersionsClientAPI = (*machinelearningservices.DataVersionsClient)(nil) + +// DatastoresClientAPI contains the set of methods on the DatastoresClient type. +type DatastoresClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, body machinelearningservices.DatastoreResource, skipValidation *bool) (result machinelearningservices.DatastoreResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result machinelearningservices.DatastoreResource, 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.DatastoreResourceArmPaginatedResultPage, 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.DatastoreResourceArmPaginatedResultIterator, err error) + ListSecrets(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName string, workspaceName string, name string, body machinelearningservices.EnvironmentContainerResource) (result machinelearningservices.EnvironmentContainerResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result machinelearningservices.EnvironmentContainerResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.EnvironmentContainerResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.EnvironmentContainerResourceArmPaginatedResultIterator, err error) +} + +var _ EnvironmentContainersClientAPI = (*machinelearningservices.EnvironmentContainersClient)(nil) + +// EnvironmentVersionsClientAPI contains the set of methods on the EnvironmentVersionsClient type. +type EnvironmentVersionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string, body machinelearningservices.EnvironmentVersionResource) (result machinelearningservices.EnvironmentVersionResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result machinelearningservices.EnvironmentVersionResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.EnvironmentVersionResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, name string, orderBy string, top *int32, skip string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.EnvironmentVersionResourceArmPaginatedResultIterator, err error) +} + +var _ EnvironmentVersionsClientAPI = (*machinelearningservices.EnvironmentVersionsClient)(nil) + +// JobsClientAPI contains the set of methods on the JobsClient type. +type JobsClientAPI interface { + Cancel(ctx context.Context, resourceGroupName string, workspaceName string, ID string) (result autorest.Response, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, ID string, body machinelearningservices.JobBaseResource) (result machinelearningservices.JobBaseResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, ID string) (result machinelearningservices.JobsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, ID string) (result machinelearningservices.JobBaseResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, jobType string, tag string, listViewType machinelearningservices.ListViewType, scheduled *bool, scheduleID string) (result machinelearningservices.JobBaseResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, jobType string, tag string, listViewType machinelearningservices.ListViewType, scheduled *bool, scheduleID string) (result machinelearningservices.JobBaseResourceArmPaginatedResultIterator, err error) +} + +var _ JobsClientAPI = (*machinelearningservices.JobsClient)(nil) + +// ModelContainersClientAPI contains the set of methods on the ModelContainersClient type. +type ModelContainersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, body machinelearningservices.ModelContainerResource) (result machinelearningservices.ModelContainerResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string) (result machinelearningservices.ModelContainerResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32, listViewType machinelearningservices.ListViewType) (result machinelearningservices.ModelContainerResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32, listViewType machinelearningservices.ListViewType) (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, resourceGroupName string, workspaceName string, name string, version string, body machinelearningservices.ModelVersionResource) (result machinelearningservices.ModelVersionResource, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version string) (result machinelearningservices.ModelVersionResource, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, name string, skip string, orderBy string, top *int32, version string, description string, offset *int32, tags string, properties string, feed string, listViewType machinelearningservices.ListViewType) (result machinelearningservices.ModelVersionResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, name string, skip string, orderBy string, top *int32, version string, description string, offset *int32, tags string, properties string, feed string, listViewType machinelearningservices.ListViewType) (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, resourceGroupName string, workspaceName string, endpointName string, body machinelearningservices.OnlineEndpointTrackedResource) (result machinelearningservices.OnlineEndpointsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string) (result machinelearningservices.OnlineEndpointsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string) (result machinelearningservices.OnlineEndpointTrackedResource, err error) + GetToken(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName string, workspaceName string, endpointName string) (result machinelearningservices.EndpointAuthKeys, err error) + RegenerateKeys(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, body machinelearningservices.RegenerateEndpointKeysRequest) (result machinelearningservices.OnlineEndpointsRegenerateKeysFuture, err error) + Update(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, body machinelearningservices.OnlineDeploymentTrackedResource) (result machinelearningservices.OnlineDeploymentsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string) (result machinelearningservices.OnlineDeploymentsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string) (result machinelearningservices.OnlineDeploymentTrackedResource, err error) + GetLogs(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, body machinelearningservices.DeploymentLogsRequest) (result machinelearningservices.DeploymentLogs, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, orderBy string, top *int32, skip string) (result machinelearningservices.OnlineDeploymentTrackedResourceArmPaginatedResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, orderBy string, top *int32, skip string) (result machinelearningservices.OnlineDeploymentTrackedResourceArmPaginatedResultIterator, err error) + ListSkus(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, count *int32, skip string) (result machinelearningservices.SkuResourceArmPaginatedResultPage, err error) + ListSkusComplete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, count *int32, skip string) (result machinelearningservices.SkuResourceArmPaginatedResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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) diff --git a/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/modelcontainers.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/modelcontainers.go new file mode 100644 index 000000000000..849d80be6e6f --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/modelcontainers.go @@ -0,0 +1,440 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// body - container entity to create or update. +func (client ModelContainersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name 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: 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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, 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, resourceGroupName, workspaceName, name, 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, resourceGroupName string, workspaceName string, name 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 = "2022-02-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}/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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +func (client ModelContainersClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +func (client ModelContainersClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name 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, resourceGroupName, workspaceName, name) + 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, resourceGroupName string, workspaceName string, name 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 = "2022-02-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. +// listViewType - view type for including/excluding (for example) archived entities. +func (client ModelContainersClient) List(ctx context.Context, resourceGroupName string, workspaceName string, skip string, count *int32, listViewType ListViewType) (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, listViewType) + 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, listViewType ListViewType) (*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 = "2022-02-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) + } + if len(string(listViewType)) > 0 { + queryParameters["listViewType"] = autorest.Encode("query", listViewType) + } else { + queryParameters["listViewType"] = autorest.Encode("query", "ActiveOnly") + } + + 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, listViewType ListViewType) (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, listViewType) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/models.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/models.go new file mode 100644 index 000000000000..60f83c08efa3 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/models.go @@ -0,0 +1,20632 @@ +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/2022-02-01-preview/machinelearningservices" + +// AccountKeyDatastoreCredentials account key datastore credentials configuration. +type AccountKeyDatastoreCredentials struct { + // Secrets - [Required] Storage account secrets. + Secrets *AccountKeyDatastoreSecrets `json:"secrets,omitempty"` + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey1', 'CredentialsTypeCertificate1', 'CredentialsTypeNone1', 'CredentialsTypeSas1', 'CredentialsTypeServicePrincipal1' + CredentialsType CredentialsTypeBasicDatastoreCredentials `json:"credentialsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountKeyDatastoreCredentials. +func (akdc AccountKeyDatastoreCredentials) MarshalJSON() ([]byte, error) { + akdc.CredentialsType = CredentialsTypeAccountKey1 + 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 +} + +// 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', 'SecretsTypeAccountKey', 'SecretsTypeCertificate', 'SecretsTypeKerberosKeytab', 'SecretsTypeKerberosPassword', 'SecretsTypeSas', 'SecretsTypeServicePrincipal' + SecretsType SecretsTypeBasicDatastoreSecrets `json:"secretsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountKeyDatastoreSecrets. +func (akds AccountKeyDatastoreSecrets) MarshalJSON() ([]byte, error) { + akds.SecretsType = SecretsTypeAccountKey + 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 +} + +// AsKerberosKeytabSecrets is the BasicDatastoreSecrets implementation for AccountKeyDatastoreSecrets. +func (akds AccountKeyDatastoreSecrets) AsKerberosKeytabSecrets() (*KerberosKeytabSecrets, bool) { + return nil, false +} + +// AsKerberosPasswordSecrets is the BasicDatastoreSecrets implementation for AccountKeyDatastoreSecrets. +func (akds AccountKeyDatastoreSecrets) AsKerberosPasswordSecrets() (*KerberosPasswordSecrets, 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 +} + +// 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 { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // ComputeLocation - READ-ONLY; 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 *AKSProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AKS. +func (a AKS) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.ComputeType != "" { + objectMap["computeType"] = a.ComputeType + } + 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.Properties != nil { + objectMap["properties"] = a.Properties + } + return json.Marshal(objectMap) +} + +// AksComputeSecrets secrets related to a Machine Learning compute based on AKS. +type AksComputeSecrets struct { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // 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"` +} + +// AksComputeSecretsProperties properties of AksComputeSecrets +type AksComputeSecretsProperties 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"` +} + +// 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) +} + +// AKSSchema ... +type AKSSchema struct { + // Properties - AKS properties + Properties *AKSProperties `json:"properties,omitempty"` +} + +// AmlCompute an Azure Machine Learning compute. +type AmlCompute struct { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // ComputeLocation - READ-ONLY; 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 - Properties of AmlCompute + Properties *AmlComputeProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AmlCompute. +func (ac AmlCompute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ac.ComputeType != "" { + objectMap["computeType"] = ac.ComputeType + } + 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.Properties != nil { + objectMap["properties"] = ac.Properties + } + return json.Marshal(objectMap) +} + +// 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 result of AmlCompute Nodes +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"` +} + +// MarshalJSON is the custom marshaler for AmlComputeNodesInformation. +func (acni AmlComputeNodesInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// 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"` + // PropertyBag - A property bag containing additional properties. + PropertyBag map[string]interface{} `json:"propertyBag"` +} + +// MarshalJSON is the custom marshaler for AmlComputeProperties. +func (acp AmlComputeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if acp.OsType != "" { + objectMap["osType"] = acp.OsType + } + if acp.VMSize != nil { + objectMap["vmSize"] = acp.VMSize + } + if acp.VMPriority != "" { + objectMap["vmPriority"] = acp.VMPriority + } + if acp.VirtualMachineImage != nil { + objectMap["virtualMachineImage"] = acp.VirtualMachineImage + } + if acp.IsolatedNetwork != nil { + objectMap["isolatedNetwork"] = acp.IsolatedNetwork + } + if acp.ScaleSettings != nil { + objectMap["scaleSettings"] = acp.ScaleSettings + } + if acp.UserAccountCredentials != nil { + objectMap["userAccountCredentials"] = acp.UserAccountCredentials + } + if acp.Subnet != nil { + objectMap["subnet"] = acp.Subnet + } + if acp.RemoteLoginPortPublicAccess != "" { + objectMap["remoteLoginPortPublicAccess"] = acp.RemoteLoginPortPublicAccess + } + if acp.EnableNodePublicIP != nil { + objectMap["enableNodePublicIp"] = acp.EnableNodePublicIP + } + if acp.PropertyBag != nil { + objectMap["propertyBag"] = acp.PropertyBag + } + return json.Marshal(objectMap) +} + +// AmlComputeSchema properties(top level) of AmlCompute +type AmlComputeSchema struct { + // Properties - Properties of AmlCompute + Properties *AmlComputeProperties `json:"properties,omitempty"` +} + +// AmlOperation azure Machine Learning workspace REST API operation +type AmlOperation struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display name of operation + Display *AmlOperationDisplay `json:"display,omitempty"` + // IsDataAction - Indicates whether the operation applies to data-plane + IsDataAction *bool `json:"isDataAction,omitempty"` +} + +// AmlOperationDisplay display name of operation +type AmlOperationDisplay 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"` +} + +// AmlOperationListResult an array of operations supported by the resource provider. +type AmlOperationListResult struct { + autorest.Response `json:"-"` + // Value - List of AML workspace operations supported by the AML workspace resource provider. + Value *[]AmlOperation `json:"value,omitempty"` +} + +// AmlToken AML Token identity configuration. +type AmlToken struct { + // IdentityType - Possible values include: 'IdentityTypeIdentityConfiguration', 'IdentityTypeAMLToken', 'IdentityTypeManaged', 'IdentityTypeUserIdentity' + 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 +} + +// AsUserIdentity is the BasicIdentityConfiguration implementation for AmlToken. +func (at AmlToken) AsUserIdentity() (*UserIdentity, 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"` +} + +// AssetBase ... +type AssetBase struct { + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // 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 AssetBase. +func (ab AssetBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ab.IsAnonymous != nil { + objectMap["isAnonymous"] = ab.IsAnonymous + } + if ab.IsArchived != nil { + objectMap["isArchived"] = ab.IsArchived + } + if ab.Description != nil { + objectMap["description"] = ab.Description + } + if ab.Properties != nil { + objectMap["properties"] = ab.Properties + } + if ab.Tags != nil { + objectMap["tags"] = ab.Tags + } + return json.Marshal(objectMap) +} + +// AssetContainer ... +type AssetContainer struct { + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // LatestVersion - READ-ONLY; The latest version inside this container. + LatestVersion *string `json:"latestVersion,omitempty"` + // NextVersion - READ-ONLY; The next auto incremental version + NextVersion *string `json:"nextVersion,omitempty"` + // 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 AssetContainer. +func (ac AssetContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ac.IsArchived != nil { + objectMap["isArchived"] = ac.IsArchived + } + if ac.Description != nil { + objectMap["description"] = ac.Description + } + if ac.Properties != nil { + objectMap["properties"] = ac.Properties + } + if ac.Tags != nil { + objectMap["tags"] = ac.Tags + } + return json.Marshal(objectMap) +} + +// AssetJobInput asset input type. +type AssetJobInput struct { + // Mode - Input Asset Delivery Mode. Possible values include: 'ReadOnlyMount', 'ReadWriteMount', 'Download', 'Direct', 'EvalMount', 'EvalDownload' + Mode InputDeliveryMode `json:"mode,omitempty"` + // URI - [Required] Input Asset URI. + URI *string `json:"uri,omitempty"` +} + +// AssetJobOutput asset output type. +type AssetJobOutput struct { + // Mode - Output Asset Delivery Mode. Possible values include: 'OutputDeliveryModeReadWriteMount', 'OutputDeliveryModeUpload' + Mode OutputDeliveryMode `json:"mode,omitempty"` + // URI - Output Asset URI. + URI *string `json:"uri,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"` +} + +// AutoForecastHorizon forecast horizon determined automatically by system. +type AutoForecastHorizon struct { + // Mode - Possible values include: 'ModeBasicForecastHorizonModeForecastHorizon', 'ModeBasicForecastHorizonModeAuto', 'ModeBasicForecastHorizonModeCustom' + Mode ModeBasicForecastHorizon `json:"mode,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutoForecastHorizon. +func (afh AutoForecastHorizon) MarshalJSON() ([]byte, error) { + afh.Mode = ModeBasicForecastHorizonModeAuto + objectMap := make(map[string]interface{}) + if afh.Mode != "" { + objectMap["mode"] = afh.Mode + } + return json.Marshal(objectMap) +} + +// AsAutoForecastHorizon is the BasicForecastHorizon implementation for AutoForecastHorizon. +func (afh AutoForecastHorizon) AsAutoForecastHorizon() (*AutoForecastHorizon, bool) { + return &afh, true +} + +// AsCustomForecastHorizon is the BasicForecastHorizon implementation for AutoForecastHorizon. +func (afh AutoForecastHorizon) AsCustomForecastHorizon() (*CustomForecastHorizon, bool) { + return nil, false +} + +// AsForecastHorizon is the BasicForecastHorizon implementation for AutoForecastHorizon. +func (afh AutoForecastHorizon) AsForecastHorizon() (*ForecastHorizon, bool) { + return nil, false +} + +// AsBasicForecastHorizon is the BasicForecastHorizon implementation for AutoForecastHorizon. +func (afh AutoForecastHorizon) AsBasicForecastHorizon() (BasicForecastHorizon, bool) { + return &afh, true +} + +// AutoMLJob autoMLJob class. +// Use this class for executing AutoML tasks like Classification/Regression etc. +// See TaskType enum for all the tasks supported. +type AutoMLJob struct { + // EnvironmentID - The ARM resource ID of the Environment specification for the job. + // This is optional value to provide, if not provided, AutoML will default this to Production AutoML curated environment version when running the job. + EnvironmentID *string `json:"environmentId,omitempty"` + // EnvironmentVariables - Environment variables included in the job. + EnvironmentVariables map[string]*string `json:"environmentVariables"` + // Outputs - Mapping of output data bindings used in the job. + Outputs map[string]BasicJobOutput `json:"outputs"` + // Resources - Compute Resource configuration for the job. + Resources *ResourceConfiguration `json:"resources,omitempty"` + // TaskDetails - [Required] This represents scenario which can be one of Tables/NLP/Image + TaskDetails BasicAutoMLVertical `json:"taskDetails,omitempty"` + // ComputeID - ARM resource ID of the compute resource. + ComputeID *string `json:"computeId,omitempty"` + // DisplayName - Display name of job. + DisplayName *string `json:"displayName,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, UserIdentity or null. + // Defaults to AmlToken if null. + Identity BasicIdentityConfiguration `json:"identity,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // Schedule - Schedule definition of job. + // If no schedule is provided, the job is run once and immediately after submission. + Schedule BasicScheduleBase `json:"schedule,omitempty"` + // Services - List of JobEndpoints. + // For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + Services map[string]*JobService `json:"services"` + // Status - READ-ONLY; Status of the job. Possible values include: 'JobStatusNotStarted', 'JobStatusStarting', 'JobStatusProvisioning', 'JobStatusPreparing', 'JobStatusQueued', 'JobStatusRunning', 'JobStatusFinalizing', 'JobStatusCancelRequested', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusCanceled', 'JobStatusNotResponding', 'JobStatusPaused', 'JobStatusUnknown', 'JobStatusScheduled' + Status JobStatus `json:"status,omitempty"` + // 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"` + // JobType - Possible values include: 'JobTypeJobBase', 'JobTypeAutoML1', 'JobTypeCommand1', 'JobTypePipeline1', 'JobTypeSweep1' + JobType JobTypeBasicJobBase `json:"jobType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutoMLJob. +func (amj AutoMLJob) MarshalJSON() ([]byte, error) { + amj.JobType = JobTypeAutoML1 + objectMap := make(map[string]interface{}) + if amj.EnvironmentID != nil { + objectMap["environmentId"] = amj.EnvironmentID + } + if amj.EnvironmentVariables != nil { + objectMap["environmentVariables"] = amj.EnvironmentVariables + } + if amj.Outputs != nil { + objectMap["outputs"] = amj.Outputs + } + if amj.Resources != nil { + objectMap["resources"] = amj.Resources + } + objectMap["taskDetails"] = amj.TaskDetails + if amj.ComputeID != nil { + objectMap["computeId"] = amj.ComputeID + } + if amj.DisplayName != nil { + objectMap["displayName"] = amj.DisplayName + } + if amj.ExperimentName != nil { + objectMap["experimentName"] = amj.ExperimentName + } + objectMap["identity"] = amj.Identity + if amj.IsArchived != nil { + objectMap["isArchived"] = amj.IsArchived + } + objectMap["schedule"] = amj.Schedule + if amj.Services != nil { + objectMap["services"] = amj.Services + } + if amj.JobType != "" { + objectMap["jobType"] = amj.JobType + } + if amj.Description != nil { + objectMap["description"] = amj.Description + } + if amj.Properties != nil { + objectMap["properties"] = amj.Properties + } + if amj.Tags != nil { + objectMap["tags"] = amj.Tags + } + return json.Marshal(objectMap) +} + +// AsAutoMLJob is the BasicJobBase implementation for AutoMLJob. +func (amj AutoMLJob) AsAutoMLJob() (*AutoMLJob, bool) { + return &amj, true +} + +// AsCommandJob is the BasicJobBase implementation for AutoMLJob. +func (amj AutoMLJob) AsCommandJob() (*CommandJob, bool) { + return nil, false +} + +// AsPipelineJob is the BasicJobBase implementation for AutoMLJob. +func (amj AutoMLJob) AsPipelineJob() (*PipelineJob, bool) { + return nil, false +} + +// AsSweepJob is the BasicJobBase implementation for AutoMLJob. +func (amj AutoMLJob) AsSweepJob() (*SweepJob, bool) { + return nil, false +} + +// AsJobBase is the BasicJobBase implementation for AutoMLJob. +func (amj AutoMLJob) AsJobBase() (*JobBase, bool) { + return nil, false +} + +// AsBasicJobBase is the BasicJobBase implementation for AutoMLJob. +func (amj AutoMLJob) AsBasicJobBase() (BasicJobBase, bool) { + return &amj, true +} + +// UnmarshalJSON is the custom unmarshaler for AutoMLJob struct. +func (amj *AutoMLJob) 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 "environmentId": + if v != nil { + var environmentID string + err = json.Unmarshal(*v, &environmentID) + if err != nil { + return err + } + amj.EnvironmentID = &environmentID + } + case "environmentVariables": + if v != nil { + var environmentVariables map[string]*string + err = json.Unmarshal(*v, &environmentVariables) + if err != nil { + return err + } + amj.EnvironmentVariables = environmentVariables + } + case "outputs": + if v != nil { + var outputs map[string]BasicJobOutput + err = json.Unmarshal(*v, &outputs) + if err != nil { + return err + } + amj.Outputs = outputs + } + case "resources": + if v != nil { + var resources ResourceConfiguration + err = json.Unmarshal(*v, &resources) + if err != nil { + return err + } + amj.Resources = &resources + } + case "taskDetails": + if v != nil { + taskDetails, err := unmarshalBasicAutoMLVertical(*v) + if err != nil { + return err + } + amj.TaskDetails = taskDetails + } + case "computeId": + if v != nil { + var computeID string + err = json.Unmarshal(*v, &computeID) + if err != nil { + return err + } + amj.ComputeID = &computeID + } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + amj.DisplayName = &displayName + } + case "experimentName": + if v != nil { + var experimentName string + err = json.Unmarshal(*v, &experimentName) + if err != nil { + return err + } + amj.ExperimentName = &experimentName + } + case "identity": + if v != nil { + identity, err := unmarshalBasicIdentityConfiguration(*v) + if err != nil { + return err + } + amj.Identity = identity + } + case "isArchived": + if v != nil { + var isArchived bool + err = json.Unmarshal(*v, &isArchived) + if err != nil { + return err + } + amj.IsArchived = &isArchived + } + case "schedule": + if v != nil { + schedule, err := unmarshalBasicScheduleBase(*v) + if err != nil { + return err + } + amj.Schedule = schedule + } + case "services": + if v != nil { + var services map[string]*JobService + err = json.Unmarshal(*v, &services) + if err != nil { + return err + } + amj.Services = services + } + case "status": + if v != nil { + var status JobStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + amj.Status = status + } + case "jobType": + if v != nil { + var jobType JobTypeBasicJobBase + err = json.Unmarshal(*v, &jobType) + if err != nil { + return err + } + amj.JobType = jobType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + amj.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + amj.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + amj.Tags = tags + } + } + } + + return nil +} + +// BasicAutoMLVertical autoML vertical class. +// Base class for AutoML verticals - TableVertical/ImageVertical/NLPVertical +type BasicAutoMLVertical interface { + AsAutoMLVertical() (*AutoMLVertical, bool) +} + +// AutoMLVertical autoML vertical class. +// Base class for AutoML verticals - TableVertical/ImageVertical/NLPVertical +type AutoMLVertical struct { + // LogVerbosity - Log verbosity for the job. Possible values include: 'LogVerbosityNotSet', 'LogVerbosityDebug', 'LogVerbosityInfo', 'LogVerbosityWarning', 'LogVerbosityError', 'LogVerbosityCritical' + LogVerbosity LogVerbosity `json:"logVerbosity,omitempty"` + // TaskType - Possible values include: 'TaskTypeAutoMLVertical' + TaskType TaskTypeBasicAutoMLVertical `json:"taskType,omitempty"` +} + +func unmarshalBasicAutoMLVertical(body []byte) (BasicAutoMLVertical, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["taskType"] { + default: + var amv AutoMLVertical + err := json.Unmarshal(body, &amv) + return amv, err + } +} +func unmarshalBasicAutoMLVerticalArray(body []byte) ([]BasicAutoMLVertical, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + amvArray := make([]BasicAutoMLVertical, len(rawMessages)) + + for index, rawMessage := range rawMessages { + amv, err := unmarshalBasicAutoMLVertical(*rawMessage) + if err != nil { + return nil, err + } + amvArray[index] = amv + } + return amvArray, nil +} + +// MarshalJSON is the custom marshaler for AutoMLVertical. +func (amv AutoMLVertical) MarshalJSON() ([]byte, error) { + amv.TaskType = TaskTypeAutoMLVertical + objectMap := make(map[string]interface{}) + if amv.LogVerbosity != "" { + objectMap["logVerbosity"] = amv.LogVerbosity + } + if amv.TaskType != "" { + objectMap["taskType"] = amv.TaskType + } + return json.Marshal(objectMap) +} + +// AsAutoMLVertical is the BasicAutoMLVertical implementation for AutoMLVertical. +func (amv AutoMLVertical) AsAutoMLVertical() (*AutoMLVertical, bool) { + return &amv, true +} + +// AsBasicAutoMLVertical is the BasicAutoMLVertical implementation for AutoMLVertical. +func (amv AutoMLVertical) AsBasicAutoMLVertical() (BasicAutoMLVertical, bool) { + return &amv, true +} + +// AutoNCrossValidations n-Cross validations determined automatically. +type AutoNCrossValidations struct { + // Mode - Possible values include: 'ModeNCrossValidations', 'ModeAuto', 'ModeCustom' + Mode Mode `json:"mode,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutoNCrossValidations. +func (ancv AutoNCrossValidations) MarshalJSON() ([]byte, error) { + ancv.Mode = ModeAuto + objectMap := make(map[string]interface{}) + if ancv.Mode != "" { + objectMap["mode"] = ancv.Mode + } + return json.Marshal(objectMap) +} + +// AsAutoNCrossValidations is the BasicNCrossValidations implementation for AutoNCrossValidations. +func (ancv AutoNCrossValidations) AsAutoNCrossValidations() (*AutoNCrossValidations, bool) { + return &ancv, true +} + +// AsCustomNCrossValidations is the BasicNCrossValidations implementation for AutoNCrossValidations. +func (ancv AutoNCrossValidations) AsCustomNCrossValidations() (*CustomNCrossValidations, bool) { + return nil, false +} + +// AsNCrossValidations is the BasicNCrossValidations implementation for AutoNCrossValidations. +func (ancv AutoNCrossValidations) AsNCrossValidations() (*NCrossValidations, bool) { + return nil, false +} + +// AsBasicNCrossValidations is the BasicNCrossValidations implementation for AutoNCrossValidations. +func (ancv AutoNCrossValidations) AsBasicNCrossValidations() (BasicNCrossValidations, bool) { + return &ancv, true +} + +// 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"` +} + +// AutoSeasonality ... +type AutoSeasonality struct { + // Mode - Possible values include: 'ModeBasicSeasonalityModeSeasonality', 'ModeBasicSeasonalityModeAuto', 'ModeBasicSeasonalityModeCustom' + Mode ModeBasicSeasonality `json:"mode,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutoSeasonality. +func (as AutoSeasonality) MarshalJSON() ([]byte, error) { + as.Mode = ModeBasicSeasonalityModeAuto + objectMap := make(map[string]interface{}) + if as.Mode != "" { + objectMap["mode"] = as.Mode + } + return json.Marshal(objectMap) +} + +// AsAutoSeasonality is the BasicSeasonality implementation for AutoSeasonality. +func (as AutoSeasonality) AsAutoSeasonality() (*AutoSeasonality, bool) { + return &as, true +} + +// AsCustomSeasonality is the BasicSeasonality implementation for AutoSeasonality. +func (as AutoSeasonality) AsCustomSeasonality() (*CustomSeasonality, bool) { + return nil, false +} + +// AsSeasonality is the BasicSeasonality implementation for AutoSeasonality. +func (as AutoSeasonality) AsSeasonality() (*Seasonality, bool) { + return nil, false +} + +// AsBasicSeasonality is the BasicSeasonality implementation for AutoSeasonality. +func (as AutoSeasonality) AsBasicSeasonality() (BasicSeasonality, bool) { + return &as, true +} + +// AutoTargetLags ... +type AutoTargetLags struct { + // Mode - Possible values include: 'ModeBasicTargetLagsModeTargetLags', 'ModeBasicTargetLagsModeAuto', 'ModeBasicTargetLagsModeCustom' + Mode ModeBasicTargetLags `json:"mode,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutoTargetLags. +func (atl AutoTargetLags) MarshalJSON() ([]byte, error) { + atl.Mode = ModeBasicTargetLagsModeAuto + objectMap := make(map[string]interface{}) + if atl.Mode != "" { + objectMap["mode"] = atl.Mode + } + return json.Marshal(objectMap) +} + +// AsAutoTargetLags is the BasicTargetLags implementation for AutoTargetLags. +func (atl AutoTargetLags) AsAutoTargetLags() (*AutoTargetLags, bool) { + return &atl, true +} + +// AsCustomTargetLags is the BasicTargetLags implementation for AutoTargetLags. +func (atl AutoTargetLags) AsCustomTargetLags() (*CustomTargetLags, bool) { + return nil, false +} + +// AsTargetLags is the BasicTargetLags implementation for AutoTargetLags. +func (atl AutoTargetLags) AsTargetLags() (*TargetLags, bool) { + return nil, false +} + +// AsBasicTargetLags is the BasicTargetLags implementation for AutoTargetLags. +func (atl AutoTargetLags) AsBasicTargetLags() (BasicTargetLags, bool) { + return &atl, true +} + +// AutoTargetRollingWindowSize target lags rolling window determined automatically. +type AutoTargetRollingWindowSize struct { + // Mode - Possible values include: 'ModeBasicTargetRollingWindowSizeModeTargetRollingWindowSize', 'ModeBasicTargetRollingWindowSizeModeAuto', 'ModeBasicTargetRollingWindowSizeModeCustom' + Mode ModeBasicTargetRollingWindowSize `json:"mode,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutoTargetRollingWindowSize. +func (atrws AutoTargetRollingWindowSize) MarshalJSON() ([]byte, error) { + atrws.Mode = ModeBasicTargetRollingWindowSizeModeAuto + objectMap := make(map[string]interface{}) + if atrws.Mode != "" { + objectMap["mode"] = atrws.Mode + } + return json.Marshal(objectMap) +} + +// AsAutoTargetRollingWindowSize is the BasicTargetRollingWindowSize implementation for AutoTargetRollingWindowSize. +func (atrws AutoTargetRollingWindowSize) AsAutoTargetRollingWindowSize() (*AutoTargetRollingWindowSize, bool) { + return &atrws, true +} + +// AsCustomTargetRollingWindowSize is the BasicTargetRollingWindowSize implementation for AutoTargetRollingWindowSize. +func (atrws AutoTargetRollingWindowSize) AsCustomTargetRollingWindowSize() (*CustomTargetRollingWindowSize, bool) { + return nil, false +} + +// AsTargetRollingWindowSize is the BasicTargetRollingWindowSize implementation for AutoTargetRollingWindowSize. +func (atrws AutoTargetRollingWindowSize) AsTargetRollingWindowSize() (*TargetRollingWindowSize, bool) { + return nil, false +} + +// AsBasicTargetRollingWindowSize is the BasicTargetRollingWindowSize implementation for AutoTargetRollingWindowSize. +func (atrws AutoTargetRollingWindowSize) AsBasicTargetRollingWindowSize() (BasicTargetRollingWindowSize, bool) { + return &atrws, true +} + +// AzureBlobDatastore azure Blob datastore configuration. +type AzureBlobDatastore struct { + // AccountName - Storage account name. + AccountName *string `json:"accountName,omitempty"` + // ContainerName - Storage account container name. + ContainerName *string `json:"containerName,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"` + // ServiceDataAccessAuthIdentity - Indicates which identity to use to authenticate service data access to customer's storage. Possible values include: 'ServiceDataAccessAuthIdentityNone', 'ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity', 'ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity' + ServiceDataAccessAuthIdentity ServiceDataAccessAuthIdentity `json:"serviceDataAccessAuthIdentity,omitempty"` + // Credentials - [Required] Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // IsDefault - READ-ONLY; Readonly property to indicate if datastore is the workspace default datastore + IsDefault *bool `json:"isDefault,omitempty"` + // 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"` + // DatastoreType - Possible values include: 'DatastoreTypeDatastore', 'DatastoreTypeAzureBlob', 'DatastoreTypeAzureDataLakeGen1', 'DatastoreTypeAzureDataLakeGen2', 'DatastoreTypeAzureFile', 'DatastoreTypeHdfs' + DatastoreType DatastoreTypeBasicDatastore `json:"datastoreType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureBlobDatastore. +func (abd AzureBlobDatastore) MarshalJSON() ([]byte, error) { + abd.DatastoreType = DatastoreTypeAzureBlob + objectMap := make(map[string]interface{}) + if abd.AccountName != nil { + objectMap["accountName"] = abd.AccountName + } + if abd.ContainerName != nil { + objectMap["containerName"] = abd.ContainerName + } + if abd.Endpoint != nil { + objectMap["endpoint"] = abd.Endpoint + } + if abd.Protocol != nil { + objectMap["protocol"] = abd.Protocol + } + if abd.ServiceDataAccessAuthIdentity != "" { + objectMap["serviceDataAccessAuthIdentity"] = abd.ServiceDataAccessAuthIdentity + } + objectMap["credentials"] = abd.Credentials + if abd.DatastoreType != "" { + objectMap["datastoreType"] = abd.DatastoreType + } + if abd.Description != nil { + objectMap["description"] = abd.Description + } + if abd.Properties != nil { + objectMap["properties"] = abd.Properties + } + if abd.Tags != nil { + objectMap["tags"] = abd.Tags + } + return json.Marshal(objectMap) +} + +// AsAzureBlobDatastore is the BasicDatastore implementation for AzureBlobDatastore. +func (abd AzureBlobDatastore) AsAzureBlobDatastore() (*AzureBlobDatastore, bool) { + return &abd, true +} + +// AsAzureDataLakeGen1Datastore is the BasicDatastore implementation for AzureBlobDatastore. +func (abd AzureBlobDatastore) AsAzureDataLakeGen1Datastore() (*AzureDataLakeGen1Datastore, bool) { + return nil, false +} + +// AsAzureDataLakeGen2Datastore is the BasicDatastore implementation for AzureBlobDatastore. +func (abd AzureBlobDatastore) AsAzureDataLakeGen2Datastore() (*AzureDataLakeGen2Datastore, bool) { + return nil, false +} + +// AsAzureFileDatastore is the BasicDatastore implementation for AzureBlobDatastore. +func (abd AzureBlobDatastore) AsAzureFileDatastore() (*AzureFileDatastore, bool) { + return nil, false +} + +// AsHdfsDatastore is the BasicDatastore implementation for AzureBlobDatastore. +func (abd AzureBlobDatastore) AsHdfsDatastore() (*HdfsDatastore, bool) { + return nil, false +} + +// AsDatastore is the BasicDatastore implementation for AzureBlobDatastore. +func (abd AzureBlobDatastore) AsDatastore() (*Datastore, bool) { + return nil, false +} + +// AsBasicDatastore is the BasicDatastore implementation for AzureBlobDatastore. +func (abd AzureBlobDatastore) AsBasicDatastore() (BasicDatastore, bool) { + return &abd, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureBlobDatastore struct. +func (abd *AzureBlobDatastore) 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 + } + abd.AccountName = &accountName + } + case "containerName": + if v != nil { + var containerName string + err = json.Unmarshal(*v, &containerName) + if err != nil { + return err + } + abd.ContainerName = &containerName + } + case "endpoint": + if v != nil { + var endpoint string + err = json.Unmarshal(*v, &endpoint) + if err != nil { + return err + } + abd.Endpoint = &endpoint + } + case "protocol": + if v != nil { + var protocol string + err = json.Unmarshal(*v, &protocol) + if err != nil { + return err + } + abd.Protocol = &protocol + } + case "serviceDataAccessAuthIdentity": + if v != nil { + var serviceDataAccessAuthIdentity ServiceDataAccessAuthIdentity + err = json.Unmarshal(*v, &serviceDataAccessAuthIdentity) + if err != nil { + return err + } + abd.ServiceDataAccessAuthIdentity = serviceDataAccessAuthIdentity + } + case "credentials": + if v != nil { + credentials, err := unmarshalBasicDatastoreCredentials(*v) + if err != nil { + return err + } + abd.Credentials = credentials + } + case "isDefault": + if v != nil { + var isDefault bool + err = json.Unmarshal(*v, &isDefault) + if err != nil { + return err + } + abd.IsDefault = &isDefault + } + case "datastoreType": + if v != nil { + var datastoreType DatastoreTypeBasicDatastore + err = json.Unmarshal(*v, &datastoreType) + if err != nil { + return err + } + abd.DatastoreType = datastoreType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + abd.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + abd.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + abd.Tags = tags + } + } + } + + return nil +} + +// AzureDataLakeGen1Datastore azure Data Lake Gen1 datastore configuration. +type AzureDataLakeGen1Datastore struct { + // ServiceDataAccessAuthIdentity - Indicates which identity to use to authenticate service data access to customer's storage. Possible values include: 'ServiceDataAccessAuthIdentityNone', 'ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity', 'ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity' + ServiceDataAccessAuthIdentity ServiceDataAccessAuthIdentity `json:"serviceDataAccessAuthIdentity,omitempty"` + // StoreName - [Required] Azure Data Lake store name. + StoreName *string `json:"storeName,omitempty"` + // Credentials - [Required] Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // IsDefault - READ-ONLY; Readonly property to indicate if datastore is the workspace default datastore + IsDefault *bool `json:"isDefault,omitempty"` + // DatastoreType - Possible values include: 'DatastoreTypeDatastore', 'DatastoreTypeAzureBlob', 'DatastoreTypeAzureDataLakeGen1', 'DatastoreTypeAzureDataLakeGen2', 'DatastoreTypeAzureFile', 'DatastoreTypeHdfs' + DatastoreType DatastoreTypeBasicDatastore `json:"datastoreType,omitempty"` + // 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 AzureDataLakeGen1Datastore. +func (adlg1d AzureDataLakeGen1Datastore) MarshalJSON() ([]byte, error) { + adlg1d.DatastoreType = DatastoreTypeAzureDataLakeGen1 + objectMap := make(map[string]interface{}) + if adlg1d.ServiceDataAccessAuthIdentity != "" { + objectMap["serviceDataAccessAuthIdentity"] = adlg1d.ServiceDataAccessAuthIdentity + } + if adlg1d.StoreName != nil { + objectMap["storeName"] = adlg1d.StoreName + } + objectMap["credentials"] = adlg1d.Credentials + if adlg1d.DatastoreType != "" { + objectMap["datastoreType"] = adlg1d.DatastoreType + } + if adlg1d.Description != nil { + objectMap["description"] = adlg1d.Description + } + if adlg1d.Properties != nil { + objectMap["properties"] = adlg1d.Properties + } + if adlg1d.Tags != nil { + objectMap["tags"] = adlg1d.Tags + } + return json.Marshal(objectMap) +} + +// AsAzureBlobDatastore is the BasicDatastore implementation for AzureDataLakeGen1Datastore. +func (adlg1d AzureDataLakeGen1Datastore) AsAzureBlobDatastore() (*AzureBlobDatastore, bool) { + return nil, false +} + +// AsAzureDataLakeGen1Datastore is the BasicDatastore implementation for AzureDataLakeGen1Datastore. +func (adlg1d AzureDataLakeGen1Datastore) AsAzureDataLakeGen1Datastore() (*AzureDataLakeGen1Datastore, bool) { + return &adlg1d, true +} + +// AsAzureDataLakeGen2Datastore is the BasicDatastore implementation for AzureDataLakeGen1Datastore. +func (adlg1d AzureDataLakeGen1Datastore) AsAzureDataLakeGen2Datastore() (*AzureDataLakeGen2Datastore, bool) { + return nil, false +} + +// AsAzureFileDatastore is the BasicDatastore implementation for AzureDataLakeGen1Datastore. +func (adlg1d AzureDataLakeGen1Datastore) AsAzureFileDatastore() (*AzureFileDatastore, bool) { + return nil, false +} + +// AsHdfsDatastore is the BasicDatastore implementation for AzureDataLakeGen1Datastore. +func (adlg1d AzureDataLakeGen1Datastore) AsHdfsDatastore() (*HdfsDatastore, bool) { + return nil, false +} + +// AsDatastore is the BasicDatastore implementation for AzureDataLakeGen1Datastore. +func (adlg1d AzureDataLakeGen1Datastore) AsDatastore() (*Datastore, bool) { + return nil, false +} + +// AsBasicDatastore is the BasicDatastore implementation for AzureDataLakeGen1Datastore. +func (adlg1d AzureDataLakeGen1Datastore) AsBasicDatastore() (BasicDatastore, bool) { + return &adlg1d, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureDataLakeGen1Datastore struct. +func (adlg1d *AzureDataLakeGen1Datastore) 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 "serviceDataAccessAuthIdentity": + if v != nil { + var serviceDataAccessAuthIdentity ServiceDataAccessAuthIdentity + err = json.Unmarshal(*v, &serviceDataAccessAuthIdentity) + if err != nil { + return err + } + adlg1d.ServiceDataAccessAuthIdentity = serviceDataAccessAuthIdentity + } + case "storeName": + if v != nil { + var storeName string + err = json.Unmarshal(*v, &storeName) + if err != nil { + return err + } + adlg1d.StoreName = &storeName + } + case "credentials": + if v != nil { + credentials, err := unmarshalBasicDatastoreCredentials(*v) + if err != nil { + return err + } + adlg1d.Credentials = credentials + } + case "isDefault": + if v != nil { + var isDefault bool + err = json.Unmarshal(*v, &isDefault) + if err != nil { + return err + } + adlg1d.IsDefault = &isDefault + } + case "datastoreType": + if v != nil { + var datastoreType DatastoreTypeBasicDatastore + err = json.Unmarshal(*v, &datastoreType) + if err != nil { + return err + } + adlg1d.DatastoreType = datastoreType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + adlg1d.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + adlg1d.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + adlg1d.Tags = tags + } + } + } + + return nil +} + +// AzureDataLakeGen2Datastore azure Data Lake Gen2 datastore configuration. +type AzureDataLakeGen2Datastore struct { + // AccountName - [Required] Storage account name. + AccountName *string `json:"accountName,omitempty"` + // Endpoint - Azure cloud endpoint for the storage account. + Endpoint *string `json:"endpoint,omitempty"` + // Filesystem - [Required] The name of the Data Lake Gen2 filesystem. + Filesystem *string `json:"filesystem,omitempty"` + // Protocol - Protocol used to communicate with the storage account. + Protocol *string `json:"protocol,omitempty"` + // ServiceDataAccessAuthIdentity - Indicates which identity to use to authenticate service data access to customer's storage. Possible values include: 'ServiceDataAccessAuthIdentityNone', 'ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity', 'ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity' + ServiceDataAccessAuthIdentity ServiceDataAccessAuthIdentity `json:"serviceDataAccessAuthIdentity,omitempty"` + // Credentials - [Required] Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // IsDefault - READ-ONLY; Readonly property to indicate if datastore is the workspace default datastore + IsDefault *bool `json:"isDefault,omitempty"` + // DatastoreType - Possible values include: 'DatastoreTypeDatastore', 'DatastoreTypeAzureBlob', 'DatastoreTypeAzureDataLakeGen1', 'DatastoreTypeAzureDataLakeGen2', 'DatastoreTypeAzureFile', 'DatastoreTypeHdfs' + DatastoreType DatastoreTypeBasicDatastore `json:"datastoreType,omitempty"` + // 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 AzureDataLakeGen2Datastore. +func (adlg2d AzureDataLakeGen2Datastore) MarshalJSON() ([]byte, error) { + adlg2d.DatastoreType = DatastoreTypeAzureDataLakeGen2 + objectMap := make(map[string]interface{}) + if adlg2d.AccountName != nil { + objectMap["accountName"] = adlg2d.AccountName + } + if adlg2d.Endpoint != nil { + objectMap["endpoint"] = adlg2d.Endpoint + } + if adlg2d.Filesystem != nil { + objectMap["filesystem"] = adlg2d.Filesystem + } + if adlg2d.Protocol != nil { + objectMap["protocol"] = adlg2d.Protocol + } + if adlg2d.ServiceDataAccessAuthIdentity != "" { + objectMap["serviceDataAccessAuthIdentity"] = adlg2d.ServiceDataAccessAuthIdentity + } + objectMap["credentials"] = adlg2d.Credentials + if adlg2d.DatastoreType != "" { + objectMap["datastoreType"] = adlg2d.DatastoreType + } + if adlg2d.Description != nil { + objectMap["description"] = adlg2d.Description + } + if adlg2d.Properties != nil { + objectMap["properties"] = adlg2d.Properties + } + if adlg2d.Tags != nil { + objectMap["tags"] = adlg2d.Tags + } + return json.Marshal(objectMap) +} + +// AsAzureBlobDatastore is the BasicDatastore implementation for AzureDataLakeGen2Datastore. +func (adlg2d AzureDataLakeGen2Datastore) AsAzureBlobDatastore() (*AzureBlobDatastore, bool) { + return nil, false +} + +// AsAzureDataLakeGen1Datastore is the BasicDatastore implementation for AzureDataLakeGen2Datastore. +func (adlg2d AzureDataLakeGen2Datastore) AsAzureDataLakeGen1Datastore() (*AzureDataLakeGen1Datastore, bool) { + return nil, false +} + +// AsAzureDataLakeGen2Datastore is the BasicDatastore implementation for AzureDataLakeGen2Datastore. +func (adlg2d AzureDataLakeGen2Datastore) AsAzureDataLakeGen2Datastore() (*AzureDataLakeGen2Datastore, bool) { + return &adlg2d, true +} + +// AsAzureFileDatastore is the BasicDatastore implementation for AzureDataLakeGen2Datastore. +func (adlg2d AzureDataLakeGen2Datastore) AsAzureFileDatastore() (*AzureFileDatastore, bool) { + return nil, false +} + +// AsHdfsDatastore is the BasicDatastore implementation for AzureDataLakeGen2Datastore. +func (adlg2d AzureDataLakeGen2Datastore) AsHdfsDatastore() (*HdfsDatastore, bool) { + return nil, false +} + +// AsDatastore is the BasicDatastore implementation for AzureDataLakeGen2Datastore. +func (adlg2d AzureDataLakeGen2Datastore) AsDatastore() (*Datastore, bool) { + return nil, false +} + +// AsBasicDatastore is the BasicDatastore implementation for AzureDataLakeGen2Datastore. +func (adlg2d AzureDataLakeGen2Datastore) AsBasicDatastore() (BasicDatastore, bool) { + return &adlg2d, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureDataLakeGen2Datastore struct. +func (adlg2d *AzureDataLakeGen2Datastore) 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 + } + adlg2d.AccountName = &accountName + } + case "endpoint": + if v != nil { + var endpoint string + err = json.Unmarshal(*v, &endpoint) + if err != nil { + return err + } + adlg2d.Endpoint = &endpoint + } + case "filesystem": + if v != nil { + var filesystem string + err = json.Unmarshal(*v, &filesystem) + if err != nil { + return err + } + adlg2d.Filesystem = &filesystem + } + case "protocol": + if v != nil { + var protocol string + err = json.Unmarshal(*v, &protocol) + if err != nil { + return err + } + adlg2d.Protocol = &protocol + } + case "serviceDataAccessAuthIdentity": + if v != nil { + var serviceDataAccessAuthIdentity ServiceDataAccessAuthIdentity + err = json.Unmarshal(*v, &serviceDataAccessAuthIdentity) + if err != nil { + return err + } + adlg2d.ServiceDataAccessAuthIdentity = serviceDataAccessAuthIdentity + } + case "credentials": + if v != nil { + credentials, err := unmarshalBasicDatastoreCredentials(*v) + if err != nil { + return err + } + adlg2d.Credentials = credentials + } + case "isDefault": + if v != nil { + var isDefault bool + err = json.Unmarshal(*v, &isDefault) + if err != nil { + return err + } + adlg2d.IsDefault = &isDefault + } + case "datastoreType": + if v != nil { + var datastoreType DatastoreTypeBasicDatastore + err = json.Unmarshal(*v, &datastoreType) + if err != nil { + return err + } + adlg2d.DatastoreType = datastoreType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + adlg2d.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + adlg2d.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + adlg2d.Tags = tags + } + } + } + + 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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureFileDatastore azure File datastore configuration. +type AzureFileDatastore struct { + // AccountName - [Required] Storage account name. + AccountName *string `json:"accountName,omitempty"` + // Endpoint - Azure cloud endpoint for the storage account. + Endpoint *string `json:"endpoint,omitempty"` + // FileShareName - [Required] TODO - File share name. + FileShareName *string `json:"fileShareName,omitempty"` + // Protocol - Protocol used to communicate with the storage account. + Protocol *string `json:"protocol,omitempty"` + // ServiceDataAccessAuthIdentity - Indicates which identity to use to authenticate service data access to customer's storage. Possible values include: 'ServiceDataAccessAuthIdentityNone', 'ServiceDataAccessAuthIdentityWorkspaceSystemAssignedIdentity', 'ServiceDataAccessAuthIdentityWorkspaceUserAssignedIdentity' + ServiceDataAccessAuthIdentity ServiceDataAccessAuthIdentity `json:"serviceDataAccessAuthIdentity,omitempty"` + // Credentials - [Required] Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // IsDefault - READ-ONLY; Readonly property to indicate if datastore is the workspace default datastore + IsDefault *bool `json:"isDefault,omitempty"` + // DatastoreType - Possible values include: 'DatastoreTypeDatastore', 'DatastoreTypeAzureBlob', 'DatastoreTypeAzureDataLakeGen1', 'DatastoreTypeAzureDataLakeGen2', 'DatastoreTypeAzureFile', 'DatastoreTypeHdfs' + DatastoreType DatastoreTypeBasicDatastore `json:"datastoreType,omitempty"` + // 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 AzureFileDatastore. +func (afd AzureFileDatastore) MarshalJSON() ([]byte, error) { + afd.DatastoreType = DatastoreTypeAzureFile + objectMap := make(map[string]interface{}) + if afd.AccountName != nil { + objectMap["accountName"] = afd.AccountName + } + if afd.Endpoint != nil { + objectMap["endpoint"] = afd.Endpoint + } + if afd.FileShareName != nil { + objectMap["fileShareName"] = afd.FileShareName + } + if afd.Protocol != nil { + objectMap["protocol"] = afd.Protocol + } + if afd.ServiceDataAccessAuthIdentity != "" { + objectMap["serviceDataAccessAuthIdentity"] = afd.ServiceDataAccessAuthIdentity + } + objectMap["credentials"] = afd.Credentials + if afd.DatastoreType != "" { + objectMap["datastoreType"] = afd.DatastoreType + } + if afd.Description != nil { + objectMap["description"] = afd.Description + } + if afd.Properties != nil { + objectMap["properties"] = afd.Properties + } + if afd.Tags != nil { + objectMap["tags"] = afd.Tags + } + return json.Marshal(objectMap) +} + +// AsAzureBlobDatastore is the BasicDatastore implementation for AzureFileDatastore. +func (afd AzureFileDatastore) AsAzureBlobDatastore() (*AzureBlobDatastore, bool) { + return nil, false +} + +// AsAzureDataLakeGen1Datastore is the BasicDatastore implementation for AzureFileDatastore. +func (afd AzureFileDatastore) AsAzureDataLakeGen1Datastore() (*AzureDataLakeGen1Datastore, bool) { + return nil, false +} + +// AsAzureDataLakeGen2Datastore is the BasicDatastore implementation for AzureFileDatastore. +func (afd AzureFileDatastore) AsAzureDataLakeGen2Datastore() (*AzureDataLakeGen2Datastore, bool) { + return nil, false +} + +// AsAzureFileDatastore is the BasicDatastore implementation for AzureFileDatastore. +func (afd AzureFileDatastore) AsAzureFileDatastore() (*AzureFileDatastore, bool) { + return &afd, true +} + +// AsHdfsDatastore is the BasicDatastore implementation for AzureFileDatastore. +func (afd AzureFileDatastore) AsHdfsDatastore() (*HdfsDatastore, bool) { + return nil, false +} + +// AsDatastore is the BasicDatastore implementation for AzureFileDatastore. +func (afd AzureFileDatastore) AsDatastore() (*Datastore, bool) { + return nil, false +} + +// AsBasicDatastore is the BasicDatastore implementation for AzureFileDatastore. +func (afd AzureFileDatastore) AsBasicDatastore() (BasicDatastore, bool) { + return &afd, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureFileDatastore struct. +func (afd *AzureFileDatastore) 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 + } + afd.AccountName = &accountName + } + case "endpoint": + if v != nil { + var endpoint string + err = json.Unmarshal(*v, &endpoint) + if err != nil { + return err + } + afd.Endpoint = &endpoint + } + case "fileShareName": + if v != nil { + var fileShareName string + err = json.Unmarshal(*v, &fileShareName) + if err != nil { + return err + } + afd.FileShareName = &fileShareName + } + case "protocol": + if v != nil { + var protocol string + err = json.Unmarshal(*v, &protocol) + if err != nil { + return err + } + afd.Protocol = &protocol + } + case "serviceDataAccessAuthIdentity": + if v != nil { + var serviceDataAccessAuthIdentity ServiceDataAccessAuthIdentity + err = json.Unmarshal(*v, &serviceDataAccessAuthIdentity) + if err != nil { + return err + } + afd.ServiceDataAccessAuthIdentity = serviceDataAccessAuthIdentity + } + case "credentials": + if v != nil { + credentials, err := unmarshalBasicDatastoreCredentials(*v) + if err != nil { + return err + } + afd.Credentials = credentials + } + case "isDefault": + if v != nil { + var isDefault bool + err = json.Unmarshal(*v, &isDefault) + if err != nil { + return err + } + afd.IsDefault = &isDefault + } + case "datastoreType": + if v != nil { + var datastoreType DatastoreTypeBasicDatastore + err = json.Unmarshal(*v, &datastoreType) + if err != nil { + return err + } + afd.DatastoreType = datastoreType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + afd.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + afd.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + afd.Tags = tags + } + } + } + + return nil +} + +// BanditPolicy defines an early termination policy based on slack criteria, and a frequency and delay +// interval for evaluation +type BanditPolicy struct { + // SlackAmount - Absolute distance allowed from the best performing run. + SlackAmount *float64 `json:"slackAmount,omitempty"` + // SlackFactor - Ratio of the allowed distance from the best performing run. + SlackFactor *float64 `json:"slackFactor,omitempty"` + // DelayEvaluation - Number of intervals by which to delay the first evaluation. + DelayEvaluation *int32 `json:"delayEvaluation,omitempty"` + // EvaluationInterval - Interval (number of runs) between policy evaluations. + 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 { + // Compute - Compute target for batch inference operation. + Compute *string `json:"compute,omitempty"` + // 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"` + // MaxConcurrencyPerInstance - Indicates maximum number of parallelism per instance. + MaxConcurrencyPerInstance *int32 `json:"maxConcurrencyPerInstance,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"` + // OutputAction - Indicates how the output will be organized. Possible values include: 'SummaryOnly', 'AppendRow' + OutputAction BatchOutputAction `json:"outputAction,omitempty"` + // OutputFileName - Customized output file name for append_row output action. + OutputFileName *string `json:"outputFileName,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state for the endpoint deployment. Possible values include: 'DeploymentProvisioningStateCreating', 'DeploymentProvisioningStateDeleting', 'DeploymentProvisioningStateScaling', 'DeploymentProvisioningStateUpdating', 'DeploymentProvisioningStateSucceeded', 'DeploymentProvisioningStateFailed', 'DeploymentProvisioningStateCanceled' + ProvisioningState DeploymentProvisioningState `json:"provisioningState,omitempty"` + // Resources - Indicates compute configuration for the job. + // If not provided, will default to the defaults defined in ResourceConfiguration. + Resources *ResourceConfiguration `json:"resources,omitempty"` + // RetrySettings - Retry Settings for the batch inference operation. + // If not provided, will default to the defaults defined in BatchRetrySettings. + RetrySettings *BatchRetrySettings `json:"retrySettings,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"` + // Properties - Property dictionary. Properties can be added, but not removed or altered. + Properties map[string]*string `json:"properties"` +} + +// MarshalJSON is the custom marshaler for BatchDeployment. +func (bd BatchDeployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bd.Compute != nil { + objectMap["compute"] = bd.Compute + } + if bd.ErrorThreshold != nil { + objectMap["errorThreshold"] = bd.ErrorThreshold + } + if bd.LoggingLevel != "" { + objectMap["loggingLevel"] = bd.LoggingLevel + } + if bd.MaxConcurrencyPerInstance != nil { + objectMap["maxConcurrencyPerInstance"] = bd.MaxConcurrencyPerInstance + } + if bd.MiniBatchSize != nil { + objectMap["miniBatchSize"] = bd.MiniBatchSize + } + objectMap["model"] = bd.Model + if bd.OutputAction != "" { + objectMap["outputAction"] = bd.OutputAction + } + if bd.OutputFileName != nil { + objectMap["outputFileName"] = bd.OutputFileName + } + if bd.Resources != nil { + objectMap["resources"] = bd.Resources + } + if bd.RetrySettings != nil { + objectMap["retrySettings"] = bd.RetrySettings + } + if bd.CodeConfiguration != nil { + objectMap["codeConfiguration"] = bd.CodeConfiguration + } + 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.Properties != nil { + objectMap["properties"] = bd.Properties + } + 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 "compute": + if v != nil { + var compute string + err = json.Unmarshal(*v, &compute) + if err != nil { + return err + } + bd.Compute = &compute + } + 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 "maxConcurrencyPerInstance": + if v != nil { + var maxConcurrencyPerInstance int32 + err = json.Unmarshal(*v, &maxConcurrencyPerInstance) + if err != nil { + return err + } + bd.MaxConcurrencyPerInstance = &maxConcurrencyPerInstance + } + 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 "outputAction": + if v != nil { + var outputAction BatchOutputAction + err = json.Unmarshal(*v, &outputAction) + if err != nil { + return err + } + bd.OutputAction = outputAction + } + case "outputFileName": + if v != nil { + var outputFileName string + err = json.Unmarshal(*v, &outputFileName) + if err != nil { + return err + } + bd.OutputFileName = &outputFileName + } + case "provisioningState": + if v != nil { + var provisioningState DeploymentProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + bd.ProvisioningState = provisioningState + } + case "resources": + if v != nil { + var resources ResourceConfiguration + err = json.Unmarshal(*v, &resources) + if err != nil { + return err + } + bd.Resources = &resources + } + case "retrySettings": + if v != nil { + var retrySettings BatchRetrySettings + err = json.Unmarshal(*v, &retrySettings) + if err != nil { + return err + } + bd.RetrySettings = &retrySettings + } + case "codeConfiguration": + if v != nil { + var codeConfiguration CodeConfiguration + err = json.Unmarshal(*v, &codeConfiguration) + if err != nil { + return err + } + bd.CodeConfiguration = &codeConfiguration + } + 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 "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + bd.Properties = properties + } + } + } + + return nil +} + +// BatchDeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BatchDeploymentsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BatchDeploymentsClient) (BatchDeploymentTrackedResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BatchDeploymentsCreateOrUpdateFuture) 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 BatchDeploymentsCreateOrUpdateFuture.Result. +func (future *BatchDeploymentsCreateOrUpdateFuture) result(client BatchDeploymentsClient) (bdtr BatchDeploymentTrackedResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bdtr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.BatchDeploymentsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bdtr.Response.Response, err = future.GetResult(sender); err == nil && bdtr.Response.Response.StatusCode != http.StatusNoContent { + bdtr, err = client.CreateOrUpdateResponder(bdtr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsCreateOrUpdateFuture", "Result", bdtr.Response.Response, "Failure responding to request") + } + } + return +} + +// BatchDeploymentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BatchDeploymentsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BatchDeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BatchDeploymentsDeleteFuture) 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 BatchDeploymentsDeleteFuture.Result. +func (future *BatchDeploymentsDeleteFuture) result(client BatchDeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.BatchDeploymentsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BatchDeploymentsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BatchDeploymentsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BatchDeploymentsClient) (BatchDeploymentTrackedResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BatchDeploymentsUpdateFuture) 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 BatchDeploymentsUpdateFuture.Result. +func (future *BatchDeploymentsUpdateFuture) result(client BatchDeploymentsClient) (bdtr BatchDeploymentTrackedResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bdtr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.BatchDeploymentsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bdtr.Response.Response, err = future.GetResult(sender); err == nil && bdtr.Response.Response.StatusCode != http.StatusNoContent { + bdtr, err = client.UpdateResponder(bdtr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchDeploymentsUpdateFuture", "Result", bdtr.Response.Response, "Failure responding to request") + } + } + return +} + +// BatchDeploymentTrackedResource ... +type BatchDeploymentTrackedResource struct { + autorest.Response `json:"-"` + // Identity - Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Properties - [Required] Additional attributes of the entity. + Properties *BatchDeployment `json:"properties,omitempty"` + // Sku - Sku details required for ARM contract for Autoscaling. + Sku *Sku `json:"sku,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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.Sku != nil { + objectMap["sku"] = bdtr.Sku + } + 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 - The link to the next page of BatchDeployment objects. If null, there are no additional pages. + 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 { + // Defaults - Default values for Batch Endpoint + Defaults *BatchEndpointDefaults `json:"defaults,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state for the endpoint. Possible values include: 'EndpointProvisioningStateCreating', 'EndpointProvisioningStateDeleting', 'EndpointProvisioningStateSucceeded', 'EndpointProvisioningStateFailed', 'EndpointProvisioningStateUpdating', 'EndpointProvisioningStateCanceled' + ProvisioningState EndpointProvisioningState `json:"provisioningState,omitempty"` + // AuthMode - [Required] Use 'Key' for key based authentication and 'AMLToken' for Azure Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' does. 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"` +} + +// MarshalJSON is the custom marshaler for BatchEndpoint. +func (be BatchEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if be.Defaults != nil { + objectMap["defaults"] = be.Defaults + } + 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 + } + return json.Marshal(objectMap) +} + +// BatchEndpointDefaults batch endpoint default values +type BatchEndpointDefaults struct { + // DeploymentName - Name of the deployment that will be default for the endpoint. + // This deployment will end up getting 100% traffic when the endpoint scoring URL is invoked. + DeploymentName *string `json:"deploymentName,omitempty"` +} + +// BatchEndpointsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BatchEndpointsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BatchEndpointsClient) (BatchEndpointTrackedResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BatchEndpointsCreateOrUpdateFuture) 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 BatchEndpointsCreateOrUpdateFuture.Result. +func (future *BatchEndpointsCreateOrUpdateFuture) result(client BatchEndpointsClient) (betr BatchEndpointTrackedResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + betr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.BatchEndpointsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if betr.Response.Response, err = future.GetResult(sender); err == nil && betr.Response.Response.StatusCode != http.StatusNoContent { + betr, err = client.CreateOrUpdateResponder(betr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsCreateOrUpdateFuture", "Result", betr.Response.Response, "Failure responding to request") + } + } + return +} + +// BatchEndpointsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BatchEndpointsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BatchEndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BatchEndpointsDeleteFuture) 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 BatchEndpointsDeleteFuture.Result. +func (future *BatchEndpointsDeleteFuture) result(client BatchEndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.BatchEndpointsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BatchEndpointsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BatchEndpointsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BatchEndpointsClient) (BatchEndpointTrackedResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BatchEndpointsUpdateFuture) 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 BatchEndpointsUpdateFuture.Result. +func (future *BatchEndpointsUpdateFuture) result(client BatchEndpointsClient) (betr BatchEndpointTrackedResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + betr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.BatchEndpointsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if betr.Response.Response, err = future.GetResult(sender); err == nil && betr.Response.Response.StatusCode != http.StatusNoContent { + betr, err = client.UpdateResponder(betr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.BatchEndpointsUpdateFuture", "Result", betr.Response.Response, "Failure responding to request") + } + } + return +} + +// BatchEndpointTrackedResource ... +type BatchEndpointTrackedResource struct { + autorest.Response `json:"-"` + // Identity - Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Properties - [Required] Additional attributes of the entity. + Properties *BatchEndpoint `json:"properties,omitempty"` + // Sku - Sku details required for ARM contract for Autoscaling. + Sku *Sku `json:"sku,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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.Sku != nil { + objectMap["sku"] = betr.Sku + } + 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 - The link to the next page of BatchEndpoint objects. If null, there are no additional pages. + 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, + } +} + +// 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"` +} + +// BayesianSamplingAlgorithm defines a Sampling Algorithm that generates values based on previous values +type BayesianSamplingAlgorithm struct { + // SamplingAlgorithmType - Possible values include: 'SamplingAlgorithmTypeSamplingAlgorithm', 'SamplingAlgorithmTypeBayesian1', 'SamplingAlgorithmTypeGrid1', 'SamplingAlgorithmTypeRandom1' + SamplingAlgorithmType SamplingAlgorithmTypeBasicSamplingAlgorithm `json:"samplingAlgorithmType,omitempty"` +} + +// MarshalJSON is the custom marshaler for BayesianSamplingAlgorithm. +func (bsa BayesianSamplingAlgorithm) MarshalJSON() ([]byte, error) { + bsa.SamplingAlgorithmType = SamplingAlgorithmTypeBayesian1 + objectMap := make(map[string]interface{}) + if bsa.SamplingAlgorithmType != "" { + objectMap["samplingAlgorithmType"] = bsa.SamplingAlgorithmType + } + return json.Marshal(objectMap) +} + +// AsBayesianSamplingAlgorithm is the BasicSamplingAlgorithm implementation for BayesianSamplingAlgorithm. +func (bsa BayesianSamplingAlgorithm) AsBayesianSamplingAlgorithm() (*BayesianSamplingAlgorithm, bool) { + return &bsa, true +} + +// AsGridSamplingAlgorithm is the BasicSamplingAlgorithm implementation for BayesianSamplingAlgorithm. +func (bsa BayesianSamplingAlgorithm) AsGridSamplingAlgorithm() (*GridSamplingAlgorithm, bool) { + return nil, false +} + +// AsRandomSamplingAlgorithm is the BasicSamplingAlgorithm implementation for BayesianSamplingAlgorithm. +func (bsa BayesianSamplingAlgorithm) AsRandomSamplingAlgorithm() (*RandomSamplingAlgorithm, bool) { + return nil, false +} + +// AsSamplingAlgorithm is the BasicSamplingAlgorithm implementation for BayesianSamplingAlgorithm. +func (bsa BayesianSamplingAlgorithm) AsSamplingAlgorithm() (*SamplingAlgorithm, bool) { + return nil, false +} + +// AsBasicSamplingAlgorithm is the BasicSamplingAlgorithm implementation for BayesianSamplingAlgorithm. +func (bsa BayesianSamplingAlgorithm) AsBasicSamplingAlgorithm() (BasicSamplingAlgorithm, bool) { + return &bsa, true +} + +// BuildContext configuration settings for Docker build context +type BuildContext struct { + // ContextURI - [Required] URI of the Docker build context used to build the image. Supports blob URIs on environment creation and may return blob or Git URIs. + // + ContextURI *string `json:"contextUri,omitempty"` + // DockerfilePath - Path to the Dockerfile in the build context. + // + DockerfilePath *string `json:"dockerfilePath,omitempty"` +} + +// CertificateDatastoreCredentials certificate datastore credentials configuration. +type CertificateDatastoreCredentials struct { + // AuthorityURL - Authority URL used for authentication. + AuthorityURL *string `json:"authorityUrl,omitempty"` + // ClientID - [Required] Service principal client ID. + ClientID *uuid.UUID `json:"clientId,omitempty"` + // ResourceURL - Resource the service principal has access to. + ResourceURL *string `json:"resourceUrl,omitempty"` + // Secrets - [Required] Service principal secrets. + Secrets *CertificateDatastoreSecrets `json:"secrets,omitempty"` + // TenantID - [Required] ID of the tenant to which the service principal belongs. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // Thumbprint - [Required] Thumbprint of the certificate used for authentication. + Thumbprint *string `json:"thumbprint,omitempty"` + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey1', 'CredentialsTypeCertificate1', 'CredentialsTypeNone1', 'CredentialsTypeSas1', 'CredentialsTypeServicePrincipal1' + CredentialsType CredentialsTypeBasicDatastoreCredentials `json:"credentialsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateDatastoreCredentials. +func (cdc CertificateDatastoreCredentials) MarshalJSON() ([]byte, error) { + cdc.CredentialsType = CredentialsTypeCertificate1 + objectMap := make(map[string]interface{}) + if cdc.AuthorityURL != nil { + objectMap["authorityUrl"] = cdc.AuthorityURL + } + if cdc.ClientID != nil { + objectMap["clientId"] = cdc.ClientID + } + if cdc.ResourceURL != nil { + objectMap["resourceUrl"] = cdc.ResourceURL + } + 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 +} + +// 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', 'SecretsTypeAccountKey', 'SecretsTypeCertificate', 'SecretsTypeKerberosKeytab', 'SecretsTypeKerberosPassword', 'SecretsTypeSas', 'SecretsTypeServicePrincipal' + SecretsType SecretsTypeBasicDatastoreSecrets `json:"secretsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateDatastoreSecrets. +func (cds CertificateDatastoreSecrets) MarshalJSON() ([]byte, error) { + cds.SecretsType = SecretsTypeCertificate + 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 +} + +// AsKerberosKeytabSecrets is the BasicDatastoreSecrets implementation for CertificateDatastoreSecrets. +func (cds CertificateDatastoreSecrets) AsKerberosKeytabSecrets() (*KerberosKeytabSecrets, bool) { + return nil, false +} + +// AsKerberosPasswordSecrets is the BasicDatastoreSecrets implementation for CertificateDatastoreSecrets. +func (cds CertificateDatastoreSecrets) AsKerberosPasswordSecrets() (*KerberosPasswordSecrets, 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 +} + +// 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 +} + +// Classification classification task in AutoML Table vertical. +type Classification struct { + // DataSettings - Data inputs for AutoMLJob. + DataSettings *TableVerticalDataSettings `json:"dataSettings,omitempty"` + // FeaturizationSettings - Featurization inputs needed for AutoML job. + FeaturizationSettings *TableVerticalFeaturizationSettings `json:"featurizationSettings,omitempty"` + // LimitSettings - Execution constraints for AutoMLJob. + LimitSettings *TableVerticalLimitSettings `json:"limitSettings,omitempty"` + // TrainingSettings - Inputs for training phase for an AutoML Job. + TrainingSettings *TrainingSettings `json:"trainingSettings,omitempty"` + // LogVerbosity - Log verbosity for the job. Possible values include: 'LogVerbosityNotSet', 'LogVerbosityDebug', 'LogVerbosityInfo', 'LogVerbosityWarning', 'LogVerbosityError', 'LogVerbosityCritical' + LogVerbosity LogVerbosity `json:"logVerbosity,omitempty"` + // TaskType - [Required] Task type for AutoMLJob. Possible values include: 'TaskTypeClassification', 'TaskTypeRegression', 'TaskTypeForecasting', 'TaskTypeImageClassification', 'TaskTypeImageClassificationMultilabel', 'TaskTypeImageObjectDetection', 'TaskTypeImageInstanceSegmentation', 'TaskTypeTextClassification', 'TaskTypeTextClassificationMultilabel', 'TaskTypeTextNER' + TaskType TaskType `json:"taskType,omitempty"` + // AllowedModels - Allowed models for classification task. + AllowedModels *[]ClassificationModels `json:"allowedModels,omitempty"` + // BlockedModels - Blocked models for classification task. + BlockedModels *[]ClassificationModels `json:"blockedModels,omitempty"` + // PrimaryMetric - Primary metric for the task. Possible values include: 'ClassificationPrimaryMetricsAUCWeighted', 'ClassificationPrimaryMetricsAccuracy', 'ClassificationPrimaryMetricsNormMacroRecall', 'ClassificationPrimaryMetricsAveragePrecisionScoreWeighted', 'ClassificationPrimaryMetricsPrecisionScoreWeighted' + PrimaryMetric ClassificationPrimaryMetrics `json:"primaryMetric,omitempty"` +} + +// 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 { + // Properties - Properties of ClusterUpdate + Properties *ScaleSettingsInformation `json:"properties,omitempty"` +} + +// CodeConfiguration configuration for a scoring code asset. +type CodeConfiguration struct { + // CodeID - ARM resource ID of the code asset. + CodeID *string `json:"codeId,omitempty"` + // ScoringScript - [Required] The script to execute on startup. eg. "score.py" + ScoringScript *string `json:"scoringScript,omitempty"` +} + +// CodeContainer container for code asset versions. +type CodeContainer struct { + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // LatestVersion - READ-ONLY; The latest version inside this container. + LatestVersion *string `json:"latestVersion,omitempty"` + // NextVersion - READ-ONLY; The next auto incremental version + NextVersion *string `json:"nextVersion,omitempty"` + // 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.IsArchived != nil { + objectMap["isArchived"] = cc.IsArchived + } + 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 - [Required] Additional attributes of the entity. + Properties *CodeContainer `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 - The link to the next page of CodeContainer objects. If null, there are no additional pages. + 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 { + // CodeURI - Uri where code is located + CodeURI *string `json:"codeUri,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // 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 CodeVersion. +func (cv CodeVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cv.CodeURI != nil { + objectMap["codeUri"] = cv.CodeURI + } + if cv.IsAnonymous != nil { + objectMap["isAnonymous"] = cv.IsAnonymous + } + if cv.IsArchived != nil { + objectMap["isArchived"] = cv.IsArchived + } + if cv.Description != nil { + objectMap["description"] = cv.Description + } + 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 - [Required] Additional attributes of the entity. + Properties *CodeVersion `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 - The link to the next page of CodeVersion objects. If null, there are no additional pages. + 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, + } +} + +// ColumnTransformer column transformer parameters. +type ColumnTransformer struct { + // Fields - Fields to apply transformer logic on. + Fields *[]string `json:"fields,omitempty"` + // Parameters - Different properties to be passed to transformer. + // Input expected is dictionary of key,value pairs in JSON format. + Parameters interface{} `json:"parameters,omitempty"` +} + +// CommandJob command job definition. +type CommandJob struct { + // CodeID - ARM resource ID of the code asset. + CodeID *string `json:"codeId,omitempty"` + // Command - [Required] 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 - [Required] 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"` + // Inputs - Mapping of input data bindings used in the job. + Inputs map[string]BasicJobInput `json:"inputs"` + // Limits - Command Job limit. + Limits *CommandJobLimits `json:"limits,omitempty"` + // Outputs - Mapping of output data bindings used in the job. + Outputs map[string]BasicJobOutput `json:"outputs"` + // Parameters - READ-ONLY; Input parameters. + Parameters interface{} `json:"parameters,omitempty"` + // Resources - Compute Resource configuration for the job. + Resources *ResourceConfiguration `json:"resources,omitempty"` + // ComputeID - ARM resource ID of the compute resource. + ComputeID *string `json:"computeId,omitempty"` + // DisplayName - Display name of job. + DisplayName *string `json:"displayName,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, UserIdentity or null. + // Defaults to AmlToken if null. + Identity BasicIdentityConfiguration `json:"identity,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // Schedule - Schedule definition of job. + // If no schedule is provided, the job is run once and immediately after submission. + Schedule BasicScheduleBase `json:"schedule,omitempty"` + // Services - List of JobEndpoints. + // For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + Services map[string]*JobService `json:"services"` + // Status - READ-ONLY; Status of the job. Possible values include: 'JobStatusNotStarted', 'JobStatusStarting', 'JobStatusProvisioning', 'JobStatusPreparing', 'JobStatusQueued', 'JobStatusRunning', 'JobStatusFinalizing', 'JobStatusCancelRequested', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusCanceled', 'JobStatusNotResponding', 'JobStatusPaused', 'JobStatusUnknown', 'JobStatusScheduled' + Status JobStatus `json:"status,omitempty"` + // JobType - Possible values include: 'JobTypeJobBase', 'JobTypeAutoML1', 'JobTypeCommand1', 'JobTypePipeline1', 'JobTypeSweep1' + JobType JobTypeBasicJobBase `json:"jobType,omitempty"` + // 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 CommandJob. +func (cj CommandJob) MarshalJSON() ([]byte, error) { + cj.JobType = JobTypeCommand1 + objectMap := make(map[string]interface{}) + if cj.CodeID != nil { + objectMap["codeId"] = cj.CodeID + } + if cj.Command != nil { + objectMap["command"] = cj.Command + } + objectMap["distribution"] = cj.Distribution + if cj.EnvironmentID != nil { + objectMap["environmentId"] = cj.EnvironmentID + } + if cj.EnvironmentVariables != nil { + objectMap["environmentVariables"] = cj.EnvironmentVariables + } + if cj.Inputs != nil { + objectMap["inputs"] = cj.Inputs + } + if cj.Limits != nil { + objectMap["limits"] = cj.Limits + } + if cj.Outputs != nil { + objectMap["outputs"] = cj.Outputs + } + if cj.Resources != nil { + objectMap["resources"] = cj.Resources + } + if cj.ComputeID != nil { + objectMap["computeId"] = cj.ComputeID + } + if cj.DisplayName != nil { + objectMap["displayName"] = cj.DisplayName + } + if cj.ExperimentName != nil { + objectMap["experimentName"] = cj.ExperimentName + } + objectMap["identity"] = cj.Identity + if cj.IsArchived != nil { + objectMap["isArchived"] = cj.IsArchived + } + objectMap["schedule"] = cj.Schedule + if cj.Services != nil { + objectMap["services"] = cj.Services + } + if cj.JobType != "" { + objectMap["jobType"] = cj.JobType + } + if cj.Description != nil { + objectMap["description"] = cj.Description + } + if cj.Properties != nil { + objectMap["properties"] = cj.Properties + } + if cj.Tags != nil { + objectMap["tags"] = cj.Tags + } + return json.Marshal(objectMap) +} + +// AsAutoMLJob is the BasicJobBase implementation for CommandJob. +func (cj CommandJob) AsAutoMLJob() (*AutoMLJob, bool) { + return nil, false +} + +// AsCommandJob is the BasicJobBase implementation for CommandJob. +func (cj CommandJob) AsCommandJob() (*CommandJob, bool) { + return &cj, true +} + +// AsPipelineJob is the BasicJobBase implementation for CommandJob. +func (cj CommandJob) AsPipelineJob() (*PipelineJob, bool) { + return nil, false +} + +// 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 "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 "inputs": + if v != nil { + var inputs map[string]BasicJobInput + err = json.Unmarshal(*v, &inputs) + if err != nil { + return err + } + cj.Inputs = inputs + } + case "limits": + if v != nil { + var limits CommandJobLimits + err = json.Unmarshal(*v, &limits) + if err != nil { + return err + } + cj.Limits = &limits + } + case "outputs": + if v != nil { + var outputs map[string]BasicJobOutput + err = json.Unmarshal(*v, &outputs) + if err != nil { + return err + } + cj.Outputs = outputs + } + case "parameters": + if v != nil { + var parameters interface{} + err = json.Unmarshal(*v, ¶meters) + if err != nil { + return err + } + cj.Parameters = parameters + } + case "resources": + if v != nil { + var resources ResourceConfiguration + err = json.Unmarshal(*v, &resources) + if err != nil { + return err + } + cj.Resources = &resources + } + case "computeId": + if v != nil { + var computeID string + err = json.Unmarshal(*v, &computeID) + if err != nil { + return err + } + cj.ComputeID = &computeID + } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + cj.DisplayName = &displayName + } + 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 "isArchived": + if v != nil { + var isArchived bool + err = json.Unmarshal(*v, &isArchived) + if err != nil { + return err + } + cj.IsArchived = &isArchived + } + case "schedule": + if v != nil { + schedule, err := unmarshalBasicScheduleBase(*v) + if err != nil { + return err + } + cj.Schedule = schedule + } + case "services": + if v != nil { + var services map[string]*JobService + err = json.Unmarshal(*v, &services) + if err != nil { + return err + } + cj.Services = services + } + case "status": + if v != nil { + var status JobStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + cj.Status = status + } + case "jobType": + if v != nil { + var jobType JobTypeBasicJobBase + err = json.Unmarshal(*v, &jobType) + if err != nil { + return err + } + cj.JobType = jobType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + cj.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + cj.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cj.Tags = tags + } + } + } + + return nil +} + +// CommandJobLimits command Job limit class. +type CommandJobLimits struct { + // 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"` + // JobLimitsType - Possible values include: 'JobLimitsTypeJobLimits', 'JobLimitsTypeCommand', 'JobLimitsTypeSweep' + JobLimitsType JobLimitsTypeBasicJobLimits `json:"jobLimitsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for CommandJobLimits. +func (cjl CommandJobLimits) MarshalJSON() ([]byte, error) { + cjl.JobLimitsType = JobLimitsTypeCommand + objectMap := make(map[string]interface{}) + if cjl.Timeout != nil { + objectMap["timeout"] = cjl.Timeout + } + if cjl.JobLimitsType != "" { + objectMap["jobLimitsType"] = cjl.JobLimitsType + } + return json.Marshal(objectMap) +} + +// AsCommandJobLimits is the BasicJobLimits implementation for CommandJobLimits. +func (cjl CommandJobLimits) AsCommandJobLimits() (*CommandJobLimits, bool) { + return &cjl, true +} + +// AsSweepJobLimits is the BasicJobLimits implementation for CommandJobLimits. +func (cjl CommandJobLimits) AsSweepJobLimits() (*SweepJobLimits, bool) { + return nil, false +} + +// AsJobLimits is the BasicJobLimits implementation for CommandJobLimits. +func (cjl CommandJobLimits) AsJobLimits() (*JobLimits, bool) { + return nil, false +} + +// AsBasicJobLimits is the BasicJobLimits implementation for CommandJobLimits. +func (cjl CommandJobLimits) AsBasicJobLimits() (BasicJobLimits, bool) { + return &cjl, true +} + +// ComponentContainer component container definition. +// +type ComponentContainer struct { + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // LatestVersion - READ-ONLY; The latest version inside this container. + LatestVersion *string `json:"latestVersion,omitempty"` + // NextVersion - READ-ONLY; The next auto incremental version + NextVersion *string `json:"nextVersion,omitempty"` + // 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 ComponentContainer. +func (cc ComponentContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cc.IsArchived != nil { + objectMap["isArchived"] = cc.IsArchived + } + 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) +} + +// ComponentContainerResource azure Resource Manager resource envelope. +type ComponentContainerResource struct { + autorest.Response `json:"-"` + // Properties - [Required] Additional attributes of the entity. + Properties *ComponentContainer `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComponentContainerResource. +func (ccr ComponentContainerResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ccr.Properties != nil { + objectMap["properties"] = ccr.Properties + } + return json.Marshal(objectMap) +} + +// ComponentContainerResourceArmPaginatedResult a paginated list of ComponentContainer entities. +type ComponentContainerResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + // NextLink - The link to the next page of ComponentContainer objects. If null, there are no additional pages. + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type ComponentContainer. + Value *[]ComponentContainerResource `json:"value,omitempty"` +} + +// ComponentContainerResourceArmPaginatedResultIterator provides access to a complete listing of +// ComponentContainerResource values. +type ComponentContainerResourceArmPaginatedResultIterator struct { + i int + page ComponentContainerResourceArmPaginatedResultPage +} + +// 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 *ComponentContainerResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentContainerResourceArmPaginatedResultIterator.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 *ComponentContainerResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ComponentContainerResourceArmPaginatedResultIterator) 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 ComponentContainerResourceArmPaginatedResultIterator) Response() ComponentContainerResourceArmPaginatedResult { + 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 ComponentContainerResourceArmPaginatedResultIterator) Value() ComponentContainerResource { + if !iter.page.NotDone() { + return ComponentContainerResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ComponentContainerResourceArmPaginatedResultIterator type. +func NewComponentContainerResourceArmPaginatedResultIterator(page ComponentContainerResourceArmPaginatedResultPage) ComponentContainerResourceArmPaginatedResultIterator { + return ComponentContainerResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ccrapr ComponentContainerResourceArmPaginatedResult) IsEmpty() bool { + return ccrapr.Value == nil || len(*ccrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ccrapr ComponentContainerResourceArmPaginatedResult) hasNextLink() bool { + return ccrapr.NextLink != nil && len(*ccrapr.NextLink) != 0 +} + +// componentContainerResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ccrapr ComponentContainerResourceArmPaginatedResult) componentContainerResourceArmPaginatedResultPreparer(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))) +} + +// ComponentContainerResourceArmPaginatedResultPage contains a page of ComponentContainerResource values. +type ComponentContainerResourceArmPaginatedResultPage struct { + fn func(context.Context, ComponentContainerResourceArmPaginatedResult) (ComponentContainerResourceArmPaginatedResult, error) + ccrapr ComponentContainerResourceArmPaginatedResult +} + +// 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 *ComponentContainerResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentContainerResourceArmPaginatedResultPage.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 *ComponentContainerResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ComponentContainerResourceArmPaginatedResultPage) NotDone() bool { + return !page.ccrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ComponentContainerResourceArmPaginatedResultPage) Response() ComponentContainerResourceArmPaginatedResult { + return page.ccrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ComponentContainerResourceArmPaginatedResultPage) Values() []ComponentContainerResource { + if page.ccrapr.IsEmpty() { + return nil + } + return *page.ccrapr.Value +} + +// Creates a new instance of the ComponentContainerResourceArmPaginatedResultPage type. +func NewComponentContainerResourceArmPaginatedResultPage(cur ComponentContainerResourceArmPaginatedResult, getNextPage func(context.Context, ComponentContainerResourceArmPaginatedResult) (ComponentContainerResourceArmPaginatedResult, error)) ComponentContainerResourceArmPaginatedResultPage { + return ComponentContainerResourceArmPaginatedResultPage{ + fn: getNextPage, + ccrapr: cur, + } +} + +// ComponentVersion definition of a component version: defines resources that span component types. +type ComponentVersion struct { + // ComponentSpec - Defines Component definition details. + // + ComponentSpec interface{} `json:"componentSpec,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // 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 ComponentVersion. +func (cv ComponentVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cv.ComponentSpec != nil { + objectMap["componentSpec"] = cv.ComponentSpec + } + if cv.IsAnonymous != nil { + objectMap["isAnonymous"] = cv.IsAnonymous + } + if cv.IsArchived != nil { + objectMap["isArchived"] = cv.IsArchived + } + if cv.Description != nil { + objectMap["description"] = cv.Description + } + if cv.Properties != nil { + objectMap["properties"] = cv.Properties + } + if cv.Tags != nil { + objectMap["tags"] = cv.Tags + } + return json.Marshal(objectMap) +} + +// ComponentVersionResource azure Resource Manager resource envelope. +type ComponentVersionResource struct { + autorest.Response `json:"-"` + // Properties - [Required] Additional attributes of the entity. + Properties *ComponentVersion `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComponentVersionResource. +func (cvr ComponentVersionResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cvr.Properties != nil { + objectMap["properties"] = cvr.Properties + } + return json.Marshal(objectMap) +} + +// ComponentVersionResourceArmPaginatedResult a paginated list of ComponentVersion entities. +type ComponentVersionResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + // NextLink - The link to the next page of ComponentVersion objects. If null, there are no additional pages. + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type ComponentVersion. + Value *[]ComponentVersionResource `json:"value,omitempty"` +} + +// ComponentVersionResourceArmPaginatedResultIterator provides access to a complete listing of +// ComponentVersionResource values. +type ComponentVersionResourceArmPaginatedResultIterator struct { + i int + page ComponentVersionResourceArmPaginatedResultPage +} + +// 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 *ComponentVersionResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentVersionResourceArmPaginatedResultIterator.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 *ComponentVersionResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ComponentVersionResourceArmPaginatedResultIterator) 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 ComponentVersionResourceArmPaginatedResultIterator) Response() ComponentVersionResourceArmPaginatedResult { + 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 ComponentVersionResourceArmPaginatedResultIterator) Value() ComponentVersionResource { + if !iter.page.NotDone() { + return ComponentVersionResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ComponentVersionResourceArmPaginatedResultIterator type. +func NewComponentVersionResourceArmPaginatedResultIterator(page ComponentVersionResourceArmPaginatedResultPage) ComponentVersionResourceArmPaginatedResultIterator { + return ComponentVersionResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cvrapr ComponentVersionResourceArmPaginatedResult) IsEmpty() bool { + return cvrapr.Value == nil || len(*cvrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cvrapr ComponentVersionResourceArmPaginatedResult) hasNextLink() bool { + return cvrapr.NextLink != nil && len(*cvrapr.NextLink) != 0 +} + +// componentVersionResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cvrapr ComponentVersionResourceArmPaginatedResult) componentVersionResourceArmPaginatedResultPreparer(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))) +} + +// ComponentVersionResourceArmPaginatedResultPage contains a page of ComponentVersionResource values. +type ComponentVersionResourceArmPaginatedResultPage struct { + fn func(context.Context, ComponentVersionResourceArmPaginatedResult) (ComponentVersionResourceArmPaginatedResult, error) + cvrapr ComponentVersionResourceArmPaginatedResult +} + +// 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 *ComponentVersionResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ComponentVersionResourceArmPaginatedResultPage.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 *ComponentVersionResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ComponentVersionResourceArmPaginatedResultPage) NotDone() bool { + return !page.cvrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ComponentVersionResourceArmPaginatedResultPage) Response() ComponentVersionResourceArmPaginatedResult { + return page.cvrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ComponentVersionResourceArmPaginatedResultPage) Values() []ComponentVersionResource { + if page.cvrapr.IsEmpty() { + return nil + } + return *page.cvrapr.Value +} + +// Creates a new instance of the ComponentVersionResourceArmPaginatedResultPage type. +func NewComponentVersionResourceArmPaginatedResultPage(cur ComponentVersionResourceArmPaginatedResult, getNextPage func(context.Context, ComponentVersionResourceArmPaginatedResult) (ComponentVersionResourceArmPaginatedResult, error)) ComponentVersionResourceArmPaginatedResultPage { + return ComponentVersionResourceArmPaginatedResultPage{ + fn: getNextPage, + cvrapr: cur, + } +} + +// BasicCompute machine Learning compute object. +type BasicCompute interface { + AsDataFactory() (*DataFactory, bool) + AsSynapseSpark() (*SynapseSpark, bool) + AsCompute() (*Compute, bool) +} + +// Compute machine Learning compute object. +type Compute struct { + // ComputeLocation - READ-ONLY; 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', 'ComputeTypeDataFactory1', 'ComputeTypeSynapseSpark1' + 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(ComputeTypeDataFactory1): + var df DataFactory + err := json.Unmarshal(body, &df) + return df, err + case string(ComputeTypeSynapseSpark1): + var ss SynapseSpark + err := json.Unmarshal(body, &ss) + return ss, 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.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) +} + +// AsDataFactory is the BasicCompute implementation for Compute. +func (c Compute) AsDataFactory() (*DataFactory, bool) { + return nil, false +} + +// AsSynapseSpark is the BasicCompute implementation for Compute. +func (c Compute) AsSynapseSpark() (*SynapseSpark, 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 +} + +// 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 { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // ComputeLocation - READ-ONLY; 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 - Properties of ComputeInstance + Properties *ComputeInstanceProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComputeInstance. +func (ci ComputeInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ci.ComputeType != "" { + objectMap["computeType"] = ci.ComputeType + } + 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.Properties != nil { + objectMap["properties"] = ci.Properties + } + return json.Marshal(objectMap) +} + +// 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) +} + +// ComputeInstanceContainer defines an Aml Instance container. +type ComputeInstanceContainer struct { + // Name - Name of the ComputeInstance container. + Name *string `json:"name,omitempty"` + // Autosave - Auto save settings. Possible values include: 'None', 'Local', 'Remote' + Autosave Autosave `json:"autosave,omitempty"` + // Gpu - Information of GPU. + Gpu *string `json:"gpu,omitempty"` + // Network - network of this container. Possible values include: 'Bridge', 'Host' + Network Network `json:"network,omitempty"` + // Environment - Environment information of this container. + Environment *ComputeInstanceEnvironmentInfo `json:"environment,omitempty"` + // Services - READ-ONLY; services of this containers. + Services *[]interface{} `json:"services,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComputeInstanceContainer. +func (cic ComputeInstanceContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cic.Name != nil { + objectMap["name"] = cic.Name + } + if cic.Autosave != "" { + objectMap["autosave"] = cic.Autosave + } + if cic.Gpu != nil { + objectMap["gpu"] = cic.Gpu + } + if cic.Network != "" { + objectMap["network"] = cic.Network + } + if cic.Environment != nil { + objectMap["environment"] = cic.Environment + } + 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) +} + +// ComputeInstanceDataDisk defines an Aml Instance DataDisk. +type ComputeInstanceDataDisk struct { + // Caching - Caching type of Data Disk. Possible values include: 'CachingNone', 'CachingReadOnly', 'CachingReadWrite' + Caching Caching `json:"caching,omitempty"` + // DiskSizeGB - The initial disk size in gigabytes. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // Lun - The lun is used to uniquely identify each data disk. If attaching multiple disks, each should have a distinct lun. + Lun *int32 `json:"lun,omitempty"` + // StorageAccountType - type of this storage account. Possible values include: 'StandardLRS', 'PremiumLRS' + StorageAccountType StorageAccountType `json:"storageAccountType,omitempty"` +} + +// ComputeInstanceDataMount defines an Aml Instance DataMount. +type ComputeInstanceDataMount struct { + // Source - Source of the ComputeInstance data mount. + Source *string `json:"source,omitempty"` + // SourceType - Data source type. Possible values include: 'SourceTypeDataset', 'SourceTypeDatastore', 'SourceTypeURI' + SourceType SourceType `json:"sourceType,omitempty"` + // MountName - name of the ComputeInstance data mount. + MountName *string `json:"mountName,omitempty"` + // MountAction - Mount Action. Possible values include: 'Mount', 'Unmount' + MountAction MountAction `json:"mountAction,omitempty"` + // CreatedBy - who this data mount created by. + CreatedBy *string `json:"createdBy,omitempty"` + // MountPath - Path of this data mount. + MountPath *string `json:"mountPath,omitempty"` + // MountState - Mount state. Possible values include: 'MountRequested', 'Mounted', 'MountFailed', 'UnmountRequested', 'UnmountFailed', 'Unmounted' + MountState MountState `json:"mountState,omitempty"` + // MountedOn - The time when the disk mounted. + MountedOn *date.Time `json:"mountedOn,omitempty"` + // Error - Error of this data mount. + Error *string `json:"error,omitempty"` +} + +// ComputeInstanceEnvironmentInfo environment information +type ComputeInstanceEnvironmentInfo struct { + // Name - name of environment. + Name *string `json:"name,omitempty"` + // Version - version of environment. + Version *string `json:"version,omitempty"` +} + +// 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"` + // OperationTrigger - Trigger of operation. Possible values include: 'User', 'Schedule', 'IdleShutdown' + OperationTrigger OperationTrigger `json:"operationTrigger,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 - READ-ONLY; The list of schedules to be applied on the computes. + Schedules *ComputeSchedules `json:"schedules,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"` + // Containers - READ-ONLY; Describes informations of containers on this ComputeInstance. + Containers *[]ComputeInstanceContainer `json:"containers,omitempty"` + // DataDisks - READ-ONLY; Describes informations of dataDisks on this ComputeInstance. + DataDisks *[]ComputeInstanceDataDisk `json:"dataDisks,omitempty"` + // DataMounts - READ-ONLY; Describes informations of dataMounts on this ComputeInstance. + DataMounts *[]ComputeInstanceDataMount `json:"dataMounts,omitempty"` + // Versions - READ-ONLY; ComputeInstance version. + Versions *ComputeInstanceVersion `json:"versions,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComputeInstanceProperties. +func (cip ComputeInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cip.VMSize != nil { + objectMap["vmSize"] = cip.VMSize + } + if cip.Subnet != nil { + objectMap["subnet"] = cip.Subnet + } + if cip.ApplicationSharingPolicy != "" { + objectMap["applicationSharingPolicy"] = cip.ApplicationSharingPolicy + } + if cip.SSHSettings != nil { + objectMap["sshSettings"] = cip.SSHSettings + } + if cip.ComputeInstanceAuthorizationType != "" { + objectMap["computeInstanceAuthorizationType"] = cip.ComputeInstanceAuthorizationType + } + if cip.PersonalComputeInstanceSettings != nil { + objectMap["personalComputeInstanceSettings"] = cip.PersonalComputeInstanceSettings + } + if cip.SetupScripts != nil { + objectMap["setupScripts"] = cip.SetupScripts + } + if cip.EnableNodePublicIP != nil { + objectMap["enableNodePublicIp"] = cip.EnableNodePublicIP + } + return json.Marshal(objectMap) +} + +// ComputeInstanceSchema properties(top level) of ComputeInstance +type ComputeInstanceSchema struct { + // Properties - Properties of ComputeInstance + Properties *ComputeInstanceProperties `json:"properties,omitempty"` +} + +// 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) +} + +// ComputeInstanceVersion version of computeInstance. +type ComputeInstanceVersion struct { + // Runtime - Runtime of compute instance. + Runtime *string `json:"runtime,omitempty"` +} + +// ComputeResource machine Learning compute object wrapped into ARM resource envelope. +type ComputeResource struct { + autorest.Response `json:"-"` + // 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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` + // Properties - Compute properties + Properties BasicCompute `json:"properties,omitempty"` + // Identity - The identity of the resource. + Identity *ManagedServiceIdentity `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"` +} + +// 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 + } + 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 "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 + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + cr.SystemData = &systemData + } + case "properties": + if v != nil { + properties, err := unmarshalBasicCompute(*v) + if err != nil { + return err + } + cr.Properties = properties + } + case "identity": + if v != nil { + var identity ManagedServiceIdentity + 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 + } + } + } + + return nil +} + +// ComputeResourceSchema ... +type ComputeResourceSchema struct { + // Properties - Compute properties + Properties BasicCompute `json:"properties,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for ComputeResourceSchema struct. +func (crs *ComputeResourceSchema) 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 + } + crs.Properties = properties + } + } + } + + return nil +} + +// ComputeRestartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ComputeRestartFuture 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 *ComputeRestartFuture) 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 ComputeRestartFuture.Result. +func (future *ComputeRestartFuture) 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.ComputeRestartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.ComputeRestartFuture") + return + } + ar.Response = future.Response() + return +} + +// 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 { + 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: 'ComputeTypeComputeSecrets' + 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"] { + 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 = ComputeTypeComputeSecrets + objectMap := make(map[string]interface{}) + if cs.ComputeType != "" { + objectMap["computeType"] = cs.ComputeType + } + return json.Marshal(objectMap) +} + +// 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: 'Completed', 'Provisioning', 'Failed' + ProvisioningStatus ProvisioningStatus `json:"provisioningStatus,omitempty"` + // Action - Possible values include: 'Start', 'Stop' + Action ComputePowerAction `json:"action,omitempty"` + Schedule BasicScheduleBase `json:"schedule,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComputeStartStopSchedule. +func (csss ComputeStartStopSchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csss.Action != "" { + objectMap["action"] = csss.Action + } + objectMap["schedule"] = csss.Schedule + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ComputeStartStopSchedule struct. +func (csss *ComputeStartStopSchedule) 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 + } + csss.ID = &ID + } + case "provisioningStatus": + if v != nil { + var provisioningStatus ProvisioningStatus + err = json.Unmarshal(*v, &provisioningStatus) + if err != nil { + return err + } + csss.ProvisioningStatus = provisioningStatus + } + case "action": + if v != nil { + var action ComputePowerAction + err = json.Unmarshal(*v, &action) + if err != nil { + return err + } + csss.Action = action + } + case "schedule": + if v != nil { + schedule, err := unmarshalBasicScheduleBase(*v) + if err != nil { + return err + } + csss.Schedule = schedule + } + } + } + + return nil +} + +// 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 resource requirements for each container instance within an online +// deployment. +type ContainerResourceRequirements struct { + // ContainerResourceLimits - Container resource limit info: + ContainerResourceLimits *ContainerResourceSettings `json:"containerResourceLimits,omitempty"` + // ContainerResourceRequests - Container resource request info: + ContainerResourceRequests *ContainerResourceSettings `json:"containerResourceRequests,omitempty"` +} + +// ContainerResourceSettings ... +type ContainerResourceSettings struct { + // CPU - Number of vCPUs request/limit for container. More info: + // https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + CPU *string `json:"cpu,omitempty"` + // Gpu - Number of Nvidia GPU cards request/limit for container. More info: + // https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + Gpu *string `json:"gpu,omitempty"` + // Memory - Memory size request/limit for container. More info: + // https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ + Memory *string `json:"memory,omitempty"` +} + +// CosmosDbSettings ... +type CosmosDbSettings struct { + // CollectionsThroughput - The throughput of the collections in cosmosdb database + CollectionsThroughput *int32 `json:"collectionsThroughput,omitempty"` +} + +// CronSchedule cron schedule definition +type CronSchedule struct { + // Expression - [Required] Specifies cron expression of schedule. + // The expression should follow NCronTab format. + Expression *string `json:"expression,omitempty"` + // EndTime - Specifies end time of schedule in ISO 8601 format. + // If not present, the schedule will run indefinitely + EndTime *date.Time `json:"endTime,omitempty"` + // ScheduleStatus - Specifies the schedule's status. Possible values include: 'ScheduleStatusEnabled', 'ScheduleStatusDisabled' + ScheduleStatus ScheduleStatus `json:"scheduleStatus,omitempty"` + // StartTime - Specifies start time of schedule in ISO 8601 format. + StartTime *date.Time `json:"startTime,omitempty"` + // TimeZone - Specifies time zone in which the schedule runs. + // TimeZone should follow Windows time zone format. + TimeZone *string `json:"timeZone,omitempty"` + // ScheduleType - Possible values include: 'ScheduleTypeScheduleBase', 'ScheduleTypeRecurrence', 'ScheduleTypeCron' + ScheduleType ScheduleTypeBasicScheduleBase `json:"scheduleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for CronSchedule. +func (cs CronSchedule) MarshalJSON() ([]byte, error) { + cs.ScheduleType = ScheduleTypeCron + objectMap := make(map[string]interface{}) + if cs.Expression != nil { + objectMap["expression"] = cs.Expression + } + if cs.EndTime != nil { + objectMap["endTime"] = cs.EndTime + } + if cs.ScheduleStatus != "" { + objectMap["scheduleStatus"] = cs.ScheduleStatus + } + if cs.StartTime != nil { + objectMap["startTime"] = cs.StartTime + } + if cs.TimeZone != nil { + objectMap["timeZone"] = cs.TimeZone + } + if cs.ScheduleType != "" { + objectMap["scheduleType"] = cs.ScheduleType + } + return json.Marshal(objectMap) +} + +// AsRecurrenceSchedule is the BasicScheduleBase implementation for CronSchedule. +func (cs CronSchedule) AsRecurrenceSchedule() (*RecurrenceSchedule, bool) { + return nil, false +} + +// AsCronSchedule is the BasicScheduleBase implementation for CronSchedule. +func (cs CronSchedule) AsCronSchedule() (*CronSchedule, bool) { + return &cs, true +} + +// AsScheduleBase is the BasicScheduleBase implementation for CronSchedule. +func (cs CronSchedule) AsScheduleBase() (*ScheduleBase, bool) { + return nil, false +} + +// AsBasicScheduleBase is the BasicScheduleBase implementation for CronSchedule. +func (cs CronSchedule) AsBasicScheduleBase() (BasicScheduleBase, bool) { + return &cs, true +} + +// CustomForecastHorizon the desired maximum forecast horizon in units of time-series frequency. +type CustomForecastHorizon struct { + // Value - [Required] Forecast horizon value. + Value *int32 `json:"value,omitempty"` + // Mode - Possible values include: 'ModeBasicForecastHorizonModeForecastHorizon', 'ModeBasicForecastHorizonModeAuto', 'ModeBasicForecastHorizonModeCustom' + Mode ModeBasicForecastHorizon `json:"mode,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomForecastHorizon. +func (cfh CustomForecastHorizon) MarshalJSON() ([]byte, error) { + cfh.Mode = ModeBasicForecastHorizonModeCustom + objectMap := make(map[string]interface{}) + if cfh.Value != nil { + objectMap["value"] = cfh.Value + } + if cfh.Mode != "" { + objectMap["mode"] = cfh.Mode + } + return json.Marshal(objectMap) +} + +// AsAutoForecastHorizon is the BasicForecastHorizon implementation for CustomForecastHorizon. +func (cfh CustomForecastHorizon) AsAutoForecastHorizon() (*AutoForecastHorizon, bool) { + return nil, false +} + +// AsCustomForecastHorizon is the BasicForecastHorizon implementation for CustomForecastHorizon. +func (cfh CustomForecastHorizon) AsCustomForecastHorizon() (*CustomForecastHorizon, bool) { + return &cfh, true +} + +// AsForecastHorizon is the BasicForecastHorizon implementation for CustomForecastHorizon. +func (cfh CustomForecastHorizon) AsForecastHorizon() (*ForecastHorizon, bool) { + return nil, false +} + +// AsBasicForecastHorizon is the BasicForecastHorizon implementation for CustomForecastHorizon. +func (cfh CustomForecastHorizon) AsBasicForecastHorizon() (BasicForecastHorizon, bool) { + return &cfh, true +} + +// CustomModelJobInput ... +type CustomModelJobInput struct { + // Mode - Input Asset Delivery Mode. Possible values include: 'ReadOnlyMount', 'ReadWriteMount', 'Download', 'Direct', 'EvalMount', 'EvalDownload' + Mode InputDeliveryMode `json:"mode,omitempty"` + // URI - [Required] Input Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the input. + Description *string `json:"description,omitempty"` + // JobInputType - [Required] Specifies the type of job. Possible values include: 'JobInputTypeLiteral', 'JobInputTypeURIFile', 'JobInputTypeURIFolder', 'JobInputTypeMLTable', 'JobInputTypeCustomModel', 'JobInputTypeMLFlowModel', 'JobInputTypeTritonModel' + JobInputType JobInputType `json:"jobInputType,omitempty"` +} + +// CustomModelJobOutput ... +type CustomModelJobOutput struct { + // Mode - Output Asset Delivery Mode. Possible values include: 'OutputDeliveryModeReadWriteMount', 'OutputDeliveryModeUpload' + Mode OutputDeliveryMode `json:"mode,omitempty"` + // URI - Output Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the output. + Description *string `json:"description,omitempty"` + // JobOutputType - [Required] Specifies the type of job. Possible values include: 'JobOutputTypeURIFile', 'JobOutputTypeURIFolder', 'JobOutputTypeMLTable', 'JobOutputTypeCustomModel', 'JobOutputTypeMLFlowModel', 'JobOutputTypeTritonModel' + JobOutputType JobOutputType `json:"jobOutputType,omitempty"` +} + +// CustomNCrossValidations n-Cross validations are specified by user. +type CustomNCrossValidations struct { + // Value - [Required] N-Cross validations value. + Value *int32 `json:"value,omitempty"` + // Mode - Possible values include: 'ModeNCrossValidations', 'ModeAuto', 'ModeCustom' + Mode Mode `json:"mode,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomNCrossValidations. +func (cncv CustomNCrossValidations) MarshalJSON() ([]byte, error) { + cncv.Mode = ModeCustom + objectMap := make(map[string]interface{}) + if cncv.Value != nil { + objectMap["value"] = cncv.Value + } + if cncv.Mode != "" { + objectMap["mode"] = cncv.Mode + } + return json.Marshal(objectMap) +} + +// AsAutoNCrossValidations is the BasicNCrossValidations implementation for CustomNCrossValidations. +func (cncv CustomNCrossValidations) AsAutoNCrossValidations() (*AutoNCrossValidations, bool) { + return nil, false +} + +// AsCustomNCrossValidations is the BasicNCrossValidations implementation for CustomNCrossValidations. +func (cncv CustomNCrossValidations) AsCustomNCrossValidations() (*CustomNCrossValidations, bool) { + return &cncv, true +} + +// AsNCrossValidations is the BasicNCrossValidations implementation for CustomNCrossValidations. +func (cncv CustomNCrossValidations) AsNCrossValidations() (*NCrossValidations, bool) { + return nil, false +} + +// AsBasicNCrossValidations is the BasicNCrossValidations implementation for CustomNCrossValidations. +func (cncv CustomNCrossValidations) AsBasicNCrossValidations() (BasicNCrossValidations, bool) { + return &cncv, true +} + +// CustomSeasonality ... +type CustomSeasonality struct { + // Value - [Required] Seasonality value. + Value *int32 `json:"value,omitempty"` + // Mode - Possible values include: 'ModeBasicSeasonalityModeSeasonality', 'ModeBasicSeasonalityModeAuto', 'ModeBasicSeasonalityModeCustom' + Mode ModeBasicSeasonality `json:"mode,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomSeasonality. +func (cs CustomSeasonality) MarshalJSON() ([]byte, error) { + cs.Mode = ModeBasicSeasonalityModeCustom + objectMap := make(map[string]interface{}) + if cs.Value != nil { + objectMap["value"] = cs.Value + } + if cs.Mode != "" { + objectMap["mode"] = cs.Mode + } + return json.Marshal(objectMap) +} + +// AsAutoSeasonality is the BasicSeasonality implementation for CustomSeasonality. +func (cs CustomSeasonality) AsAutoSeasonality() (*AutoSeasonality, bool) { + return nil, false +} + +// AsCustomSeasonality is the BasicSeasonality implementation for CustomSeasonality. +func (cs CustomSeasonality) AsCustomSeasonality() (*CustomSeasonality, bool) { + return &cs, true +} + +// AsSeasonality is the BasicSeasonality implementation for CustomSeasonality. +func (cs CustomSeasonality) AsSeasonality() (*Seasonality, bool) { + return nil, false +} + +// AsBasicSeasonality is the BasicSeasonality implementation for CustomSeasonality. +func (cs CustomSeasonality) AsBasicSeasonality() (BasicSeasonality, bool) { + return &cs, true +} + +// CustomTargetLags ... +type CustomTargetLags struct { + // Values - [Required] Set target lags values. + Values *[]int32 `json:"values,omitempty"` + // Mode - Possible values include: 'ModeBasicTargetLagsModeTargetLags', 'ModeBasicTargetLagsModeAuto', 'ModeBasicTargetLagsModeCustom' + Mode ModeBasicTargetLags `json:"mode,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomTargetLags. +func (ctl CustomTargetLags) MarshalJSON() ([]byte, error) { + ctl.Mode = ModeBasicTargetLagsModeCustom + objectMap := make(map[string]interface{}) + if ctl.Values != nil { + objectMap["values"] = ctl.Values + } + if ctl.Mode != "" { + objectMap["mode"] = ctl.Mode + } + return json.Marshal(objectMap) +} + +// AsAutoTargetLags is the BasicTargetLags implementation for CustomTargetLags. +func (ctl CustomTargetLags) AsAutoTargetLags() (*AutoTargetLags, bool) { + return nil, false +} + +// AsCustomTargetLags is the BasicTargetLags implementation for CustomTargetLags. +func (ctl CustomTargetLags) AsCustomTargetLags() (*CustomTargetLags, bool) { + return &ctl, true +} + +// AsTargetLags is the BasicTargetLags implementation for CustomTargetLags. +func (ctl CustomTargetLags) AsTargetLags() (*TargetLags, bool) { + return nil, false +} + +// AsBasicTargetLags is the BasicTargetLags implementation for CustomTargetLags. +func (ctl CustomTargetLags) AsBasicTargetLags() (BasicTargetLags, bool) { + return &ctl, true +} + +// CustomTargetRollingWindowSize ... +type CustomTargetRollingWindowSize struct { + // Value - [Required] TargetRollingWindowSize value. + Value *int32 `json:"value,omitempty"` + // Mode - Possible values include: 'ModeBasicTargetRollingWindowSizeModeTargetRollingWindowSize', 'ModeBasicTargetRollingWindowSizeModeAuto', 'ModeBasicTargetRollingWindowSizeModeCustom' + Mode ModeBasicTargetRollingWindowSize `json:"mode,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomTargetRollingWindowSize. +func (ctrws CustomTargetRollingWindowSize) MarshalJSON() ([]byte, error) { + ctrws.Mode = ModeBasicTargetRollingWindowSizeModeCustom + objectMap := make(map[string]interface{}) + if ctrws.Value != nil { + objectMap["value"] = ctrws.Value + } + if ctrws.Mode != "" { + objectMap["mode"] = ctrws.Mode + } + return json.Marshal(objectMap) +} + +// AsAutoTargetRollingWindowSize is the BasicTargetRollingWindowSize implementation for CustomTargetRollingWindowSize. +func (ctrws CustomTargetRollingWindowSize) AsAutoTargetRollingWindowSize() (*AutoTargetRollingWindowSize, bool) { + return nil, false +} + +// AsCustomTargetRollingWindowSize is the BasicTargetRollingWindowSize implementation for CustomTargetRollingWindowSize. +func (ctrws CustomTargetRollingWindowSize) AsCustomTargetRollingWindowSize() (*CustomTargetRollingWindowSize, bool) { + return &ctrws, true +} + +// AsTargetRollingWindowSize is the BasicTargetRollingWindowSize implementation for CustomTargetRollingWindowSize. +func (ctrws CustomTargetRollingWindowSize) AsTargetRollingWindowSize() (*TargetRollingWindowSize, bool) { + return nil, false +} + +// AsBasicTargetRollingWindowSize is the BasicTargetRollingWindowSize implementation for CustomTargetRollingWindowSize. +func (ctrws CustomTargetRollingWindowSize) AsBasicTargetRollingWindowSize() (BasicTargetRollingWindowSize, bool) { + return &ctrws, true +} + +// Databricks a DataFactory compute. +type Databricks struct { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // ComputeLocation - READ-ONLY; 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 *DatabricksProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Databricks. +func (d Databricks) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.ComputeType != "" { + objectMap["computeType"] = d.ComputeType + } + 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.Properties != nil { + objectMap["properties"] = d.Properties + } + return json.Marshal(objectMap) +} + +// DatabricksComputeSecrets secrets related to a Machine Learning compute based on Databricks. +type DatabricksComputeSecrets struct { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // DatabricksAccessToken - access token for databricks account. + DatabricksAccessToken *string `json:"databricksAccessToken,omitempty"` +} + +// DatabricksComputeSecretsProperties properties of Databricks Compute Secrets +type DatabricksComputeSecretsProperties struct { + // DatabricksAccessToken - access token for databricks account. + DatabricksAccessToken *string `json:"databricksAccessToken,omitempty"` +} + +// DatabricksProperties properties of Databricks +type DatabricksProperties struct { + // DatabricksAccessToken - Databricks access token + DatabricksAccessToken *string `json:"databricksAccessToken,omitempty"` + // WorkspaceURL - Workspace Url + WorkspaceURL *string `json:"workspaceUrl,omitempty"` +} + +// DatabricksSchema ... +type DatabricksSchema struct { + Properties *DatabricksProperties `json:"properties,omitempty"` +} + +// DataContainer container for data asset versions. +type DataContainer struct { + // DataType - [Required] Specifies the type of data. Possible values include: 'URIFile', 'URIFolder', 'MLTable' + DataType DataType `json:"dataType,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // LatestVersion - READ-ONLY; The latest version inside this container. + LatestVersion *string `json:"latestVersion,omitempty"` + // NextVersion - READ-ONLY; The next auto incremental version + NextVersion *string `json:"nextVersion,omitempty"` + // 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.DataType != "" { + objectMap["dataType"] = dc.DataType + } + if dc.IsArchived != nil { + objectMap["isArchived"] = dc.IsArchived + } + 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 - [Required] Additional attributes of the entity. + Properties *DataContainer `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 - The link to the next page of DataContainer objects. If null, there are no additional pages. + 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 - READ-ONLY; 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', 'ComputeTypeDataFactory1', 'ComputeTypeSynapseSpark1' + 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.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) +} + +// AsDataFactory is the BasicCompute implementation for DataFactory. +func (df DataFactory) AsDataFactory() (*DataFactory, bool) { + return &df, true +} + +// AsSynapseSpark is the BasicCompute implementation for DataFactory. +func (df DataFactory) AsSynapseSpark() (*SynapseSpark, 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 { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // ComputeLocation - READ-ONLY; 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 *DataLakeAnalyticsProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataLakeAnalytics. +func (dla DataLakeAnalytics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dla.ComputeType != "" { + objectMap["computeType"] = dla.ComputeType + } + 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.Properties != nil { + objectMap["properties"] = dla.Properties + } + return json.Marshal(objectMap) +} + +// DataLakeAnalyticsProperties ... +type DataLakeAnalyticsProperties struct { + // DataLakeStoreAccountName - DataLake Store Account Name + DataLakeStoreAccountName *string `json:"dataLakeStoreAccountName,omitempty"` +} + +// DataLakeAnalyticsSchema ... +type DataLakeAnalyticsSchema struct { + Properties *DataLakeAnalyticsProperties `json:"properties,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 +} + +// DataSettings collection of registered Tabular Dataset Ids and other data settings required for training +// and validating models. +type DataSettings struct { + // TargetColumnName - [Required] Target column name: This is prediction values column. + // Also known as label column name in context of classification tasks. + TargetColumnName *string `json:"targetColumnName,omitempty"` + // TestData - Test data input. + TestData *TestDataSettings `json:"testData,omitempty"` + // TrainingData - [Required] Training data input. + TrainingData *TrainingDataSettings `json:"trainingData,omitempty"` +} + +// BasicDatastore base definition for datastore contents configuration. +type BasicDatastore interface { + AsAzureBlobDatastore() (*AzureBlobDatastore, bool) + AsAzureDataLakeGen1Datastore() (*AzureDataLakeGen1Datastore, bool) + AsAzureDataLakeGen2Datastore() (*AzureDataLakeGen2Datastore, bool) + AsAzureFileDatastore() (*AzureFileDatastore, bool) + AsHdfsDatastore() (*HdfsDatastore, bool) + AsDatastore() (*Datastore, bool) +} + +// Datastore base definition for datastore contents configuration. +type Datastore struct { + // Credentials - [Required] Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // IsDefault - READ-ONLY; Readonly property to indicate if datastore is the workspace default datastore + IsDefault *bool `json:"isDefault,omitempty"` + // DatastoreType - Possible values include: 'DatastoreTypeDatastore', 'DatastoreTypeAzureBlob', 'DatastoreTypeAzureDataLakeGen1', 'DatastoreTypeAzureDataLakeGen2', 'DatastoreTypeAzureFile', 'DatastoreTypeHdfs' + DatastoreType DatastoreTypeBasicDatastore `json:"datastoreType,omitempty"` + // 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"` +} + +func unmarshalBasicDatastore(body []byte) (BasicDatastore, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["datastoreType"] { + case string(DatastoreTypeAzureBlob): + var abd AzureBlobDatastore + err := json.Unmarshal(body, &abd) + return abd, err + case string(DatastoreTypeAzureDataLakeGen1): + var adlg1d AzureDataLakeGen1Datastore + err := json.Unmarshal(body, &adlg1d) + return adlg1d, err + case string(DatastoreTypeAzureDataLakeGen2): + var adlg2d AzureDataLakeGen2Datastore + err := json.Unmarshal(body, &adlg2d) + return adlg2d, err + case string(DatastoreTypeAzureFile): + var afd AzureFileDatastore + err := json.Unmarshal(body, &afd) + return afd, err + case string(DatastoreTypeHdfs): + var hd HdfsDatastore + err := json.Unmarshal(body, &hd) + return hd, err + default: + var d Datastore + err := json.Unmarshal(body, &d) + return d, err + } +} +func unmarshalBasicDatastoreArray(body []byte) ([]BasicDatastore, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + dArray := make([]BasicDatastore, len(rawMessages)) + + for index, rawMessage := range rawMessages { + d, err := unmarshalBasicDatastore(*rawMessage) + if err != nil { + return nil, err + } + dArray[index] = d + } + return dArray, nil +} + +// MarshalJSON is the custom marshaler for Datastore. +func (d Datastore) MarshalJSON() ([]byte, error) { + d.DatastoreType = DatastoreTypeDatastore + objectMap := make(map[string]interface{}) + objectMap["credentials"] = d.Credentials + if d.DatastoreType != "" { + objectMap["datastoreType"] = d.DatastoreType + } + if d.Description != nil { + objectMap["description"] = d.Description + } + if d.Properties != nil { + objectMap["properties"] = d.Properties + } + if d.Tags != nil { + objectMap["tags"] = d.Tags + } + return json.Marshal(objectMap) +} + +// AsAzureBlobDatastore is the BasicDatastore implementation for Datastore. +func (d Datastore) AsAzureBlobDatastore() (*AzureBlobDatastore, bool) { + return nil, false +} + +// AsAzureDataLakeGen1Datastore is the BasicDatastore implementation for Datastore. +func (d Datastore) AsAzureDataLakeGen1Datastore() (*AzureDataLakeGen1Datastore, bool) { + return nil, false +} + +// AsAzureDataLakeGen2Datastore is the BasicDatastore implementation for Datastore. +func (d Datastore) AsAzureDataLakeGen2Datastore() (*AzureDataLakeGen2Datastore, bool) { + return nil, false +} + +// AsAzureFileDatastore is the BasicDatastore implementation for Datastore. +func (d Datastore) AsAzureFileDatastore() (*AzureFileDatastore, bool) { + return nil, false +} + +// AsHdfsDatastore is the BasicDatastore implementation for Datastore. +func (d Datastore) AsHdfsDatastore() (*HdfsDatastore, bool) { + return nil, false +} + +// AsDatastore is the BasicDatastore implementation for Datastore. +func (d Datastore) AsDatastore() (*Datastore, bool) { + return &d, true +} + +// AsBasicDatastore is the BasicDatastore implementation for Datastore. +func (d Datastore) AsBasicDatastore() (BasicDatastore, bool) { + return &d, true +} + +// UnmarshalJSON is the custom unmarshaler for Datastore struct. +func (d *Datastore) 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 + } + d.Credentials = credentials + } + case "isDefault": + if v != nil { + var isDefault bool + err = json.Unmarshal(*v, &isDefault) + if err != nil { + return err + } + d.IsDefault = &isDefault + } + case "datastoreType": + if v != nil { + var datastoreType DatastoreTypeBasicDatastore + err = json.Unmarshal(*v, &datastoreType) + if err != nil { + return err + } + d.DatastoreType = datastoreType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + d.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + d.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + d.Tags = tags + } + } + } + + return nil +} + +// BasicDatastoreCredentials base definition for datastore credentials. +type BasicDatastoreCredentials interface { + AsAccountKeyDatastoreCredentials() (*AccountKeyDatastoreCredentials, bool) + AsCertificateDatastoreCredentials() (*CertificateDatastoreCredentials, bool) + AsNoneDatastoreCredentials() (*NoneDatastoreCredentials, bool) + AsSasDatastoreCredentials() (*SasDatastoreCredentials, bool) + AsServicePrincipalDatastoreCredentials() (*ServicePrincipalDatastoreCredentials, bool) + AsDatastoreCredentials() (*DatastoreCredentials, bool) +} + +// DatastoreCredentials base definition for datastore credentials. +type DatastoreCredentials struct { + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey1', 'CredentialsTypeCertificate1', 'CredentialsTypeNone1', 'CredentialsTypeSas1', 'CredentialsTypeServicePrincipal1' + 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(CredentialsTypeAccountKey1): + var akdc AccountKeyDatastoreCredentials + err := json.Unmarshal(body, &akdc) + return akdc, err + case string(CredentialsTypeCertificate1): + var cdc CertificateDatastoreCredentials + err := json.Unmarshal(body, &cdc) + return cdc, err + case string(CredentialsTypeNone1): + var ndc NoneDatastoreCredentials + err := json.Unmarshal(body, &ndc) + return ndc, err + case string(CredentialsTypeSas1): + var sdc SasDatastoreCredentials + err := json.Unmarshal(body, &sdc) + return sdc, err + case string(CredentialsTypeServicePrincipal1): + var spdc ServicePrincipalDatastoreCredentials + err := json.Unmarshal(body, &spdc) + return spdc, 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 +} + +// 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 +} + +// DatastoreResource azure Resource Manager resource envelope. +type DatastoreResource struct { + autorest.Response `json:"-"` + // Properties - [Required] Additional attributes of the entity. + Properties BasicDatastore `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for DatastoreResource. +func (dr DatastoreResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = dr.Properties + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DatastoreResource struct. +func (dr *DatastoreResource) 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 := unmarshalBasicDatastore(*v) + if err != nil { + return err + } + dr.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dr.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + dr.SystemData = &systemData + } + } + } + + return nil +} + +// DatastoreResourceArmPaginatedResult a paginated list of Datastore entities. +type DatastoreResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + // NextLink - The link to the next page of Datastore objects. If null, there are no additional pages. + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type Datastore. + Value *[]DatastoreResource `json:"value,omitempty"` +} + +// DatastoreResourceArmPaginatedResultIterator provides access to a complete listing of DatastoreResource +// values. +type DatastoreResourceArmPaginatedResultIterator struct { + i int + page DatastoreResourceArmPaginatedResultPage +} + +// 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 *DatastoreResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatastoreResourceArmPaginatedResultIterator.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 *DatastoreResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DatastoreResourceArmPaginatedResultIterator) 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 DatastoreResourceArmPaginatedResultIterator) Response() DatastoreResourceArmPaginatedResult { + 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 DatastoreResourceArmPaginatedResultIterator) Value() DatastoreResource { + if !iter.page.NotDone() { + return DatastoreResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DatastoreResourceArmPaginatedResultIterator type. +func NewDatastoreResourceArmPaginatedResultIterator(page DatastoreResourceArmPaginatedResultPage) DatastoreResourceArmPaginatedResultIterator { + return DatastoreResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (drapr DatastoreResourceArmPaginatedResult) IsEmpty() bool { + return drapr.Value == nil || len(*drapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (drapr DatastoreResourceArmPaginatedResult) hasNextLink() bool { + return drapr.NextLink != nil && len(*drapr.NextLink) != 0 +} + +// datastoreResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (drapr DatastoreResourceArmPaginatedResult) datastoreResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !drapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(drapr.NextLink))) +} + +// DatastoreResourceArmPaginatedResultPage contains a page of DatastoreResource values. +type DatastoreResourceArmPaginatedResultPage struct { + fn func(context.Context, DatastoreResourceArmPaginatedResult) (DatastoreResourceArmPaginatedResult, error) + drapr DatastoreResourceArmPaginatedResult +} + +// 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 *DatastoreResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatastoreResourceArmPaginatedResultPage.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.drapr) + if err != nil { + return err + } + page.drapr = 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 *DatastoreResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DatastoreResourceArmPaginatedResultPage) NotDone() bool { + return !page.drapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DatastoreResourceArmPaginatedResultPage) Response() DatastoreResourceArmPaginatedResult { + return page.drapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DatastoreResourceArmPaginatedResultPage) Values() []DatastoreResource { + if page.drapr.IsEmpty() { + return nil + } + return *page.drapr.Value +} + +// Creates a new instance of the DatastoreResourceArmPaginatedResultPage type. +func NewDatastoreResourceArmPaginatedResultPage(cur DatastoreResourceArmPaginatedResult, getNextPage func(context.Context, DatastoreResourceArmPaginatedResult) (DatastoreResourceArmPaginatedResult, error)) DatastoreResourceArmPaginatedResultPage { + return DatastoreResourceArmPaginatedResultPage{ + fn: getNextPage, + drapr: cur, + } +} + +// BasicDatastoreSecrets base definition for datastore secrets. +type BasicDatastoreSecrets interface { + AsAccountKeyDatastoreSecrets() (*AccountKeyDatastoreSecrets, bool) + AsCertificateDatastoreSecrets() (*CertificateDatastoreSecrets, bool) + AsKerberosKeytabSecrets() (*KerberosKeytabSecrets, bool) + AsKerberosPasswordSecrets() (*KerberosPasswordSecrets, bool) + AsSasDatastoreSecrets() (*SasDatastoreSecrets, bool) + AsServicePrincipalDatastoreSecrets() (*ServicePrincipalDatastoreSecrets, bool) + AsDatastoreSecrets() (*DatastoreSecrets, bool) +} + +// DatastoreSecrets base definition for datastore secrets. +type DatastoreSecrets struct { + autorest.Response `json:"-"` + // SecretsType - Possible values include: 'SecretsTypeDatastoreSecrets', 'SecretsTypeAccountKey', 'SecretsTypeCertificate', 'SecretsTypeKerberosKeytab', 'SecretsTypeKerberosPassword', 'SecretsTypeSas', 'SecretsTypeServicePrincipal' + 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(SecretsTypeAccountKey): + var akds AccountKeyDatastoreSecrets + err := json.Unmarshal(body, &akds) + return akds, err + case string(SecretsTypeCertificate): + var cds CertificateDatastoreSecrets + err := json.Unmarshal(body, &cds) + return cds, err + case string(SecretsTypeKerberosKeytab): + var kks KerberosKeytabSecrets + err := json.Unmarshal(body, &kks) + return kks, err + case string(SecretsTypeKerberosPassword): + var kps KerberosPasswordSecrets + err := json.Unmarshal(body, &kps) + return kps, err + case string(SecretsTypeSas): + var sds SasDatastoreSecrets + err := json.Unmarshal(body, &sds) + return sds, err + case string(SecretsTypeServicePrincipal): + var spds ServicePrincipalDatastoreSecrets + err := json.Unmarshal(body, &spds) + return spds, 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 +} + +// AsKerberosKeytabSecrets is the BasicDatastoreSecrets implementation for DatastoreSecrets. +func (ds DatastoreSecrets) AsKerberosKeytabSecrets() (*KerberosKeytabSecrets, bool) { + return nil, false +} + +// AsKerberosPasswordSecrets is the BasicDatastoreSecrets implementation for DatastoreSecrets. +func (ds DatastoreSecrets) AsKerberosPasswordSecrets() (*KerberosPasswordSecrets, 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 +} + +// 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 +} + +// BasicDataVersionBase data version base definition +type BasicDataVersionBase interface { + AsMLTableData() (*MLTableData, bool) + AsURIFileDataVersion() (*URIFileDataVersion, bool) + AsURIFolderDataVersion() (*URIFolderDataVersion, bool) + AsDataVersionBase() (*DataVersionBase, bool) +} + +// DataVersionBase data version base definition +type DataVersionBase struct { + // DataURI - [Required] Uri of the data. Usage/meaning depends on Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20220201Preview.Assets.DataVersionBase.DataType + DataURI *string `json:"dataUri,omitempty"` + // DataType - Possible values include: 'DataTypeDataVersionBase', 'DataTypeMLTable', 'DataTypeURIFile', 'DataTypeURIFolder' + DataType DataTypeBasicDataVersionBase `json:"dataType,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // 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"` +} + +func unmarshalBasicDataVersionBase(body []byte) (BasicDataVersionBase, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["dataType"] { + case string(DataTypeMLTable): + var mtd MLTableData + err := json.Unmarshal(body, &mtd) + return mtd, err + case string(DataTypeURIFile): + var ufdv URIFileDataVersion + err := json.Unmarshal(body, &ufdv) + return ufdv, err + case string(DataTypeURIFolder): + var ufdv URIFolderDataVersion + err := json.Unmarshal(body, &ufdv) + return ufdv, err + default: + var dvb DataVersionBase + err := json.Unmarshal(body, &dvb) + return dvb, err + } +} +func unmarshalBasicDataVersionBaseArray(body []byte) ([]BasicDataVersionBase, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + dvbArray := make([]BasicDataVersionBase, len(rawMessages)) + + for index, rawMessage := range rawMessages { + dvb, err := unmarshalBasicDataVersionBase(*rawMessage) + if err != nil { + return nil, err + } + dvbArray[index] = dvb + } + return dvbArray, nil +} + +// MarshalJSON is the custom marshaler for DataVersionBase. +func (dvb DataVersionBase) MarshalJSON() ([]byte, error) { + dvb.DataType = DataTypeDataVersionBase + objectMap := make(map[string]interface{}) + if dvb.DataURI != nil { + objectMap["dataUri"] = dvb.DataURI + } + if dvb.DataType != "" { + objectMap["dataType"] = dvb.DataType + } + if dvb.IsAnonymous != nil { + objectMap["isAnonymous"] = dvb.IsAnonymous + } + if dvb.IsArchived != nil { + objectMap["isArchived"] = dvb.IsArchived + } + if dvb.Description != nil { + objectMap["description"] = dvb.Description + } + if dvb.Properties != nil { + objectMap["properties"] = dvb.Properties + } + if dvb.Tags != nil { + objectMap["tags"] = dvb.Tags + } + return json.Marshal(objectMap) +} + +// AsMLTableData is the BasicDataVersionBase implementation for DataVersionBase. +func (dvb DataVersionBase) AsMLTableData() (*MLTableData, bool) { + return nil, false +} + +// AsURIFileDataVersion is the BasicDataVersionBase implementation for DataVersionBase. +func (dvb DataVersionBase) AsURIFileDataVersion() (*URIFileDataVersion, bool) { + return nil, false +} + +// AsURIFolderDataVersion is the BasicDataVersionBase implementation for DataVersionBase. +func (dvb DataVersionBase) AsURIFolderDataVersion() (*URIFolderDataVersion, bool) { + return nil, false +} + +// AsDataVersionBase is the BasicDataVersionBase implementation for DataVersionBase. +func (dvb DataVersionBase) AsDataVersionBase() (*DataVersionBase, bool) { + return &dvb, true +} + +// AsBasicDataVersionBase is the BasicDataVersionBase implementation for DataVersionBase. +func (dvb DataVersionBase) AsBasicDataVersionBase() (BasicDataVersionBase, bool) { + return &dvb, true +} + +// DataVersionBaseResource azure Resource Manager resource envelope. +type DataVersionBaseResource struct { + autorest.Response `json:"-"` + // Properties - [Required] Additional attributes of the entity. + Properties BasicDataVersionBase `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataVersionBaseResource. +func (dvbr DataVersionBaseResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = dvbr.Properties + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DataVersionBaseResource struct. +func (dvbr *DataVersionBaseResource) 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 := unmarshalBasicDataVersionBase(*v) + if err != nil { + return err + } + dvbr.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dvbr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dvbr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dvbr.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + dvbr.SystemData = &systemData + } + } + } + + return nil +} + +// DataVersionBaseResourceArmPaginatedResult a paginated list of DataVersionBase entities. +type DataVersionBaseResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + // NextLink - The link to the next page of DataVersionBase objects. If null, there are no additional pages. + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type DataVersionBase. + Value *[]DataVersionBaseResource `json:"value,omitempty"` +} + +// DataVersionBaseResourceArmPaginatedResultIterator provides access to a complete listing of +// DataVersionBaseResource values. +type DataVersionBaseResourceArmPaginatedResultIterator struct { + i int + page DataVersionBaseResourceArmPaginatedResultPage +} + +// 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 *DataVersionBaseResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataVersionBaseResourceArmPaginatedResultIterator.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 *DataVersionBaseResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DataVersionBaseResourceArmPaginatedResultIterator) 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 DataVersionBaseResourceArmPaginatedResultIterator) Response() DataVersionBaseResourceArmPaginatedResult { + 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 DataVersionBaseResourceArmPaginatedResultIterator) Value() DataVersionBaseResource { + if !iter.page.NotDone() { + return DataVersionBaseResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DataVersionBaseResourceArmPaginatedResultIterator type. +func NewDataVersionBaseResourceArmPaginatedResultIterator(page DataVersionBaseResourceArmPaginatedResultPage) DataVersionBaseResourceArmPaginatedResultIterator { + return DataVersionBaseResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dvbrapr DataVersionBaseResourceArmPaginatedResult) IsEmpty() bool { + return dvbrapr.Value == nil || len(*dvbrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dvbrapr DataVersionBaseResourceArmPaginatedResult) hasNextLink() bool { + return dvbrapr.NextLink != nil && len(*dvbrapr.NextLink) != 0 +} + +// dataVersionBaseResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dvbrapr DataVersionBaseResourceArmPaginatedResult) dataVersionBaseResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !dvbrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dvbrapr.NextLink))) +} + +// DataVersionBaseResourceArmPaginatedResultPage contains a page of DataVersionBaseResource values. +type DataVersionBaseResourceArmPaginatedResultPage struct { + fn func(context.Context, DataVersionBaseResourceArmPaginatedResult) (DataVersionBaseResourceArmPaginatedResult, error) + dvbrapr DataVersionBaseResourceArmPaginatedResult +} + +// 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 *DataVersionBaseResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataVersionBaseResourceArmPaginatedResultPage.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.dvbrapr) + if err != nil { + return err + } + page.dvbrapr = 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 *DataVersionBaseResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DataVersionBaseResourceArmPaginatedResultPage) NotDone() bool { + return !page.dvbrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DataVersionBaseResourceArmPaginatedResultPage) Response() DataVersionBaseResourceArmPaginatedResult { + return page.dvbrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DataVersionBaseResourceArmPaginatedResultPage) Values() []DataVersionBaseResource { + if page.dvbrapr.IsEmpty() { + return nil + } + return *page.dvbrapr.Value +} + +// Creates a new instance of the DataVersionBaseResourceArmPaginatedResultPage type. +func NewDataVersionBaseResourceArmPaginatedResultPage(cur DataVersionBaseResourceArmPaginatedResult, getNextPage func(context.Context, DataVersionBaseResourceArmPaginatedResult) (DataVersionBaseResourceArmPaginatedResult, error)) DataVersionBaseResourceArmPaginatedResultPage { + return DataVersionBaseResourceArmPaginatedResultPage{ + fn: getNextPage, + dvbrapr: cur, + } +} + +// DefaultScaleSettings ... +type DefaultScaleSettings struct { + // ScaleType - Possible values include: 'ScaleTypeOnlineScaleSettings', 'ScaleTypeDefault', 'ScaleTypeTargetUtilization' + ScaleType ScaleTypeBasicOnlineScaleSettings `json:"scaleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for DefaultScaleSettings. +func (dss DefaultScaleSettings) MarshalJSON() ([]byte, error) { + dss.ScaleType = ScaleTypeDefault + objectMap := make(map[string]interface{}) + if dss.ScaleType != "" { + objectMap["scaleType"] = dss.ScaleType + } + return json.Marshal(objectMap) +} + +// AsDefaultScaleSettings is the BasicOnlineScaleSettings implementation for DefaultScaleSettings. +func (dss DefaultScaleSettings) AsDefaultScaleSettings() (*DefaultScaleSettings, bool) { + return &dss, true +} + +// AsTargetUtilizationScaleSettings is the BasicOnlineScaleSettings implementation for DefaultScaleSettings. +func (dss DefaultScaleSettings) AsTargetUtilizationScaleSettings() (*TargetUtilizationScaleSettings, bool) { + return nil, false +} + +// AsOnlineScaleSettings is the BasicOnlineScaleSettings implementation for DefaultScaleSettings. +func (dss DefaultScaleSettings) AsOnlineScaleSettings() (*OnlineScaleSettings, bool) { + return nil, false +} + +// AsBasicOnlineScaleSettings is the BasicOnlineScaleSettings implementation for DefaultScaleSettings. +func (dss DefaultScaleSettings) AsBasicOnlineScaleSettings() (BasicOnlineScaleSettings, bool) { + return &dss, true +} + +// DeploymentLogs ... +type DeploymentLogs struct { + autorest.Response `json:"-"` + // Content - The retrieved online deployment logs. + 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"` +} + +// DiagnoseRequestProperties ... +type DiagnoseRequestProperties struct { + // Udr - Setting for diagnosing user defined routing + Udr map[string]interface{} `json:"udr"` + // Nsg - Setting for diagnosing network security group + Nsg map[string]interface{} `json:"nsg"` + // ResourceLock - Setting for diagnosing resource lock + ResourceLock map[string]interface{} `json:"resourceLock"` + // DNSResolution - Setting for diagnosing dns resolution + DNSResolution map[string]interface{} `json:"dnsResolution"` + // StorageAccount - Setting for diagnosing dependent storage account + StorageAccount map[string]interface{} `json:"storageAccount"` + // KeyVault - Setting for diagnosing dependent key vault + KeyVault map[string]interface{} `json:"keyVault"` + // ContainerRegistry - Setting for diagnosing dependent container registry + ContainerRegistry map[string]interface{} `json:"containerRegistry"` + // ApplicationInsights - Setting for diagnosing dependent application insights + ApplicationInsights map[string]interface{} `json:"applicationInsights"` + // Others - Setting for diagnosing unclassified category of problems + Others map[string]interface{} `json:"others"` +} + +// MarshalJSON is the custom marshaler for DiagnoseRequestProperties. +func (drp DiagnoseRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if drp.Udr != nil { + objectMap["udr"] = drp.Udr + } + if drp.Nsg != nil { + objectMap["nsg"] = drp.Nsg + } + if drp.ResourceLock != nil { + objectMap["resourceLock"] = drp.ResourceLock + } + if drp.DNSResolution != nil { + objectMap["dnsResolution"] = drp.DNSResolution + } + if drp.StorageAccount != nil { + objectMap["storageAccount"] = drp.StorageAccount + } + if drp.KeyVault != nil { + objectMap["keyVault"] = drp.KeyVault + } + if drp.ContainerRegistry != nil { + objectMap["containerRegistry"] = drp.ContainerRegistry + } + if drp.ApplicationInsights != nil { + objectMap["applicationInsights"] = drp.ApplicationInsights + } + if drp.Others != nil { + objectMap["others"] = drp.Others + } + return json.Marshal(objectMap) +} + +// DiagnoseResponseResult ... +type DiagnoseResponseResult struct { + autorest.Response `json:"-"` + Value *DiagnoseResponseResultValue `json:"value,omitempty"` +} + +// DiagnoseResponseResultValue ... +type DiagnoseResponseResultValue struct { + UserDefinedRouteResults *[]DiagnoseResult `json:"userDefinedRouteResults,omitempty"` + NetworkSecurityRuleResults *[]DiagnoseResult `json:"networkSecurityRuleResults,omitempty"` + ResourceLockResults *[]DiagnoseResult `json:"resourceLockResults,omitempty"` + DNSResolutionResults *[]DiagnoseResult `json:"dnsResolutionResults,omitempty"` + StorageAccountResults *[]DiagnoseResult `json:"storageAccountResults,omitempty"` + KeyVaultResults *[]DiagnoseResult `json:"keyVaultResults,omitempty"` + ContainerRegistryResults *[]DiagnoseResult `json:"containerRegistryResults,omitempty"` + ApplicationInsightsResults *[]DiagnoseResult `json:"applicationInsightsResults,omitempty"` + OtherResults *[]DiagnoseResult `json:"otherResults,omitempty"` +} + +// DiagnoseResult result of Diagnose +type DiagnoseResult struct { + // Code - READ-ONLY; Code for workspace setup error + Code *string `json:"code,omitempty"` + // Level - READ-ONLY; Level of workspace setup error. Possible values include: 'DiagnoseResultLevelWarning', 'DiagnoseResultLevelError', 'DiagnoseResultLevelInformation' + Level DiagnoseResultLevel `json:"level,omitempty"` + // Message - READ-ONLY; Message of workspace setup error + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for DiagnoseResult. +func (dr DiagnoseResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DiagnoseWorkspaceParameters parameters to diagnose a workspace +type DiagnoseWorkspaceParameters struct { + // Value - Value of Parameters + Value *DiagnoseRequestProperties `json:"value,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 +} + +// 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 - Number of intervals by which to delay the first evaluation. + DelayEvaluation *int32 `json:"delayEvaluation,omitempty"` + // EvaluationInterval - Interval (number of runs) between policy evaluations. + 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 +} + +// EncryptionKeyVaultProperties ... +type EncryptionKeyVaultProperties 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"` +} + +// EncryptionProperty ... +type EncryptionProperty struct { + // Status - Indicates whether or not the encryption is enabled for the workspace. Possible values include: 'EncryptionStatusEnabled', 'EncryptionStatusDisabled' + 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 *EncryptionKeyVaultProperties `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 for endpoint authentication. + 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"` +} + +// EndpointDeploymentPropertiesBase base definition for endpoint deployment. +type EndpointDeploymentPropertiesBase struct { + // 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"` + // Properties - Property dictionary. Properties can be added, but not removed or altered. + Properties map[string]*string `json:"properties"` +} + +// MarshalJSON is the custom marshaler for EndpointDeploymentPropertiesBase. +func (edpb EndpointDeploymentPropertiesBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if edpb.CodeConfiguration != nil { + objectMap["codeConfiguration"] = edpb.CodeConfiguration + } + if edpb.Description != nil { + objectMap["description"] = edpb.Description + } + if edpb.EnvironmentID != nil { + objectMap["environmentId"] = edpb.EnvironmentID + } + if edpb.EnvironmentVariables != nil { + objectMap["environmentVariables"] = edpb.EnvironmentVariables + } + if edpb.Properties != nil { + objectMap["properties"] = edpb.Properties + } + return json.Marshal(objectMap) +} + +// EndpointPropertiesBase inference Endpoint base definition +type EndpointPropertiesBase struct { + // AuthMode - [Required] Use 'Key' for key based authentication and 'AMLToken' for Azure Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' does. 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"` +} + +// MarshalJSON is the custom marshaler for EndpointPropertiesBase. +func (epb EndpointPropertiesBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if epb.AuthMode != "" { + objectMap["authMode"] = epb.AuthMode + } + if epb.Description != nil { + objectMap["description"] = epb.Description + } + if epb.Keys != nil { + objectMap["keys"] = epb.Keys + } + if epb.Properties != nil { + objectMap["properties"] = epb.Properties + } + return json.Marshal(objectMap) +} + +// EnvironmentContainer container for environment specification versions. +type EnvironmentContainer struct { + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // LatestVersion - READ-ONLY; The latest version inside this container. + LatestVersion *string `json:"latestVersion,omitempty"` + // NextVersion - READ-ONLY; The next auto incremental version + NextVersion *string `json:"nextVersion,omitempty"` + // 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.IsArchived != nil { + objectMap["isArchived"] = ec.IsArchived + } + 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 - [Required] Additional attributes of the entity. + Properties *EnvironmentContainer `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 - The link to the next page of EnvironmentContainer objects. If null, there are no additional pages. + 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, + } +} + +// EnvironmentVersion environment version details. +type EnvironmentVersion struct { + // Build - Configuration settings for Docker build context. + Build *BuildContext `json:"build,omitempty"` + // 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"` + // EnvironmentType - READ-ONLY; Environment type is either user managed or curated by the Azure ML service + // . Possible values include: 'Curated', 'UserCreated' + EnvironmentType EnvironmentType `json:"environmentType,omitempty"` + // Image - Name of the image that will be used for the environment. + // + Image *string `json:"image,omitempty"` + // InferenceConfig - Defines configuration specific to inference. + InferenceConfig *InferenceContainerProperties `json:"inferenceConfig,omitempty"` + // OsType - The OS type of the environment. Possible values include: 'Linux', 'Windows' + OsType OperatingSystemType `json:"osType,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // 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 EnvironmentVersion. +func (ev EnvironmentVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ev.Build != nil { + objectMap["build"] = ev.Build + } + if ev.CondaFile != nil { + objectMap["condaFile"] = ev.CondaFile + } + if ev.Image != nil { + objectMap["image"] = ev.Image + } + if ev.InferenceConfig != nil { + objectMap["inferenceConfig"] = ev.InferenceConfig + } + if ev.OsType != "" { + objectMap["osType"] = ev.OsType + } + if ev.IsAnonymous != nil { + objectMap["isAnonymous"] = ev.IsAnonymous + } + if ev.IsArchived != nil { + objectMap["isArchived"] = ev.IsArchived + } + if ev.Description != nil { + objectMap["description"] = ev.Description + } + if ev.Properties != nil { + objectMap["properties"] = ev.Properties + } + if ev.Tags != nil { + objectMap["tags"] = ev.Tags + } + return json.Marshal(objectMap) +} + +// EnvironmentVersionResource azure Resource Manager resource envelope. +type EnvironmentVersionResource struct { + autorest.Response `json:"-"` + // Properties - [Required] Additional attributes of the entity. + Properties *EnvironmentVersion `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for EnvironmentVersionResource. +func (evr EnvironmentVersionResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if evr.Properties != nil { + objectMap["properties"] = evr.Properties + } + return json.Marshal(objectMap) +} + +// EnvironmentVersionResourceArmPaginatedResult a paginated list of EnvironmentVersion entities. +type EnvironmentVersionResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + // NextLink - The link to the next page of EnvironmentVersion objects. If null, there are no additional pages. + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type EnvironmentVersion. + Value *[]EnvironmentVersionResource `json:"value,omitempty"` +} + +// EnvironmentVersionResourceArmPaginatedResultIterator provides access to a complete listing of +// EnvironmentVersionResource values. +type EnvironmentVersionResourceArmPaginatedResultIterator struct { + i int + page EnvironmentVersionResourceArmPaginatedResultPage +} + +// 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 *EnvironmentVersionResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentVersionResourceArmPaginatedResultIterator.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 *EnvironmentVersionResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EnvironmentVersionResourceArmPaginatedResultIterator) 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 EnvironmentVersionResourceArmPaginatedResultIterator) Response() EnvironmentVersionResourceArmPaginatedResult { + 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 EnvironmentVersionResourceArmPaginatedResultIterator) Value() EnvironmentVersionResource { + if !iter.page.NotDone() { + return EnvironmentVersionResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EnvironmentVersionResourceArmPaginatedResultIterator type. +func NewEnvironmentVersionResourceArmPaginatedResultIterator(page EnvironmentVersionResourceArmPaginatedResultPage) EnvironmentVersionResourceArmPaginatedResultIterator { + return EnvironmentVersionResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (evrapr EnvironmentVersionResourceArmPaginatedResult) IsEmpty() bool { + return evrapr.Value == nil || len(*evrapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (evrapr EnvironmentVersionResourceArmPaginatedResult) hasNextLink() bool { + return evrapr.NextLink != nil && len(*evrapr.NextLink) != 0 +} + +// environmentVersionResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (evrapr EnvironmentVersionResourceArmPaginatedResult) environmentVersionResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !evrapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(evrapr.NextLink))) +} + +// EnvironmentVersionResourceArmPaginatedResultPage contains a page of EnvironmentVersionResource values. +type EnvironmentVersionResourceArmPaginatedResultPage struct { + fn func(context.Context, EnvironmentVersionResourceArmPaginatedResult) (EnvironmentVersionResourceArmPaginatedResult, error) + evrapr EnvironmentVersionResourceArmPaginatedResult +} + +// 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 *EnvironmentVersionResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentVersionResourceArmPaginatedResultPage.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.evrapr) + if err != nil { + return err + } + page.evrapr = 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 *EnvironmentVersionResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EnvironmentVersionResourceArmPaginatedResultPage) NotDone() bool { + return !page.evrapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EnvironmentVersionResourceArmPaginatedResultPage) Response() EnvironmentVersionResourceArmPaginatedResult { + return page.evrapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EnvironmentVersionResourceArmPaginatedResultPage) Values() []EnvironmentVersionResource { + if page.evrapr.IsEmpty() { + return nil + } + return *page.evrapr.Value +} + +// Creates a new instance of the EnvironmentVersionResourceArmPaginatedResultPage type. +func NewEnvironmentVersionResourceArmPaginatedResultPage(cur EnvironmentVersionResourceArmPaginatedResult, getNextPage func(context.Context, EnvironmentVersionResourceArmPaginatedResult) (EnvironmentVersionResourceArmPaginatedResult, error)) EnvironmentVersionResourceArmPaginatedResultPage { + return EnvironmentVersionResourceArmPaginatedResultPage{ + fn: getNextPage, + evrapr: 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"` +} + +// ExternalFQDNResponse ... +type ExternalFQDNResponse struct { + autorest.Response `json:"-"` + Value *[]FQDNEndpoints `json:"value,omitempty"` +} + +// FeaturizationSettings featurization Configuration. +type FeaturizationSettings struct { + // DatasetLanguage - Dataset language, useful for the text data. + DatasetLanguage *string `json:"datasetLanguage,omitempty"` +} + +// FlavorData ... +type FlavorData struct { + // Data - Model flavor-specific data. + 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) +} + +// BasicForecastHorizon the desired maximum forecast horizon in units of time-series frequency. +type BasicForecastHorizon interface { + AsAutoForecastHorizon() (*AutoForecastHorizon, bool) + AsCustomForecastHorizon() (*CustomForecastHorizon, bool) + AsForecastHorizon() (*ForecastHorizon, bool) +} + +// ForecastHorizon the desired maximum forecast horizon in units of time-series frequency. +type ForecastHorizon struct { + // Mode - Possible values include: 'ModeBasicForecastHorizonModeForecastHorizon', 'ModeBasicForecastHorizonModeAuto', 'ModeBasicForecastHorizonModeCustom' + Mode ModeBasicForecastHorizon `json:"mode,omitempty"` +} + +func unmarshalBasicForecastHorizon(body []byte) (BasicForecastHorizon, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["mode"] { + case string(ModeBasicForecastHorizonModeAuto): + var afh AutoForecastHorizon + err := json.Unmarshal(body, &afh) + return afh, err + case string(ModeBasicForecastHorizonModeCustom): + var cfh CustomForecastHorizon + err := json.Unmarshal(body, &cfh) + return cfh, err + default: + var fh ForecastHorizon + err := json.Unmarshal(body, &fh) + return fh, err + } +} +func unmarshalBasicForecastHorizonArray(body []byte) ([]BasicForecastHorizon, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + fhArray := make([]BasicForecastHorizon, len(rawMessages)) + + for index, rawMessage := range rawMessages { + fh, err := unmarshalBasicForecastHorizon(*rawMessage) + if err != nil { + return nil, err + } + fhArray[index] = fh + } + return fhArray, nil +} + +// MarshalJSON is the custom marshaler for ForecastHorizon. +func (fh ForecastHorizon) MarshalJSON() ([]byte, error) { + fh.Mode = ModeBasicForecastHorizonModeForecastHorizon + objectMap := make(map[string]interface{}) + if fh.Mode != "" { + objectMap["mode"] = fh.Mode + } + return json.Marshal(objectMap) +} + +// AsAutoForecastHorizon is the BasicForecastHorizon implementation for ForecastHorizon. +func (fh ForecastHorizon) AsAutoForecastHorizon() (*AutoForecastHorizon, bool) { + return nil, false +} + +// AsCustomForecastHorizon is the BasicForecastHorizon implementation for ForecastHorizon. +func (fh ForecastHorizon) AsCustomForecastHorizon() (*CustomForecastHorizon, bool) { + return nil, false +} + +// AsForecastHorizon is the BasicForecastHorizon implementation for ForecastHorizon. +func (fh ForecastHorizon) AsForecastHorizon() (*ForecastHorizon, bool) { + return &fh, true +} + +// AsBasicForecastHorizon is the BasicForecastHorizon implementation for ForecastHorizon. +func (fh ForecastHorizon) AsBasicForecastHorizon() (BasicForecastHorizon, bool) { + return &fh, true +} + +// Forecasting forecasting task in AutoML Table vertical. +type Forecasting struct { + // DataSettings - Data inputs for AutoMLJob. + DataSettings *TableVerticalDataSettings `json:"dataSettings,omitempty"` + // FeaturizationSettings - Featurization inputs needed for AutoML job. + FeaturizationSettings *TableVerticalFeaturizationSettings `json:"featurizationSettings,omitempty"` + // LimitSettings - Execution constraints for AutoMLJob. + LimitSettings *TableVerticalLimitSettings `json:"limitSettings,omitempty"` + // TrainingSettings - Inputs for training phase for an AutoML Job. + TrainingSettings *TrainingSettings `json:"trainingSettings,omitempty"` + // LogVerbosity - Log verbosity for the job. Possible values include: 'LogVerbosityNotSet', 'LogVerbosityDebug', 'LogVerbosityInfo', 'LogVerbosityWarning', 'LogVerbosityError', 'LogVerbosityCritical' + LogVerbosity LogVerbosity `json:"logVerbosity,omitempty"` + // TaskType - [Required] Task type for AutoMLJob. Possible values include: 'TaskTypeClassification', 'TaskTypeRegression', 'TaskTypeForecasting', 'TaskTypeImageClassification', 'TaskTypeImageClassificationMultilabel', 'TaskTypeImageObjectDetection', 'TaskTypeImageInstanceSegmentation', 'TaskTypeTextClassification', 'TaskTypeTextClassificationMultilabel', 'TaskTypeTextNER' + TaskType TaskType `json:"taskType,omitempty"` + // AllowedModels - Allowed models for forecasting task. + AllowedModels *[]ForecastingModels `json:"allowedModels,omitempty"` + // BlockedModels - Blocked models for forecasting task. + BlockedModels *[]ForecastingModels `json:"blockedModels,omitempty"` + // ForecastingSettings - Forecasting task specific inputs. + ForecastingSettings *ForecastingSettings `json:"forecastingSettings,omitempty"` + // PrimaryMetric - Primary metric for forecasting task. Possible values include: 'SpearmanCorrelation', 'NormalizedRootMeanSquaredError', 'R2Score', 'NormalizedMeanAbsoluteError' + PrimaryMetric ForecastingPrimaryMetrics `json:"primaryMetric,omitempty"` +} + +// ForecastingSettings forecasting specific parameters. +type ForecastingSettings struct { + // CountryOrRegionForHolidays - Country or region for holidays for forecasting tasks. + // These should be ISO 3166 two-letter country/region codes, for example 'US' or 'GB'. + CountryOrRegionForHolidays *string `json:"countryOrRegionForHolidays,omitempty"` + // CvStepSize - Number of periods between the origin time of one CV fold and the next fold. For + // example, if `CVStepSize` = 3 for daily data, the origin time for each fold will be + // three days apart. + CvStepSize *int32 `json:"cvStepSize,omitempty"` + // FeatureLags - Flag for generating lags for the numeric features with 'auto' or null. Possible values include: 'FeatureLagsNone', 'FeatureLagsAuto' + FeatureLags FeatureLags `json:"featureLags,omitempty"` + // ForecastHorizon - The desired maximum forecast horizon in units of time-series frequency. + ForecastHorizon BasicForecastHorizon `json:"forecastHorizon,omitempty"` + // Frequency - When forecasting, this parameter represents the period with which the forecast is desired, for example daily, weekly, yearly, etc. The forecast frequency is dataset frequency by default. + Frequency *string `json:"frequency,omitempty"` + // Seasonality - Set time series seasonality as an integer multiple of the series frequency. + // If seasonality is set to 'auto', it will be inferred. + Seasonality BasicSeasonality `json:"seasonality,omitempty"` + // ShortSeriesHandlingConfig - The parameter defining how if AutoML should handle short time series. Possible values include: 'ShortSeriesHandlingConfigurationNone', 'ShortSeriesHandlingConfigurationAuto', 'ShortSeriesHandlingConfigurationPad', 'ShortSeriesHandlingConfigurationDrop' + ShortSeriesHandlingConfig ShortSeriesHandlingConfiguration `json:"shortSeriesHandlingConfig,omitempty"` + // TargetAggregateFunction - The function to be used to aggregate the time series target column to conform to a user specified frequency. + // If the TargetAggregateFunction is set i.e. not 'None', but the freq parameter is not set, the error is raised. The possible target aggregation functions are: "sum", "max", "min" and "mean". Possible values include: 'TargetAggregationFunctionNone', 'TargetAggregationFunctionSum', 'TargetAggregationFunctionMax', 'TargetAggregationFunctionMin', 'TargetAggregationFunctionMean' + TargetAggregateFunction TargetAggregationFunction `json:"targetAggregateFunction,omitempty"` + // TargetLags - The number of past periods to lag from the target column. + TargetLags BasicTargetLags `json:"targetLags,omitempty"` + // TargetRollingWindowSize - The number of past periods used to create a rolling window average of the target column. + TargetRollingWindowSize BasicTargetRollingWindowSize `json:"targetRollingWindowSize,omitempty"` + // TimeColumnName - The name of the time column. This parameter is required when forecasting to specify the datetime column in the input data used for building the time series and inferring its frequency. + TimeColumnName *string `json:"timeColumnName,omitempty"` + // TimeSeriesIDColumnNames - The names of columns used to group a timeseries. It can be used to create multiple series. + // If grain is not defined, the data set is assumed to be one time-series. This parameter is used with task type forecasting. + TimeSeriesIDColumnNames *[]string `json:"timeSeriesIdColumnNames,omitempty"` + // UseStl - Configure STL Decomposition of the time-series target column. Possible values include: 'UseStlNone', 'UseStlSeason', 'UseStlSeasonTrend' + UseStl UseStl `json:"useStl,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for ForecastingSettings struct. +func (fs *ForecastingSettings) 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 "countryOrRegionForHolidays": + if v != nil { + var countryOrRegionForHolidays string + err = json.Unmarshal(*v, &countryOrRegionForHolidays) + if err != nil { + return err + } + fs.CountryOrRegionForHolidays = &countryOrRegionForHolidays + } + case "cvStepSize": + if v != nil { + var cvStepSize int32 + err = json.Unmarshal(*v, &cvStepSize) + if err != nil { + return err + } + fs.CvStepSize = &cvStepSize + } + case "featureLags": + if v != nil { + var featureLags FeatureLags + err = json.Unmarshal(*v, &featureLags) + if err != nil { + return err + } + fs.FeatureLags = featureLags + } + case "forecastHorizon": + if v != nil { + forecastHorizon, err := unmarshalBasicForecastHorizon(*v) + if err != nil { + return err + } + fs.ForecastHorizon = forecastHorizon + } + case "frequency": + if v != nil { + var frequency string + err = json.Unmarshal(*v, &frequency) + if err != nil { + return err + } + fs.Frequency = &frequency + } + case "seasonality": + if v != nil { + seasonality, err := unmarshalBasicSeasonality(*v) + if err != nil { + return err + } + fs.Seasonality = seasonality + } + case "shortSeriesHandlingConfig": + if v != nil { + var shortSeriesHandlingConfig ShortSeriesHandlingConfiguration + err = json.Unmarshal(*v, &shortSeriesHandlingConfig) + if err != nil { + return err + } + fs.ShortSeriesHandlingConfig = shortSeriesHandlingConfig + } + case "targetAggregateFunction": + if v != nil { + var targetAggregateFunction TargetAggregationFunction + err = json.Unmarshal(*v, &targetAggregateFunction) + if err != nil { + return err + } + fs.TargetAggregateFunction = targetAggregateFunction + } + case "targetLags": + if v != nil { + targetLags, err := unmarshalBasicTargetLags(*v) + if err != nil { + return err + } + fs.TargetLags = targetLags + } + case "targetRollingWindowSize": + if v != nil { + targetRollingWindowSize, err := unmarshalBasicTargetRollingWindowSize(*v) + if err != nil { + return err + } + fs.TargetRollingWindowSize = targetRollingWindowSize + } + case "timeColumnName": + if v != nil { + var timeColumnName string + err = json.Unmarshal(*v, &timeColumnName) + if err != nil { + return err + } + fs.TimeColumnName = &timeColumnName + } + case "timeSeriesIdColumnNames": + if v != nil { + var timeSeriesIDColumnNames []string + err = json.Unmarshal(*v, &timeSeriesIDColumnNames) + if err != nil { + return err + } + fs.TimeSeriesIDColumnNames = &timeSeriesIDColumnNames + } + case "useStl": + if v != nil { + var useStl UseStl + err = json.Unmarshal(*v, &useStl) + if err != nil { + return err + } + fs.UseStl = useStl + } + } + } + + return nil +} + +// FQDNEndpoint ... +type FQDNEndpoint struct { + DomainName *string `json:"domainName,omitempty"` + EndpointDetails *[]FQDNEndpointDetail `json:"endpointDetails,omitempty"` +} + +// FQDNEndpointDetail ... +type FQDNEndpointDetail struct { + Port *int32 `json:"port,omitempty"` +} + +// FQDNEndpoints ... +type FQDNEndpoints struct { + Properties *FQDNEndpointsProperties `json:"properties,omitempty"` +} + +// FQDNEndpointsProperties ... +type FQDNEndpointsProperties struct { + Category *string `json:"category,omitempty"` + Endpoints *[]FQDNEndpoint `json:"endpoints,omitempty"` +} + +// GridSamplingAlgorithm defines a Sampling Algorithm that exhaustively generates every value combination +// in the space +type GridSamplingAlgorithm struct { + // SamplingAlgorithmType - Possible values include: 'SamplingAlgorithmTypeSamplingAlgorithm', 'SamplingAlgorithmTypeBayesian1', 'SamplingAlgorithmTypeGrid1', 'SamplingAlgorithmTypeRandom1' + SamplingAlgorithmType SamplingAlgorithmTypeBasicSamplingAlgorithm `json:"samplingAlgorithmType,omitempty"` +} + +// MarshalJSON is the custom marshaler for GridSamplingAlgorithm. +func (gsa GridSamplingAlgorithm) MarshalJSON() ([]byte, error) { + gsa.SamplingAlgorithmType = SamplingAlgorithmTypeGrid1 + objectMap := make(map[string]interface{}) + if gsa.SamplingAlgorithmType != "" { + objectMap["samplingAlgorithmType"] = gsa.SamplingAlgorithmType + } + return json.Marshal(objectMap) +} + +// AsBayesianSamplingAlgorithm is the BasicSamplingAlgorithm implementation for GridSamplingAlgorithm. +func (gsa GridSamplingAlgorithm) AsBayesianSamplingAlgorithm() (*BayesianSamplingAlgorithm, bool) { + return nil, false +} + +// AsGridSamplingAlgorithm is the BasicSamplingAlgorithm implementation for GridSamplingAlgorithm. +func (gsa GridSamplingAlgorithm) AsGridSamplingAlgorithm() (*GridSamplingAlgorithm, bool) { + return &gsa, true +} + +// AsRandomSamplingAlgorithm is the BasicSamplingAlgorithm implementation for GridSamplingAlgorithm. +func (gsa GridSamplingAlgorithm) AsRandomSamplingAlgorithm() (*RandomSamplingAlgorithm, bool) { + return nil, false +} + +// AsSamplingAlgorithm is the BasicSamplingAlgorithm implementation for GridSamplingAlgorithm. +func (gsa GridSamplingAlgorithm) AsSamplingAlgorithm() (*SamplingAlgorithm, bool) { + return nil, false +} + +// AsBasicSamplingAlgorithm is the BasicSamplingAlgorithm implementation for GridSamplingAlgorithm. +func (gsa GridSamplingAlgorithm) AsBasicSamplingAlgorithm() (BasicSamplingAlgorithm, bool) { + return &gsa, true +} + +// HdfsDatastore ... +type HdfsDatastore struct { + // HdfsServerCertificate - The TLS cert of the HDFS server. Needs to be a base64 encoded string. Required if "Https" protocol is selected. + HdfsServerCertificate *string `json:"hdfsServerCertificate,omitempty"` + // NameNodeAddress - [Required] IP Address or DNS HostName. + NameNodeAddress *string `json:"nameNodeAddress,omitempty"` + // Protocol - Protocol used to communicate with the storage account (Https/Http). + Protocol *string `json:"protocol,omitempty"` + // Credentials - [Required] Account credentials. + Credentials BasicDatastoreCredentials `json:"credentials,omitempty"` + // IsDefault - READ-ONLY; Readonly property to indicate if datastore is the workspace default datastore + IsDefault *bool `json:"isDefault,omitempty"` + // DatastoreType - Possible values include: 'DatastoreTypeDatastore', 'DatastoreTypeAzureBlob', 'DatastoreTypeAzureDataLakeGen1', 'DatastoreTypeAzureDataLakeGen2', 'DatastoreTypeAzureFile', 'DatastoreTypeHdfs' + DatastoreType DatastoreTypeBasicDatastore `json:"datastoreType,omitempty"` + // 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 HdfsDatastore. +func (hd HdfsDatastore) MarshalJSON() ([]byte, error) { + hd.DatastoreType = DatastoreTypeHdfs + objectMap := make(map[string]interface{}) + if hd.HdfsServerCertificate != nil { + objectMap["hdfsServerCertificate"] = hd.HdfsServerCertificate + } + if hd.NameNodeAddress != nil { + objectMap["nameNodeAddress"] = hd.NameNodeAddress + } + if hd.Protocol != nil { + objectMap["protocol"] = hd.Protocol + } + objectMap["credentials"] = hd.Credentials + if hd.DatastoreType != "" { + objectMap["datastoreType"] = hd.DatastoreType + } + if hd.Description != nil { + objectMap["description"] = hd.Description + } + if hd.Properties != nil { + objectMap["properties"] = hd.Properties + } + if hd.Tags != nil { + objectMap["tags"] = hd.Tags + } + return json.Marshal(objectMap) +} + +// AsAzureBlobDatastore is the BasicDatastore implementation for HdfsDatastore. +func (hd HdfsDatastore) AsAzureBlobDatastore() (*AzureBlobDatastore, bool) { + return nil, false +} + +// AsAzureDataLakeGen1Datastore is the BasicDatastore implementation for HdfsDatastore. +func (hd HdfsDatastore) AsAzureDataLakeGen1Datastore() (*AzureDataLakeGen1Datastore, bool) { + return nil, false +} + +// AsAzureDataLakeGen2Datastore is the BasicDatastore implementation for HdfsDatastore. +func (hd HdfsDatastore) AsAzureDataLakeGen2Datastore() (*AzureDataLakeGen2Datastore, bool) { + return nil, false +} + +// AsAzureFileDatastore is the BasicDatastore implementation for HdfsDatastore. +func (hd HdfsDatastore) AsAzureFileDatastore() (*AzureFileDatastore, bool) { + return nil, false +} + +// AsHdfsDatastore is the BasicDatastore implementation for HdfsDatastore. +func (hd HdfsDatastore) AsHdfsDatastore() (*HdfsDatastore, bool) { + return &hd, true +} + +// AsDatastore is the BasicDatastore implementation for HdfsDatastore. +func (hd HdfsDatastore) AsDatastore() (*Datastore, bool) { + return nil, false +} + +// AsBasicDatastore is the BasicDatastore implementation for HdfsDatastore. +func (hd HdfsDatastore) AsBasicDatastore() (BasicDatastore, bool) { + return &hd, true +} + +// UnmarshalJSON is the custom unmarshaler for HdfsDatastore struct. +func (hd *HdfsDatastore) 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 "hdfsServerCertificate": + if v != nil { + var hdfsServerCertificate string + err = json.Unmarshal(*v, &hdfsServerCertificate) + if err != nil { + return err + } + hd.HdfsServerCertificate = &hdfsServerCertificate + } + case "nameNodeAddress": + if v != nil { + var nameNodeAddress string + err = json.Unmarshal(*v, &nameNodeAddress) + if err != nil { + return err + } + hd.NameNodeAddress = &nameNodeAddress + } + case "protocol": + if v != nil { + var protocol string + err = json.Unmarshal(*v, &protocol) + if err != nil { + return err + } + hd.Protocol = &protocol + } + case "credentials": + if v != nil { + credentials, err := unmarshalBasicDatastoreCredentials(*v) + if err != nil { + return err + } + hd.Credentials = credentials + } + case "isDefault": + if v != nil { + var isDefault bool + err = json.Unmarshal(*v, &isDefault) + if err != nil { + return err + } + hd.IsDefault = &isDefault + } + case "datastoreType": + if v != nil { + var datastoreType DatastoreTypeBasicDatastore + err = json.Unmarshal(*v, &datastoreType) + if err != nil { + return err + } + hd.DatastoreType = datastoreType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + hd.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + hd.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + hd.Tags = tags + } + } + } + + return nil +} + +// HDInsight a HDInsight compute. +type HDInsight struct { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // ComputeLocation - READ-ONLY; 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 *HDInsightProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for HDInsight. +func (hi HDInsight) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hi.ComputeType != "" { + objectMap["computeType"] = hi.ComputeType + } + 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.Properties != nil { + objectMap["properties"] = hi.Properties + } + return json.Marshal(objectMap) +} + +// HDInsightProperties hDInsight compute properties +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"` +} + +// HDInsightSchema ... +type HDInsightSchema struct { + Properties *HDInsightProperties `json:"properties,omitempty"` +} + +// IDAssetReference reference to an asset via its ARM resource ID. +type IDAssetReference struct { + // AssetID - [Required] 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: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// 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 + } + return json.Marshal(objectMap) +} + +// BasicIdentityConfiguration base definition for identity configuration. +type BasicIdentityConfiguration interface { + AsAmlToken() (*AmlToken, bool) + AsManagedIdentity() (*ManagedIdentity, bool) + AsUserIdentity() (*UserIdentity, bool) + AsIdentityConfiguration() (*IdentityConfiguration, bool) +} + +// IdentityConfiguration base definition for identity configuration. +type IdentityConfiguration struct { + // IdentityType - Possible values include: 'IdentityTypeIdentityConfiguration', 'IdentityTypeAMLToken', 'IdentityTypeManaged', 'IdentityTypeUserIdentity' + 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 + case string(IdentityTypeUserIdentity): + var UI UserIdentity + err := json.Unmarshal(body, &UI) + return UI, 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 +} + +// AsUserIdentity is the BasicIdentityConfiguration implementation for IdentityConfiguration. +func (ic IdentityConfiguration) AsUserIdentity() (*UserIdentity, 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"` +} + +// ImageClassification image Classification. Multi-class image classification is used when an image is +// classified with only a single label +// from a set of classes - e.g. each image is classified as either an image of a 'cat' or a 'dog' or a +// 'duck'. +type ImageClassification struct { + // ModelSettings - Settings used for training the model. + ModelSettings *ImageModelSettingsClassification `json:"modelSettings,omitempty"` + // SearchSpace - Search space for sampling different combinations of models and their hyperparameters. + SearchSpace *[]ImageModelDistributionSettingsClassification `json:"searchSpace,omitempty"` + // LogVerbosity - Log verbosity for the job. Possible values include: 'LogVerbosityNotSet', 'LogVerbosityDebug', 'LogVerbosityInfo', 'LogVerbosityWarning', 'LogVerbosityError', 'LogVerbosityCritical' + LogVerbosity LogVerbosity `json:"logVerbosity,omitempty"` + // TaskType - [Required] Task type for AutoMLJob. Possible values include: 'TaskTypeClassification', 'TaskTypeRegression', 'TaskTypeForecasting', 'TaskTypeImageClassification', 'TaskTypeImageClassificationMultilabel', 'TaskTypeImageObjectDetection', 'TaskTypeImageInstanceSegmentation', 'TaskTypeTextClassification', 'TaskTypeTextClassificationMultilabel', 'TaskTypeTextNER' + TaskType TaskType `json:"taskType,omitempty"` + // PrimaryMetric - Primary metric to optimize for this task. Possible values include: 'ClassificationPrimaryMetricsAUCWeighted', 'ClassificationPrimaryMetricsAccuracy', 'ClassificationPrimaryMetricsNormMacroRecall', 'ClassificationPrimaryMetricsAveragePrecisionScoreWeighted', 'ClassificationPrimaryMetricsPrecisionScoreWeighted' + PrimaryMetric ClassificationPrimaryMetrics `json:"primaryMetric,omitempty"` +} + +// ImageClassificationBase ... +type ImageClassificationBase struct { + // ModelSettings - Settings used for training the model. + ModelSettings *ImageModelSettingsClassification `json:"modelSettings,omitempty"` + // SearchSpace - Search space for sampling different combinations of models and their hyperparameters. + SearchSpace *[]ImageModelDistributionSettingsClassification `json:"searchSpace,omitempty"` + // DataSettings - [Required] Collection of registered Tabular Dataset Ids and other data settings required for training and validating models. + DataSettings *ImageVerticalDataSettings `json:"dataSettings,omitempty"` + // LimitSettings - [Required] Limit settings for the AutoML job. + LimitSettings *ImageLimitSettings `json:"limitSettings,omitempty"` + // SweepSettings - Model sweeping and hyperparameter sweeping related settings. + SweepSettings *ImageSweepSettings `json:"sweepSettings,omitempty"` +} + +// ImageClassificationMultilabel image Classification Multilabel. Multi-label image classification is used +// when an image could have one or more labels +// from a set of labels - e.g. an image could be labeled with both 'cat' and 'dog'. +type ImageClassificationMultilabel struct { + // ModelSettings - Settings used for training the model. + ModelSettings *ImageModelSettingsClassification `json:"modelSettings,omitempty"` + // SearchSpace - Search space for sampling different combinations of models and their hyperparameters. + SearchSpace *[]ImageModelDistributionSettingsClassification `json:"searchSpace,omitempty"` + // LogVerbosity - Log verbosity for the job. Possible values include: 'LogVerbosityNotSet', 'LogVerbosityDebug', 'LogVerbosityInfo', 'LogVerbosityWarning', 'LogVerbosityError', 'LogVerbosityCritical' + LogVerbosity LogVerbosity `json:"logVerbosity,omitempty"` + // TaskType - [Required] Task type for AutoMLJob. Possible values include: 'TaskTypeClassification', 'TaskTypeRegression', 'TaskTypeForecasting', 'TaskTypeImageClassification', 'TaskTypeImageClassificationMultilabel', 'TaskTypeImageObjectDetection', 'TaskTypeImageInstanceSegmentation', 'TaskTypeTextClassification', 'TaskTypeTextClassificationMultilabel', 'TaskTypeTextNER' + TaskType TaskType `json:"taskType,omitempty"` + // PrimaryMetric - Primary metric to optimize for this task. Possible values include: 'AUCWeighted', 'Accuracy', 'NormMacroRecall', 'AveragePrecisionScoreWeighted', 'PrecisionScoreWeighted', 'IOU' + PrimaryMetric ClassificationMultilabelPrimaryMetrics `json:"primaryMetric,omitempty"` +} + +// ImageInstanceSegmentation image Instance Segmentation. Instance segmentation is used to identify objects +// in an image at the pixel level, +// drawing a polygon around each object in the image. +type ImageInstanceSegmentation struct { + // ModelSettings - Settings used for training the model. + ModelSettings *ImageModelSettingsObjectDetection `json:"modelSettings,omitempty"` + // SearchSpace - Search space for sampling different combinations of models and their hyperparameters. + SearchSpace *[]ImageModelDistributionSettingsObjectDetection `json:"searchSpace,omitempty"` + // LogVerbosity - Log verbosity for the job. Possible values include: 'LogVerbosityNotSet', 'LogVerbosityDebug', 'LogVerbosityInfo', 'LogVerbosityWarning', 'LogVerbosityError', 'LogVerbosityCritical' + LogVerbosity LogVerbosity `json:"logVerbosity,omitempty"` + // TaskType - [Required] Task type for AutoMLJob. Possible values include: 'TaskTypeClassification', 'TaskTypeRegression', 'TaskTypeForecasting', 'TaskTypeImageClassification', 'TaskTypeImageClassificationMultilabel', 'TaskTypeImageObjectDetection', 'TaskTypeImageInstanceSegmentation', 'TaskTypeTextClassification', 'TaskTypeTextClassificationMultilabel', 'TaskTypeTextNER' + TaskType TaskType `json:"taskType,omitempty"` + // PrimaryMetric - Primary metric to optimize for this task. Possible values include: 'MeanAveragePrecision' + PrimaryMetric InstanceSegmentationPrimaryMetrics `json:"primaryMetric,omitempty"` +} + +// ImageLimitSettings limit settings for the AutoML job. +type ImageLimitSettings struct { + // MaxConcurrentTrials - Maximum number of concurrent AutoML iterations. + MaxConcurrentTrials *int32 `json:"maxConcurrentTrials,omitempty"` + // MaxTrials - Maximum number of AutoML iterations. + MaxTrials *int32 `json:"maxTrials,omitempty"` + // Timeout - AutoML job timeout. + Timeout *string `json:"timeout,omitempty"` +} + +// ImageModelDistributionSettings distribution expressions to sweep over values of model settings. +// +// Some examples are: +// +// ModelName = "choice('seresnext', 'resnest50')"; +// LearningRate = "uniform(0.001, 0.01)"; +// LayersToFreeze = "choice(0, 2)"; +// +// All distributions can be specified as distribution_name(min, max) or choice(val1, val2, ..., valn) +// where distribution name can be: uniform, quniform, loguniform, etc +// For more details on how to compose distribution expressions please check the documentation: +// https://docs.microsoft.com/en-us/azure/machine-learning/how-to-tune-hyperparameters +// For more information on the available settings please visit the official documentation: +// https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. +type ImageModelDistributionSettings struct { + // AmsGradient - Enable AMSGrad when optimizer is 'adam' or 'adamw'. + AmsGradient *string `json:"amsGradient,omitempty"` + // Augmentations - Settings for using Augmentations. + Augmentations *string `json:"augmentations,omitempty"` + // Beta1 - Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1]. + Beta1 *string `json:"beta1,omitempty"` + // Beta2 - Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1]. + Beta2 *string `json:"beta2,omitempty"` + // Distributed - Whether to use distributer training. + Distributed *string `json:"distributed,omitempty"` + // EarlyStopping - Enable early stopping logic during training. + EarlyStopping *string `json:"earlyStopping,omitempty"` + // EarlyStoppingDelay - Minimum number of epochs or validation evaluations to wait before primary metric improvement + // is tracked for early stopping. Must be a positive integer. + EarlyStoppingDelay *string `json:"earlyStoppingDelay,omitempty"` + // EarlyStoppingPatience - Minimum number of epochs or validation evaluations with no primary metric improvement before + // the run is stopped. Must be a positive integer. + EarlyStoppingPatience *string `json:"earlyStoppingPatience,omitempty"` + // EnableOnnxNormalization - Enable normalization when exporting ONNX model. + EnableOnnxNormalization *string `json:"enableOnnxNormalization,omitempty"` + // EvaluationFrequency - Frequency to evaluate validation dataset to get metric scores. Must be a positive integer. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + // GradientAccumulationStep - Gradient accumulation means running a configured number of "GradAccumulationStep" steps without + // updating the model weights while accumulating the gradients of those steps, and then using + // the accumulated gradients to compute the weight updates. Must be a positive integer. + GradientAccumulationStep *string `json:"gradientAccumulationStep,omitempty"` + // LayersToFreeze - Number of layers to freeze for the model. Must be a positive integer. + // For instance, passing 2 as value for 'seresnext' means + // freezing layer0 and layer1. For a full list of models supported and details on layer freeze, please + // see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + LayersToFreeze *string `json:"layersToFreeze,omitempty"` + // LearningRate - Initial learning rate. Must be a float in the range [0, 1]. + LearningRate *string `json:"learningRate,omitempty"` + // LearningRateScheduler - Type of learning rate scheduler. Must be 'warmup_cosine' or 'step'. + LearningRateScheduler *string `json:"learningRateScheduler,omitempty"` + // ModelName - Name of the model to use for training. + // For more information on the available models please visit the official documentation: + // https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + ModelName *string `json:"modelName,omitempty"` + // Momentum - Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. + Momentum *string `json:"momentum,omitempty"` + // Nesterov - Enable nesterov when optimizer is 'sgd'. + Nesterov *string `json:"nesterov,omitempty"` + // NumberOfEpochs - Number of training epochs. Must be a positive integer. + NumberOfEpochs *string `json:"numberOfEpochs,omitempty"` + // NumberOfWorkers - Number of data loader workers. Must be a non-negative integer. + NumberOfWorkers *string `json:"numberOfWorkers,omitempty"` + // Optimizer - Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. + Optimizer *string `json:"optimizer,omitempty"` + // RandomSeed - Random seed to be used when using deterministic training. + RandomSeed *string `json:"randomSeed,omitempty"` + // SplitRatio - If validation data is not defined, this specifies the split ratio for splitting + // train data into random train and validation subsets. Must be a float in the range [0, 1]. + SplitRatio *string `json:"splitRatio,omitempty"` + // StepLRGamma - Value of gamma when learning rate scheduler is 'step'. Must be a float in the range [0, 1]. + StepLRGamma *string `json:"stepLRGamma,omitempty"` + // StepLRStepSize - Value of step size when learning rate scheduler is 'step'. Must be a positive integer. + StepLRStepSize *string `json:"stepLRStepSize,omitempty"` + // TrainingBatchSize - Training batch size. Must be a positive integer. + TrainingBatchSize *string `json:"trainingBatchSize,omitempty"` + // ValidationBatchSize - Validation batch size. Must be a positive integer. + ValidationBatchSize *string `json:"validationBatchSize,omitempty"` + // WarmupCosineLRCycles - Value of cosine cycle when learning rate scheduler is 'warmup_cosine'. Must be a float in the range [0, 1]. + WarmupCosineLRCycles *string `json:"warmupCosineLRCycles,omitempty"` + // WarmupCosineLRWarmupEpochs - Value of warmup epochs when learning rate scheduler is 'warmup_cosine'. Must be a positive integer. + WarmupCosineLRWarmupEpochs *string `json:"warmupCosineLRWarmupEpochs,omitempty"` + // WeightDecay - Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be a float in the range[0, 1]. + WeightDecay *string `json:"weightDecay,omitempty"` +} + +// ImageModelDistributionSettingsClassification distribution expressions to sweep over values of model +// settings. +// +// Some examples are: +// +// ModelName = "choice('seresnext', 'resnest50')"; +// LearningRate = "uniform(0.001, 0.01)"; +// LayersToFreeze = "choice(0, 2)"; +// +// For more details on how to compose distribution expressions please check the documentation: +// https://docs.microsoft.com/en-us/azure/machine-learning/how-to-tune-hyperparameters +// For more information on the available settings please visit the official documentation: +// https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. +type ImageModelDistributionSettingsClassification struct { + // TrainingCropSize - Image crop size that is input to the neural network for the training dataset. Must be a positive integer. + TrainingCropSize *string `json:"trainingCropSize,omitempty"` + // ValidationCropSize - Image crop size that is input to the neural network for the validation dataset. Must be a positive integer. + ValidationCropSize *string `json:"validationCropSize,omitempty"` + // ValidationResizeSize - Image size to which to resize before cropping for validation dataset. Must be a positive integer. + ValidationResizeSize *string `json:"validationResizeSize,omitempty"` + // WeightedLoss - Weighted loss. The accepted values are 0 for no weighted loss. + // 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be 0 or 1 or 2. + WeightedLoss *string `json:"weightedLoss,omitempty"` + // AmsGradient - Enable AMSGrad when optimizer is 'adam' or 'adamw'. + AmsGradient *string `json:"amsGradient,omitempty"` + // Augmentations - Settings for using Augmentations. + Augmentations *string `json:"augmentations,omitempty"` + // Beta1 - Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1]. + Beta1 *string `json:"beta1,omitempty"` + // Beta2 - Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1]. + Beta2 *string `json:"beta2,omitempty"` + // Distributed - Whether to use distributer training. + Distributed *string `json:"distributed,omitempty"` + // EarlyStopping - Enable early stopping logic during training. + EarlyStopping *string `json:"earlyStopping,omitempty"` + // EarlyStoppingDelay - Minimum number of epochs or validation evaluations to wait before primary metric improvement + // is tracked for early stopping. Must be a positive integer. + EarlyStoppingDelay *string `json:"earlyStoppingDelay,omitempty"` + // EarlyStoppingPatience - Minimum number of epochs or validation evaluations with no primary metric improvement before + // the run is stopped. Must be a positive integer. + EarlyStoppingPatience *string `json:"earlyStoppingPatience,omitempty"` + // EnableOnnxNormalization - Enable normalization when exporting ONNX model. + EnableOnnxNormalization *string `json:"enableOnnxNormalization,omitempty"` + // EvaluationFrequency - Frequency to evaluate validation dataset to get metric scores. Must be a positive integer. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + // GradientAccumulationStep - Gradient accumulation means running a configured number of "GradAccumulationStep" steps without + // updating the model weights while accumulating the gradients of those steps, and then using + // the accumulated gradients to compute the weight updates. Must be a positive integer. + GradientAccumulationStep *string `json:"gradientAccumulationStep,omitempty"` + // LayersToFreeze - Number of layers to freeze for the model. Must be a positive integer. + // For instance, passing 2 as value for 'seresnext' means + // freezing layer0 and layer1. For a full list of models supported and details on layer freeze, please + // see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + LayersToFreeze *string `json:"layersToFreeze,omitempty"` + // LearningRate - Initial learning rate. Must be a float in the range [0, 1]. + LearningRate *string `json:"learningRate,omitempty"` + // LearningRateScheduler - Type of learning rate scheduler. Must be 'warmup_cosine' or 'step'. + LearningRateScheduler *string `json:"learningRateScheduler,omitempty"` + // ModelName - Name of the model to use for training. + // For more information on the available models please visit the official documentation: + // https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + ModelName *string `json:"modelName,omitempty"` + // Momentum - Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. + Momentum *string `json:"momentum,omitempty"` + // Nesterov - Enable nesterov when optimizer is 'sgd'. + Nesterov *string `json:"nesterov,omitempty"` + // NumberOfEpochs - Number of training epochs. Must be a positive integer. + NumberOfEpochs *string `json:"numberOfEpochs,omitempty"` + // NumberOfWorkers - Number of data loader workers. Must be a non-negative integer. + NumberOfWorkers *string `json:"numberOfWorkers,omitempty"` + // Optimizer - Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. + Optimizer *string `json:"optimizer,omitempty"` + // RandomSeed - Random seed to be used when using deterministic training. + RandomSeed *string `json:"randomSeed,omitempty"` + // SplitRatio - If validation data is not defined, this specifies the split ratio for splitting + // train data into random train and validation subsets. Must be a float in the range [0, 1]. + SplitRatio *string `json:"splitRatio,omitempty"` + // StepLRGamma - Value of gamma when learning rate scheduler is 'step'. Must be a float in the range [0, 1]. + StepLRGamma *string `json:"stepLRGamma,omitempty"` + // StepLRStepSize - Value of step size when learning rate scheduler is 'step'. Must be a positive integer. + StepLRStepSize *string `json:"stepLRStepSize,omitempty"` + // TrainingBatchSize - Training batch size. Must be a positive integer. + TrainingBatchSize *string `json:"trainingBatchSize,omitempty"` + // ValidationBatchSize - Validation batch size. Must be a positive integer. + ValidationBatchSize *string `json:"validationBatchSize,omitempty"` + // WarmupCosineLRCycles - Value of cosine cycle when learning rate scheduler is 'warmup_cosine'. Must be a float in the range [0, 1]. + WarmupCosineLRCycles *string `json:"warmupCosineLRCycles,omitempty"` + // WarmupCosineLRWarmupEpochs - Value of warmup epochs when learning rate scheduler is 'warmup_cosine'. Must be a positive integer. + WarmupCosineLRWarmupEpochs *string `json:"warmupCosineLRWarmupEpochs,omitempty"` + // WeightDecay - Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be a float in the range[0, 1]. + WeightDecay *string `json:"weightDecay,omitempty"` +} + +// ImageModelDistributionSettingsObjectDetection distribution expressions to sweep over values of model +// settings. +// +// Some examples are: +// +// ModelName = "choice('seresnext', 'resnest50')"; +// LearningRate = "uniform(0.001, 0.01)"; +// LayersToFreeze = "choice(0, 2)"; +// +// For more details on how to compose distribution expressions please check the documentation: +// https://docs.microsoft.com/en-us/azure/machine-learning/how-to-tune-hyperparameters +// For more information on the available settings please visit the official documentation: +// https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. +type ImageModelDistributionSettingsObjectDetection struct { + // BoxDetectionsPerImage - Maximum number of detections per image, for all classes. Must be a positive integer. + // Note: This settings is not supported for the 'yolov5' algorithm. + BoxDetectionsPerImage *string `json:"boxDetectionsPerImage,omitempty"` + // BoxScoreThreshold - During inference, only return proposals with a classification score greater than + // BoxScoreThreshold. Must be a float in the range[0, 1]. + BoxScoreThreshold *string `json:"boxScoreThreshold,omitempty"` + // ImageSize - Image size for train and validation. Must be a positive integer. + // Note: The training run may get into CUDA OOM if the size is too big. + // Note: This settings is only supported for the 'yolov5' algorithm. + ImageSize *string `json:"imageSize,omitempty"` + // MaxSize - Maximum size of the image to be rescaled before feeding it to the backbone. + // Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + // Note: This settings is not supported for the 'yolov5' algorithm. + MaxSize *string `json:"maxSize,omitempty"` + // MinSize - Minimum size of the image to be rescaled before feeding it to the backbone. + // Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + // Note: This settings is not supported for the 'yolov5' algorithm. + MinSize *string `json:"minSize,omitempty"` + // ModelSize - Model size. Must be 'small', 'medium', 'large', or 'xlarge'. + // Note: training run may get into CUDA OOM if the model size is too big. + // Note: This settings is only supported for the 'yolov5' algorithm. + ModelSize *string `json:"modelSize,omitempty"` + // MultiScale - Enable multi-scale image by varying image size by +/- 50%. + // Note: training run may get into CUDA OOM if no sufficient GPU memory. + // Note: This settings is only supported for the 'yolov5' algorithm. + MultiScale *string `json:"multiScale,omitempty"` + // NmsIouThreshold - IOU threshold used during inference in NMS post processing. Must be float in the range [0, 1]. + NmsIouThreshold *string `json:"nmsIouThreshold,omitempty"` + // TileGridSize - The grid size to use for tiling each image. Note: TileGridSize must not be + // None to enable small object detection logic. A string containing two integers in mxn format. + // Note: This settings is not supported for the 'yolov5' algorithm. + TileGridSize *string `json:"tileGridSize,omitempty"` + // TileOverlapRatio - Overlap ratio between adjacent tiles in each dimension. Must be float in the range [0, 1). + // Note: This settings is not supported for the 'yolov5' algorithm. + TileOverlapRatio *string `json:"tileOverlapRatio,omitempty"` + // TilePredictionsNmsThreshold - The IOU threshold to use to perform NMS while merging predictions from tiles and image. + // Used in validation/ inference. Must be float in the range [0, 1]. + // Note: This settings is not supported for the 'yolov5' algorithm. + // NMS: Non-maximum suppression + TilePredictionsNmsThreshold *string `json:"tilePredictionsNmsThreshold,omitempty"` + // ValidationIouThreshold - IOU threshold to use when computing validation metric. Must be float in the range [0, 1]. + ValidationIouThreshold *string `json:"validationIouThreshold,omitempty"` + // ValidationMetricType - Metric computation method to use for validation metrics. Must be 'none', 'coco', 'voc', or 'coco_voc'. + ValidationMetricType *string `json:"validationMetricType,omitempty"` + // AmsGradient - Enable AMSGrad when optimizer is 'adam' or 'adamw'. + AmsGradient *string `json:"amsGradient,omitempty"` + // Augmentations - Settings for using Augmentations. + Augmentations *string `json:"augmentations,omitempty"` + // Beta1 - Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1]. + Beta1 *string `json:"beta1,omitempty"` + // Beta2 - Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1]. + Beta2 *string `json:"beta2,omitempty"` + // Distributed - Whether to use distributer training. + Distributed *string `json:"distributed,omitempty"` + // EarlyStopping - Enable early stopping logic during training. + EarlyStopping *string `json:"earlyStopping,omitempty"` + // EarlyStoppingDelay - Minimum number of epochs or validation evaluations to wait before primary metric improvement + // is tracked for early stopping. Must be a positive integer. + EarlyStoppingDelay *string `json:"earlyStoppingDelay,omitempty"` + // EarlyStoppingPatience - Minimum number of epochs or validation evaluations with no primary metric improvement before + // the run is stopped. Must be a positive integer. + EarlyStoppingPatience *string `json:"earlyStoppingPatience,omitempty"` + // EnableOnnxNormalization - Enable normalization when exporting ONNX model. + EnableOnnxNormalization *string `json:"enableOnnxNormalization,omitempty"` + // EvaluationFrequency - Frequency to evaluate validation dataset to get metric scores. Must be a positive integer. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + // GradientAccumulationStep - Gradient accumulation means running a configured number of "GradAccumulationStep" steps without + // updating the model weights while accumulating the gradients of those steps, and then using + // the accumulated gradients to compute the weight updates. Must be a positive integer. + GradientAccumulationStep *string `json:"gradientAccumulationStep,omitempty"` + // LayersToFreeze - Number of layers to freeze for the model. Must be a positive integer. + // For instance, passing 2 as value for 'seresnext' means + // freezing layer0 and layer1. For a full list of models supported and details on layer freeze, please + // see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + LayersToFreeze *string `json:"layersToFreeze,omitempty"` + // LearningRate - Initial learning rate. Must be a float in the range [0, 1]. + LearningRate *string `json:"learningRate,omitempty"` + // LearningRateScheduler - Type of learning rate scheduler. Must be 'warmup_cosine' or 'step'. + LearningRateScheduler *string `json:"learningRateScheduler,omitempty"` + // ModelName - Name of the model to use for training. + // For more information on the available models please visit the official documentation: + // https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + ModelName *string `json:"modelName,omitempty"` + // Momentum - Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. + Momentum *string `json:"momentum,omitempty"` + // Nesterov - Enable nesterov when optimizer is 'sgd'. + Nesterov *string `json:"nesterov,omitempty"` + // NumberOfEpochs - Number of training epochs. Must be a positive integer. + NumberOfEpochs *string `json:"numberOfEpochs,omitempty"` + // NumberOfWorkers - Number of data loader workers. Must be a non-negative integer. + NumberOfWorkers *string `json:"numberOfWorkers,omitempty"` + // Optimizer - Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. + Optimizer *string `json:"optimizer,omitempty"` + // RandomSeed - Random seed to be used when using deterministic training. + RandomSeed *string `json:"randomSeed,omitempty"` + // SplitRatio - If validation data is not defined, this specifies the split ratio for splitting + // train data into random train and validation subsets. Must be a float in the range [0, 1]. + SplitRatio *string `json:"splitRatio,omitempty"` + // StepLRGamma - Value of gamma when learning rate scheduler is 'step'. Must be a float in the range [0, 1]. + StepLRGamma *string `json:"stepLRGamma,omitempty"` + // StepLRStepSize - Value of step size when learning rate scheduler is 'step'. Must be a positive integer. + StepLRStepSize *string `json:"stepLRStepSize,omitempty"` + // TrainingBatchSize - Training batch size. Must be a positive integer. + TrainingBatchSize *string `json:"trainingBatchSize,omitempty"` + // ValidationBatchSize - Validation batch size. Must be a positive integer. + ValidationBatchSize *string `json:"validationBatchSize,omitempty"` + // WarmupCosineLRCycles - Value of cosine cycle when learning rate scheduler is 'warmup_cosine'. Must be a float in the range [0, 1]. + WarmupCosineLRCycles *string `json:"warmupCosineLRCycles,omitempty"` + // WarmupCosineLRWarmupEpochs - Value of warmup epochs when learning rate scheduler is 'warmup_cosine'. Must be a positive integer. + WarmupCosineLRWarmupEpochs *string `json:"warmupCosineLRWarmupEpochs,omitempty"` + // WeightDecay - Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be a float in the range[0, 1]. + WeightDecay *string `json:"weightDecay,omitempty"` +} + +// ImageModelSettings settings used for training the model. +// For more information on the available settings please visit the official documentation: +// https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. +type ImageModelSettings struct { + // AdvancedSettings - Settings for advanced scenarios. + AdvancedSettings *string `json:"advancedSettings,omitempty"` + // AmsGradient - Enable AMSGrad when optimizer is 'adam' or 'adamw'. + AmsGradient *bool `json:"amsGradient,omitempty"` + // Augmentations - Settings for using Augmentations. + Augmentations *string `json:"augmentations,omitempty"` + // Beta1 - Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1]. + Beta1 *float64 `json:"beta1,omitempty"` + // Beta2 - Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1]. + Beta2 *float64 `json:"beta2,omitempty"` + // CheckpointDatasetID - FileDataset id for pretrained checkpoint(s) for incremental training. + // Make sure to pass CheckpointFilename along with CheckpointDatasetId. + CheckpointDatasetID *string `json:"checkpointDatasetId,omitempty"` + // CheckpointFilename - The pretrained checkpoint filename in FileDataset for incremental training. + // Make sure to pass CheckpointDatasetId along with CheckpointFilename. + CheckpointFilename *string `json:"checkpointFilename,omitempty"` + // CheckpointFrequency - Frequency to store model checkpoints. Must be a positive integer. + CheckpointFrequency *int32 `json:"checkpointFrequency,omitempty"` + // CheckpointRunID - The id of a previous run that has a pretrained checkpoint for incremental training. + CheckpointRunID *string `json:"checkpointRunId,omitempty"` + // Distributed - Whether to use distributed training. + Distributed *bool `json:"distributed,omitempty"` + // EarlyStopping - Enable early stopping logic during training. + EarlyStopping *bool `json:"earlyStopping,omitempty"` + // EarlyStoppingDelay - Minimum number of epochs or validation evaluations to wait before primary metric improvement + // is tracked for early stopping. Must be a positive integer. + EarlyStoppingDelay *int32 `json:"earlyStoppingDelay,omitempty"` + // EarlyStoppingPatience - Minimum number of epochs or validation evaluations with no primary metric improvement before + // the run is stopped. Must be a positive integer. + EarlyStoppingPatience *int32 `json:"earlyStoppingPatience,omitempty"` + // EnableOnnxNormalization - Enable normalization when exporting ONNX model. + EnableOnnxNormalization *bool `json:"enableOnnxNormalization,omitempty"` + // EvaluationFrequency - Frequency to evaluate validation dataset to get metric scores. Must be a positive integer. + EvaluationFrequency *int32 `json:"evaluationFrequency,omitempty"` + // GradientAccumulationStep - Gradient accumulation means running a configured number of "GradAccumulationStep" steps without + // updating the model weights while accumulating the gradients of those steps, and then using + // the accumulated gradients to compute the weight updates. Must be a positive integer. + GradientAccumulationStep *int32 `json:"gradientAccumulationStep,omitempty"` + // LayersToFreeze - Number of layers to freeze for the model. Must be a positive integer. + // For instance, passing 2 as value for 'seresnext' means + // freezing layer0 and layer1. For a full list of models supported and details on layer freeze, please + // see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + LayersToFreeze *int32 `json:"layersToFreeze,omitempty"` + // LearningRate - Initial learning rate. Must be a float in the range [0, 1]. + LearningRate *float64 `json:"learningRate,omitempty"` + // LearningRateScheduler - Type of learning rate scheduler. Must be 'warmup_cosine' or 'step'. Possible values include: 'LearningRateSchedulerNone', 'LearningRateSchedulerWarmupCosine', 'LearningRateSchedulerStep' + LearningRateScheduler LearningRateScheduler `json:"learningRateScheduler,omitempty"` + // ModelName - Name of the model to use for training. + // For more information on the available models please visit the official documentation: + // https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + ModelName *string `json:"modelName,omitempty"` + // Momentum - Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. + Momentum *float64 `json:"momentum,omitempty"` + // Nesterov - Enable nesterov when optimizer is 'sgd'. + Nesterov *bool `json:"nesterov,omitempty"` + // NumberOfEpochs - Number of training epochs. Must be a positive integer. + NumberOfEpochs *int32 `json:"numberOfEpochs,omitempty"` + // NumberOfWorkers - Number of data loader workers. Must be a non-negative integer. + NumberOfWorkers *int32 `json:"numberOfWorkers,omitempty"` + // Optimizer - Type of optimizer. Possible values include: 'StochasticOptimizerNone', 'StochasticOptimizerSgd', 'StochasticOptimizerAdam', 'StochasticOptimizerAdamw' + Optimizer StochasticOptimizer `json:"optimizer,omitempty"` + // RandomSeed - Random seed to be used when using deterministic training. + RandomSeed *int32 `json:"randomSeed,omitempty"` + // SplitRatio - If validation data is not defined, this specifies the split ratio for splitting + // train data into random train and validation subsets. Must be a float in the range [0, 1]. + SplitRatio *float64 `json:"splitRatio,omitempty"` + // StepLRGamma - Value of gamma when learning rate scheduler is 'step'. Must be a float in the range [0, 1]. + StepLRGamma *float64 `json:"stepLRGamma,omitempty"` + // StepLRStepSize - Value of step size when learning rate scheduler is 'step'. Must be a positive integer. + StepLRStepSize *int32 `json:"stepLRStepSize,omitempty"` + // TrainingBatchSize - Training batch size. Must be a positive integer. + TrainingBatchSize *int32 `json:"trainingBatchSize,omitempty"` + // ValidationBatchSize - Validation batch size. Must be a positive integer. + ValidationBatchSize *int32 `json:"validationBatchSize,omitempty"` + // WarmupCosineLRCycles - Value of cosine cycle when learning rate scheduler is 'warmup_cosine'. Must be a float in the range [0, 1]. + WarmupCosineLRCycles *float64 `json:"warmupCosineLRCycles,omitempty"` + // WarmupCosineLRWarmupEpochs - Value of warmup epochs when learning rate scheduler is 'warmup_cosine'. Must be a positive integer. + WarmupCosineLRWarmupEpochs *int32 `json:"warmupCosineLRWarmupEpochs,omitempty"` + // WeightDecay - Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be a float in the range[0, 1]. + WeightDecay *float64 `json:"weightDecay,omitempty"` +} + +// ImageModelSettingsClassification settings used for training the model. +// For more information on the available settings please visit the official documentation: +// https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. +type ImageModelSettingsClassification struct { + // TrainingCropSize - Image crop size that is input to the neural network for the training dataset. Must be a positive integer. + TrainingCropSize *int32 `json:"trainingCropSize,omitempty"` + // ValidationCropSize - Image crop size that is input to the neural network for the validation dataset. Must be a positive integer. + ValidationCropSize *int32 `json:"validationCropSize,omitempty"` + // ValidationResizeSize - Image size to which to resize before cropping for validation dataset. Must be a positive integer. + ValidationResizeSize *int32 `json:"validationResizeSize,omitempty"` + // WeightedLoss - Weighted loss. The accepted values are 0 for no weighted loss. + // 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be 0 or 1 or 2. + WeightedLoss *int32 `json:"weightedLoss,omitempty"` + // AdvancedSettings - Settings for advanced scenarios. + AdvancedSettings *string `json:"advancedSettings,omitempty"` + // AmsGradient - Enable AMSGrad when optimizer is 'adam' or 'adamw'. + AmsGradient *bool `json:"amsGradient,omitempty"` + // Augmentations - Settings for using Augmentations. + Augmentations *string `json:"augmentations,omitempty"` + // Beta1 - Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1]. + Beta1 *float64 `json:"beta1,omitempty"` + // Beta2 - Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1]. + Beta2 *float64 `json:"beta2,omitempty"` + // CheckpointDatasetID - FileDataset id for pretrained checkpoint(s) for incremental training. + // Make sure to pass CheckpointFilename along with CheckpointDatasetId. + CheckpointDatasetID *string `json:"checkpointDatasetId,omitempty"` + // CheckpointFilename - The pretrained checkpoint filename in FileDataset for incremental training. + // Make sure to pass CheckpointDatasetId along with CheckpointFilename. + CheckpointFilename *string `json:"checkpointFilename,omitempty"` + // CheckpointFrequency - Frequency to store model checkpoints. Must be a positive integer. + CheckpointFrequency *int32 `json:"checkpointFrequency,omitempty"` + // CheckpointRunID - The id of a previous run that has a pretrained checkpoint for incremental training. + CheckpointRunID *string `json:"checkpointRunId,omitempty"` + // Distributed - Whether to use distributed training. + Distributed *bool `json:"distributed,omitempty"` + // EarlyStopping - Enable early stopping logic during training. + EarlyStopping *bool `json:"earlyStopping,omitempty"` + // EarlyStoppingDelay - Minimum number of epochs or validation evaluations to wait before primary metric improvement + // is tracked for early stopping. Must be a positive integer. + EarlyStoppingDelay *int32 `json:"earlyStoppingDelay,omitempty"` + // EarlyStoppingPatience - Minimum number of epochs or validation evaluations with no primary metric improvement before + // the run is stopped. Must be a positive integer. + EarlyStoppingPatience *int32 `json:"earlyStoppingPatience,omitempty"` + // EnableOnnxNormalization - Enable normalization when exporting ONNX model. + EnableOnnxNormalization *bool `json:"enableOnnxNormalization,omitempty"` + // EvaluationFrequency - Frequency to evaluate validation dataset to get metric scores. Must be a positive integer. + EvaluationFrequency *int32 `json:"evaluationFrequency,omitempty"` + // GradientAccumulationStep - Gradient accumulation means running a configured number of "GradAccumulationStep" steps without + // updating the model weights while accumulating the gradients of those steps, and then using + // the accumulated gradients to compute the weight updates. Must be a positive integer. + GradientAccumulationStep *int32 `json:"gradientAccumulationStep,omitempty"` + // LayersToFreeze - Number of layers to freeze for the model. Must be a positive integer. + // For instance, passing 2 as value for 'seresnext' means + // freezing layer0 and layer1. For a full list of models supported and details on layer freeze, please + // see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + LayersToFreeze *int32 `json:"layersToFreeze,omitempty"` + // LearningRate - Initial learning rate. Must be a float in the range [0, 1]. + LearningRate *float64 `json:"learningRate,omitempty"` + // LearningRateScheduler - Type of learning rate scheduler. Must be 'warmup_cosine' or 'step'. Possible values include: 'LearningRateSchedulerNone', 'LearningRateSchedulerWarmupCosine', 'LearningRateSchedulerStep' + LearningRateScheduler LearningRateScheduler `json:"learningRateScheduler,omitempty"` + // ModelName - Name of the model to use for training. + // For more information on the available models please visit the official documentation: + // https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + ModelName *string `json:"modelName,omitempty"` + // Momentum - Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. + Momentum *float64 `json:"momentum,omitempty"` + // Nesterov - Enable nesterov when optimizer is 'sgd'. + Nesterov *bool `json:"nesterov,omitempty"` + // NumberOfEpochs - Number of training epochs. Must be a positive integer. + NumberOfEpochs *int32 `json:"numberOfEpochs,omitempty"` + // NumberOfWorkers - Number of data loader workers. Must be a non-negative integer. + NumberOfWorkers *int32 `json:"numberOfWorkers,omitempty"` + // Optimizer - Type of optimizer. Possible values include: 'StochasticOptimizerNone', 'StochasticOptimizerSgd', 'StochasticOptimizerAdam', 'StochasticOptimizerAdamw' + Optimizer StochasticOptimizer `json:"optimizer,omitempty"` + // RandomSeed - Random seed to be used when using deterministic training. + RandomSeed *int32 `json:"randomSeed,omitempty"` + // SplitRatio - If validation data is not defined, this specifies the split ratio for splitting + // train data into random train and validation subsets. Must be a float in the range [0, 1]. + SplitRatio *float64 `json:"splitRatio,omitempty"` + // StepLRGamma - Value of gamma when learning rate scheduler is 'step'. Must be a float in the range [0, 1]. + StepLRGamma *float64 `json:"stepLRGamma,omitempty"` + // StepLRStepSize - Value of step size when learning rate scheduler is 'step'. Must be a positive integer. + StepLRStepSize *int32 `json:"stepLRStepSize,omitempty"` + // TrainingBatchSize - Training batch size. Must be a positive integer. + TrainingBatchSize *int32 `json:"trainingBatchSize,omitempty"` + // ValidationBatchSize - Validation batch size. Must be a positive integer. + ValidationBatchSize *int32 `json:"validationBatchSize,omitempty"` + // WarmupCosineLRCycles - Value of cosine cycle when learning rate scheduler is 'warmup_cosine'. Must be a float in the range [0, 1]. + WarmupCosineLRCycles *float64 `json:"warmupCosineLRCycles,omitempty"` + // WarmupCosineLRWarmupEpochs - Value of warmup epochs when learning rate scheduler is 'warmup_cosine'. Must be a positive integer. + WarmupCosineLRWarmupEpochs *int32 `json:"warmupCosineLRWarmupEpochs,omitempty"` + // WeightDecay - Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be a float in the range[0, 1]. + WeightDecay *float64 `json:"weightDecay,omitempty"` +} + +// ImageModelSettingsObjectDetection settings used for training the model. +// For more information on the available settings please visit the official documentation: +// https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. +type ImageModelSettingsObjectDetection struct { + // BoxDetectionsPerImage - Maximum number of detections per image, for all classes. Must be a positive integer. + // Note: This settings is not supported for the 'yolov5' algorithm. + BoxDetectionsPerImage *int32 `json:"boxDetectionsPerImage,omitempty"` + // BoxScoreThreshold - During inference, only return proposals with a classification score greater than + // BoxScoreThreshold. Must be a float in the range[0, 1]. + BoxScoreThreshold *float64 `json:"boxScoreThreshold,omitempty"` + // ImageSize - Image size for train and validation. Must be a positive integer. + // Note: The training run may get into CUDA OOM if the size is too big. + // Note: This settings is only supported for the 'yolov5' algorithm. + ImageSize *int32 `json:"imageSize,omitempty"` + // MaxSize - Maximum size of the image to be rescaled before feeding it to the backbone. + // Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + // Note: This settings is not supported for the 'yolov5' algorithm. + MaxSize *int32 `json:"maxSize,omitempty"` + // MinSize - Minimum size of the image to be rescaled before feeding it to the backbone. + // Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + // Note: This settings is not supported for the 'yolov5' algorithm. + MinSize *int32 `json:"minSize,omitempty"` + // ModelSize - Model size. Must be 'small', 'medium', 'large', or 'xlarge'. + // Note: training run may get into CUDA OOM if the model size is too big. + // Note: This settings is only supported for the 'yolov5' algorithm. Possible values include: 'ModelSizeNone', 'ModelSizeSmall', 'ModelSizeMedium', 'ModelSizeLarge', 'ModelSizeExtraLarge' + ModelSize ModelSize `json:"modelSize,omitempty"` + // MultiScale - Enable multi-scale image by varying image size by +/- 50%. + // Note: training run may get into CUDA OOM if no sufficient GPU memory. + // Note: This settings is only supported for the 'yolov5' algorithm. + MultiScale *bool `json:"multiScale,omitempty"` + // NmsIouThreshold - IOU threshold used during inference in NMS post processing. Must be a float in the range [0, 1]. + NmsIouThreshold *float64 `json:"nmsIouThreshold,omitempty"` + // TileGridSize - The grid size to use for tiling each image. Note: TileGridSize must not be + // None to enable small object detection logic. A string containing two integers in mxn format. + // Note: This settings is not supported for the 'yolov5' algorithm. + TileGridSize *string `json:"tileGridSize,omitempty"` + // TileOverlapRatio - Overlap ratio between adjacent tiles in each dimension. Must be float in the range [0, 1). + // Note: This settings is not supported for the 'yolov5' algorithm. + TileOverlapRatio *float64 `json:"tileOverlapRatio,omitempty"` + // TilePredictionsNmsThreshold - The IOU threshold to use to perform NMS while merging predictions from tiles and image. + // Used in validation/ inference. Must be float in the range [0, 1]. + // Note: This settings is not supported for the 'yolov5' algorithm. + TilePredictionsNmsThreshold *float64 `json:"tilePredictionsNmsThreshold,omitempty"` + // ValidationIouThreshold - IOU threshold to use when computing validation metric. Must be float in the range [0, 1]. + ValidationIouThreshold *float64 `json:"validationIouThreshold,omitempty"` + // ValidationMetricType - Metric computation method to use for validation metrics. Possible values include: 'ValidationMetricTypeNone', 'ValidationMetricTypeCoco', 'ValidationMetricTypeVoc', 'ValidationMetricTypeCocoVoc' + ValidationMetricType ValidationMetricType `json:"validationMetricType,omitempty"` + // AdvancedSettings - Settings for advanced scenarios. + AdvancedSettings *string `json:"advancedSettings,omitempty"` + // AmsGradient - Enable AMSGrad when optimizer is 'adam' or 'adamw'. + AmsGradient *bool `json:"amsGradient,omitempty"` + // Augmentations - Settings for using Augmentations. + Augmentations *string `json:"augmentations,omitempty"` + // Beta1 - Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1]. + Beta1 *float64 `json:"beta1,omitempty"` + // Beta2 - Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1]. + Beta2 *float64 `json:"beta2,omitempty"` + // CheckpointDatasetID - FileDataset id for pretrained checkpoint(s) for incremental training. + // Make sure to pass CheckpointFilename along with CheckpointDatasetId. + CheckpointDatasetID *string `json:"checkpointDatasetId,omitempty"` + // CheckpointFilename - The pretrained checkpoint filename in FileDataset for incremental training. + // Make sure to pass CheckpointDatasetId along with CheckpointFilename. + CheckpointFilename *string `json:"checkpointFilename,omitempty"` + // CheckpointFrequency - Frequency to store model checkpoints. Must be a positive integer. + CheckpointFrequency *int32 `json:"checkpointFrequency,omitempty"` + // CheckpointRunID - The id of a previous run that has a pretrained checkpoint for incremental training. + CheckpointRunID *string `json:"checkpointRunId,omitempty"` + // Distributed - Whether to use distributed training. + Distributed *bool `json:"distributed,omitempty"` + // EarlyStopping - Enable early stopping logic during training. + EarlyStopping *bool `json:"earlyStopping,omitempty"` + // EarlyStoppingDelay - Minimum number of epochs or validation evaluations to wait before primary metric improvement + // is tracked for early stopping. Must be a positive integer. + EarlyStoppingDelay *int32 `json:"earlyStoppingDelay,omitempty"` + // EarlyStoppingPatience - Minimum number of epochs or validation evaluations with no primary metric improvement before + // the run is stopped. Must be a positive integer. + EarlyStoppingPatience *int32 `json:"earlyStoppingPatience,omitempty"` + // EnableOnnxNormalization - Enable normalization when exporting ONNX model. + EnableOnnxNormalization *bool `json:"enableOnnxNormalization,omitempty"` + // EvaluationFrequency - Frequency to evaluate validation dataset to get metric scores. Must be a positive integer. + EvaluationFrequency *int32 `json:"evaluationFrequency,omitempty"` + // GradientAccumulationStep - Gradient accumulation means running a configured number of "GradAccumulationStep" steps without + // updating the model weights while accumulating the gradients of those steps, and then using + // the accumulated gradients to compute the weight updates. Must be a positive integer. + GradientAccumulationStep *int32 `json:"gradientAccumulationStep,omitempty"` + // LayersToFreeze - Number of layers to freeze for the model. Must be a positive integer. + // For instance, passing 2 as value for 'seresnext' means + // freezing layer0 and layer1. For a full list of models supported and details on layer freeze, please + // see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + LayersToFreeze *int32 `json:"layersToFreeze,omitempty"` + // LearningRate - Initial learning rate. Must be a float in the range [0, 1]. + LearningRate *float64 `json:"learningRate,omitempty"` + // LearningRateScheduler - Type of learning rate scheduler. Must be 'warmup_cosine' or 'step'. Possible values include: 'LearningRateSchedulerNone', 'LearningRateSchedulerWarmupCosine', 'LearningRateSchedulerStep' + LearningRateScheduler LearningRateScheduler `json:"learningRateScheduler,omitempty"` + // ModelName - Name of the model to use for training. + // For more information on the available models please visit the official documentation: + // https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + ModelName *string `json:"modelName,omitempty"` + // Momentum - Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. + Momentum *float64 `json:"momentum,omitempty"` + // Nesterov - Enable nesterov when optimizer is 'sgd'. + Nesterov *bool `json:"nesterov,omitempty"` + // NumberOfEpochs - Number of training epochs. Must be a positive integer. + NumberOfEpochs *int32 `json:"numberOfEpochs,omitempty"` + // NumberOfWorkers - Number of data loader workers. Must be a non-negative integer. + NumberOfWorkers *int32 `json:"numberOfWorkers,omitempty"` + // Optimizer - Type of optimizer. Possible values include: 'StochasticOptimizerNone', 'StochasticOptimizerSgd', 'StochasticOptimizerAdam', 'StochasticOptimizerAdamw' + Optimizer StochasticOptimizer `json:"optimizer,omitempty"` + // RandomSeed - Random seed to be used when using deterministic training. + RandomSeed *int32 `json:"randomSeed,omitempty"` + // SplitRatio - If validation data is not defined, this specifies the split ratio for splitting + // train data into random train and validation subsets. Must be a float in the range [0, 1]. + SplitRatio *float64 `json:"splitRatio,omitempty"` + // StepLRGamma - Value of gamma when learning rate scheduler is 'step'. Must be a float in the range [0, 1]. + StepLRGamma *float64 `json:"stepLRGamma,omitempty"` + // StepLRStepSize - Value of step size when learning rate scheduler is 'step'. Must be a positive integer. + StepLRStepSize *int32 `json:"stepLRStepSize,omitempty"` + // TrainingBatchSize - Training batch size. Must be a positive integer. + TrainingBatchSize *int32 `json:"trainingBatchSize,omitempty"` + // ValidationBatchSize - Validation batch size. Must be a positive integer. + ValidationBatchSize *int32 `json:"validationBatchSize,omitempty"` + // WarmupCosineLRCycles - Value of cosine cycle when learning rate scheduler is 'warmup_cosine'. Must be a float in the range [0, 1]. + WarmupCosineLRCycles *float64 `json:"warmupCosineLRCycles,omitempty"` + // WarmupCosineLRWarmupEpochs - Value of warmup epochs when learning rate scheduler is 'warmup_cosine'. Must be a positive integer. + WarmupCosineLRWarmupEpochs *int32 `json:"warmupCosineLRWarmupEpochs,omitempty"` + // WeightDecay - Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be a float in the range[0, 1]. + WeightDecay *float64 `json:"weightDecay,omitempty"` +} + +// ImageObjectDetection image Object Detection. Object detection is used to identify objects in an image +// and locate each object with a +// bounding box e.g. locate all dogs and cats in an image and draw a bounding box around each. +type ImageObjectDetection struct { + // ModelSettings - Settings used for training the model. + ModelSettings *ImageModelSettingsObjectDetection `json:"modelSettings,omitempty"` + // SearchSpace - Search space for sampling different combinations of models and their hyperparameters. + SearchSpace *[]ImageModelDistributionSettingsObjectDetection `json:"searchSpace,omitempty"` + // LogVerbosity - Log verbosity for the job. Possible values include: 'LogVerbosityNotSet', 'LogVerbosityDebug', 'LogVerbosityInfo', 'LogVerbosityWarning', 'LogVerbosityError', 'LogVerbosityCritical' + LogVerbosity LogVerbosity `json:"logVerbosity,omitempty"` + // TaskType - [Required] Task type for AutoMLJob. Possible values include: 'TaskTypeClassification', 'TaskTypeRegression', 'TaskTypeForecasting', 'TaskTypeImageClassification', 'TaskTypeImageClassificationMultilabel', 'TaskTypeImageObjectDetection', 'TaskTypeImageInstanceSegmentation', 'TaskTypeTextClassification', 'TaskTypeTextClassificationMultilabel', 'TaskTypeTextNER' + TaskType TaskType `json:"taskType,omitempty"` + // PrimaryMetric - Primary metric to optimize for this task. Possible values include: 'ObjectDetectionPrimaryMetricsMeanAveragePrecision' + PrimaryMetric ObjectDetectionPrimaryMetrics `json:"primaryMetric,omitempty"` +} + +// ImageObjectDetectionBase ... +type ImageObjectDetectionBase struct { + // ModelSettings - Settings used for training the model. + ModelSettings *ImageModelSettingsObjectDetection `json:"modelSettings,omitempty"` + // SearchSpace - Search space for sampling different combinations of models and their hyperparameters. + SearchSpace *[]ImageModelDistributionSettingsObjectDetection `json:"searchSpace,omitempty"` + // DataSettings - [Required] Collection of registered Tabular Dataset Ids and other data settings required for training and validating models. + DataSettings *ImageVerticalDataSettings `json:"dataSettings,omitempty"` + // LimitSettings - [Required] Limit settings for the AutoML job. + LimitSettings *ImageLimitSettings `json:"limitSettings,omitempty"` + // SweepSettings - Model sweeping and hyperparameter sweeping related settings. + SweepSettings *ImageSweepSettings `json:"sweepSettings,omitempty"` +} + +// ImageSweepLimitSettings limit settings for model sweeping and hyperparameter sweeping. +type ImageSweepLimitSettings struct { + // MaxConcurrentTrials - Maximum number of concurrent iterations for the underlying Sweep job. + MaxConcurrentTrials *int32 `json:"maxConcurrentTrials,omitempty"` + // MaxTrials - Maximum number of iterations for the underlying Sweep job. + MaxTrials *int32 `json:"maxTrials,omitempty"` +} + +// ImageSweepSettings model sweeping and hyperparameter sweeping related settings. +type ImageSweepSettings struct { + // EarlyTermination - Type of early termination policy. + EarlyTermination BasicEarlyTerminationPolicy `json:"earlyTermination,omitempty"` + // Limits - [Required] Limit settings for model sweeping and hyperparameter sweeping. + Limits *ImageSweepLimitSettings `json:"limits,omitempty"` + // SamplingAlgorithm - [Required] Type of the hyperparameter sampling algorithms. Possible values include: 'SamplingAlgorithmTypeGrid', 'SamplingAlgorithmTypeRandom', 'SamplingAlgorithmTypeBayesian' + SamplingAlgorithm SamplingAlgorithmType `json:"samplingAlgorithm,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for ImageSweepSettings struct. +func (iss *ImageSweepSettings) 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 "earlyTermination": + if v != nil { + earlyTermination, err := unmarshalBasicEarlyTerminationPolicy(*v) + if err != nil { + return err + } + iss.EarlyTermination = earlyTermination + } + case "limits": + if v != nil { + var limits ImageSweepLimitSettings + err = json.Unmarshal(*v, &limits) + if err != nil { + return err + } + iss.Limits = &limits + } + case "samplingAlgorithm": + if v != nil { + var samplingAlgorithm SamplingAlgorithmType + err = json.Unmarshal(*v, &samplingAlgorithm) + if err != nil { + return err + } + iss.SamplingAlgorithm = samplingAlgorithm + } + } + } + + return nil +} + +// ImageVertical abstract class for AutoML tasks that train image (computer vision) models - +// such as Image Classification / Image Classification Multilabel / Image Object Detection / Image Instance +// Segmentation. +type ImageVertical struct { + // DataSettings - [Required] Collection of registered Tabular Dataset Ids and other data settings required for training and validating models. + DataSettings *ImageVerticalDataSettings `json:"dataSettings,omitempty"` + // LimitSettings - [Required] Limit settings for the AutoML job. + LimitSettings *ImageLimitSettings `json:"limitSettings,omitempty"` + // SweepSettings - Model sweeping and hyperparameter sweeping related settings. + SweepSettings *ImageSweepSettings `json:"sweepSettings,omitempty"` +} + +// ImageVerticalDataSettings collection of registered Tabular Dataset Ids and other data settings required +// for training and validating models. +type ImageVerticalDataSettings struct { + // ValidationData - Settings for the validation dataset. + ValidationData *ImageVerticalValidationDataSettings `json:"validationData,omitempty"` + // TargetColumnName - [Required] Target column name: This is prediction values column. + // Also known as label column name in context of classification tasks. + TargetColumnName *string `json:"targetColumnName,omitempty"` + // TestData - Test data input. + TestData *TestDataSettings `json:"testData,omitempty"` + // TrainingData - [Required] Training data input. + TrainingData *TrainingDataSettings `json:"trainingData,omitempty"` +} + +// ImageVerticalValidationDataSettings ... +type ImageVerticalValidationDataSettings struct { + // Data - Validation data MLTable. + Data *MLTableJobInput `json:"data,omitempty"` + // ValidationDataSize - The fraction of training dataset that needs to be set aside for validation purpose. + // Values between (0.0 , 1.0) + // Applied when validation dataset is not provided. + ValidationDataSize *float64 `json:"validationDataSize,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"` +} + +// InstanceTypeSchema instance type schema. +type InstanceTypeSchema struct { + // NodeSelector - Node Selector + NodeSelector map[string]*string `json:"nodeSelector"` + // Resources - Resource requests/limits for this instance type + Resources *InstanceTypeSchemaResources `json:"resources,omitempty"` +} + +// MarshalJSON is the custom marshaler for InstanceTypeSchema. +func (its InstanceTypeSchema) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if its.NodeSelector != nil { + objectMap["nodeSelector"] = its.NodeSelector + } + if its.Resources != nil { + objectMap["resources"] = its.Resources + } + return json.Marshal(objectMap) +} + +// InstanceTypeSchemaResources resource requests/limits for this instance type +type InstanceTypeSchemaResources struct { + // Requests - Resource requests for this instance type + Requests map[string]*string `json:"requests"` + // Limits - Resource limits for this instance type + Limits map[string]*string `json:"limits"` +} + +// MarshalJSON is the custom marshaler for InstanceTypeSchemaResources. +func (its InstanceTypeSchemaResources) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if its.Requests != nil { + objectMap["requests"] = its.Requests + } + if its.Limits != nil { + objectMap["limits"] = its.Limits + } + return json.Marshal(objectMap) +} + +// BasicJobBase base definition for a job. +type BasicJobBase interface { + AsAutoMLJob() (*AutoMLJob, bool) + AsCommandJob() (*CommandJob, bool) + AsPipelineJob() (*PipelineJob, bool) + AsSweepJob() (*SweepJob, bool) + AsJobBase() (*JobBase, bool) +} + +// JobBase base definition for a job. +type JobBase struct { + // ComputeID - ARM resource ID of the compute resource. + ComputeID *string `json:"computeId,omitempty"` + // DisplayName - Display name of job. + DisplayName *string `json:"displayName,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, UserIdentity or null. + // Defaults to AmlToken if null. + Identity BasicIdentityConfiguration `json:"identity,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // Schedule - Schedule definition of job. + // If no schedule is provided, the job is run once and immediately after submission. + Schedule BasicScheduleBase `json:"schedule,omitempty"` + // Services - List of JobEndpoints. + // For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + Services map[string]*JobService `json:"services"` + // Status - READ-ONLY; Status of the job. Possible values include: 'JobStatusNotStarted', 'JobStatusStarting', 'JobStatusProvisioning', 'JobStatusPreparing', 'JobStatusQueued', 'JobStatusRunning', 'JobStatusFinalizing', 'JobStatusCancelRequested', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusCanceled', 'JobStatusNotResponding', 'JobStatusPaused', 'JobStatusUnknown', 'JobStatusScheduled' + Status JobStatus `json:"status,omitempty"` + // JobType - Possible values include: 'JobTypeJobBase', 'JobTypeAutoML1', 'JobTypeCommand1', 'JobTypePipeline1', 'JobTypeSweep1' + JobType JobTypeBasicJobBase `json:"jobType,omitempty"` + // 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"` +} + +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(JobTypeAutoML1): + var amj AutoMLJob + err := json.Unmarshal(body, &amj) + return amj, err + case string(JobTypeCommand1): + var cj CommandJob + err := json.Unmarshal(body, &cj) + return cj, err + case string(JobTypePipeline1): + var pj PipelineJob + err := json.Unmarshal(body, &pj) + return pj, err + case string(JobTypeSweep1): + 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.ComputeID != nil { + objectMap["computeId"] = jb.ComputeID + } + if jb.DisplayName != nil { + objectMap["displayName"] = jb.DisplayName + } + if jb.ExperimentName != nil { + objectMap["experimentName"] = jb.ExperimentName + } + objectMap["identity"] = jb.Identity + if jb.IsArchived != nil { + objectMap["isArchived"] = jb.IsArchived + } + objectMap["schedule"] = jb.Schedule + if jb.Services != nil { + objectMap["services"] = jb.Services + } + if jb.JobType != "" { + objectMap["jobType"] = jb.JobType + } + if jb.Description != nil { + objectMap["description"] = jb.Description + } + if jb.Properties != nil { + objectMap["properties"] = jb.Properties + } + if jb.Tags != nil { + objectMap["tags"] = jb.Tags + } + return json.Marshal(objectMap) +} + +// AsAutoMLJob is the BasicJobBase implementation for JobBase. +func (jb JobBase) AsAutoMLJob() (*AutoMLJob, bool) { + return nil, false +} + +// AsCommandJob is the BasicJobBase implementation for JobBase. +func (jb JobBase) AsCommandJob() (*CommandJob, bool) { + return nil, false +} + +// AsPipelineJob is the BasicJobBase implementation for JobBase. +func (jb JobBase) AsPipelineJob() (*PipelineJob, 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 +} + +// UnmarshalJSON is the custom unmarshaler for JobBase struct. +func (jb *JobBase) 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 "computeId": + if v != nil { + var computeID string + err = json.Unmarshal(*v, &computeID) + if err != nil { + return err + } + jb.ComputeID = &computeID + } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + jb.DisplayName = &displayName + } + case "experimentName": + if v != nil { + var experimentName string + err = json.Unmarshal(*v, &experimentName) + if err != nil { + return err + } + jb.ExperimentName = &experimentName + } + case "identity": + if v != nil { + identity, err := unmarshalBasicIdentityConfiguration(*v) + if err != nil { + return err + } + jb.Identity = identity + } + case "isArchived": + if v != nil { + var isArchived bool + err = json.Unmarshal(*v, &isArchived) + if err != nil { + return err + } + jb.IsArchived = &isArchived + } + case "schedule": + if v != nil { + schedule, err := unmarshalBasicScheduleBase(*v) + if err != nil { + return err + } + jb.Schedule = schedule + } + case "services": + if v != nil { + var services map[string]*JobService + err = json.Unmarshal(*v, &services) + if err != nil { + return err + } + jb.Services = services + } + case "status": + if v != nil { + var status JobStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + jb.Status = status + } + case "jobType": + if v != nil { + var jobType JobTypeBasicJobBase + err = json.Unmarshal(*v, &jobType) + if err != nil { + return err + } + jb.JobType = jobType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + jb.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + jb.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + jb.Tags = tags + } + } + } + + return nil +} + +// JobBaseResource azure Resource Manager resource envelope. +type JobBaseResource struct { + autorest.Response `json:"-"` + // Properties - [Required] Additional attributes of the entity. + Properties BasicJobBase `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 "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 + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + jbr.SystemData = &systemData + } + } + } + + return nil +} + +// JobBaseResourceArmPaginatedResult a paginated list of JobBase entities. +type JobBaseResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + // NextLink - The link to the next page of JobBase objects. If null, there are no additional pages. + 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, + } +} + +// BasicJobInput command job definition. +type BasicJobInput interface { + AsLiteralJobInput() (*LiteralJobInput, bool) + AsJobInput() (*JobInput, bool) +} + +// JobInput command job definition. +type JobInput struct { + // Description - Description for the input. + Description *string `json:"description,omitempty"` + // JobInputType - Possible values include: 'JobInputTypeJobInput', 'JobInputTypeLiteral1' + JobInputType JobInputTypeBasicJobInput `json:"jobInputType,omitempty"` +} + +func unmarshalBasicJobInput(body []byte) (BasicJobInput, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["jobInputType"] { + case string(JobInputTypeLiteral1): + var lji LiteralJobInput + err := json.Unmarshal(body, &lji) + return lji, err + default: + var ji JobInput + err := json.Unmarshal(body, &ji) + return ji, err + } +} +func unmarshalBasicJobInputArray(body []byte) ([]BasicJobInput, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + jiArray := make([]BasicJobInput, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ji, err := unmarshalBasicJobInput(*rawMessage) + if err != nil { + return nil, err + } + jiArray[index] = ji + } + return jiArray, nil +} + +// MarshalJSON is the custom marshaler for JobInput. +func (ji JobInput) MarshalJSON() ([]byte, error) { + ji.JobInputType = JobInputTypeJobInput + objectMap := make(map[string]interface{}) + if ji.Description != nil { + objectMap["description"] = ji.Description + } + if ji.JobInputType != "" { + objectMap["jobInputType"] = ji.JobInputType + } + return json.Marshal(objectMap) +} + +// AsLiteralJobInput is the BasicJobInput implementation for JobInput. +func (ji JobInput) AsLiteralJobInput() (*LiteralJobInput, bool) { + return nil, false +} + +// AsJobInput is the BasicJobInput implementation for JobInput. +func (ji JobInput) AsJobInput() (*JobInput, bool) { + return &ji, true +} + +// AsBasicJobInput is the BasicJobInput implementation for JobInput. +func (ji JobInput) AsBasicJobInput() (BasicJobInput, bool) { + return &ji, true +} + +// BasicJobLimits ... +type BasicJobLimits interface { + AsCommandJobLimits() (*CommandJobLimits, bool) + AsSweepJobLimits() (*SweepJobLimits, bool) + AsJobLimits() (*JobLimits, bool) +} + +// JobLimits ... +type JobLimits struct { + // 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"` + // JobLimitsType - Possible values include: 'JobLimitsTypeJobLimits', 'JobLimitsTypeCommand', 'JobLimitsTypeSweep' + JobLimitsType JobLimitsTypeBasicJobLimits `json:"jobLimitsType,omitempty"` +} + +func unmarshalBasicJobLimits(body []byte) (BasicJobLimits, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["jobLimitsType"] { + case string(JobLimitsTypeCommand): + var cjl CommandJobLimits + err := json.Unmarshal(body, &cjl) + return cjl, err + case string(JobLimitsTypeSweep): + var sjl SweepJobLimits + err := json.Unmarshal(body, &sjl) + return sjl, err + default: + var jl JobLimits + err := json.Unmarshal(body, &jl) + return jl, err + } +} +func unmarshalBasicJobLimitsArray(body []byte) ([]BasicJobLimits, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + jlArray := make([]BasicJobLimits, len(rawMessages)) + + for index, rawMessage := range rawMessages { + jl, err := unmarshalBasicJobLimits(*rawMessage) + if err != nil { + return nil, err + } + jlArray[index] = jl + } + return jlArray, nil +} + +// MarshalJSON is the custom marshaler for JobLimits. +func (jl JobLimits) MarshalJSON() ([]byte, error) { + jl.JobLimitsType = JobLimitsTypeJobLimits + objectMap := make(map[string]interface{}) + if jl.Timeout != nil { + objectMap["timeout"] = jl.Timeout + } + if jl.JobLimitsType != "" { + objectMap["jobLimitsType"] = jl.JobLimitsType + } + return json.Marshal(objectMap) +} + +// AsCommandJobLimits is the BasicJobLimits implementation for JobLimits. +func (jl JobLimits) AsCommandJobLimits() (*CommandJobLimits, bool) { + return nil, false +} + +// AsSweepJobLimits is the BasicJobLimits implementation for JobLimits. +func (jl JobLimits) AsSweepJobLimits() (*SweepJobLimits, bool) { + return nil, false +} + +// AsJobLimits is the BasicJobLimits implementation for JobLimits. +func (jl JobLimits) AsJobLimits() (*JobLimits, bool) { + return &jl, true +} + +// AsBasicJobLimits is the BasicJobLimits implementation for JobLimits. +func (jl JobLimits) AsBasicJobLimits() (BasicJobLimits, bool) { + return &jl, true +} + +// BasicJobOutput job output definition container information on where to find job output/logs. +type BasicJobOutput interface { + AsJobOutput() (*JobOutput, bool) +} + +// JobOutput job output definition container information on where to find job output/logs. +type JobOutput struct { + // Description - Description for the output. + Description *string `json:"description,omitempty"` + // JobOutputType - Possible values include: 'JobOutputTypeJobOutput' + JobOutputType JobOutputTypeBasicJobOutput `json:"jobOutputType,omitempty"` +} + +func unmarshalBasicJobOutput(body []byte) (BasicJobOutput, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["jobOutputType"] { + default: + var jo JobOutput + err := json.Unmarshal(body, &jo) + return jo, err + } +} +func unmarshalBasicJobOutputArray(body []byte) ([]BasicJobOutput, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + joArray := make([]BasicJobOutput, len(rawMessages)) + + for index, rawMessage := range rawMessages { + jo, err := unmarshalBasicJobOutput(*rawMessage) + if err != nil { + return nil, err + } + joArray[index] = jo + } + return joArray, nil +} + +// MarshalJSON is the custom marshaler for JobOutput. +func (jo JobOutput) MarshalJSON() ([]byte, error) { + jo.JobOutputType = JobOutputTypeJobOutput + objectMap := make(map[string]interface{}) + if jo.Description != nil { + objectMap["description"] = jo.Description + } + if jo.JobOutputType != "" { + objectMap["jobOutputType"] = jo.JobOutputType + } + return json.Marshal(objectMap) +} + +// AsJobOutput is the BasicJobOutput implementation for JobOutput. +func (jo JobOutput) AsJobOutput() (*JobOutput, bool) { + return &jo, true +} + +// AsBasicJobOutput is the BasicJobOutput implementation for JobOutput. +func (jo JobOutput) AsBasicJobOutput() (BasicJobOutput, bool) { + return &jo, true +} + +// 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 +} + +// JobService job endpoint definition +type JobService struct { + // Endpoint - Url for endpoint. + Endpoint *string `json:"endpoint,omitempty"` + // ErrorMessage - READ-ONLY; Any error in the service. + ErrorMessage *string `json:"errorMessage,omitempty"` + // JobServiceType - Endpoint type. + JobServiceType *string `json:"jobServiceType,omitempty"` + // Port - Port for endpoint. + Port *int32 `json:"port,omitempty"` + // Properties - Additional properties to set on the endpoint. + Properties map[string]*string `json:"properties"` + // Status - READ-ONLY; Status of endpoint. + Status *string `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for JobService. +func (js JobService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if js.Endpoint != nil { + objectMap["endpoint"] = js.Endpoint + } + if js.JobServiceType != nil { + objectMap["jobServiceType"] = js.JobServiceType + } + if js.Port != nil { + objectMap["port"] = js.Port + } + if js.Properties != nil { + objectMap["properties"] = js.Properties + } + return json.Marshal(objectMap) +} + +// KerberosCredentials ... +type KerberosCredentials struct { + // KerberosKdcAddress - [Required] IP Address or DNS HostName. + KerberosKdcAddress *string `json:"kerberosKdcAddress,omitempty"` + // KerberosPrincipal - [Required] Kerberos Username + KerberosPrincipal *string `json:"kerberosPrincipal,omitempty"` + // KerberosRealm - [Required] Domain over which a Kerberos authentication server has the authority to authenticate a user, host or service. + KerberosRealm *string `json:"kerberosRealm,omitempty"` +} + +// KerberosKeytabCredentials ... +type KerberosKeytabCredentials struct { + // KerberosKdcAddress - [Required] IP Address or DNS HostName. + KerberosKdcAddress *string `json:"kerberosKdcAddress,omitempty"` + // KerberosPrincipal - [Required] Kerberos Username + KerberosPrincipal *string `json:"kerberosPrincipal,omitempty"` + // KerberosRealm - [Required] Domain over which a Kerberos authentication server has the authority to authenticate a user, host or service. + KerberosRealm *string `json:"kerberosRealm,omitempty"` + // CredentialsType - [Required] Credential type used to authentication with storage. Possible values include: 'CredentialsTypeAccountKey', 'CredentialsTypeCertificate', 'CredentialsTypeNone', 'CredentialsTypeSas', 'CredentialsTypeServicePrincipal', 'CredentialsTypeKerberosKeytab', 'CredentialsTypeKerberosPassword' + CredentialsType CredentialsType `json:"credentialsType,omitempty"` + // Secrets - [Required] Keytab secrets. + Secrets *KerberosKeytabSecrets `json:"secrets,omitempty"` +} + +// KerberosKeytabSecrets ... +type KerberosKeytabSecrets struct { + // KerberosKeytab - Kerberos keytab secret. + KerberosKeytab *string `json:"kerberosKeytab,omitempty"` + // SecretsType - Possible values include: 'SecretsTypeDatastoreSecrets', 'SecretsTypeAccountKey', 'SecretsTypeCertificate', 'SecretsTypeKerberosKeytab', 'SecretsTypeKerberosPassword', 'SecretsTypeSas', 'SecretsTypeServicePrincipal' + SecretsType SecretsTypeBasicDatastoreSecrets `json:"secretsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for KerberosKeytabSecrets. +func (kks KerberosKeytabSecrets) MarshalJSON() ([]byte, error) { + kks.SecretsType = SecretsTypeKerberosKeytab + objectMap := make(map[string]interface{}) + if kks.KerberosKeytab != nil { + objectMap["kerberosKeytab"] = kks.KerberosKeytab + } + if kks.SecretsType != "" { + objectMap["secretsType"] = kks.SecretsType + } + return json.Marshal(objectMap) +} + +// AsAccountKeyDatastoreSecrets is the BasicDatastoreSecrets implementation for KerberosKeytabSecrets. +func (kks KerberosKeytabSecrets) AsAccountKeyDatastoreSecrets() (*AccountKeyDatastoreSecrets, bool) { + return nil, false +} + +// AsCertificateDatastoreSecrets is the BasicDatastoreSecrets implementation for KerberosKeytabSecrets. +func (kks KerberosKeytabSecrets) AsCertificateDatastoreSecrets() (*CertificateDatastoreSecrets, bool) { + return nil, false +} + +// AsKerberosKeytabSecrets is the BasicDatastoreSecrets implementation for KerberosKeytabSecrets. +func (kks KerberosKeytabSecrets) AsKerberosKeytabSecrets() (*KerberosKeytabSecrets, bool) { + return &kks, true +} + +// AsKerberosPasswordSecrets is the BasicDatastoreSecrets implementation for KerberosKeytabSecrets. +func (kks KerberosKeytabSecrets) AsKerberosPasswordSecrets() (*KerberosPasswordSecrets, bool) { + return nil, false +} + +// AsSasDatastoreSecrets is the BasicDatastoreSecrets implementation for KerberosKeytabSecrets. +func (kks KerberosKeytabSecrets) AsSasDatastoreSecrets() (*SasDatastoreSecrets, bool) { + return nil, false +} + +// AsServicePrincipalDatastoreSecrets is the BasicDatastoreSecrets implementation for KerberosKeytabSecrets. +func (kks KerberosKeytabSecrets) AsServicePrincipalDatastoreSecrets() (*ServicePrincipalDatastoreSecrets, bool) { + return nil, false +} + +// AsDatastoreSecrets is the BasicDatastoreSecrets implementation for KerberosKeytabSecrets. +func (kks KerberosKeytabSecrets) AsDatastoreSecrets() (*DatastoreSecrets, bool) { + return nil, false +} + +// AsBasicDatastoreSecrets is the BasicDatastoreSecrets implementation for KerberosKeytabSecrets. +func (kks KerberosKeytabSecrets) AsBasicDatastoreSecrets() (BasicDatastoreSecrets, bool) { + return &kks, true +} + +// KerberosPasswordCredentials ... +type KerberosPasswordCredentials struct { + // KerberosKdcAddress - [Required] IP Address or DNS HostName. + KerberosKdcAddress *string `json:"kerberosKdcAddress,omitempty"` + // KerberosPrincipal - [Required] Kerberos Username + KerberosPrincipal *string `json:"kerberosPrincipal,omitempty"` + // KerberosRealm - [Required] Domain over which a Kerberos authentication server has the authority to authenticate a user, host or service. + KerberosRealm *string `json:"kerberosRealm,omitempty"` + // CredentialsType - [Required] Credential type used to authentication with storage. Possible values include: 'CredentialsTypeAccountKey', 'CredentialsTypeCertificate', 'CredentialsTypeNone', 'CredentialsTypeSas', 'CredentialsTypeServicePrincipal', 'CredentialsTypeKerberosKeytab', 'CredentialsTypeKerberosPassword' + CredentialsType CredentialsType `json:"credentialsType,omitempty"` + // Secrets - [Required] Kerberos password secrets. + Secrets *KerberosPasswordSecrets `json:"secrets,omitempty"` +} + +// KerberosPasswordSecrets ... +type KerberosPasswordSecrets struct { + // KerberosPassword - Kerberos password secret. + KerberosPassword *string `json:"kerberosPassword,omitempty"` + // SecretsType - Possible values include: 'SecretsTypeDatastoreSecrets', 'SecretsTypeAccountKey', 'SecretsTypeCertificate', 'SecretsTypeKerberosKeytab', 'SecretsTypeKerberosPassword', 'SecretsTypeSas', 'SecretsTypeServicePrincipal' + SecretsType SecretsTypeBasicDatastoreSecrets `json:"secretsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for KerberosPasswordSecrets. +func (kps KerberosPasswordSecrets) MarshalJSON() ([]byte, error) { + kps.SecretsType = SecretsTypeKerberosPassword + objectMap := make(map[string]interface{}) + if kps.KerberosPassword != nil { + objectMap["kerberosPassword"] = kps.KerberosPassword + } + if kps.SecretsType != "" { + objectMap["secretsType"] = kps.SecretsType + } + return json.Marshal(objectMap) +} + +// AsAccountKeyDatastoreSecrets is the BasicDatastoreSecrets implementation for KerberosPasswordSecrets. +func (kps KerberosPasswordSecrets) AsAccountKeyDatastoreSecrets() (*AccountKeyDatastoreSecrets, bool) { + return nil, false +} + +// AsCertificateDatastoreSecrets is the BasicDatastoreSecrets implementation for KerberosPasswordSecrets. +func (kps KerberosPasswordSecrets) AsCertificateDatastoreSecrets() (*CertificateDatastoreSecrets, bool) { + return nil, false +} + +// AsKerberosKeytabSecrets is the BasicDatastoreSecrets implementation for KerberosPasswordSecrets. +func (kps KerberosPasswordSecrets) AsKerberosKeytabSecrets() (*KerberosKeytabSecrets, bool) { + return nil, false +} + +// AsKerberosPasswordSecrets is the BasicDatastoreSecrets implementation for KerberosPasswordSecrets. +func (kps KerberosPasswordSecrets) AsKerberosPasswordSecrets() (*KerberosPasswordSecrets, bool) { + return &kps, true +} + +// AsSasDatastoreSecrets is the BasicDatastoreSecrets implementation for KerberosPasswordSecrets. +func (kps KerberosPasswordSecrets) AsSasDatastoreSecrets() (*SasDatastoreSecrets, bool) { + return nil, false +} + +// AsServicePrincipalDatastoreSecrets is the BasicDatastoreSecrets implementation for KerberosPasswordSecrets. +func (kps KerberosPasswordSecrets) AsServicePrincipalDatastoreSecrets() (*ServicePrincipalDatastoreSecrets, bool) { + return nil, false +} + +// AsDatastoreSecrets is the BasicDatastoreSecrets implementation for KerberosPasswordSecrets. +func (kps KerberosPasswordSecrets) AsDatastoreSecrets() (*DatastoreSecrets, bool) { + return nil, false +} + +// AsBasicDatastoreSecrets is the BasicDatastoreSecrets implementation for KerberosPasswordSecrets. +func (kps KerberosPasswordSecrets) AsBasicDatastoreSecrets() (BasicDatastoreSecrets, bool) { + return &kps, true +} + +// Kubernetes a Machine Learning compute based on Kubernetes Compute. +type Kubernetes struct { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // ComputeLocation - READ-ONLY; 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 - Properties of Kubernetes + Properties *KubernetesProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Kubernetes. +func (kVar Kubernetes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kVar.ComputeType != "" { + objectMap["computeType"] = kVar.ComputeType + } + if kVar.Description != nil { + objectMap["description"] = kVar.Description + } + if kVar.ResourceID != nil { + objectMap["resourceId"] = kVar.ResourceID + } + if kVar.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = kVar.DisableLocalAuth + } + if kVar.Properties != nil { + objectMap["properties"] = kVar.Properties + } + return json.Marshal(objectMap) +} + +// KubernetesOnlineDeployment properties specific to a KubernetesOnlineDeployment. +type KubernetesOnlineDeployment struct { + // ContainerResourceRequirements - The resource requirements for the container (cpu and memory). + ContainerResourceRequirements *ContainerResourceRequirements `json:"containerResourceRequirements,omitempty"` + // AppInsightsEnabled - If true, enables Application Insights logging. + AppInsightsEnabled *bool `json:"appInsightsEnabled,omitempty"` + // EgressPublicNetworkAccess - If Enabled, allow egress public network access. If Disabled, this will create secure egress. Default: Enabled. Possible values include: 'Enabled', 'Disabled' + EgressPublicNetworkAccess EgressPublicNetworkAccessType `json:"egressPublicNetworkAccess,omitempty"` + // InstanceType - Compute instance type. + InstanceType *string `json:"instanceType,omitempty"` + // LivenessProbe - Liveness probe monitors the health of the container regularly. + LivenessProbe *ProbeSettings `json:"livenessProbe,omitempty"` + // Model - The URI path to the model. + Model *string `json:"model,omitempty"` + // ModelMountPath - The path to mount the model in custom container. + ModelMountPath *string `json:"modelMountPath,omitempty"` + // PrivateNetworkConnection - If true, enable private network connection. + // DEPRECATED for future API versions. Use EgressPublicNetworkAccess. + PrivateNetworkConnection *bool `json:"privateNetworkConnection,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state for the endpoint deployment. Possible values include: 'DeploymentProvisioningStateCreating', 'DeploymentProvisioningStateDeleting', 'DeploymentProvisioningStateScaling', 'DeploymentProvisioningStateUpdating', 'DeploymentProvisioningStateSucceeded', 'DeploymentProvisioningStateFailed', 'DeploymentProvisioningStateCanceled' + ProvisioningState DeploymentProvisioningState `json:"provisioningState,omitempty"` + // ReadinessProbe - Readiness probe validates if the container is ready to serve traffic. The properties and defaults are the same as liveness probe. + ReadinessProbe *ProbeSettings `json:"readinessProbe,omitempty"` + // RequestSettings - Request settings for the deployment. + RequestSettings *OnlineRequestSettings `json:"requestSettings,omitempty"` + // ScaleSettings - Scale settings for the deployment. + // If it is null or not provided, + // it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + // and to DefaultScaleSettings for ManagedOnlineDeployment. + ScaleSettings BasicOnlineScaleSettings `json:"scaleSettings,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"` + // Properties - Property dictionary. Properties can be added, but not removed or altered. + Properties map[string]*string `json:"properties"` + // EndpointComputeType - Possible values include: 'EndpointComputeTypeOnlineDeployment', 'EndpointComputeTypeKubernetes1', 'EndpointComputeTypeManaged1' + EndpointComputeType EndpointComputeTypeBasicOnlineDeployment `json:"endpointComputeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for KubernetesOnlineDeployment. +func (kod KubernetesOnlineDeployment) MarshalJSON() ([]byte, error) { + kod.EndpointComputeType = EndpointComputeTypeKubernetes1 + objectMap := make(map[string]interface{}) + if kod.ContainerResourceRequirements != nil { + objectMap["containerResourceRequirements"] = kod.ContainerResourceRequirements + } + if kod.AppInsightsEnabled != nil { + objectMap["appInsightsEnabled"] = kod.AppInsightsEnabled + } + if kod.EgressPublicNetworkAccess != "" { + objectMap["egressPublicNetworkAccess"] = kod.EgressPublicNetworkAccess + } + if kod.InstanceType != nil { + objectMap["instanceType"] = kod.InstanceType + } + if kod.LivenessProbe != nil { + objectMap["livenessProbe"] = kod.LivenessProbe + } + if kod.Model != nil { + objectMap["model"] = kod.Model + } + if kod.ModelMountPath != nil { + objectMap["modelMountPath"] = kod.ModelMountPath + } + if kod.PrivateNetworkConnection != nil { + objectMap["privateNetworkConnection"] = kod.PrivateNetworkConnection + } + if kod.ReadinessProbe != nil { + objectMap["readinessProbe"] = kod.ReadinessProbe + } + if kod.RequestSettings != nil { + objectMap["requestSettings"] = kod.RequestSettings + } + objectMap["scaleSettings"] = kod.ScaleSettings + if kod.EndpointComputeType != "" { + objectMap["endpointComputeType"] = kod.EndpointComputeType + } + 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.Properties != nil { + objectMap["properties"] = kod.Properties + } + return json.Marshal(objectMap) +} + +// AsKubernetesOnlineDeployment is the BasicOnlineDeployment implementation for KubernetesOnlineDeployment. +func (kod KubernetesOnlineDeployment) AsKubernetesOnlineDeployment() (*KubernetesOnlineDeployment, bool) { + return &kod, true +} + +// AsManagedOnlineDeployment is the BasicOnlineDeployment implementation for KubernetesOnlineDeployment. +func (kod KubernetesOnlineDeployment) AsManagedOnlineDeployment() (*ManagedOnlineDeployment, bool) { + return nil, false +} + +// AsOnlineDeployment is the BasicOnlineDeployment implementation for KubernetesOnlineDeployment. +func (kod KubernetesOnlineDeployment) AsOnlineDeployment() (*OnlineDeployment, bool) { + return nil, false +} + +// AsBasicOnlineDeployment is the BasicOnlineDeployment implementation for KubernetesOnlineDeployment. +func (kod KubernetesOnlineDeployment) AsBasicOnlineDeployment() (BasicOnlineDeployment, bool) { + return &kod, true +} + +// UnmarshalJSON is the custom unmarshaler for KubernetesOnlineDeployment struct. +func (kod *KubernetesOnlineDeployment) 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 "egressPublicNetworkAccess": + if v != nil { + var egressPublicNetworkAccess EgressPublicNetworkAccessType + err = json.Unmarshal(*v, &egressPublicNetworkAccess) + if err != nil { + return err + } + kod.EgressPublicNetworkAccess = egressPublicNetworkAccess + } + case "instanceType": + if v != nil { + var instanceType string + err = json.Unmarshal(*v, &instanceType) + if err != nil { + return err + } + kod.InstanceType = &instanceType + } + 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 { + var model string + err = json.Unmarshal(*v, &model) + if err != nil { + return err + } + kod.Model = &model + } + case "modelMountPath": + if v != nil { + var modelMountPath string + err = json.Unmarshal(*v, &modelMountPath) + if err != nil { + return err + } + kod.ModelMountPath = &modelMountPath + } + case "privateNetworkConnection": + if v != nil { + var privateNetworkConnection bool + err = json.Unmarshal(*v, &privateNetworkConnection) + if err != nil { + return err + } + kod.PrivateNetworkConnection = &privateNetworkConnection + } + case "provisioningState": + if v != nil { + var provisioningState DeploymentProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + kod.ProvisioningState = provisioningState + } + case "readinessProbe": + if v != nil { + var readinessProbe ProbeSettings + err = json.Unmarshal(*v, &readinessProbe) + if err != nil { + return err + } + kod.ReadinessProbe = &readinessProbe + } + 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 + } + 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 "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + kod.Properties = properties + } + } + } + + return nil +} + +// KubernetesProperties kubernetes properties +type KubernetesProperties struct { + // RelayConnectionString - Relay connection string. + RelayConnectionString *string `json:"relayConnectionString,omitempty"` + // ServiceBusConnectionString - ServiceBus connection string. + ServiceBusConnectionString *string `json:"serviceBusConnectionString,omitempty"` + // ExtensionPrincipalID - Extension principal-id. + ExtensionPrincipalID *string `json:"extensionPrincipalId,omitempty"` + // ExtensionInstanceReleaseTrain - Extension instance release train. + ExtensionInstanceReleaseTrain *string `json:"extensionInstanceReleaseTrain,omitempty"` + // VcName - VC name. + VcName *string `json:"vcName,omitempty"` + // Namespace - Compute namespace + Namespace *string `json:"namespace,omitempty"` + // DefaultInstanceType - Default instance type + DefaultInstanceType *string `json:"defaultInstanceType,omitempty"` + // InstanceTypes - Instance Type Schema + InstanceTypes map[string]*InstanceTypeSchema `json:"instanceTypes"` +} + +// MarshalJSON is the custom marshaler for KubernetesProperties. +func (kp KubernetesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kp.RelayConnectionString != nil { + objectMap["relayConnectionString"] = kp.RelayConnectionString + } + if kp.ServiceBusConnectionString != nil { + objectMap["serviceBusConnectionString"] = kp.ServiceBusConnectionString + } + if kp.ExtensionPrincipalID != nil { + objectMap["extensionPrincipalId"] = kp.ExtensionPrincipalID + } + if kp.ExtensionInstanceReleaseTrain != nil { + objectMap["extensionInstanceReleaseTrain"] = kp.ExtensionInstanceReleaseTrain + } + if kp.VcName != nil { + objectMap["vcName"] = kp.VcName + } + if kp.Namespace != nil { + objectMap["namespace"] = kp.Namespace + } + if kp.DefaultInstanceType != nil { + objectMap["defaultInstanceType"] = kp.DefaultInstanceType + } + if kp.InstanceTypes != nil { + objectMap["instanceTypes"] = kp.InstanceTypes + } + return json.Marshal(objectMap) +} + +// KubernetesSchema kubernetes Compute Schema +type KubernetesSchema struct { + // Properties - Properties of Kubernetes + Properties *KubernetesProperties `json:"properties,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, + } +} + +// LiteralJobInput literal input type. +type LiteralJobInput struct { + // Value - [Required] Literal value for the input. + Value *string `json:"value,omitempty"` + // Description - Description for the input. + Description *string `json:"description,omitempty"` + // JobInputType - Possible values include: 'JobInputTypeJobInput', 'JobInputTypeLiteral1' + JobInputType JobInputTypeBasicJobInput `json:"jobInputType,omitempty"` +} + +// MarshalJSON is the custom marshaler for LiteralJobInput. +func (lji LiteralJobInput) MarshalJSON() ([]byte, error) { + lji.JobInputType = JobInputTypeLiteral1 + objectMap := make(map[string]interface{}) + if lji.Value != nil { + objectMap["value"] = lji.Value + } + if lji.Description != nil { + objectMap["description"] = lji.Description + } + if lji.JobInputType != "" { + objectMap["jobInputType"] = lji.JobInputType + } + return json.Marshal(objectMap) +} + +// AsLiteralJobInput is the BasicJobInput implementation for LiteralJobInput. +func (lji LiteralJobInput) AsLiteralJobInput() (*LiteralJobInput, bool) { + return &lji, true +} + +// AsJobInput is the BasicJobInput implementation for LiteralJobInput. +func (lji LiteralJobInput) AsJobInput() (*JobInput, bool) { + return nil, false +} + +// AsBasicJobInput is the BasicJobInput implementation for LiteralJobInput. +func (lji LiteralJobInput) AsBasicJobInput() (BasicJobInput, bool) { + return &lji, true +} + +// 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', 'IdentityTypeUserIdentity' + 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 +} + +// AsUserIdentity is the BasicIdentityConfiguration implementation for ManagedIdentity. +func (mi ManagedIdentity) AsUserIdentity() (*UserIdentity, bool) { + return nil, false +} + +// 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 properties specific to a ManagedOnlineDeployment. +type ManagedOnlineDeployment struct { + // AppInsightsEnabled - If true, enables Application Insights logging. + AppInsightsEnabled *bool `json:"appInsightsEnabled,omitempty"` + // EgressPublicNetworkAccess - If Enabled, allow egress public network access. If Disabled, this will create secure egress. Default: Enabled. Possible values include: 'Enabled', 'Disabled' + EgressPublicNetworkAccess EgressPublicNetworkAccessType `json:"egressPublicNetworkAccess,omitempty"` + // InstanceType - Compute instance type. + InstanceType *string `json:"instanceType,omitempty"` + // LivenessProbe - Liveness probe monitors the health of the container regularly. + LivenessProbe *ProbeSettings `json:"livenessProbe,omitempty"` + // Model - The URI path to the model. + Model *string `json:"model,omitempty"` + // ModelMountPath - The path to mount the model in custom container. + ModelMountPath *string `json:"modelMountPath,omitempty"` + // PrivateNetworkConnection - If true, enable private network connection. + // DEPRECATED for future API versions. Use EgressPublicNetworkAccess. + PrivateNetworkConnection *bool `json:"privateNetworkConnection,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state for the endpoint deployment. Possible values include: 'DeploymentProvisioningStateCreating', 'DeploymentProvisioningStateDeleting', 'DeploymentProvisioningStateScaling', 'DeploymentProvisioningStateUpdating', 'DeploymentProvisioningStateSucceeded', 'DeploymentProvisioningStateFailed', 'DeploymentProvisioningStateCanceled' + ProvisioningState DeploymentProvisioningState `json:"provisioningState,omitempty"` + // ReadinessProbe - Readiness probe validates if the container is ready to serve traffic. The properties and defaults are the same as liveness probe. + ReadinessProbe *ProbeSettings `json:"readinessProbe,omitempty"` + // RequestSettings - Request settings for the deployment. + RequestSettings *OnlineRequestSettings `json:"requestSettings,omitempty"` + // ScaleSettings - Scale settings for the deployment. + // If it is null or not provided, + // it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + // and to DefaultScaleSettings for ManagedOnlineDeployment. + ScaleSettings BasicOnlineScaleSettings `json:"scaleSettings,omitempty"` + // EndpointComputeType - Possible values include: 'EndpointComputeTypeOnlineDeployment', 'EndpointComputeTypeKubernetes1', 'EndpointComputeTypeManaged1' + EndpointComputeType EndpointComputeTypeBasicOnlineDeployment `json:"endpointComputeType,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"` + // Properties - Property dictionary. Properties can be added, but not removed or altered. + Properties map[string]*string `json:"properties"` +} + +// MarshalJSON is the custom marshaler for ManagedOnlineDeployment. +func (mod ManagedOnlineDeployment) MarshalJSON() ([]byte, error) { + mod.EndpointComputeType = EndpointComputeTypeManaged1 + objectMap := make(map[string]interface{}) + if mod.AppInsightsEnabled != nil { + objectMap["appInsightsEnabled"] = mod.AppInsightsEnabled + } + if mod.EgressPublicNetworkAccess != "" { + objectMap["egressPublicNetworkAccess"] = mod.EgressPublicNetworkAccess + } + if mod.InstanceType != nil { + objectMap["instanceType"] = mod.InstanceType + } + if mod.LivenessProbe != nil { + objectMap["livenessProbe"] = mod.LivenessProbe + } + if mod.Model != nil { + objectMap["model"] = mod.Model + } + if mod.ModelMountPath != nil { + objectMap["modelMountPath"] = mod.ModelMountPath + } + if mod.PrivateNetworkConnection != nil { + objectMap["privateNetworkConnection"] = mod.PrivateNetworkConnection + } + if mod.ReadinessProbe != nil { + objectMap["readinessProbe"] = mod.ReadinessProbe + } + if mod.RequestSettings != nil { + objectMap["requestSettings"] = mod.RequestSettings + } + objectMap["scaleSettings"] = mod.ScaleSettings + if mod.EndpointComputeType != "" { + objectMap["endpointComputeType"] = mod.EndpointComputeType + } + 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.Properties != nil { + objectMap["properties"] = mod.Properties + } + return json.Marshal(objectMap) +} + +// AsKubernetesOnlineDeployment is the BasicOnlineDeployment implementation for ManagedOnlineDeployment. +func (mod ManagedOnlineDeployment) AsKubernetesOnlineDeployment() (*KubernetesOnlineDeployment, 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 "appInsightsEnabled": + if v != nil { + var appInsightsEnabled bool + err = json.Unmarshal(*v, &appInsightsEnabled) + if err != nil { + return err + } + mod.AppInsightsEnabled = &appInsightsEnabled + } + case "egressPublicNetworkAccess": + if v != nil { + var egressPublicNetworkAccess EgressPublicNetworkAccessType + err = json.Unmarshal(*v, &egressPublicNetworkAccess) + if err != nil { + return err + } + mod.EgressPublicNetworkAccess = egressPublicNetworkAccess + } + case "instanceType": + if v != nil { + var instanceType string + err = json.Unmarshal(*v, &instanceType) + if err != nil { + return err + } + mod.InstanceType = &instanceType + } + 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 { + var model string + err = json.Unmarshal(*v, &model) + if err != nil { + return err + } + mod.Model = &model + } + case "modelMountPath": + if v != nil { + var modelMountPath string + err = json.Unmarshal(*v, &modelMountPath) + if err != nil { + return err + } + mod.ModelMountPath = &modelMountPath + } + case "privateNetworkConnection": + if v != nil { + var privateNetworkConnection bool + err = json.Unmarshal(*v, &privateNetworkConnection) + if err != nil { + return err + } + mod.PrivateNetworkConnection = &privateNetworkConnection + } + case "provisioningState": + if v != nil { + var provisioningState DeploymentProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + mod.ProvisioningState = provisioningState + } + case "readinessProbe": + if v != nil { + var readinessProbe ProbeSettings + err = json.Unmarshal(*v, &readinessProbe) + if err != nil { + return err + } + mod.ReadinessProbe = &readinessProbe + } + 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 + } + 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 "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + mod.Properties = properties + } + } + } + + return nil +} + +// ManagedServiceIdentity managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentity struct { + // PrincipalID - READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. + PrincipalID *uuid.UUID `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // Type - Possible values include: 'ManagedServiceIdentityTypeNone', 'ManagedServiceIdentityTypeSystemAssigned', 'ManagedServiceIdentityTypeUserAssigned', 'ManagedServiceIdentityTypeSystemAssignedUserAssigned' + Type ManagedServiceIdentityType `json:"type,omitempty"` + UserAssignedIdentities map[string]*UserAssignedIdentity `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for ManagedServiceIdentity. +func (msi ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if msi.Type != "" { + objectMap["type"] = msi.Type + } + if msi.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = msi.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// MedianStoppingPolicy defines an early termination policy based on running averages of the primary metric +// of all runs +type MedianStoppingPolicy struct { + // DelayEvaluation - Number of intervals by which to delay the first evaluation. + DelayEvaluation *int32 `json:"delayEvaluation,omitempty"` + // EvaluationInterval - Interval (number of runs) between policy evaluations. + 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 +} + +// MLFlowModelJobInput ... +type MLFlowModelJobInput struct { + // Mode - Input Asset Delivery Mode. Possible values include: 'ReadOnlyMount', 'ReadWriteMount', 'Download', 'Direct', 'EvalMount', 'EvalDownload' + Mode InputDeliveryMode `json:"mode,omitempty"` + // URI - [Required] Input Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the input. + Description *string `json:"description,omitempty"` + // JobInputType - [Required] Specifies the type of job. Possible values include: 'JobInputTypeLiteral', 'JobInputTypeURIFile', 'JobInputTypeURIFolder', 'JobInputTypeMLTable', 'JobInputTypeCustomModel', 'JobInputTypeMLFlowModel', 'JobInputTypeTritonModel' + JobInputType JobInputType `json:"jobInputType,omitempty"` +} + +// MLFlowModelJobOutput ... +type MLFlowModelJobOutput struct { + // Mode - Output Asset Delivery Mode. Possible values include: 'OutputDeliveryModeReadWriteMount', 'OutputDeliveryModeUpload' + Mode OutputDeliveryMode `json:"mode,omitempty"` + // URI - Output Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the output. + Description *string `json:"description,omitempty"` + // JobOutputType - [Required] Specifies the type of job. Possible values include: 'JobOutputTypeURIFile', 'JobOutputTypeURIFolder', 'JobOutputTypeMLTable', 'JobOutputTypeCustomModel', 'JobOutputTypeMLFlowModel', 'JobOutputTypeTritonModel' + JobOutputType JobOutputType `json:"jobOutputType,omitempty"` +} + +// MLTableData mLTable data definition +type MLTableData struct { + // ReferencedUris - Uris referenced in the MLTable definition (required for lineage) + ReferencedUris *[]string `json:"referencedUris,omitempty"` + // DataURI - [Required] Uri of the data. Usage/meaning depends on Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20220201Preview.Assets.DataVersionBase.DataType + DataURI *string `json:"dataUri,omitempty"` + // DataType - Possible values include: 'DataTypeDataVersionBase', 'DataTypeMLTable', 'DataTypeURIFile', 'DataTypeURIFolder' + DataType DataTypeBasicDataVersionBase `json:"dataType,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // 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 MLTableData. +func (mtd MLTableData) MarshalJSON() ([]byte, error) { + mtd.DataType = DataTypeMLTable + objectMap := make(map[string]interface{}) + if mtd.ReferencedUris != nil { + objectMap["referencedUris"] = mtd.ReferencedUris + } + if mtd.DataURI != nil { + objectMap["dataUri"] = mtd.DataURI + } + if mtd.DataType != "" { + objectMap["dataType"] = mtd.DataType + } + if mtd.IsAnonymous != nil { + objectMap["isAnonymous"] = mtd.IsAnonymous + } + if mtd.IsArchived != nil { + objectMap["isArchived"] = mtd.IsArchived + } + if mtd.Description != nil { + objectMap["description"] = mtd.Description + } + if mtd.Properties != nil { + objectMap["properties"] = mtd.Properties + } + if mtd.Tags != nil { + objectMap["tags"] = mtd.Tags + } + return json.Marshal(objectMap) +} + +// AsMLTableData is the BasicDataVersionBase implementation for MLTableData. +func (mtd MLTableData) AsMLTableData() (*MLTableData, bool) { + return &mtd, true +} + +// AsURIFileDataVersion is the BasicDataVersionBase implementation for MLTableData. +func (mtd MLTableData) AsURIFileDataVersion() (*URIFileDataVersion, bool) { + return nil, false +} + +// AsURIFolderDataVersion is the BasicDataVersionBase implementation for MLTableData. +func (mtd MLTableData) AsURIFolderDataVersion() (*URIFolderDataVersion, bool) { + return nil, false +} + +// AsDataVersionBase is the BasicDataVersionBase implementation for MLTableData. +func (mtd MLTableData) AsDataVersionBase() (*DataVersionBase, bool) { + return nil, false +} + +// AsBasicDataVersionBase is the BasicDataVersionBase implementation for MLTableData. +func (mtd MLTableData) AsBasicDataVersionBase() (BasicDataVersionBase, bool) { + return &mtd, true +} + +// MLTableJobInput ... +type MLTableJobInput struct { + // Mode - Input Asset Delivery Mode. Possible values include: 'ReadOnlyMount', 'ReadWriteMount', 'Download', 'Direct', 'EvalMount', 'EvalDownload' + Mode InputDeliveryMode `json:"mode,omitempty"` + // URI - [Required] Input Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the input. + Description *string `json:"description,omitempty"` + // JobInputType - [Required] Specifies the type of job. Possible values include: 'JobInputTypeLiteral', 'JobInputTypeURIFile', 'JobInputTypeURIFolder', 'JobInputTypeMLTable', 'JobInputTypeCustomModel', 'JobInputTypeMLFlowModel', 'JobInputTypeTritonModel' + JobInputType JobInputType `json:"jobInputType,omitempty"` +} + +// MLTableJobOutput ... +type MLTableJobOutput struct { + // Mode - Output Asset Delivery Mode. Possible values include: 'OutputDeliveryModeReadWriteMount', 'OutputDeliveryModeUpload' + Mode OutputDeliveryMode `json:"mode,omitempty"` + // URI - Output Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the output. + Description *string `json:"description,omitempty"` + // JobOutputType - [Required] Specifies the type of job. Possible values include: 'JobOutputTypeURIFile', 'JobOutputTypeURIFolder', 'JobOutputTypeMLTable', 'JobOutputTypeCustomModel', 'JobOutputTypeMLFlowModel', 'JobOutputTypeTritonModel' + JobOutputType JobOutputType `json:"jobOutputType,omitempty"` +} + +// ModelContainer ... +type ModelContainer struct { + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // LatestVersion - READ-ONLY; The latest version inside this container. + LatestVersion *string `json:"latestVersion,omitempty"` + // NextVersion - READ-ONLY; The next auto incremental version + NextVersion *string `json:"nextVersion,omitempty"` + // 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.IsArchived != nil { + objectMap["isArchived"] = mc.IsArchived + } + 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 - [Required] Additional attributes of the entity. + Properties *ModelContainer `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 - The link to the next page of ModelContainer objects. If null, there are no additional pages. + 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 { + // Flavors - Mapping of model flavors to their properties. + Flavors map[string]*FlavorData `json:"flavors"` + // JobName - Name of the training job which produced this model + JobName *string `json:"jobName,omitempty"` + // ModelType - The storage format for this entity. Used for NCD. Possible values include: 'CustomModel', 'MLFlowModel', 'TritonModel' + ModelType ModelType `json:"modelType,omitempty"` + // ModelURI - The URI path to the model contents. + ModelURI *string `json:"modelUri,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // 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 ModelVersion. +func (mv ModelVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mv.Flavors != nil { + objectMap["flavors"] = mv.Flavors + } + if mv.JobName != nil { + objectMap["jobName"] = mv.JobName + } + if mv.ModelType != "" { + objectMap["modelType"] = mv.ModelType + } + if mv.ModelURI != nil { + objectMap["modelUri"] = mv.ModelURI + } + if mv.IsAnonymous != nil { + objectMap["isAnonymous"] = mv.IsAnonymous + } + if mv.IsArchived != nil { + objectMap["isArchived"] = mv.IsArchived + } + if mv.Description != nil { + objectMap["description"] = mv.Description + } + 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 - [Required] Additional attributes of the entity. + Properties *ModelVersion `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 - The link to the next page of ModelVersion objects. If null, there are no additional pages. + 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 - Number of processes per MPI node. + 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 +} + +// BasicNCrossValidations n-Cross validations value. +type BasicNCrossValidations interface { + AsAutoNCrossValidations() (*AutoNCrossValidations, bool) + AsCustomNCrossValidations() (*CustomNCrossValidations, bool) + AsNCrossValidations() (*NCrossValidations, bool) +} + +// NCrossValidations n-Cross validations value. +type NCrossValidations struct { + // Mode - Possible values include: 'ModeNCrossValidations', 'ModeAuto', 'ModeCustom' + Mode Mode `json:"mode,omitempty"` +} + +func unmarshalBasicNCrossValidations(body []byte) (BasicNCrossValidations, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["mode"] { + case string(ModeAuto): + var ancv AutoNCrossValidations + err := json.Unmarshal(body, &ancv) + return ancv, err + case string(ModeCustom): + var cncv CustomNCrossValidations + err := json.Unmarshal(body, &cncv) + return cncv, err + default: + var ncv NCrossValidations + err := json.Unmarshal(body, &ncv) + return ncv, err + } +} +func unmarshalBasicNCrossValidationsArray(body []byte) ([]BasicNCrossValidations, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + ncvArray := make([]BasicNCrossValidations, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ncv, err := unmarshalBasicNCrossValidations(*rawMessage) + if err != nil { + return nil, err + } + ncvArray[index] = ncv + } + return ncvArray, nil +} + +// MarshalJSON is the custom marshaler for NCrossValidations. +func (ncv NCrossValidations) MarshalJSON() ([]byte, error) { + ncv.Mode = ModeNCrossValidations + objectMap := make(map[string]interface{}) + if ncv.Mode != "" { + objectMap["mode"] = ncv.Mode + } + return json.Marshal(objectMap) +} + +// AsAutoNCrossValidations is the BasicNCrossValidations implementation for NCrossValidations. +func (ncv NCrossValidations) AsAutoNCrossValidations() (*AutoNCrossValidations, bool) { + return nil, false +} + +// AsCustomNCrossValidations is the BasicNCrossValidations implementation for NCrossValidations. +func (ncv NCrossValidations) AsCustomNCrossValidations() (*CustomNCrossValidations, bool) { + return nil, false +} + +// AsNCrossValidations is the BasicNCrossValidations implementation for NCrossValidations. +func (ncv NCrossValidations) AsNCrossValidations() (*NCrossValidations, bool) { + return &ncv, true +} + +// AsBasicNCrossValidations is the BasicNCrossValidations implementation for NCrossValidations. +func (ncv NCrossValidations) AsBasicNCrossValidations() (BasicNCrossValidations, bool) { + return &ncv, true +} + +// NlpVertical abstract class for NLP related AutoML tasks. +// NLP - Natural Language Processing. +type NlpVertical struct { + // DataSettings - Data inputs for AutoMLJob. + DataSettings *NlpVerticalDataSettings `json:"dataSettings,omitempty"` + // FeaturizationSettings - Featurization inputs needed for AutoML job. + FeaturizationSettings *NlpVerticalFeaturizationSettings `json:"featurizationSettings,omitempty"` + // LimitSettings - Execution constraints for AutoMLJob. + LimitSettings *NlpVerticalLimitSettings `json:"limitSettings,omitempty"` +} + +// NlpVerticalDataSettings class for data inputs. +// NLP - Natural Language Processing. +type NlpVerticalDataSettings struct { + // ValidationData - Validation data inputs. + ValidationData *NlpVerticalValidationDataSettings `json:"validationData,omitempty"` + // TargetColumnName - [Required] Target column name: This is prediction values column. + // Also known as label column name in context of classification tasks. + TargetColumnName *string `json:"targetColumnName,omitempty"` + // TestData - Test data input. + TestData *TestDataSettings `json:"testData,omitempty"` + // TrainingData - [Required] Training data input. + TrainingData *TrainingDataSettings `json:"trainingData,omitempty"` +} + +// NlpVerticalFeaturizationSettings ... +type NlpVerticalFeaturizationSettings struct { + // DatasetLanguage - Dataset language, useful for the text data. + DatasetLanguage *string `json:"datasetLanguage,omitempty"` +} + +// NlpVerticalLimitSettings job execution constraints. +type NlpVerticalLimitSettings struct { + // MaxConcurrentTrials - Maximum Concurrent AutoML iterations. + MaxConcurrentTrials *int32 `json:"maxConcurrentTrials,omitempty"` + // MaxTrials - Number of AutoML iterations. + MaxTrials *int32 `json:"maxTrials,omitempty"` + // Timeout - AutoML job timeout. + Timeout *string `json:"timeout,omitempty"` +} + +// NlpVerticalValidationDataSettings ... +type NlpVerticalValidationDataSettings struct { + // Data - Validation data MLTable. + Data *MLTableJobInput `json:"data,omitempty"` + // ValidationDataSize - The fraction of training dataset that needs to be set aside for validation purpose. + // Values between (0.0 , 1.0) + // Applied when validation dataset is not provided. + ValidationDataSize *float64 `json:"validationDataSize,omitempty"` +} + +// 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 { + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey1', 'CredentialsTypeCertificate1', 'CredentialsTypeNone1', 'CredentialsTypeSas1', 'CredentialsTypeServicePrincipal1' + CredentialsType CredentialsTypeBasicDatastoreCredentials `json:"credentialsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NoneDatastoreCredentials. +func (ndc NoneDatastoreCredentials) MarshalJSON() ([]byte, error) { + ndc.CredentialsType = CredentialsTypeNone1 + objectMap := make(map[string]interface{}) + 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 +} + +// 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 +} + +// 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 optimization objective. +type Objective struct { + // Goal - [Required] Defines supported metric goals for hyperparameter tuning. Possible values include: 'Minimize', 'Maximize' + Goal Goal `json:"goal,omitempty"` + // PrimaryMetric - [Required] Name of the metric to optimize. + PrimaryMetric *string `json:"primaryMetric,omitempty"` +} + +// BasicOnlineDeployment ... +type BasicOnlineDeployment interface { + AsKubernetesOnlineDeployment() (*KubernetesOnlineDeployment, bool) + AsManagedOnlineDeployment() (*ManagedOnlineDeployment, bool) + AsOnlineDeployment() (*OnlineDeployment, bool) +} + +// OnlineDeployment ... +type OnlineDeployment struct { + // AppInsightsEnabled - If true, enables Application Insights logging. + AppInsightsEnabled *bool `json:"appInsightsEnabled,omitempty"` + // EgressPublicNetworkAccess - If Enabled, allow egress public network access. If Disabled, this will create secure egress. Default: Enabled. Possible values include: 'Enabled', 'Disabled' + EgressPublicNetworkAccess EgressPublicNetworkAccessType `json:"egressPublicNetworkAccess,omitempty"` + // InstanceType - Compute instance type. + InstanceType *string `json:"instanceType,omitempty"` + // LivenessProbe - Liveness probe monitors the health of the container regularly. + LivenessProbe *ProbeSettings `json:"livenessProbe,omitempty"` + // Model - The URI path to the model. + Model *string `json:"model,omitempty"` + // ModelMountPath - The path to mount the model in custom container. + ModelMountPath *string `json:"modelMountPath,omitempty"` + // PrivateNetworkConnection - If true, enable private network connection. + // DEPRECATED for future API versions. Use EgressPublicNetworkAccess. + PrivateNetworkConnection *bool `json:"privateNetworkConnection,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state for the endpoint deployment. Possible values include: 'DeploymentProvisioningStateCreating', 'DeploymentProvisioningStateDeleting', 'DeploymentProvisioningStateScaling', 'DeploymentProvisioningStateUpdating', 'DeploymentProvisioningStateSucceeded', 'DeploymentProvisioningStateFailed', 'DeploymentProvisioningStateCanceled' + ProvisioningState DeploymentProvisioningState `json:"provisioningState,omitempty"` + // ReadinessProbe - Readiness probe validates if the container is ready to serve traffic. The properties and defaults are the same as liveness probe. + ReadinessProbe *ProbeSettings `json:"readinessProbe,omitempty"` + // RequestSettings - Request settings for the deployment. + RequestSettings *OnlineRequestSettings `json:"requestSettings,omitempty"` + // ScaleSettings - Scale settings for the deployment. + // If it is null or not provided, + // it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + // and to DefaultScaleSettings for ManagedOnlineDeployment. + ScaleSettings BasicOnlineScaleSettings `json:"scaleSettings,omitempty"` + // EndpointComputeType - Possible values include: 'EndpointComputeTypeOnlineDeployment', 'EndpointComputeTypeKubernetes1', 'EndpointComputeTypeManaged1' + EndpointComputeType EndpointComputeTypeBasicOnlineDeployment `json:"endpointComputeType,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"` + // Properties - Property dictionary. Properties can be added, but not removed or altered. + Properties map[string]*string `json:"properties"` +} + +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(EndpointComputeTypeKubernetes1): + var kod KubernetesOnlineDeployment + err := json.Unmarshal(body, &kod) + return kod, err + case string(EndpointComputeTypeManaged1): + 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.EgressPublicNetworkAccess != "" { + objectMap["egressPublicNetworkAccess"] = od.EgressPublicNetworkAccess + } + if od.InstanceType != nil { + objectMap["instanceType"] = od.InstanceType + } + if od.LivenessProbe != nil { + objectMap["livenessProbe"] = od.LivenessProbe + } + if od.Model != nil { + objectMap["model"] = od.Model + } + if od.ModelMountPath != nil { + objectMap["modelMountPath"] = od.ModelMountPath + } + if od.PrivateNetworkConnection != nil { + objectMap["privateNetworkConnection"] = od.PrivateNetworkConnection + } + if od.ReadinessProbe != nil { + objectMap["readinessProbe"] = od.ReadinessProbe + } + if od.RequestSettings != nil { + objectMap["requestSettings"] = od.RequestSettings + } + objectMap["scaleSettings"] = od.ScaleSettings + if od.EndpointComputeType != "" { + objectMap["endpointComputeType"] = od.EndpointComputeType + } + 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.Properties != nil { + objectMap["properties"] = od.Properties + } + return json.Marshal(objectMap) +} + +// AsKubernetesOnlineDeployment is the BasicOnlineDeployment implementation for OnlineDeployment. +func (od OnlineDeployment) AsKubernetesOnlineDeployment() (*KubernetesOnlineDeployment, 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 "egressPublicNetworkAccess": + if v != nil { + var egressPublicNetworkAccess EgressPublicNetworkAccessType + err = json.Unmarshal(*v, &egressPublicNetworkAccess) + if err != nil { + return err + } + od.EgressPublicNetworkAccess = egressPublicNetworkAccess + } + case "instanceType": + if v != nil { + var instanceType string + err = json.Unmarshal(*v, &instanceType) + if err != nil { + return err + } + od.InstanceType = &instanceType + } + 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 { + var model string + err = json.Unmarshal(*v, &model) + if err != nil { + return err + } + od.Model = &model + } + case "modelMountPath": + if v != nil { + var modelMountPath string + err = json.Unmarshal(*v, &modelMountPath) + if err != nil { + return err + } + od.ModelMountPath = &modelMountPath + } + case "privateNetworkConnection": + if v != nil { + var privateNetworkConnection bool + err = json.Unmarshal(*v, &privateNetworkConnection) + if err != nil { + return err + } + od.PrivateNetworkConnection = &privateNetworkConnection + } + case "provisioningState": + if v != nil { + var provisioningState DeploymentProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + od.ProvisioningState = provisioningState + } + case "readinessProbe": + if v != nil { + var readinessProbe ProbeSettings + err = json.Unmarshal(*v, &readinessProbe) + if err != nil { + return err + } + od.ReadinessProbe = &readinessProbe + } + 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 + } + 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 "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + od.Properties = properties + } + } + } + + 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 - Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Properties - [Required] Additional attributes of the entity. + Properties BasicOnlineDeployment `json:"properties,omitempty"` + // Sku - Sku details required for ARM contract for Autoscaling. + Sku *Sku `json:"sku,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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.Sku != nil { + objectMap["sku"] = odtr.Sku + } + 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 ManagedServiceIdentity + 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 "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + odtr.Sku = &sku + } + 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 + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + odtr.SystemData = &systemData + } + } + } + + return nil +} + +// OnlineDeploymentTrackedResourceArmPaginatedResult a paginated list of OnlineDeployment entities. +type OnlineDeploymentTrackedResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + // NextLink - The link to the next page of OnlineDeployment objects. If null, there are no additional pages. + 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 { + // Compute - ARM resource ID of the compute if it exists. + // optional + Compute *string `json:"compute,omitempty"` + // MirrorTraffic - Percentage of traffic to be mirrored to each deployment without using returned scoring. Traffic values need to sum to utmost 50. + MirrorTraffic map[string]*int32 `json:"mirrorTraffic"` + // ProvisioningState - READ-ONLY; Provisioning state for the endpoint. Possible values include: 'EndpointProvisioningStateCreating', 'EndpointProvisioningStateDeleting', 'EndpointProvisioningStateSucceeded', 'EndpointProvisioningStateFailed', 'EndpointProvisioningStateUpdating', 'EndpointProvisioningStateCanceled' + ProvisioningState EndpointProvisioningState `json:"provisioningState,omitempty"` + // PublicNetworkAccess - Set to "Enabled" for endpoints that should allow public access when Private Link is enabled. Possible values include: 'PublicNetworkAccessTypeEnabled', 'PublicNetworkAccessTypeDisabled' + PublicNetworkAccess PublicNetworkAccessType `json:"publicNetworkAccess,omitempty"` + // Traffic - Percentage of traffic from endpoint to divert to each deployment. Traffic values need to sum to 100. + Traffic map[string]*int32 `json:"traffic"` + // AuthMode - [Required] Use 'Key' for key based authentication and 'AMLToken' for Azure Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' does. 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"` +} + +// MarshalJSON is the custom marshaler for OnlineEndpoint. +func (oe OnlineEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oe.Compute != nil { + objectMap["compute"] = oe.Compute + } + if oe.MirrorTraffic != nil { + objectMap["mirrorTraffic"] = oe.MirrorTraffic + } + if oe.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = oe.PublicNetworkAccess + } + if oe.Traffic != nil { + objectMap["traffic"] = oe.Traffic + } + 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 + } + 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 - Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Properties - [Required] Additional attributes of the entity. + Properties *OnlineEndpoint `json:"properties,omitempty"` + // Sku - Sku details required for ARM contract for Autoscaling. + Sku *Sku `json:"sku,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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.Sku != nil { + objectMap["sku"] = oetr.Sku + } + 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 - The link to the next page of OnlineEndpoint objects. If null, there are no additional pages. + 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 online deployment scoring requests configuration. +type OnlineRequestSettings struct { + // MaxConcurrentRequestsPerInstance - The number of maximum concurrent requests per node allowed per deployment. Defaults to 1. + MaxConcurrentRequestsPerInstance *int32 `json:"maxConcurrentRequestsPerInstance,omitempty"` + // MaxQueueWait - The maximum amount of time a request will stay in the queue in ISO 8601 format. + // Defaults to 500ms. + MaxQueueWait *string `json:"maxQueueWait,omitempty"` + // RequestTimeout - The scoring timeout in ISO 8601 format. + // Defaults to 5000ms. + RequestTimeout *string `json:"requestTimeout,omitempty"` +} + +// BasicOnlineScaleSettings online deployment scaling configuration. +type BasicOnlineScaleSettings interface { + AsDefaultScaleSettings() (*DefaultScaleSettings, bool) + AsTargetUtilizationScaleSettings() (*TargetUtilizationScaleSettings, bool) + AsOnlineScaleSettings() (*OnlineScaleSettings, bool) +} + +// OnlineScaleSettings online deployment scaling configuration. +type OnlineScaleSettings struct { + // ScaleType - Possible values include: 'ScaleTypeOnlineScaleSettings', 'ScaleTypeDefault', 'ScaleTypeTargetUtilization' + 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(ScaleTypeDefault): + var dss DefaultScaleSettings + err := json.Unmarshal(body, &dss) + return dss, err + case string(ScaleTypeTargetUtilization): + var tuss TargetUtilizationScaleSettings + err := json.Unmarshal(body, &tuss) + return tuss, 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.ScaleType != "" { + objectMap["scaleType"] = oss.ScaleType + } + return json.Marshal(objectMap) +} + +// AsDefaultScaleSettings is the BasicOnlineScaleSettings implementation for OnlineScaleSettings. +func (oss OnlineScaleSettings) AsDefaultScaleSettings() (*DefaultScaleSettings, bool) { + return nil, false +} + +// AsTargetUtilizationScaleSettings is the BasicOnlineScaleSettings implementation for OnlineScaleSettings. +func (oss OnlineScaleSettings) AsTargetUtilizationScaleSettings() (*TargetUtilizationScaleSettings, 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 +} + +// 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"` +} + +// BasicPartialAssetReferenceBase base definition for asset references. +type BasicPartialAssetReferenceBase interface { + AsPartialDataPathAssetReference() (*PartialDataPathAssetReference, bool) + AsPartialIDAssetReference() (*PartialIDAssetReference, bool) + AsPartialOutputPathAssetReference() (*PartialOutputPathAssetReference, bool) + AsPartialAssetReferenceBase() (*PartialAssetReferenceBase, bool) +} + +// PartialAssetReferenceBase base definition for asset references. +type PartialAssetReferenceBase struct { + // ReferenceType - Possible values include: 'ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypePartialAssetReferenceBase', 'ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeDataPath', 'ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeID', 'ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeOutputPath' + ReferenceType ReferenceTypeBasicPartialAssetReferenceBase `json:"referenceType,omitempty"` +} + +func unmarshalBasicPartialAssetReferenceBase(body []byte) (BasicPartialAssetReferenceBase, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["referenceType"] { + case string(ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeDataPath): + var pdpar PartialDataPathAssetReference + err := json.Unmarshal(body, &pdpar) + return pdpar, err + case string(ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeID): + var piar PartialIDAssetReference + err := json.Unmarshal(body, &piar) + return piar, err + case string(ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeOutputPath): + var popar PartialOutputPathAssetReference + err := json.Unmarshal(body, &popar) + return popar, err + default: + var parb PartialAssetReferenceBase + err := json.Unmarshal(body, &parb) + return parb, err + } +} +func unmarshalBasicPartialAssetReferenceBaseArray(body []byte) ([]BasicPartialAssetReferenceBase, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + parbArray := make([]BasicPartialAssetReferenceBase, len(rawMessages)) + + for index, rawMessage := range rawMessages { + parb, err := unmarshalBasicPartialAssetReferenceBase(*rawMessage) + if err != nil { + return nil, err + } + parbArray[index] = parb + } + return parbArray, nil +} + +// MarshalJSON is the custom marshaler for PartialAssetReferenceBase. +func (parb PartialAssetReferenceBase) MarshalJSON() ([]byte, error) { + parb.ReferenceType = ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypePartialAssetReferenceBase + objectMap := make(map[string]interface{}) + if parb.ReferenceType != "" { + objectMap["referenceType"] = parb.ReferenceType + } + return json.Marshal(objectMap) +} + +// AsPartialDataPathAssetReference is the BasicPartialAssetReferenceBase implementation for PartialAssetReferenceBase. +func (parb PartialAssetReferenceBase) AsPartialDataPathAssetReference() (*PartialDataPathAssetReference, bool) { + return nil, false +} + +// AsPartialIDAssetReference is the BasicPartialAssetReferenceBase implementation for PartialAssetReferenceBase. +func (parb PartialAssetReferenceBase) AsPartialIDAssetReference() (*PartialIDAssetReference, bool) { + return nil, false +} + +// AsPartialOutputPathAssetReference is the BasicPartialAssetReferenceBase implementation for PartialAssetReferenceBase. +func (parb PartialAssetReferenceBase) AsPartialOutputPathAssetReference() (*PartialOutputPathAssetReference, bool) { + return nil, false +} + +// AsPartialAssetReferenceBase is the BasicPartialAssetReferenceBase implementation for PartialAssetReferenceBase. +func (parb PartialAssetReferenceBase) AsPartialAssetReferenceBase() (*PartialAssetReferenceBase, bool) { + return &parb, true +} + +// AsBasicPartialAssetReferenceBase is the BasicPartialAssetReferenceBase implementation for PartialAssetReferenceBase. +func (parb PartialAssetReferenceBase) AsBasicPartialAssetReferenceBase() (BasicPartialAssetReferenceBase, bool) { + return &parb, true +} + +// PartialBatchDeployment mutable batch inference settings per deployment. +type PartialBatchDeployment struct { + // CodeConfiguration - Code configuration for the endpoint deployment. + CodeConfiguration *PartialCodeConfiguration `json:"codeConfiguration,omitempty"` + // Compute - Compute binding definition. + Compute *string `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"` + // MaxConcurrencyPerInstance - Indicates number of processes per instance + MaxConcurrencyPerInstance *int32 `json:"maxConcurrencyPerInstance,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 BasicPartialAssetReferenceBase `json:"model,omitempty"` + // OutputAction - Indicates how the output will be organized. Possible values include: 'SummaryOnly', 'AppendRow' + OutputAction BatchOutputAction `json:"outputAction,omitempty"` + // OutputFileName - Customized output file name for append_row output action. + OutputFileName *string `json:"outputFileName,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 *PartialBatchRetrySettings `json:"retrySettings,omitempty"` +} + +// MarshalJSON is the custom marshaler for PartialBatchDeployment. +func (pbd PartialBatchDeployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pbd.CodeConfiguration != nil { + objectMap["codeConfiguration"] = pbd.CodeConfiguration + } + if pbd.Compute != nil { + objectMap["compute"] = pbd.Compute + } + if pbd.Description != nil { + objectMap["description"] = pbd.Description + } + if pbd.EnvironmentID != nil { + objectMap["environmentId"] = pbd.EnvironmentID + } + if pbd.EnvironmentVariables != nil { + objectMap["environmentVariables"] = pbd.EnvironmentVariables + } + if pbd.ErrorThreshold != nil { + objectMap["errorThreshold"] = pbd.ErrorThreshold + } + if pbd.LoggingLevel != "" { + objectMap["loggingLevel"] = pbd.LoggingLevel + } + if pbd.MaxConcurrencyPerInstance != nil { + objectMap["maxConcurrencyPerInstance"] = pbd.MaxConcurrencyPerInstance + } + if pbd.MiniBatchSize != nil { + objectMap["miniBatchSize"] = pbd.MiniBatchSize + } + objectMap["model"] = pbd.Model + if pbd.OutputAction != "" { + objectMap["outputAction"] = pbd.OutputAction + } + if pbd.OutputFileName != nil { + objectMap["outputFileName"] = pbd.OutputFileName + } + if pbd.Properties != nil { + objectMap["properties"] = pbd.Properties + } + if pbd.RetrySettings != nil { + objectMap["retrySettings"] = pbd.RetrySettings + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PartialBatchDeployment struct. +func (pbd *PartialBatchDeployment) 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 PartialCodeConfiguration + err = json.Unmarshal(*v, &codeConfiguration) + if err != nil { + return err + } + pbd.CodeConfiguration = &codeConfiguration + } + case "compute": + if v != nil { + var compute string + err = json.Unmarshal(*v, &compute) + if err != nil { + return err + } + pbd.Compute = &compute + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + pbd.Description = &description + } + case "environmentId": + if v != nil { + var environmentID string + err = json.Unmarshal(*v, &environmentID) + if err != nil { + return err + } + pbd.EnvironmentID = &environmentID + } + case "environmentVariables": + if v != nil { + var environmentVariables map[string]*string + err = json.Unmarshal(*v, &environmentVariables) + if err != nil { + return err + } + pbd.EnvironmentVariables = environmentVariables + } + case "errorThreshold": + if v != nil { + var errorThreshold int32 + err = json.Unmarshal(*v, &errorThreshold) + if err != nil { + return err + } + pbd.ErrorThreshold = &errorThreshold + } + case "loggingLevel": + if v != nil { + var loggingLevel BatchLoggingLevel + err = json.Unmarshal(*v, &loggingLevel) + if err != nil { + return err + } + pbd.LoggingLevel = loggingLevel + } + case "maxConcurrencyPerInstance": + if v != nil { + var maxConcurrencyPerInstance int32 + err = json.Unmarshal(*v, &maxConcurrencyPerInstance) + if err != nil { + return err + } + pbd.MaxConcurrencyPerInstance = &maxConcurrencyPerInstance + } + case "miniBatchSize": + if v != nil { + var miniBatchSize int64 + err = json.Unmarshal(*v, &miniBatchSize) + if err != nil { + return err + } + pbd.MiniBatchSize = &miniBatchSize + } + case "model": + if v != nil { + model, err := unmarshalBasicPartialAssetReferenceBase(*v) + if err != nil { + return err + } + pbd.Model = model + } + case "outputAction": + if v != nil { + var outputAction BatchOutputAction + err = json.Unmarshal(*v, &outputAction) + if err != nil { + return err + } + pbd.OutputAction = outputAction + } + case "outputFileName": + if v != nil { + var outputFileName string + err = json.Unmarshal(*v, &outputFileName) + if err != nil { + return err + } + pbd.OutputFileName = &outputFileName + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + pbd.Properties = properties + } + case "retrySettings": + if v != nil { + var retrySettings PartialBatchRetrySettings + err = json.Unmarshal(*v, &retrySettings) + if err != nil { + return err + } + pbd.RetrySettings = &retrySettings + } + } + } + + return nil +} + +// PartialBatchDeploymentPartialTrackedResource strictly used in update requests. +type PartialBatchDeploymentPartialTrackedResource struct { + // Identity - Managed service identity (system assigned and/or user assigned identities) + Identity *PartialManagedServiceIdentity `json:"identity,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Location - The geo-location where the resource lives. + Location *string `json:"location,omitempty"` + // Properties - Additional attributes of the entity. + Properties *PartialBatchDeployment `json:"properties,omitempty"` + // Sku - Sku details required for ARM contract for Autoscaling. + Sku *PartialSku `json:"sku,omitempty"` + // Tags - Resource tags. + 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.Sku != nil { + objectMap["sku"] = pbdptr.Sku + } + if pbdptr.Tags != nil { + objectMap["tags"] = pbdptr.Tags + } + return json.Marshal(objectMap) +} + +// PartialBatchEndpoint mutable Batch endpoint configuration +type PartialBatchEndpoint struct { + // Defaults - Default values for Batch Endpoint + Defaults *BatchEndpointDefaults `json:"defaults,omitempty"` +} + +// PartialBatchEndpointPartialTrackedResource strictly used in update requests. +type PartialBatchEndpointPartialTrackedResource struct { + // Identity - Managed service identity (system assigned and/or user assigned identities) + Identity *PartialManagedServiceIdentity `json:"identity,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Location - The geo-location where the resource lives. + Location *string `json:"location,omitempty"` + // Properties - Additional attributes of the entity. + Properties *PartialBatchEndpoint `json:"properties,omitempty"` + // Sku - Sku details required for ARM contract for Autoscaling. + Sku *PartialSku `json:"sku,omitempty"` + // Tags - Resource tags. + 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.Sku != nil { + objectMap["sku"] = pbeptr.Sku + } + if pbeptr.Tags != nil { + objectMap["tags"] = pbeptr.Tags + } + return json.Marshal(objectMap) +} + +// PartialBatchRetrySettings retry settings for a batch inference operation. +type PartialBatchRetrySettings 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"` +} + +// PartialCodeConfiguration configuration for a scoring code asset. +type PartialCodeConfiguration 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"` +} + +// PartialDataPathAssetReference reference to an asset via its path in a datastore. +type PartialDataPathAssetReference 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: 'ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypePartialAssetReferenceBase', 'ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeDataPath', 'ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeID', 'ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeOutputPath' + ReferenceType ReferenceTypeBasicPartialAssetReferenceBase `json:"referenceType,omitempty"` +} + +// MarshalJSON is the custom marshaler for PartialDataPathAssetReference. +func (pdpar PartialDataPathAssetReference) MarshalJSON() ([]byte, error) { + pdpar.ReferenceType = ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeDataPath + objectMap := make(map[string]interface{}) + if pdpar.DatastoreID != nil { + objectMap["datastoreId"] = pdpar.DatastoreID + } + if pdpar.Path != nil { + objectMap["path"] = pdpar.Path + } + if pdpar.ReferenceType != "" { + objectMap["referenceType"] = pdpar.ReferenceType + } + return json.Marshal(objectMap) +} + +// AsPartialDataPathAssetReference is the BasicPartialAssetReferenceBase implementation for PartialDataPathAssetReference. +func (pdpar PartialDataPathAssetReference) AsPartialDataPathAssetReference() (*PartialDataPathAssetReference, bool) { + return &pdpar, true +} + +// AsPartialIDAssetReference is the BasicPartialAssetReferenceBase implementation for PartialDataPathAssetReference. +func (pdpar PartialDataPathAssetReference) AsPartialIDAssetReference() (*PartialIDAssetReference, bool) { + return nil, false +} + +// AsPartialOutputPathAssetReference is the BasicPartialAssetReferenceBase implementation for PartialDataPathAssetReference. +func (pdpar PartialDataPathAssetReference) AsPartialOutputPathAssetReference() (*PartialOutputPathAssetReference, bool) { + return nil, false +} + +// AsPartialAssetReferenceBase is the BasicPartialAssetReferenceBase implementation for PartialDataPathAssetReference. +func (pdpar PartialDataPathAssetReference) AsPartialAssetReferenceBase() (*PartialAssetReferenceBase, bool) { + return nil, false +} + +// AsBasicPartialAssetReferenceBase is the BasicPartialAssetReferenceBase implementation for PartialDataPathAssetReference. +func (pdpar PartialDataPathAssetReference) AsBasicPartialAssetReferenceBase() (BasicPartialAssetReferenceBase, bool) { + return &pdpar, true +} + +// PartialIDAssetReference reference to an asset via its ARM resource ID. +type PartialIDAssetReference struct { + // AssetID - ARM resource ID of the asset. + AssetID *string `json:"assetId,omitempty"` + // ReferenceType - Possible values include: 'ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypePartialAssetReferenceBase', 'ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeDataPath', 'ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeID', 'ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeOutputPath' + ReferenceType ReferenceTypeBasicPartialAssetReferenceBase `json:"referenceType,omitempty"` +} + +// MarshalJSON is the custom marshaler for PartialIDAssetReference. +func (piar PartialIDAssetReference) MarshalJSON() ([]byte, error) { + piar.ReferenceType = ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeID + objectMap := make(map[string]interface{}) + if piar.AssetID != nil { + objectMap["assetId"] = piar.AssetID + } + if piar.ReferenceType != "" { + objectMap["referenceType"] = piar.ReferenceType + } + return json.Marshal(objectMap) +} + +// AsPartialDataPathAssetReference is the BasicPartialAssetReferenceBase implementation for PartialIDAssetReference. +func (piar PartialIDAssetReference) AsPartialDataPathAssetReference() (*PartialDataPathAssetReference, bool) { + return nil, false +} + +// AsPartialIDAssetReference is the BasicPartialAssetReferenceBase implementation for PartialIDAssetReference. +func (piar PartialIDAssetReference) AsPartialIDAssetReference() (*PartialIDAssetReference, bool) { + return &piar, true +} + +// AsPartialOutputPathAssetReference is the BasicPartialAssetReferenceBase implementation for PartialIDAssetReference. +func (piar PartialIDAssetReference) AsPartialOutputPathAssetReference() (*PartialOutputPathAssetReference, bool) { + return nil, false +} + +// AsPartialAssetReferenceBase is the BasicPartialAssetReferenceBase implementation for PartialIDAssetReference. +func (piar PartialIDAssetReference) AsPartialAssetReferenceBase() (*PartialAssetReferenceBase, bool) { + return nil, false +} + +// AsBasicPartialAssetReferenceBase is the BasicPartialAssetReferenceBase implementation for PartialIDAssetReference. +func (piar PartialIDAssetReference) AsBasicPartialAssetReferenceBase() (BasicPartialAssetReferenceBase, bool) { + return &piar, true +} + +// PartialKubernetesOnlineDeployment properties specific to a KubernetesOnlineDeployment. +type PartialKubernetesOnlineDeployment struct { + // EndpointComputeType - Possible values include: 'EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypePartialOnlineDeployment', 'EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeKubernetes', 'EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeManaged' + EndpointComputeType EndpointComputeTypeBasicPartialOnlineDeployment `json:"endpointComputeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for PartialKubernetesOnlineDeployment. +func (pkod PartialKubernetesOnlineDeployment) MarshalJSON() ([]byte, error) { + pkod.EndpointComputeType = EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeKubernetes + objectMap := make(map[string]interface{}) + if pkod.EndpointComputeType != "" { + objectMap["endpointComputeType"] = pkod.EndpointComputeType + } + return json.Marshal(objectMap) +} + +// AsPartialKubernetesOnlineDeployment is the BasicPartialOnlineDeployment implementation for PartialKubernetesOnlineDeployment. +func (pkod PartialKubernetesOnlineDeployment) AsPartialKubernetesOnlineDeployment() (*PartialKubernetesOnlineDeployment, bool) { + return &pkod, true +} + +// AsPartialManagedOnlineDeployment is the BasicPartialOnlineDeployment implementation for PartialKubernetesOnlineDeployment. +func (pkod PartialKubernetesOnlineDeployment) AsPartialManagedOnlineDeployment() (*PartialManagedOnlineDeployment, bool) { + return nil, false +} + +// AsPartialOnlineDeployment is the BasicPartialOnlineDeployment implementation for PartialKubernetesOnlineDeployment. +func (pkod PartialKubernetesOnlineDeployment) AsPartialOnlineDeployment() (*PartialOnlineDeployment, bool) { + return nil, false +} + +// AsBasicPartialOnlineDeployment is the BasicPartialOnlineDeployment implementation for PartialKubernetesOnlineDeployment. +func (pkod PartialKubernetesOnlineDeployment) AsBasicPartialOnlineDeployment() (BasicPartialOnlineDeployment, bool) { + return &pkod, true +} + +// PartialManagedOnlineDeployment properties specific to a ManagedOnlineDeployment. +type PartialManagedOnlineDeployment struct { + // EndpointComputeType - Possible values include: 'EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypePartialOnlineDeployment', 'EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeKubernetes', '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.EndpointComputeType != "" { + objectMap["endpointComputeType"] = pmod.EndpointComputeType + } + return json.Marshal(objectMap) +} + +// AsPartialKubernetesOnlineDeployment is the BasicPartialOnlineDeployment implementation for PartialManagedOnlineDeployment. +func (pmod PartialManagedOnlineDeployment) AsPartialKubernetesOnlineDeployment() (*PartialKubernetesOnlineDeployment, 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 +} + +// PartialManagedServiceIdentity managed service identity (system assigned and/or user assigned identities) +type PartialManagedServiceIdentity struct { + // Type - Managed service identity (system assigned and/or user assigned identities). Possible values include: 'ManagedServiceIdentityTypeNone', 'ManagedServiceIdentityTypeSystemAssigned', 'ManagedServiceIdentityTypeUserAssigned', 'ManagedServiceIdentityTypeSystemAssignedUserAssigned' + Type ManagedServiceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. + UserAssignedIdentities map[string]interface{} `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for PartialManagedServiceIdentity. +func (pmsi PartialManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pmsi.Type != "" { + objectMap["type"] = pmsi.Type + } + if pmsi.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = pmsi.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// BasicPartialOnlineDeployment mutable online deployment configuration +type BasicPartialOnlineDeployment interface { + AsPartialKubernetesOnlineDeployment() (*PartialKubernetesOnlineDeployment, bool) + AsPartialManagedOnlineDeployment() (*PartialManagedOnlineDeployment, bool) + AsPartialOnlineDeployment() (*PartialOnlineDeployment, bool) +} + +// PartialOnlineDeployment mutable online deployment configuration +type PartialOnlineDeployment struct { + // EndpointComputeType - Possible values include: 'EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypePartialOnlineDeployment', 'EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeKubernetes', '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(EndpointComputeTypeBasicPartialOnlineDeploymentEndpointComputeTypeKubernetes): + var pkod PartialKubernetesOnlineDeployment + err := json.Unmarshal(body, &pkod) + return pkod, 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.EndpointComputeType != "" { + objectMap["endpointComputeType"] = pod.EndpointComputeType + } + return json.Marshal(objectMap) +} + +// AsPartialKubernetesOnlineDeployment is the BasicPartialOnlineDeployment implementation for PartialOnlineDeployment. +func (pod PartialOnlineDeployment) AsPartialKubernetesOnlineDeployment() (*PartialKubernetesOnlineDeployment, 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 +} + +// PartialOnlineDeploymentPartialTrackedResource strictly used in update requests. +type PartialOnlineDeploymentPartialTrackedResource struct { + // Identity - Managed service identity (system assigned and/or user assigned identities) + Identity *PartialManagedServiceIdentity `json:"identity,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Location - The geo-location where the resource lives. + Location *string `json:"location,omitempty"` + // Properties - Additional attributes of the entity. + Properties BasicPartialOnlineDeployment `json:"properties,omitempty"` + // Sku - Sku details required for ARM contract for Autoscaling. + Sku *PartialSku `json:"sku,omitempty"` + // Tags - Resource tags. + 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.Sku != nil { + objectMap["sku"] = podptr.Sku + } + 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 PartialManagedServiceIdentity + 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 "sku": + if v != nil { + var sku PartialSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + podptr.Sku = &sku + } + 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 { + // MirrorTraffic - Percentage of traffic to be mirrored to each deployment without using returned scoring. Traffic values need to sum to utmost 50. + MirrorTraffic map[string]*int32 `json:"mirrorTraffic"` + // PublicNetworkAccess - Set to "Enabled" for endpoints that should allow public access when Private Link is enabled. Possible values include: 'PublicNetworkAccessTypeEnabled', 'PublicNetworkAccessTypeDisabled' + PublicNetworkAccess PublicNetworkAccessType `json:"publicNetworkAccess,omitempty"` + // Traffic - Percentage of traffic from endpoint to divert to each deployment. Traffic values need to sum to 100. + 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.MirrorTraffic != nil { + objectMap["mirrorTraffic"] = poe.MirrorTraffic + } + if poe.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = poe.PublicNetworkAccess + } + if poe.Traffic != nil { + objectMap["traffic"] = poe.Traffic + } + return json.Marshal(objectMap) +} + +// PartialOnlineEndpointPartialTrackedResource strictly used in update requests. +type PartialOnlineEndpointPartialTrackedResource struct { + // Identity - Managed service identity (system assigned and/or user assigned identities) + Identity *PartialManagedServiceIdentity `json:"identity,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. + Kind *string `json:"kind,omitempty"` + // Location - The geo-location where the resource lives. + Location *string `json:"location,omitempty"` + // Properties - Additional attributes of the entity. + Properties *PartialOnlineEndpoint `json:"properties,omitempty"` + // Sku - Sku details required for ARM contract for Autoscaling. + Sku *PartialSku `json:"sku,omitempty"` + // Tags - Resource tags. + 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.Sku != nil { + objectMap["sku"] = poeptr.Sku + } + if poeptr.Tags != nil { + objectMap["tags"] = poeptr.Tags + } + return json.Marshal(objectMap) +} + +// PartialOutputPathAssetReference reference to an asset via its path in a job output. +type PartialOutputPathAssetReference 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: 'ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypePartialAssetReferenceBase', 'ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeDataPath', 'ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeID', 'ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeOutputPath' + ReferenceType ReferenceTypeBasicPartialAssetReferenceBase `json:"referenceType,omitempty"` +} + +// MarshalJSON is the custom marshaler for PartialOutputPathAssetReference. +func (popar PartialOutputPathAssetReference) MarshalJSON() ([]byte, error) { + popar.ReferenceType = ReferenceTypeBasicPartialAssetReferenceBaseReferenceTypeOutputPath + objectMap := make(map[string]interface{}) + if popar.JobID != nil { + objectMap["jobId"] = popar.JobID + } + if popar.Path != nil { + objectMap["path"] = popar.Path + } + if popar.ReferenceType != "" { + objectMap["referenceType"] = popar.ReferenceType + } + return json.Marshal(objectMap) +} + +// AsPartialDataPathAssetReference is the BasicPartialAssetReferenceBase implementation for PartialOutputPathAssetReference. +func (popar PartialOutputPathAssetReference) AsPartialDataPathAssetReference() (*PartialDataPathAssetReference, bool) { + return nil, false +} + +// AsPartialIDAssetReference is the BasicPartialAssetReferenceBase implementation for PartialOutputPathAssetReference. +func (popar PartialOutputPathAssetReference) AsPartialIDAssetReference() (*PartialIDAssetReference, bool) { + return nil, false +} + +// AsPartialOutputPathAssetReference is the BasicPartialAssetReferenceBase implementation for PartialOutputPathAssetReference. +func (popar PartialOutputPathAssetReference) AsPartialOutputPathAssetReference() (*PartialOutputPathAssetReference, bool) { + return &popar, true +} + +// AsPartialAssetReferenceBase is the BasicPartialAssetReferenceBase implementation for PartialOutputPathAssetReference. +func (popar PartialOutputPathAssetReference) AsPartialAssetReferenceBase() (*PartialAssetReferenceBase, bool) { + return nil, false +} + +// AsBasicPartialAssetReferenceBase is the BasicPartialAssetReferenceBase implementation for PartialOutputPathAssetReference. +func (popar PartialOutputPathAssetReference) AsBasicPartialAssetReferenceBase() (BasicPartialAssetReferenceBase, bool) { + return &popar, true +} + +// PartialSku common SKU definition. +type PartialSku struct { + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code. + Name *string `json:"name,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` +} + +// 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"` +} + +// PipelineJob pipeline Job definition: defines generic to MFE attributes. +type PipelineJob struct { + // Inputs - Inputs for the pipeline job. + Inputs map[string]BasicJobInput `json:"inputs"` + // Jobs - Jobs construct the Pipeline Job. + Jobs map[string]interface{} `json:"jobs"` + // Outputs - Outputs for the pipeline job + Outputs map[string]BasicJobOutput `json:"outputs"` + // Settings - Pipeline settings, for things like ContinueRunOnStepFailure etc. + Settings interface{} `json:"settings,omitempty"` + // ComputeID - ARM resource ID of the compute resource. + ComputeID *string `json:"computeId,omitempty"` + // DisplayName - Display name of job. + DisplayName *string `json:"displayName,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, UserIdentity or null. + // Defaults to AmlToken if null. + Identity BasicIdentityConfiguration `json:"identity,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // Schedule - Schedule definition of job. + // If no schedule is provided, the job is run once and immediately after submission. + Schedule BasicScheduleBase `json:"schedule,omitempty"` + // Services - List of JobEndpoints. + // For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + Services map[string]*JobService `json:"services"` + // Status - READ-ONLY; Status of the job. Possible values include: 'JobStatusNotStarted', 'JobStatusStarting', 'JobStatusProvisioning', 'JobStatusPreparing', 'JobStatusQueued', 'JobStatusRunning', 'JobStatusFinalizing', 'JobStatusCancelRequested', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusCanceled', 'JobStatusNotResponding', 'JobStatusPaused', 'JobStatusUnknown', 'JobStatusScheduled' + Status JobStatus `json:"status,omitempty"` + // JobType - Possible values include: 'JobTypeJobBase', 'JobTypeAutoML1', 'JobTypeCommand1', 'JobTypePipeline1', 'JobTypeSweep1' + JobType JobTypeBasicJobBase `json:"jobType,omitempty"` + // 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 PipelineJob. +func (pj PipelineJob) MarshalJSON() ([]byte, error) { + pj.JobType = JobTypePipeline1 + objectMap := make(map[string]interface{}) + if pj.Inputs != nil { + objectMap["inputs"] = pj.Inputs + } + if pj.Jobs != nil { + objectMap["jobs"] = pj.Jobs + } + if pj.Outputs != nil { + objectMap["outputs"] = pj.Outputs + } + if pj.Settings != nil { + objectMap["settings"] = pj.Settings + } + if pj.ComputeID != nil { + objectMap["computeId"] = pj.ComputeID + } + if pj.DisplayName != nil { + objectMap["displayName"] = pj.DisplayName + } + if pj.ExperimentName != nil { + objectMap["experimentName"] = pj.ExperimentName + } + objectMap["identity"] = pj.Identity + if pj.IsArchived != nil { + objectMap["isArchived"] = pj.IsArchived + } + objectMap["schedule"] = pj.Schedule + if pj.Services != nil { + objectMap["services"] = pj.Services + } + if pj.JobType != "" { + objectMap["jobType"] = pj.JobType + } + if pj.Description != nil { + objectMap["description"] = pj.Description + } + if pj.Properties != nil { + objectMap["properties"] = pj.Properties + } + if pj.Tags != nil { + objectMap["tags"] = pj.Tags + } + return json.Marshal(objectMap) +} + +// AsAutoMLJob is the BasicJobBase implementation for PipelineJob. +func (pj PipelineJob) AsAutoMLJob() (*AutoMLJob, bool) { + return nil, false +} + +// AsCommandJob is the BasicJobBase implementation for PipelineJob. +func (pj PipelineJob) AsCommandJob() (*CommandJob, bool) { + return nil, false +} + +// AsPipelineJob is the BasicJobBase implementation for PipelineJob. +func (pj PipelineJob) AsPipelineJob() (*PipelineJob, bool) { + return &pj, true +} + +// AsSweepJob is the BasicJobBase implementation for PipelineJob. +func (pj PipelineJob) AsSweepJob() (*SweepJob, bool) { + return nil, false +} + +// AsJobBase is the BasicJobBase implementation for PipelineJob. +func (pj PipelineJob) AsJobBase() (*JobBase, bool) { + return nil, false +} + +// AsBasicJobBase is the BasicJobBase implementation for PipelineJob. +func (pj PipelineJob) AsBasicJobBase() (BasicJobBase, bool) { + return &pj, true +} + +// UnmarshalJSON is the custom unmarshaler for PipelineJob struct. +func (pj *PipelineJob) 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 "inputs": + if v != nil { + var inputs map[string]BasicJobInput + err = json.Unmarshal(*v, &inputs) + if err != nil { + return err + } + pj.Inputs = inputs + } + case "jobs": + if v != nil { + var jobs map[string]interface{} + err = json.Unmarshal(*v, &jobs) + if err != nil { + return err + } + pj.Jobs = jobs + } + case "outputs": + if v != nil { + var outputs map[string]BasicJobOutput + err = json.Unmarshal(*v, &outputs) + if err != nil { + return err + } + pj.Outputs = outputs + } + case "settings": + if v != nil { + var settings interface{} + err = json.Unmarshal(*v, &settings) + if err != nil { + return err + } + pj.Settings = settings + } + case "computeId": + if v != nil { + var computeID string + err = json.Unmarshal(*v, &computeID) + if err != nil { + return err + } + pj.ComputeID = &computeID + } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + pj.DisplayName = &displayName + } + case "experimentName": + if v != nil { + var experimentName string + err = json.Unmarshal(*v, &experimentName) + if err != nil { + return err + } + pj.ExperimentName = &experimentName + } + case "identity": + if v != nil { + identity, err := unmarshalBasicIdentityConfiguration(*v) + if err != nil { + return err + } + pj.Identity = identity + } + case "isArchived": + if v != nil { + var isArchived bool + err = json.Unmarshal(*v, &isArchived) + if err != nil { + return err + } + pj.IsArchived = &isArchived + } + case "schedule": + if v != nil { + schedule, err := unmarshalBasicScheduleBase(*v) + if err != nil { + return err + } + pj.Schedule = schedule + } + case "services": + if v != nil { + var services map[string]*JobService + err = json.Unmarshal(*v, &services) + if err != nil { + return err + } + pj.Services = services + } + case "status": + if v != nil { + var status JobStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + pj.Status = status + } + case "jobType": + if v != nil { + var jobType JobTypeBasicJobBase + err = json.Unmarshal(*v, &jobType) + if err != nil { + return err + } + pj.JobType = jobType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + pj.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + pj.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pj.Tags = tags + } + } + } + + return nil +} + +// Plan plan for the resource. +type Plan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,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 *ManagedServiceIdentity `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"` + // 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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 + } + 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 ManagedServiceIdentity + 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 "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 + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + pec.SystemData = &systemData + } + } + } + + 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 *ManagedServiceIdentity `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"` + // 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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 + } + 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 ManagedServiceIdentity + 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 "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 + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + plr.SystemData = &systemData + } + } + } + + 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 deployment container liveness/readiness probe configuration. +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"` +} + +// 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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 { + // ProcessCountPerInstance - Number of processes per node. + ProcessCountPerInstance *int32 `json:"processCountPerInstance,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.ProcessCountPerInstance != nil { + objectMap["processCountPerInstance"] = pt.ProcessCountPerInstance + } + 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"` +} + +// RandomSamplingAlgorithm defines a Sampling Algorithm that generates values randomly +type RandomSamplingAlgorithm struct { + // Rule - The specific type of random algorithm. Possible values include: 'Random', 'Sobol' + Rule RandomSamplingAlgorithmRule `json:"rule,omitempty"` + // Seed - An optional integer to use as the seed for random number generation + Seed *int32 `json:"seed,omitempty"` + // SamplingAlgorithmType - Possible values include: 'SamplingAlgorithmTypeSamplingAlgorithm', 'SamplingAlgorithmTypeBayesian1', 'SamplingAlgorithmTypeGrid1', 'SamplingAlgorithmTypeRandom1' + SamplingAlgorithmType SamplingAlgorithmTypeBasicSamplingAlgorithm `json:"samplingAlgorithmType,omitempty"` +} + +// MarshalJSON is the custom marshaler for RandomSamplingAlgorithm. +func (rsaVar RandomSamplingAlgorithm) MarshalJSON() ([]byte, error) { + rsaVar.SamplingAlgorithmType = SamplingAlgorithmTypeRandom1 + objectMap := make(map[string]interface{}) + if rsaVar.Rule != "" { + objectMap["rule"] = rsaVar.Rule + } + if rsaVar.Seed != nil { + objectMap["seed"] = rsaVar.Seed + } + if rsaVar.SamplingAlgorithmType != "" { + objectMap["samplingAlgorithmType"] = rsaVar.SamplingAlgorithmType + } + return json.Marshal(objectMap) +} + +// AsBayesianSamplingAlgorithm is the BasicSamplingAlgorithm implementation for RandomSamplingAlgorithm. +func (rsaVar RandomSamplingAlgorithm) AsBayesianSamplingAlgorithm() (*BayesianSamplingAlgorithm, bool) { + return nil, false +} + +// AsGridSamplingAlgorithm is the BasicSamplingAlgorithm implementation for RandomSamplingAlgorithm. +func (rsaVar RandomSamplingAlgorithm) AsGridSamplingAlgorithm() (*GridSamplingAlgorithm, bool) { + return nil, false +} + +// AsRandomSamplingAlgorithm is the BasicSamplingAlgorithm implementation for RandomSamplingAlgorithm. +func (rsaVar RandomSamplingAlgorithm) AsRandomSamplingAlgorithm() (*RandomSamplingAlgorithm, bool) { + return &rsaVar, true +} + +// AsSamplingAlgorithm is the BasicSamplingAlgorithm implementation for RandomSamplingAlgorithm. +func (rsaVar RandomSamplingAlgorithm) AsSamplingAlgorithm() (*SamplingAlgorithm, bool) { + return nil, false +} + +// AsBasicSamplingAlgorithm is the BasicSamplingAlgorithm implementation for RandomSamplingAlgorithm. +func (rsaVar RandomSamplingAlgorithm) AsBasicSamplingAlgorithm() (BasicSamplingAlgorithm, bool) { + return &rsaVar, true +} + +// RecurrencePattern recurrence schedule pattern definition +type RecurrencePattern struct { + // Hours - [Required] List of hours for recurrence schedule pattern + Hours *[]int32 `json:"hours,omitempty"` + // Minutes - [Required] List of minutes for recurrence schedule pattern + Minutes *[]int32 `json:"minutes,omitempty"` + // Weekdays - List of weekdays for recurrence schedule pattern + Weekdays *[]Weekday `json:"weekdays,omitempty"` +} + +// RecurrenceSchedule recurrence schedule definition +type RecurrenceSchedule struct { + // Frequency - [Required] Specifies frequency with with which to trigger schedule. Possible values include: 'Minute', 'Hour', 'Day', 'Week', 'Month' + Frequency RecurrenceFrequency `json:"frequency,omitempty"` + // Interval - [Required] Specifies schedule interval in conjunction with frequency + Interval *int32 `json:"interval,omitempty"` + // Pattern - Specifies the recurrence schedule pattern + Pattern *RecurrencePattern `json:"pattern,omitempty"` + // EndTime - Specifies end time of schedule in ISO 8601 format. + // If not present, the schedule will run indefinitely + EndTime *date.Time `json:"endTime,omitempty"` + // ScheduleStatus - Specifies the schedule's status. Possible values include: 'ScheduleStatusEnabled', 'ScheduleStatusDisabled' + ScheduleStatus ScheduleStatus `json:"scheduleStatus,omitempty"` + // StartTime - Specifies start time of schedule in ISO 8601 format. + StartTime *date.Time `json:"startTime,omitempty"` + // TimeZone - Specifies time zone in which the schedule runs. + // TimeZone should follow Windows time zone format. + TimeZone *string `json:"timeZone,omitempty"` + // ScheduleType - Possible values include: 'ScheduleTypeScheduleBase', 'ScheduleTypeRecurrence', 'ScheduleTypeCron' + ScheduleType ScheduleTypeBasicScheduleBase `json:"scheduleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for RecurrenceSchedule. +func (rs RecurrenceSchedule) MarshalJSON() ([]byte, error) { + rs.ScheduleType = ScheduleTypeRecurrence + objectMap := make(map[string]interface{}) + if rs.Frequency != "" { + objectMap["frequency"] = rs.Frequency + } + if rs.Interval != nil { + objectMap["interval"] = rs.Interval + } + if rs.Pattern != nil { + objectMap["pattern"] = rs.Pattern + } + if rs.EndTime != nil { + objectMap["endTime"] = rs.EndTime + } + if rs.ScheduleStatus != "" { + objectMap["scheduleStatus"] = rs.ScheduleStatus + } + if rs.StartTime != nil { + objectMap["startTime"] = rs.StartTime + } + if rs.TimeZone != nil { + objectMap["timeZone"] = rs.TimeZone + } + if rs.ScheduleType != "" { + objectMap["scheduleType"] = rs.ScheduleType + } + return json.Marshal(objectMap) +} + +// AsRecurrenceSchedule is the BasicScheduleBase implementation for RecurrenceSchedule. +func (rs RecurrenceSchedule) AsRecurrenceSchedule() (*RecurrenceSchedule, bool) { + return &rs, true +} + +// AsCronSchedule is the BasicScheduleBase implementation for RecurrenceSchedule. +func (rs RecurrenceSchedule) AsCronSchedule() (*CronSchedule, bool) { + return nil, false +} + +// AsScheduleBase is the BasicScheduleBase implementation for RecurrenceSchedule. +func (rs RecurrenceSchedule) AsScheduleBase() (*ScheduleBase, bool) { + return nil, false +} + +// AsBasicScheduleBase is the BasicScheduleBase implementation for RecurrenceSchedule. +func (rs RecurrenceSchedule) AsBasicScheduleBase() (BasicScheduleBase, bool) { + return &rs, true +} + +// RegenerateEndpointKeysRequest ... +type RegenerateEndpointKeysRequest struct { + // KeyType - [Required] 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) +} + +// Regression regression task in AutoML Table vertical. +type Regression struct { + // DataSettings - Data inputs for AutoMLJob. + DataSettings *TableVerticalDataSettings `json:"dataSettings,omitempty"` + // FeaturizationSettings - Featurization inputs needed for AutoML job. + FeaturizationSettings *TableVerticalFeaturizationSettings `json:"featurizationSettings,omitempty"` + // LimitSettings - Execution constraints for AutoMLJob. + LimitSettings *TableVerticalLimitSettings `json:"limitSettings,omitempty"` + // TrainingSettings - Inputs for training phase for an AutoML Job. + TrainingSettings *TrainingSettings `json:"trainingSettings,omitempty"` + // LogVerbosity - Log verbosity for the job. Possible values include: 'LogVerbosityNotSet', 'LogVerbosityDebug', 'LogVerbosityInfo', 'LogVerbosityWarning', 'LogVerbosityError', 'LogVerbosityCritical' + LogVerbosity LogVerbosity `json:"logVerbosity,omitempty"` + // TaskType - [Required] Task type for AutoMLJob. Possible values include: 'TaskTypeClassification', 'TaskTypeRegression', 'TaskTypeForecasting', 'TaskTypeImageClassification', 'TaskTypeImageClassificationMultilabel', 'TaskTypeImageObjectDetection', 'TaskTypeImageInstanceSegmentation', 'TaskTypeTextClassification', 'TaskTypeTextClassificationMultilabel', 'TaskTypeTextNER' + TaskType TaskType `json:"taskType,omitempty"` + // AllowedModels - Allowed models for regression task. + AllowedModels *[]RegressionModels `json:"allowedModels,omitempty"` + // BlockedModels - Blocked models for regression task. + BlockedModels *[]RegressionModels `json:"blockedModels,omitempty"` + // PrimaryMetric - Primary metric for regression task. Possible values include: 'RegressionPrimaryMetricsSpearmanCorrelation', 'RegressionPrimaryMetricsNormalizedRootMeanSquaredError', 'RegressionPrimaryMetricsR2Score', 'RegressionPrimaryMetricsNormalizedMeanAbsoluteError' + PrimaryMetric RegressionPrimaryMetrics `json:"primaryMetric,omitempty"` +} + +// 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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceBase ... +type ResourceBase 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 ResourceBase. +func (rb ResourceBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rb.Description != nil { + objectMap["description"] = rb.Description + } + if rb.Properties != nil { + objectMap["properties"] = rb.Properties + } + if rb.Tags != nil { + objectMap["tags"] = rb.Tags + } + return json.Marshal(objectMap) +} + +// ResourceConfiguration ... +type ResourceConfiguration struct { + // InstanceCount - Optional number of instances or nodes used by the compute target. + InstanceCount *int32 `json:"instanceCount,omitempty"` + // InstanceType - Optional type of VM used as supported by the compute target. + InstanceType *string `json:"instanceType,omitempty"` + // Properties - Additional properties bag. + Properties map[string]interface{} `json:"properties"` +} + +// MarshalJSON is the custom marshaler for ResourceConfiguration. +func (rc ResourceConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rc.InstanceCount != nil { + objectMap["instanceCount"] = rc.InstanceCount + } + if rc.InstanceType != nil { + objectMap["instanceType"] = rc.InstanceType + } + if rc.Properties != nil { + objectMap["properties"] = rc.Properties + } + 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"` +} + +// ResourceModelWithAllowedPropertySet the resource model definition containing the full set of allowed +// properties for a resource. Except properties bag, there cannot be a top level property outside of this +// set. +type ResourceModelWithAllowedPropertySet struct { + // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. + ManagedBy *string `json:"managedBy,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` + Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` + Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` + Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet. +func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.ManagedBy != nil { + objectMap["managedBy"] = rmwaps.ManagedBy + } + if rmwaps.Kind != nil { + objectMap["kind"] = rmwaps.Kind + } + if rmwaps.Identity != nil { + objectMap["identity"] = rmwaps.Identity + } + if rmwaps.Sku != nil { + objectMap["sku"] = rmwaps.Sku + } + if rmwaps.Plan != nil { + objectMap["plan"] = rmwaps.Plan + } + if rmwaps.Tags != nil { + objectMap["tags"] = rmwaps.Tags + } + if rmwaps.Location != nil { + objectMap["location"] = rmwaps.Location + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetIdentity ... +type ResourceModelWithAllowedPropertySetIdentity 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: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySetIdentity. +func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.Type != "" { + objectMap["type"] = rmwaps.Type + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetPlan ... +type ResourceModelWithAllowedPropertySetPlan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// ResourceModelWithAllowedPropertySetSku ... +type ResourceModelWithAllowedPropertySetSku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// 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) +} + +// Route ... +type Route struct { + // Path - [Required] The path for the route. + Path *string `json:"path,omitempty"` + // Port - [Required] The port for the route. + Port *int32 `json:"port,omitempty"` +} + +// BasicSamplingAlgorithm the Sampling Algorithm used to generate hyperparameter values, along with properties to +// configure the algorithm +type BasicSamplingAlgorithm interface { + AsBayesianSamplingAlgorithm() (*BayesianSamplingAlgorithm, bool) + AsGridSamplingAlgorithm() (*GridSamplingAlgorithm, bool) + AsRandomSamplingAlgorithm() (*RandomSamplingAlgorithm, bool) + AsSamplingAlgorithm() (*SamplingAlgorithm, bool) +} + +// SamplingAlgorithm the Sampling Algorithm used to generate hyperparameter values, along with properties to +// configure the algorithm +type SamplingAlgorithm struct { + // SamplingAlgorithmType - Possible values include: 'SamplingAlgorithmTypeSamplingAlgorithm', 'SamplingAlgorithmTypeBayesian1', 'SamplingAlgorithmTypeGrid1', 'SamplingAlgorithmTypeRandom1' + SamplingAlgorithmType SamplingAlgorithmTypeBasicSamplingAlgorithm `json:"samplingAlgorithmType,omitempty"` +} + +func unmarshalBasicSamplingAlgorithm(body []byte) (BasicSamplingAlgorithm, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["samplingAlgorithmType"] { + case string(SamplingAlgorithmTypeBayesian1): + var bsa BayesianSamplingAlgorithm + err := json.Unmarshal(body, &bsa) + return bsa, err + case string(SamplingAlgorithmTypeGrid1): + var gsa GridSamplingAlgorithm + err := json.Unmarshal(body, &gsa) + return gsa, err + case string(SamplingAlgorithmTypeRandom1): + var rsaVar RandomSamplingAlgorithm + err := json.Unmarshal(body, &rsaVar) + return rsaVar, err + default: + var sa SamplingAlgorithm + err := json.Unmarshal(body, &sa) + return sa, err + } +} +func unmarshalBasicSamplingAlgorithmArray(body []byte) ([]BasicSamplingAlgorithm, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + saArray := make([]BasicSamplingAlgorithm, len(rawMessages)) + + for index, rawMessage := range rawMessages { + sa, err := unmarshalBasicSamplingAlgorithm(*rawMessage) + if err != nil { + return nil, err + } + saArray[index] = sa + } + return saArray, nil +} + +// MarshalJSON is the custom marshaler for SamplingAlgorithm. +func (sa SamplingAlgorithm) MarshalJSON() ([]byte, error) { + sa.SamplingAlgorithmType = SamplingAlgorithmTypeSamplingAlgorithm + objectMap := make(map[string]interface{}) + if sa.SamplingAlgorithmType != "" { + objectMap["samplingAlgorithmType"] = sa.SamplingAlgorithmType + } + return json.Marshal(objectMap) +} + +// AsBayesianSamplingAlgorithm is the BasicSamplingAlgorithm implementation for SamplingAlgorithm. +func (sa SamplingAlgorithm) AsBayesianSamplingAlgorithm() (*BayesianSamplingAlgorithm, bool) { + return nil, false +} + +// AsGridSamplingAlgorithm is the BasicSamplingAlgorithm implementation for SamplingAlgorithm. +func (sa SamplingAlgorithm) AsGridSamplingAlgorithm() (*GridSamplingAlgorithm, bool) { + return nil, false +} + +// AsRandomSamplingAlgorithm is the BasicSamplingAlgorithm implementation for SamplingAlgorithm. +func (sa SamplingAlgorithm) AsRandomSamplingAlgorithm() (*RandomSamplingAlgorithm, bool) { + return nil, false +} + +// AsSamplingAlgorithm is the BasicSamplingAlgorithm implementation for SamplingAlgorithm. +func (sa SamplingAlgorithm) AsSamplingAlgorithm() (*SamplingAlgorithm, bool) { + return &sa, true +} + +// AsBasicSamplingAlgorithm is the BasicSamplingAlgorithm implementation for SamplingAlgorithm. +func (sa SamplingAlgorithm) AsBasicSamplingAlgorithm() (BasicSamplingAlgorithm, bool) { + return &sa, true +} + +// SasDatastoreCredentials SAS datastore credentials configuration. +type SasDatastoreCredentials struct { + // Secrets - [Required] Storage container secrets. + Secrets *SasDatastoreSecrets `json:"secrets,omitempty"` + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey1', 'CredentialsTypeCertificate1', 'CredentialsTypeNone1', 'CredentialsTypeSas1', 'CredentialsTypeServicePrincipal1' + CredentialsType CredentialsTypeBasicDatastoreCredentials `json:"credentialsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SasDatastoreCredentials. +func (sdc SasDatastoreCredentials) MarshalJSON() ([]byte, error) { + sdc.CredentialsType = CredentialsTypeSas1 + 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 +} + +// 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', 'SecretsTypeAccountKey', 'SecretsTypeCertificate', 'SecretsTypeKerberosKeytab', 'SecretsTypeKerberosPassword', 'SecretsTypeSas', 'SecretsTypeServicePrincipal' + SecretsType SecretsTypeBasicDatastoreSecrets `json:"secretsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SasDatastoreSecrets. +func (sds SasDatastoreSecrets) MarshalJSON() ([]byte, error) { + sds.SecretsType = SecretsTypeSas + 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 +} + +// AsKerberosKeytabSecrets is the BasicDatastoreSecrets implementation for SasDatastoreSecrets. +func (sds SasDatastoreSecrets) AsKerberosKeytabSecrets() (*KerberosKeytabSecrets, bool) { + return nil, false +} + +// AsKerberosPasswordSecrets is the BasicDatastoreSecrets implementation for SasDatastoreSecrets. +func (sds SasDatastoreSecrets) AsKerberosPasswordSecrets() (*KerberosPasswordSecrets, 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 +} + +// 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"` +} + +// ScaleSettingsInformation desired scale settings for the amlCompute. +type ScaleSettingsInformation struct { + ScaleSettings *ScaleSettings `json:"scaleSettings,omitempty"` +} + +// BasicScheduleBase base definition of a schedule +type BasicScheduleBase interface { + AsRecurrenceSchedule() (*RecurrenceSchedule, bool) + AsCronSchedule() (*CronSchedule, bool) + AsScheduleBase() (*ScheduleBase, bool) +} + +// ScheduleBase base definition of a schedule +type ScheduleBase struct { + // EndTime - Specifies end time of schedule in ISO 8601 format. + // If not present, the schedule will run indefinitely + EndTime *date.Time `json:"endTime,omitempty"` + // ScheduleStatus - Specifies the schedule's status. Possible values include: 'ScheduleStatusEnabled', 'ScheduleStatusDisabled' + ScheduleStatus ScheduleStatus `json:"scheduleStatus,omitempty"` + // StartTime - Specifies start time of schedule in ISO 8601 format. + StartTime *date.Time `json:"startTime,omitempty"` + // TimeZone - Specifies time zone in which the schedule runs. + // TimeZone should follow Windows time zone format. + TimeZone *string `json:"timeZone,omitempty"` + // ScheduleType - Possible values include: 'ScheduleTypeScheduleBase', 'ScheduleTypeRecurrence', 'ScheduleTypeCron' + ScheduleType ScheduleTypeBasicScheduleBase `json:"scheduleType,omitempty"` +} + +func unmarshalBasicScheduleBase(body []byte) (BasicScheduleBase, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["scheduleType"] { + case string(ScheduleTypeRecurrence): + var rs RecurrenceSchedule + err := json.Unmarshal(body, &rs) + return rs, err + case string(ScheduleTypeCron): + var cs CronSchedule + err := json.Unmarshal(body, &cs) + return cs, err + default: + var sb ScheduleBase + err := json.Unmarshal(body, &sb) + return sb, err + } +} +func unmarshalBasicScheduleBaseArray(body []byte) ([]BasicScheduleBase, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + sbArray := make([]BasicScheduleBase, len(rawMessages)) + + for index, rawMessage := range rawMessages { + sb, err := unmarshalBasicScheduleBase(*rawMessage) + if err != nil { + return nil, err + } + sbArray[index] = sb + } + return sbArray, nil +} + +// MarshalJSON is the custom marshaler for ScheduleBase. +func (sb ScheduleBase) MarshalJSON() ([]byte, error) { + sb.ScheduleType = ScheduleTypeScheduleBase + objectMap := make(map[string]interface{}) + if sb.EndTime != nil { + objectMap["endTime"] = sb.EndTime + } + if sb.ScheduleStatus != "" { + objectMap["scheduleStatus"] = sb.ScheduleStatus + } + if sb.StartTime != nil { + objectMap["startTime"] = sb.StartTime + } + if sb.TimeZone != nil { + objectMap["timeZone"] = sb.TimeZone + } + if sb.ScheduleType != "" { + objectMap["scheduleType"] = sb.ScheduleType + } + return json.Marshal(objectMap) +} + +// AsRecurrenceSchedule is the BasicScheduleBase implementation for ScheduleBase. +func (sb ScheduleBase) AsRecurrenceSchedule() (*RecurrenceSchedule, bool) { + return nil, false +} + +// AsCronSchedule is the BasicScheduleBase implementation for ScheduleBase. +func (sb ScheduleBase) AsCronSchedule() (*CronSchedule, bool) { + return nil, false +} + +// AsScheduleBase is the BasicScheduleBase implementation for ScheduleBase. +func (sb ScheduleBase) AsScheduleBase() (*ScheduleBase, bool) { + return &sb, true +} + +// AsBasicScheduleBase is the BasicScheduleBase implementation for ScheduleBase. +func (sb ScheduleBase) AsBasicScheduleBase() (BasicScheduleBase, bool) { + return &sb, true +} + +// 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"` +} + +// BasicSeasonality forecasting seasonality. +type BasicSeasonality interface { + AsAutoSeasonality() (*AutoSeasonality, bool) + AsCustomSeasonality() (*CustomSeasonality, bool) + AsSeasonality() (*Seasonality, bool) +} + +// Seasonality forecasting seasonality. +type Seasonality struct { + // Mode - Possible values include: 'ModeBasicSeasonalityModeSeasonality', 'ModeBasicSeasonalityModeAuto', 'ModeBasicSeasonalityModeCustom' + Mode ModeBasicSeasonality `json:"mode,omitempty"` +} + +func unmarshalBasicSeasonality(body []byte) (BasicSeasonality, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["mode"] { + case string(ModeBasicSeasonalityModeAuto): + var as AutoSeasonality + err := json.Unmarshal(body, &as) + return as, err + case string(ModeBasicSeasonalityModeCustom): + var cs CustomSeasonality + err := json.Unmarshal(body, &cs) + return cs, err + default: + var s Seasonality + err := json.Unmarshal(body, &s) + return s, err + } +} +func unmarshalBasicSeasonalityArray(body []byte) ([]BasicSeasonality, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + sArray := make([]BasicSeasonality, len(rawMessages)) + + for index, rawMessage := range rawMessages { + s, err := unmarshalBasicSeasonality(*rawMessage) + if err != nil { + return nil, err + } + sArray[index] = s + } + return sArray, nil +} + +// MarshalJSON is the custom marshaler for Seasonality. +func (s Seasonality) MarshalJSON() ([]byte, error) { + s.Mode = ModeBasicSeasonalityModeSeasonality + objectMap := make(map[string]interface{}) + if s.Mode != "" { + objectMap["mode"] = s.Mode + } + return json.Marshal(objectMap) +} + +// AsAutoSeasonality is the BasicSeasonality implementation for Seasonality. +func (s Seasonality) AsAutoSeasonality() (*AutoSeasonality, bool) { + return nil, false +} + +// AsCustomSeasonality is the BasicSeasonality implementation for Seasonality. +func (s Seasonality) AsCustomSeasonality() (*CustomSeasonality, bool) { + return nil, false +} + +// AsSeasonality is the BasicSeasonality implementation for Seasonality. +func (s Seasonality) AsSeasonality() (*Seasonality, bool) { + return &s, true +} + +// AsBasicSeasonality is the BasicSeasonality implementation for Seasonality. +func (s Seasonality) AsBasicSeasonality() (BasicSeasonality, bool) { + return &s, true +} + +// ServiceManagedResourcesSettings ... +type ServiceManagedResourcesSettings struct { + // CosmosDb - The settings for the service managed cosmosdb account. + CosmosDb *CosmosDbSettings `json:"cosmosDb,omitempty"` +} + +// ServicePrincipalDatastoreCredentials service Principal datastore credentials configuration. +type ServicePrincipalDatastoreCredentials struct { + // AuthorityURL - Authority URL used for authentication. + AuthorityURL *string `json:"authorityUrl,omitempty"` + // ClientID - [Required] Service principal client ID. + ClientID *uuid.UUID `json:"clientId,omitempty"` + // ResourceURL - Resource the service principal has access to. + ResourceURL *string `json:"resourceUrl,omitempty"` + // Secrets - [Required] Service principal secrets. + Secrets *ServicePrincipalDatastoreSecrets `json:"secrets,omitempty"` + // TenantID - [Required] ID of the tenant to which the service principal belongs. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // CredentialsType - Possible values include: 'CredentialsTypeDatastoreCredentials', 'CredentialsTypeAccountKey1', 'CredentialsTypeCertificate1', 'CredentialsTypeNone1', 'CredentialsTypeSas1', 'CredentialsTypeServicePrincipal1' + CredentialsType CredentialsTypeBasicDatastoreCredentials `json:"credentialsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServicePrincipalDatastoreCredentials. +func (spdc ServicePrincipalDatastoreCredentials) MarshalJSON() ([]byte, error) { + spdc.CredentialsType = CredentialsTypeServicePrincipal1 + objectMap := make(map[string]interface{}) + if spdc.AuthorityURL != nil { + objectMap["authorityUrl"] = spdc.AuthorityURL + } + if spdc.ClientID != nil { + objectMap["clientId"] = spdc.ClientID + } + if spdc.ResourceURL != nil { + objectMap["resourceUrl"] = spdc.ResourceURL + } + 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 +} + +// 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', 'SecretsTypeAccountKey', 'SecretsTypeCertificate', 'SecretsTypeKerberosKeytab', 'SecretsTypeKerberosPassword', 'SecretsTypeSas', 'SecretsTypeServicePrincipal' + SecretsType SecretsTypeBasicDatastoreSecrets `json:"secretsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServicePrincipalDatastoreSecrets. +func (spds ServicePrincipalDatastoreSecrets) MarshalJSON() ([]byte, error) { + spds.SecretsType = SecretsTypeServicePrincipal + 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 +} + +// AsKerberosKeytabSecrets is the BasicDatastoreSecrets implementation for ServicePrincipalDatastoreSecrets. +func (spds ServicePrincipalDatastoreSecrets) AsKerberosKeytabSecrets() (*KerberosKeytabSecrets, bool) { + return nil, false +} + +// AsKerberosPasswordSecrets is the BasicDatastoreSecrets implementation for ServicePrincipalDatastoreSecrets. +func (spds ServicePrincipalDatastoreSecrets) AsKerberosPasswordSecrets() (*KerberosPasswordSecrets, 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 +} + +// 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 the resource model definition representing SKU +type Sku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// SkuCapacity SKU capacity information +type SkuCapacity struct { + // Default - Gets or sets the default capacity. + Default *int32 `json:"default,omitempty"` + // Maximum - Gets or sets the maximum. + Maximum *int32 `json:"maximum,omitempty"` + // Minimum - Gets or sets the minimum. + Minimum *int32 `json:"minimum,omitempty"` + // ScaleType - Gets or sets the type of the scale. Possible values include: 'SkuScaleTypeAutomatic', 'SkuScaleTypeManual', 'SkuScaleTypeNone' + ScaleType SkuScaleType `json:"scaleType,omitempty"` +} + +// SkuResource fulfills ARM Contract requirement to list all available SKUS for a resource. +type SkuResource struct { + // Capacity - Gets or sets the Sku Capacity. + Capacity *SkuCapacity `json:"capacity,omitempty"` + // ResourceType - READ-ONLY; The resource type name. + ResourceType *string `json:"resourceType,omitempty"` + // Sku - Gets or sets the Sku. + Sku *SkuSetting `json:"sku,omitempty"` +} + +// MarshalJSON is the custom marshaler for SkuResource. +func (sr SkuResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.Capacity != nil { + objectMap["capacity"] = sr.Capacity + } + if sr.Sku != nil { + objectMap["sku"] = sr.Sku + } + return json.Marshal(objectMap) +} + +// SkuResourceArmPaginatedResult a paginated list of SkuResource entities. +type SkuResourceArmPaginatedResult struct { + autorest.Response `json:"-"` + // NextLink - The link to the next page of SkuResource objects. If null, there are no additional pages. + NextLink *string `json:"nextLink,omitempty"` + // Value - An array of objects of type SkuResource. + Value *[]SkuResource `json:"value,omitempty"` +} + +// SkuResourceArmPaginatedResultIterator provides access to a complete listing of SkuResource values. +type SkuResourceArmPaginatedResultIterator struct { + i int + page SkuResourceArmPaginatedResultPage +} + +// 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 *SkuResourceArmPaginatedResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkuResourceArmPaginatedResultIterator.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 *SkuResourceArmPaginatedResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SkuResourceArmPaginatedResultIterator) 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 SkuResourceArmPaginatedResultIterator) Response() SkuResourceArmPaginatedResult { + 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 SkuResourceArmPaginatedResultIterator) Value() SkuResource { + if !iter.page.NotDone() { + return SkuResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SkuResourceArmPaginatedResultIterator type. +func NewSkuResourceArmPaginatedResultIterator(page SkuResourceArmPaginatedResultPage) SkuResourceArmPaginatedResultIterator { + return SkuResourceArmPaginatedResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (srapr SkuResourceArmPaginatedResult) IsEmpty() bool { + return srapr.Value == nil || len(*srapr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (srapr SkuResourceArmPaginatedResult) hasNextLink() bool { + return srapr.NextLink != nil && len(*srapr.NextLink) != 0 +} + +// skuResourceArmPaginatedResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (srapr SkuResourceArmPaginatedResult) skuResourceArmPaginatedResultPreparer(ctx context.Context) (*http.Request, error) { + if !srapr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(srapr.NextLink))) +} + +// SkuResourceArmPaginatedResultPage contains a page of SkuResource values. +type SkuResourceArmPaginatedResultPage struct { + fn func(context.Context, SkuResourceArmPaginatedResult) (SkuResourceArmPaginatedResult, error) + srapr SkuResourceArmPaginatedResult +} + +// 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 *SkuResourceArmPaginatedResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkuResourceArmPaginatedResultPage.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.srapr) + if err != nil { + return err + } + page.srapr = 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 *SkuResourceArmPaginatedResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SkuResourceArmPaginatedResultPage) NotDone() bool { + return !page.srapr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SkuResourceArmPaginatedResultPage) Response() SkuResourceArmPaginatedResult { + return page.srapr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SkuResourceArmPaginatedResultPage) Values() []SkuResource { + if page.srapr.IsEmpty() { + return nil + } + return *page.srapr.Value +} + +// Creates a new instance of the SkuResourceArmPaginatedResultPage type. +func NewSkuResourceArmPaginatedResultPage(cur SkuResourceArmPaginatedResult, getNextPage func(context.Context, SkuResourceArmPaginatedResult) (SkuResourceArmPaginatedResult, error)) SkuResourceArmPaginatedResultPage { + return SkuResourceArmPaginatedResultPage{ + fn: getNextPage, + srapr: cur, + } +} + +// SkuSetting skuSetting fulfills the need for stripped down SKU info in ARM contract. +type SkuSetting struct { + // Name - [Required] The name of the SKU. Ex - P3. It is typically a letter+number code. + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` +} + +// 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"` +} + +// StackEnsembleSettings advances setting to customize StackEnsemble run. +type StackEnsembleSettings struct { + // StackMetaLearnerKWargs - Optional parameters to pass to the initializer of the meta-learner. + StackMetaLearnerKWargs interface{} `json:"stackMetaLearnerKWargs,omitempty"` + // StackMetaLearnerTrainPercentage - Specifies the proportion of the training set (when choosing train and validation type of training) to be reserved for training the meta-learner. Default value is 0.2. + StackMetaLearnerTrainPercentage *float64 `json:"stackMetaLearnerTrainPercentage,omitempty"` + // StackMetaLearnerType - The meta-learner is a model trained on the output of the individual heterogeneous models. Possible values include: 'StackMetaLearnerTypeNone', 'StackMetaLearnerTypeLogisticRegression', 'StackMetaLearnerTypeLogisticRegressionCV', 'StackMetaLearnerTypeLightGBMClassifier', 'StackMetaLearnerTypeElasticNet', 'StackMetaLearnerTypeElasticNetCV', 'StackMetaLearnerTypeLightGBMRegressor', 'StackMetaLearnerTypeLinearRegression' + StackMetaLearnerType StackMetaLearnerType `json:"stackMetaLearnerType,omitempty"` +} + +// SweepJob sweep job definition. +type SweepJob struct { + // EarlyTermination - Early termination policies enable canceling poor-performing runs before they complete + EarlyTermination BasicEarlyTerminationPolicy `json:"earlyTermination,omitempty"` + // Inputs - Mapping of input data bindings used in the job. + Inputs map[string]BasicJobInput `json:"inputs"` + // Limits - Sweep Job limit. + Limits *SweepJobLimits `json:"limits,omitempty"` + // Objective - [Required] Optimization objective. + Objective *Objective `json:"objective,omitempty"` + // Outputs - Mapping of output data bindings used in the job. + Outputs map[string]BasicJobOutput `json:"outputs"` + // SamplingAlgorithm - [Required] The hyperparameter sampling algorithm + SamplingAlgorithm BasicSamplingAlgorithm `json:"samplingAlgorithm,omitempty"` + // SearchSpace - [Required] A dictionary containing each parameter and its distribution. The dictionary key is the name of the parameter + SearchSpace interface{} `json:"searchSpace,omitempty"` + // Trial - [Required] Trial component definition. + Trial *TrialComponent `json:"trial,omitempty"` + // ComputeID - ARM resource ID of the compute resource. + ComputeID *string `json:"computeId,omitempty"` + // DisplayName - Display name of job. + DisplayName *string `json:"displayName,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, UserIdentity or null. + // Defaults to AmlToken if null. + Identity BasicIdentityConfiguration `json:"identity,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // Schedule - Schedule definition of job. + // If no schedule is provided, the job is run once and immediately after submission. + Schedule BasicScheduleBase `json:"schedule,omitempty"` + // Services - List of JobEndpoints. + // For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + Services map[string]*JobService `json:"services"` + // Status - READ-ONLY; Status of the job. Possible values include: 'JobStatusNotStarted', 'JobStatusStarting', 'JobStatusProvisioning', 'JobStatusPreparing', 'JobStatusQueued', 'JobStatusRunning', 'JobStatusFinalizing', 'JobStatusCancelRequested', 'JobStatusCompleted', 'JobStatusFailed', 'JobStatusCanceled', 'JobStatusNotResponding', 'JobStatusPaused', 'JobStatusUnknown', 'JobStatusScheduled' + Status JobStatus `json:"status,omitempty"` + // JobType - Possible values include: 'JobTypeJobBase', 'JobTypeAutoML1', 'JobTypeCommand1', 'JobTypePipeline1', 'JobTypeSweep1' + JobType JobTypeBasicJobBase `json:"jobType,omitempty"` + // 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 SweepJob. +func (sj SweepJob) MarshalJSON() ([]byte, error) { + sj.JobType = JobTypeSweep1 + objectMap := make(map[string]interface{}) + objectMap["earlyTermination"] = sj.EarlyTermination + if sj.Inputs != nil { + objectMap["inputs"] = sj.Inputs + } + if sj.Limits != nil { + objectMap["limits"] = sj.Limits + } + if sj.Objective != nil { + objectMap["objective"] = sj.Objective + } + if sj.Outputs != nil { + objectMap["outputs"] = sj.Outputs + } + objectMap["samplingAlgorithm"] = sj.SamplingAlgorithm + if sj.SearchSpace != nil { + objectMap["searchSpace"] = sj.SearchSpace + } + if sj.Trial != nil { + objectMap["trial"] = sj.Trial + } + if sj.ComputeID != nil { + objectMap["computeId"] = sj.ComputeID + } + if sj.DisplayName != nil { + objectMap["displayName"] = sj.DisplayName + } + if sj.ExperimentName != nil { + objectMap["experimentName"] = sj.ExperimentName + } + objectMap["identity"] = sj.Identity + if sj.IsArchived != nil { + objectMap["isArchived"] = sj.IsArchived + } + objectMap["schedule"] = sj.Schedule + if sj.Services != nil { + objectMap["services"] = sj.Services + } + if sj.JobType != "" { + objectMap["jobType"] = sj.JobType + } + if sj.Description != nil { + objectMap["description"] = sj.Description + } + if sj.Properties != nil { + objectMap["properties"] = sj.Properties + } + if sj.Tags != nil { + objectMap["tags"] = sj.Tags + } + return json.Marshal(objectMap) +} + +// AsAutoMLJob is the BasicJobBase implementation for SweepJob. +func (sj SweepJob) AsAutoMLJob() (*AutoMLJob, bool) { + return nil, false +} + +// AsCommandJob is the BasicJobBase implementation for SweepJob. +func (sj SweepJob) AsCommandJob() (*CommandJob, bool) { + return nil, false +} + +// AsPipelineJob is the BasicJobBase implementation for SweepJob. +func (sj SweepJob) AsPipelineJob() (*PipelineJob, 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 "earlyTermination": + if v != nil { + earlyTermination, err := unmarshalBasicEarlyTerminationPolicy(*v) + if err != nil { + return err + } + sj.EarlyTermination = earlyTermination + } + case "inputs": + if v != nil { + var inputs map[string]BasicJobInput + err = json.Unmarshal(*v, &inputs) + if err != nil { + return err + } + sj.Inputs = inputs + } + case "limits": + if v != nil { + var limits SweepJobLimits + err = json.Unmarshal(*v, &limits) + if err != nil { + return err + } + sj.Limits = &limits + } + case "objective": + if v != nil { + var objective Objective + err = json.Unmarshal(*v, &objective) + if err != nil { + return err + } + sj.Objective = &objective + } + case "outputs": + if v != nil { + var outputs map[string]BasicJobOutput + err = json.Unmarshal(*v, &outputs) + if err != nil { + return err + } + sj.Outputs = outputs + } + case "samplingAlgorithm": + if v != nil { + samplingAlgorithm, err := unmarshalBasicSamplingAlgorithm(*v) + if err != nil { + return err + } + sj.SamplingAlgorithm = samplingAlgorithm + } + case "searchSpace": + if v != nil { + var searchSpace interface{} + err = json.Unmarshal(*v, &searchSpace) + if err != nil { + return err + } + sj.SearchSpace = searchSpace + } + case "trial": + if v != nil { + var trial TrialComponent + err = json.Unmarshal(*v, &trial) + if err != nil { + return err + } + sj.Trial = &trial + } + case "computeId": + if v != nil { + var computeID string + err = json.Unmarshal(*v, &computeID) + if err != nil { + return err + } + sj.ComputeID = &computeID + } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + sj.DisplayName = &displayName + } + 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 "isArchived": + if v != nil { + var isArchived bool + err = json.Unmarshal(*v, &isArchived) + if err != nil { + return err + } + sj.IsArchived = &isArchived + } + case "schedule": + if v != nil { + schedule, err := unmarshalBasicScheduleBase(*v) + if err != nil { + return err + } + sj.Schedule = schedule + } + case "services": + if v != nil { + var services map[string]*JobService + err = json.Unmarshal(*v, &services) + if err != nil { + return err + } + sj.Services = services + } + case "status": + if v != nil { + var status JobStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + sj.Status = status + } + case "jobType": + if v != nil { + var jobType JobTypeBasicJobBase + err = json.Unmarshal(*v, &jobType) + if err != nil { + return err + } + sj.JobType = jobType + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + sj.Description = &description + } + case "properties": + if v != nil { + var properties map[string]*string + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + sj.Properties = properties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + sj.Tags = tags + } + } + } + + return nil +} + +// SweepJobLimits sweep Job limit class. +type SweepJobLimits struct { + // MaxConcurrentTrials - Sweep Job max concurrent trials. + MaxConcurrentTrials *int32 `json:"maxConcurrentTrials,omitempty"` + // MaxTotalTrials - Sweep Job max total trials. + MaxTotalTrials *int32 `json:"maxTotalTrials,omitempty"` + // TrialTimeout - Sweep Job Trial timeout value. + TrialTimeout *string `json:"trialTimeout,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"` + // JobLimitsType - Possible values include: 'JobLimitsTypeJobLimits', 'JobLimitsTypeCommand', 'JobLimitsTypeSweep' + JobLimitsType JobLimitsTypeBasicJobLimits `json:"jobLimitsType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SweepJobLimits. +func (sjl SweepJobLimits) MarshalJSON() ([]byte, error) { + sjl.JobLimitsType = JobLimitsTypeSweep + objectMap := make(map[string]interface{}) + if sjl.MaxConcurrentTrials != nil { + objectMap["maxConcurrentTrials"] = sjl.MaxConcurrentTrials + } + if sjl.MaxTotalTrials != nil { + objectMap["maxTotalTrials"] = sjl.MaxTotalTrials + } + if sjl.TrialTimeout != nil { + objectMap["trialTimeout"] = sjl.TrialTimeout + } + if sjl.Timeout != nil { + objectMap["timeout"] = sjl.Timeout + } + if sjl.JobLimitsType != "" { + objectMap["jobLimitsType"] = sjl.JobLimitsType + } + return json.Marshal(objectMap) +} + +// AsCommandJobLimits is the BasicJobLimits implementation for SweepJobLimits. +func (sjl SweepJobLimits) AsCommandJobLimits() (*CommandJobLimits, bool) { + return nil, false +} + +// AsSweepJobLimits is the BasicJobLimits implementation for SweepJobLimits. +func (sjl SweepJobLimits) AsSweepJobLimits() (*SweepJobLimits, bool) { + return &sjl, true +} + +// AsJobLimits is the BasicJobLimits implementation for SweepJobLimits. +func (sjl SweepJobLimits) AsJobLimits() (*JobLimits, bool) { + return nil, false +} + +// AsBasicJobLimits is the BasicJobLimits implementation for SweepJobLimits. +func (sjl SweepJobLimits) AsBasicJobLimits() (BasicJobLimits, bool) { + return &sjl, true +} + +// SynapseSpark a SynapseSpark compute. +type SynapseSpark struct { + Properties *SynapseSparkProperties `json:"properties,omitempty"` + // ComputeLocation - READ-ONLY; 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', 'ComputeTypeDataFactory1', 'ComputeTypeSynapseSpark1' + ComputeType ComputeTypeBasicCompute `json:"computeType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SynapseSpark. +func (ss SynapseSpark) MarshalJSON() ([]byte, error) { + ss.ComputeType = ComputeTypeSynapseSpark1 + objectMap := make(map[string]interface{}) + if ss.Properties != nil { + objectMap["properties"] = ss.Properties + } + 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.ComputeType != "" { + objectMap["computeType"] = ss.ComputeType + } + return json.Marshal(objectMap) +} + +// AsDataFactory is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsDataFactory() (*DataFactory, bool) { + return nil, false +} + +// AsSynapseSpark is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsSynapseSpark() (*SynapseSpark, bool) { + return &ss, true +} + +// AsCompute is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsCompute() (*Compute, bool) { + return nil, false +} + +// AsBasicCompute is the BasicCompute implementation for SynapseSpark. +func (ss SynapseSpark) AsBasicCompute() (BasicCompute, bool) { + return &ss, true +} + +// SynapseSparkProperties ... +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) +} + +// TableVertical abstract class for AutoML tasks that use table dataset as input - such as +// Classification/Regression/Forecasting. +type TableVertical struct { + // DataSettings - Data inputs for AutoMLJob. + DataSettings *TableVerticalDataSettings `json:"dataSettings,omitempty"` + // FeaturizationSettings - Featurization inputs needed for AutoML job. + FeaturizationSettings *TableVerticalFeaturizationSettings `json:"featurizationSettings,omitempty"` + // LimitSettings - Execution constraints for AutoMLJob. + LimitSettings *TableVerticalLimitSettings `json:"limitSettings,omitempty"` + // TrainingSettings - Inputs for training phase for an AutoML Job. + TrainingSettings *TrainingSettings `json:"trainingSettings,omitempty"` +} + +// TableVerticalDataSettings class for data inputs. +type TableVerticalDataSettings struct { + // ValidationData - Validation data inputs. + ValidationData *TableVerticalValidationDataSettings `json:"validationData,omitempty"` + // WeightColumnName - The name of the sample weight column. Automated ML supports a weighted column as an input, causing rows in the data to be weighted up or down. + WeightColumnName *string `json:"weightColumnName,omitempty"` + // TargetColumnName - [Required] Target column name: This is prediction values column. + // Also known as label column name in context of classification tasks. + TargetColumnName *string `json:"targetColumnName,omitempty"` + // TestData - Test data input. + TestData *TestDataSettings `json:"testData,omitempty"` + // TrainingData - [Required] Training data input. + TrainingData *TrainingDataSettings `json:"trainingData,omitempty"` +} + +// TableVerticalFeaturizationSettings featurization Configuration. +type TableVerticalFeaturizationSettings struct { + // BlockedTransformers - These transformers shall not be used in featurization. + BlockedTransformers *[]string `json:"blockedTransformers,omitempty"` + // ColumnNameAndTypes - Dictionary of column name and its type (int, float, string, datetime etc). + ColumnNameAndTypes map[string]*string `json:"columnNameAndTypes"` + // DropColumns - Columns to be dropped from data during featurization. + DropColumns *[]string `json:"dropColumns,omitempty"` + // EnableDnnFeaturization - Determines whether to use Dnn based featurizers for data featurization. + EnableDnnFeaturization *bool `json:"enableDnnFeaturization,omitempty"` + // Mode - Featurization mode - User can keep the default 'Auto' mode and AutoML will take care of necessary transformation of the data in featurization phase. + // If 'Off' is selected then no featurization is done. + // If 'Custom' is selected then user can specify additional inputs to customize how featurization is done. Possible values include: 'Auto', 'Custom', 'Off' + Mode FeaturizationMode `json:"mode,omitempty"` + // TransformerParams - User can specify additional transformers to be used along with the columns to which it would be applied and parameters for the transformer constructor. + TransformerParams map[string][]ColumnTransformer `json:"transformerParams"` + // DatasetLanguage - Dataset language, useful for the text data. + DatasetLanguage *string `json:"datasetLanguage,omitempty"` +} + +// MarshalJSON is the custom marshaler for TableVerticalFeaturizationSettings. +func (tvfs TableVerticalFeaturizationSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tvfs.BlockedTransformers != nil { + objectMap["blockedTransformers"] = tvfs.BlockedTransformers + } + if tvfs.ColumnNameAndTypes != nil { + objectMap["columnNameAndTypes"] = tvfs.ColumnNameAndTypes + } + if tvfs.DropColumns != nil { + objectMap["dropColumns"] = tvfs.DropColumns + } + if tvfs.EnableDnnFeaturization != nil { + objectMap["enableDnnFeaturization"] = tvfs.EnableDnnFeaturization + } + if tvfs.Mode != "" { + objectMap["mode"] = tvfs.Mode + } + if tvfs.TransformerParams != nil { + objectMap["transformerParams"] = tvfs.TransformerParams + } + if tvfs.DatasetLanguage != nil { + objectMap["datasetLanguage"] = tvfs.DatasetLanguage + } + return json.Marshal(objectMap) +} + +// TableVerticalLimitSettings job execution constraints. +type TableVerticalLimitSettings struct { + // EnableEarlyTermination - Enable early termination, determines whether or not if AutoMLJob will terminate early if there is no score improvement in last 20 iterations. + EnableEarlyTermination *bool `json:"enableEarlyTermination,omitempty"` + // ExitScore - Exit score for the AutoML job. + ExitScore *float64 `json:"exitScore,omitempty"` + // MaxConcurrentTrials - Maximum Concurrent iterations. + MaxConcurrentTrials *int32 `json:"maxConcurrentTrials,omitempty"` + // MaxCoresPerTrial - Max cores per iteration. + MaxCoresPerTrial *int32 `json:"maxCoresPerTrial,omitempty"` + // MaxTrials - Number of iterations. + MaxTrials *int32 `json:"maxTrials,omitempty"` + // Timeout - AutoML job timeout. + Timeout *string `json:"timeout,omitempty"` + // TrialTimeout - Iteration timeout. + TrialTimeout *string `json:"trialTimeout,omitempty"` +} + +// TableVerticalValidationDataSettings validation settings for AutoML Table vertical tasks - +// Classification/Regression/Forecasting. +type TableVerticalValidationDataSettings struct { + // CvSplitColumnNames - Columns to use for CVSplit data. + CvSplitColumnNames *[]string `json:"cvSplitColumnNames,omitempty"` + // NCrossValidations - Number of cross validation folds to be applied on training dataset + // when validation dataset is not provided. + NCrossValidations BasicNCrossValidations `json:"nCrossValidations,omitempty"` + // Data - Validation data MLTable. + Data *MLTableJobInput `json:"data,omitempty"` + // ValidationDataSize - The fraction of training dataset that needs to be set aside for validation purpose. + // Values between (0.0 , 1.0) + // Applied when validation dataset is not provided. + ValidationDataSize *float64 `json:"validationDataSize,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for TableVerticalValidationDataSettings struct. +func (tvvds *TableVerticalValidationDataSettings) 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 "cvSplitColumnNames": + if v != nil { + var cvSplitColumnNames []string + err = json.Unmarshal(*v, &cvSplitColumnNames) + if err != nil { + return err + } + tvvds.CvSplitColumnNames = &cvSplitColumnNames + } + case "nCrossValidations": + if v != nil { + nCrossValidations, err := unmarshalBasicNCrossValidations(*v) + if err != nil { + return err + } + tvvds.NCrossValidations = nCrossValidations + } + case "data": + if v != nil { + var data MLTableJobInput + err = json.Unmarshal(*v, &data) + if err != nil { + return err + } + tvvds.Data = &data + } + case "validationDataSize": + if v != nil { + var validationDataSize float64 + err = json.Unmarshal(*v, &validationDataSize) + if err != nil { + return err + } + tvvds.ValidationDataSize = &validationDataSize + } + } + } + + return nil +} + +// BasicTargetLags the number of past periods to lag from the target column. +type BasicTargetLags interface { + AsAutoTargetLags() (*AutoTargetLags, bool) + AsCustomTargetLags() (*CustomTargetLags, bool) + AsTargetLags() (*TargetLags, bool) +} + +// TargetLags the number of past periods to lag from the target column. +type TargetLags struct { + // Mode - Possible values include: 'ModeBasicTargetLagsModeTargetLags', 'ModeBasicTargetLagsModeAuto', 'ModeBasicTargetLagsModeCustom' + Mode ModeBasicTargetLags `json:"mode,omitempty"` +} + +func unmarshalBasicTargetLags(body []byte) (BasicTargetLags, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["mode"] { + case string(ModeBasicTargetLagsModeAuto): + var atl AutoTargetLags + err := json.Unmarshal(body, &atl) + return atl, err + case string(ModeBasicTargetLagsModeCustom): + var ctl CustomTargetLags + err := json.Unmarshal(body, &ctl) + return ctl, err + default: + var tl TargetLags + err := json.Unmarshal(body, &tl) + return tl, err + } +} +func unmarshalBasicTargetLagsArray(body []byte) ([]BasicTargetLags, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + tlArray := make([]BasicTargetLags, len(rawMessages)) + + for index, rawMessage := range rawMessages { + tl, err := unmarshalBasicTargetLags(*rawMessage) + if err != nil { + return nil, err + } + tlArray[index] = tl + } + return tlArray, nil +} + +// MarshalJSON is the custom marshaler for TargetLags. +func (tl TargetLags) MarshalJSON() ([]byte, error) { + tl.Mode = ModeBasicTargetLagsModeTargetLags + objectMap := make(map[string]interface{}) + if tl.Mode != "" { + objectMap["mode"] = tl.Mode + } + return json.Marshal(objectMap) +} + +// AsAutoTargetLags is the BasicTargetLags implementation for TargetLags. +func (tl TargetLags) AsAutoTargetLags() (*AutoTargetLags, bool) { + return nil, false +} + +// AsCustomTargetLags is the BasicTargetLags implementation for TargetLags. +func (tl TargetLags) AsCustomTargetLags() (*CustomTargetLags, bool) { + return nil, false +} + +// AsTargetLags is the BasicTargetLags implementation for TargetLags. +func (tl TargetLags) AsTargetLags() (*TargetLags, bool) { + return &tl, true +} + +// AsBasicTargetLags is the BasicTargetLags implementation for TargetLags. +func (tl TargetLags) AsBasicTargetLags() (BasicTargetLags, bool) { + return &tl, true +} + +// BasicTargetRollingWindowSize forecasting target rolling window size. +type BasicTargetRollingWindowSize interface { + AsAutoTargetRollingWindowSize() (*AutoTargetRollingWindowSize, bool) + AsCustomTargetRollingWindowSize() (*CustomTargetRollingWindowSize, bool) + AsTargetRollingWindowSize() (*TargetRollingWindowSize, bool) +} + +// TargetRollingWindowSize forecasting target rolling window size. +type TargetRollingWindowSize struct { + // Mode - Possible values include: 'ModeBasicTargetRollingWindowSizeModeTargetRollingWindowSize', 'ModeBasicTargetRollingWindowSizeModeAuto', 'ModeBasicTargetRollingWindowSizeModeCustom' + Mode ModeBasicTargetRollingWindowSize `json:"mode,omitempty"` +} + +func unmarshalBasicTargetRollingWindowSize(body []byte) (BasicTargetRollingWindowSize, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["mode"] { + case string(ModeBasicTargetRollingWindowSizeModeAuto): + var atrws AutoTargetRollingWindowSize + err := json.Unmarshal(body, &atrws) + return atrws, err + case string(ModeBasicTargetRollingWindowSizeModeCustom): + var ctrws CustomTargetRollingWindowSize + err := json.Unmarshal(body, &ctrws) + return ctrws, err + default: + var trws TargetRollingWindowSize + err := json.Unmarshal(body, &trws) + return trws, err + } +} +func unmarshalBasicTargetRollingWindowSizeArray(body []byte) ([]BasicTargetRollingWindowSize, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + trwsArray := make([]BasicTargetRollingWindowSize, len(rawMessages)) + + for index, rawMessage := range rawMessages { + trws, err := unmarshalBasicTargetRollingWindowSize(*rawMessage) + if err != nil { + return nil, err + } + trwsArray[index] = trws + } + return trwsArray, nil +} + +// MarshalJSON is the custom marshaler for TargetRollingWindowSize. +func (trws TargetRollingWindowSize) MarshalJSON() ([]byte, error) { + trws.Mode = ModeBasicTargetRollingWindowSizeModeTargetRollingWindowSize + objectMap := make(map[string]interface{}) + if trws.Mode != "" { + objectMap["mode"] = trws.Mode + } + return json.Marshal(objectMap) +} + +// AsAutoTargetRollingWindowSize is the BasicTargetRollingWindowSize implementation for TargetRollingWindowSize. +func (trws TargetRollingWindowSize) AsAutoTargetRollingWindowSize() (*AutoTargetRollingWindowSize, bool) { + return nil, false +} + +// AsCustomTargetRollingWindowSize is the BasicTargetRollingWindowSize implementation for TargetRollingWindowSize. +func (trws TargetRollingWindowSize) AsCustomTargetRollingWindowSize() (*CustomTargetRollingWindowSize, bool) { + return nil, false +} + +// AsTargetRollingWindowSize is the BasicTargetRollingWindowSize implementation for TargetRollingWindowSize. +func (trws TargetRollingWindowSize) AsTargetRollingWindowSize() (*TargetRollingWindowSize, bool) { + return &trws, true +} + +// AsBasicTargetRollingWindowSize is the BasicTargetRollingWindowSize implementation for TargetRollingWindowSize. +func (trws TargetRollingWindowSize) AsBasicTargetRollingWindowSize() (BasicTargetRollingWindowSize, bool) { + return &trws, true +} + +// TargetUtilizationScaleSettings ... +type TargetUtilizationScaleSettings struct { + // MaxInstances - The maximum number of instances that the deployment can scale to. The quota will be reserved for max_instances. + MaxInstances *int32 `json:"maxInstances,omitempty"` + // MinInstances - The minimum number of instances to always be present. + MinInstances *int32 `json:"minInstances,omitempty"` + // PollingInterval - The polling interval in ISO 8691 format. Only supports duration with precision as low as Seconds. + PollingInterval *string `json:"pollingInterval,omitempty"` + // TargetUtilizationPercentage - Target CPU usage for the autoscaler. + TargetUtilizationPercentage *int32 `json:"targetUtilizationPercentage,omitempty"` + // ScaleType - Possible values include: 'ScaleTypeOnlineScaleSettings', 'ScaleTypeDefault', 'ScaleTypeTargetUtilization' + ScaleType ScaleTypeBasicOnlineScaleSettings `json:"scaleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for TargetUtilizationScaleSettings. +func (tuss TargetUtilizationScaleSettings) MarshalJSON() ([]byte, error) { + tuss.ScaleType = ScaleTypeTargetUtilization + objectMap := make(map[string]interface{}) + if tuss.MaxInstances != nil { + objectMap["maxInstances"] = tuss.MaxInstances + } + if tuss.MinInstances != nil { + objectMap["minInstances"] = tuss.MinInstances + } + if tuss.PollingInterval != nil { + objectMap["pollingInterval"] = tuss.PollingInterval + } + if tuss.TargetUtilizationPercentage != nil { + objectMap["targetUtilizationPercentage"] = tuss.TargetUtilizationPercentage + } + if tuss.ScaleType != "" { + objectMap["scaleType"] = tuss.ScaleType + } + return json.Marshal(objectMap) +} + +// AsDefaultScaleSettings is the BasicOnlineScaleSettings implementation for TargetUtilizationScaleSettings. +func (tuss TargetUtilizationScaleSettings) AsDefaultScaleSettings() (*DefaultScaleSettings, bool) { + return nil, false +} + +// AsTargetUtilizationScaleSettings is the BasicOnlineScaleSettings implementation for TargetUtilizationScaleSettings. +func (tuss TargetUtilizationScaleSettings) AsTargetUtilizationScaleSettings() (*TargetUtilizationScaleSettings, bool) { + return &tuss, true +} + +// AsOnlineScaleSettings is the BasicOnlineScaleSettings implementation for TargetUtilizationScaleSettings. +func (tuss TargetUtilizationScaleSettings) AsOnlineScaleSettings() (*OnlineScaleSettings, bool) { + return nil, false +} + +// AsBasicOnlineScaleSettings is the BasicOnlineScaleSettings implementation for TargetUtilizationScaleSettings. +func (tuss TargetUtilizationScaleSettings) AsBasicOnlineScaleSettings() (BasicOnlineScaleSettings, bool) { + return &tuss, true +} + +// TensorFlow tensorFlow distribution configuration. +type TensorFlow struct { + // ParameterServerCount - Number of parameter server tasks. + ParameterServerCount *int32 `json:"parameterServerCount,omitempty"` + // WorkerCount - Number of workers. If not specified, will default to the instance count. + 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 +} + +// TestDataSettings test data inputs. +type TestDataSettings struct { + // Data - Test data MLTable. + Data *MLTableJobInput `json:"data,omitempty"` + // TestDataSize - The fraction of test dataset that needs to be set aside for validation purpose. + // Values between (0.0 , 1.0) + // Applied when validation dataset is not provided. + TestDataSize *float64 `json:"testDataSize,omitempty"` +} + +// TextClassification text Classification task in AutoML NLP vertical. +// NLP - Natural Language Processing. +type TextClassification struct { + // DataSettings - Data inputs for AutoMLJob. + DataSettings *NlpVerticalDataSettings `json:"dataSettings,omitempty"` + // FeaturizationSettings - Featurization inputs needed for AutoML job. + FeaturizationSettings *NlpVerticalFeaturizationSettings `json:"featurizationSettings,omitempty"` + // LimitSettings - Execution constraints for AutoMLJob. + LimitSettings *NlpVerticalLimitSettings `json:"limitSettings,omitempty"` + // LogVerbosity - Log verbosity for the job. Possible values include: 'LogVerbosityNotSet', 'LogVerbosityDebug', 'LogVerbosityInfo', 'LogVerbosityWarning', 'LogVerbosityError', 'LogVerbosityCritical' + LogVerbosity LogVerbosity `json:"logVerbosity,omitempty"` + // TaskType - [Required] Task type for AutoMLJob. Possible values include: 'TaskTypeClassification', 'TaskTypeRegression', 'TaskTypeForecasting', 'TaskTypeImageClassification', 'TaskTypeImageClassificationMultilabel', 'TaskTypeImageObjectDetection', 'TaskTypeImageInstanceSegmentation', 'TaskTypeTextClassification', 'TaskTypeTextClassificationMultilabel', 'TaskTypeTextNER' + TaskType TaskType `json:"taskType,omitempty"` + // PrimaryMetric - Primary metric for Text-Classification task. Possible values include: 'ClassificationPrimaryMetricsAUCWeighted', 'ClassificationPrimaryMetricsAccuracy', 'ClassificationPrimaryMetricsNormMacroRecall', 'ClassificationPrimaryMetricsAveragePrecisionScoreWeighted', 'ClassificationPrimaryMetricsPrecisionScoreWeighted' + PrimaryMetric ClassificationPrimaryMetrics `json:"primaryMetric,omitempty"` +} + +// TextClassificationMultilabel text Classification Multilabel task in AutoML NLP vertical. +// NLP - Natural Language Processing. +type TextClassificationMultilabel struct { + // DataSettings - Data inputs for AutoMLJob. + DataSettings *NlpVerticalDataSettings `json:"dataSettings,omitempty"` + // FeaturizationSettings - Featurization inputs needed for AutoML job. + FeaturizationSettings *NlpVerticalFeaturizationSettings `json:"featurizationSettings,omitempty"` + // LimitSettings - Execution constraints for AutoMLJob. + LimitSettings *NlpVerticalLimitSettings `json:"limitSettings,omitempty"` + // LogVerbosity - Log verbosity for the job. Possible values include: 'LogVerbosityNotSet', 'LogVerbosityDebug', 'LogVerbosityInfo', 'LogVerbosityWarning', 'LogVerbosityError', 'LogVerbosityCritical' + LogVerbosity LogVerbosity `json:"logVerbosity,omitempty"` + // TaskType - [Required] Task type for AutoMLJob. Possible values include: 'TaskTypeClassification', 'TaskTypeRegression', 'TaskTypeForecasting', 'TaskTypeImageClassification', 'TaskTypeImageClassificationMultilabel', 'TaskTypeImageObjectDetection', 'TaskTypeImageInstanceSegmentation', 'TaskTypeTextClassification', 'TaskTypeTextClassificationMultilabel', 'TaskTypeTextNER' + TaskType TaskType `json:"taskType,omitempty"` + // PrimaryMetric - READ-ONLY; Primary metric for Text-Classification-Multilabel task. + // Currently only Accuracy is supported as primary metric, hence user need not set it explicitly. Possible values include: 'AUCWeighted', 'Accuracy', 'NormMacroRecall', 'AveragePrecisionScoreWeighted', 'PrecisionScoreWeighted', 'IOU' + PrimaryMetric ClassificationMultilabelPrimaryMetrics `json:"primaryMetric,omitempty"` +} + +// MarshalJSON is the custom marshaler for TextClassificationMultilabel. +func (tcm TextClassificationMultilabel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tcm.DataSettings != nil { + objectMap["dataSettings"] = tcm.DataSettings + } + if tcm.FeaturizationSettings != nil { + objectMap["featurizationSettings"] = tcm.FeaturizationSettings + } + if tcm.LimitSettings != nil { + objectMap["limitSettings"] = tcm.LimitSettings + } + if tcm.LogVerbosity != "" { + objectMap["logVerbosity"] = tcm.LogVerbosity + } + if tcm.TaskType != "" { + objectMap["taskType"] = tcm.TaskType + } + return json.Marshal(objectMap) +} + +// TextNer text-NER task in AutoML NLP vertical. +// NER - Named Entity Recognition. +// NLP - Natural Language Processing. +type TextNer struct { + // DataSettings - Data inputs for AutoMLJob. + DataSettings *NlpVerticalDataSettings `json:"dataSettings,omitempty"` + // FeaturizationSettings - Featurization inputs needed for AutoML job. + FeaturizationSettings *NlpVerticalFeaturizationSettings `json:"featurizationSettings,omitempty"` + // LimitSettings - Execution constraints for AutoMLJob. + LimitSettings *NlpVerticalLimitSettings `json:"limitSettings,omitempty"` + // LogVerbosity - Log verbosity for the job. Possible values include: 'LogVerbosityNotSet', 'LogVerbosityDebug', 'LogVerbosityInfo', 'LogVerbosityWarning', 'LogVerbosityError', 'LogVerbosityCritical' + LogVerbosity LogVerbosity `json:"logVerbosity,omitempty"` + // TaskType - [Required] Task type for AutoMLJob. Possible values include: 'TaskTypeClassification', 'TaskTypeRegression', 'TaskTypeForecasting', 'TaskTypeImageClassification', 'TaskTypeImageClassificationMultilabel', 'TaskTypeImageObjectDetection', 'TaskTypeImageInstanceSegmentation', 'TaskTypeTextClassification', 'TaskTypeTextClassificationMultilabel', 'TaskTypeTextNER' + TaskType TaskType `json:"taskType,omitempty"` + // PrimaryMetric - READ-ONLY; Primary metric for Text-NER task. + // Only 'Accuracy' is supported for Text-NER, so user need not set this explicitly. Possible values include: 'ClassificationPrimaryMetricsAUCWeighted', 'ClassificationPrimaryMetricsAccuracy', 'ClassificationPrimaryMetricsNormMacroRecall', 'ClassificationPrimaryMetricsAveragePrecisionScoreWeighted', 'ClassificationPrimaryMetricsPrecisionScoreWeighted' + PrimaryMetric ClassificationPrimaryMetrics `json:"primaryMetric,omitempty"` +} + +// MarshalJSON is the custom marshaler for TextNer. +func (tn TextNer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tn.DataSettings != nil { + objectMap["dataSettings"] = tn.DataSettings + } + if tn.FeaturizationSettings != nil { + objectMap["featurizationSettings"] = tn.FeaturizationSettings + } + if tn.LimitSettings != nil { + objectMap["limitSettings"] = tn.LimitSettings + } + if tn.LogVerbosity != "" { + objectMap["logVerbosity"] = tn.LogVerbosity + } + if tn.TaskType != "" { + objectMap["taskType"] = tn.TaskType + } + return json.Marshal(objectMap) +} + +// 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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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) +} + +// TrainingDataSettings training data input. +type TrainingDataSettings struct { + // Data - [Required] Training data MLTable. + Data *MLTableJobInput `json:"data,omitempty"` +} + +// TrainingSettings training related configuration. +type TrainingSettings struct { + // EnableDnnTraining - Enable recommendation of DNN models. + EnableDnnTraining *bool `json:"enableDnnTraining,omitempty"` + // EnableModelExplainability - Flag to turn on explainability on best model. + EnableModelExplainability *bool `json:"enableModelExplainability,omitempty"` + // EnableOnnxCompatibleModels - Flag for enabling onnx compatible models. + EnableOnnxCompatibleModels *bool `json:"enableOnnxCompatibleModels,omitempty"` + // EnableStackEnsemble - Enable stack ensemble run. + EnableStackEnsemble *bool `json:"enableStackEnsemble,omitempty"` + // EnableVoteEnsemble - Enable voting ensemble run. + EnableVoteEnsemble *bool `json:"enableVoteEnsemble,omitempty"` + // EnsembleModelDownloadTimeout - During VotingEnsemble and StackEnsemble model generation, multiple fitted models from the previous child runs are downloaded. + // Configure this parameter with a higher value than 300 secs, if more time is needed. + EnsembleModelDownloadTimeout *string `json:"ensembleModelDownloadTimeout,omitempty"` + // StackEnsembleSettings - Stack ensemble settings for stack ensemble run. + StackEnsembleSettings *StackEnsembleSettings `json:"stackEnsembleSettings,omitempty"` +} + +// TrialComponent trial component definition. +type TrialComponent struct { + // CodeID - ARM resource ID of the code asset. + CodeID *string `json:"codeId,omitempty"` + // Command - [Required] 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 - [Required] 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"` + // Resources - Compute Resource configuration for the job. + Resources *ResourceConfiguration `json:"resources,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.Resources != nil { + objectMap["resources"] = tc.Resources + } + 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 "resources": + if v != nil { + var resources ResourceConfiguration + err = json.Unmarshal(*v, &resources) + if err != nil { + return err + } + tc.Resources = &resources + } + } + } + + return nil +} + +// TritonModelJobInput ... +type TritonModelJobInput struct { + // Mode - Input Asset Delivery Mode. Possible values include: 'ReadOnlyMount', 'ReadWriteMount', 'Download', 'Direct', 'EvalMount', 'EvalDownload' + Mode InputDeliveryMode `json:"mode,omitempty"` + // URI - [Required] Input Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the input. + Description *string `json:"description,omitempty"` + // JobInputType - [Required] Specifies the type of job. Possible values include: 'JobInputTypeLiteral', 'JobInputTypeURIFile', 'JobInputTypeURIFolder', 'JobInputTypeMLTable', 'JobInputTypeCustomModel', 'JobInputTypeMLFlowModel', 'JobInputTypeTritonModel' + JobInputType JobInputType `json:"jobInputType,omitempty"` +} + +// TritonModelJobOutput ... +type TritonModelJobOutput struct { + // Mode - Output Asset Delivery Mode. Possible values include: 'OutputDeliveryModeReadWriteMount', 'OutputDeliveryModeUpload' + Mode OutputDeliveryMode `json:"mode,omitempty"` + // URI - Output Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the output. + Description *string `json:"description,omitempty"` + // JobOutputType - [Required] Specifies the type of job. Possible values include: 'JobOutputTypeURIFile', 'JobOutputTypeURIFolder', 'JobOutputTypeMLTable', 'JobOutputTypeCustomModel', 'JobOutputTypeMLFlowModel', 'JobOutputTypeTritonModel' + JobOutputType JobOutputType `json:"jobOutputType,omitempty"` +} + +// TruncationSelectionPolicy defines an early termination policy that cancels a given percentage of runs at +// each evaluation interval. +type TruncationSelectionPolicy struct { + // TruncationPercentage - The percentage of runs to cancel at each evaluation interval. + TruncationPercentage *int32 `json:"truncationPercentage,omitempty"` + // DelayEvaluation - Number of intervals by which to delay the first evaluation. + DelayEvaluation *int32 `json:"delayEvaluation,omitempty"` + // EvaluationInterval - Interval (number of runs) between policy evaluations. + 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) +} + +// URIFileDataVersion uri-file data version entity +type URIFileDataVersion struct { + // DataURI - [Required] Uri of the data. Usage/meaning depends on Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20220201Preview.Assets.DataVersionBase.DataType + DataURI *string `json:"dataUri,omitempty"` + // DataType - Possible values include: 'DataTypeDataVersionBase', 'DataTypeMLTable', 'DataTypeURIFile', 'DataTypeURIFolder' + DataType DataTypeBasicDataVersionBase `json:"dataType,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // 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 URIFileDataVersion. +func (ufdv URIFileDataVersion) MarshalJSON() ([]byte, error) { + ufdv.DataType = DataTypeURIFile + objectMap := make(map[string]interface{}) + if ufdv.DataURI != nil { + objectMap["dataUri"] = ufdv.DataURI + } + if ufdv.DataType != "" { + objectMap["dataType"] = ufdv.DataType + } + if ufdv.IsAnonymous != nil { + objectMap["isAnonymous"] = ufdv.IsAnonymous + } + if ufdv.IsArchived != nil { + objectMap["isArchived"] = ufdv.IsArchived + } + if ufdv.Description != nil { + objectMap["description"] = ufdv.Description + } + if ufdv.Properties != nil { + objectMap["properties"] = ufdv.Properties + } + if ufdv.Tags != nil { + objectMap["tags"] = ufdv.Tags + } + return json.Marshal(objectMap) +} + +// AsMLTableData is the BasicDataVersionBase implementation for URIFileDataVersion. +func (ufdv URIFileDataVersion) AsMLTableData() (*MLTableData, bool) { + return nil, false +} + +// AsURIFileDataVersion is the BasicDataVersionBase implementation for URIFileDataVersion. +func (ufdv URIFileDataVersion) AsURIFileDataVersion() (*URIFileDataVersion, bool) { + return &ufdv, true +} + +// AsURIFolderDataVersion is the BasicDataVersionBase implementation for URIFileDataVersion. +func (ufdv URIFileDataVersion) AsURIFolderDataVersion() (*URIFolderDataVersion, bool) { + return nil, false +} + +// AsDataVersionBase is the BasicDataVersionBase implementation for URIFileDataVersion. +func (ufdv URIFileDataVersion) AsDataVersionBase() (*DataVersionBase, bool) { + return nil, false +} + +// AsBasicDataVersionBase is the BasicDataVersionBase implementation for URIFileDataVersion. +func (ufdv URIFileDataVersion) AsBasicDataVersionBase() (BasicDataVersionBase, bool) { + return &ufdv, true +} + +// URIFileJobInput ... +type URIFileJobInput struct { + // Mode - Input Asset Delivery Mode. Possible values include: 'ReadOnlyMount', 'ReadWriteMount', 'Download', 'Direct', 'EvalMount', 'EvalDownload' + Mode InputDeliveryMode `json:"mode,omitempty"` + // URI - [Required] Input Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the input. + Description *string `json:"description,omitempty"` + // JobInputType - [Required] Specifies the type of job. Possible values include: 'JobInputTypeLiteral', 'JobInputTypeURIFile', 'JobInputTypeURIFolder', 'JobInputTypeMLTable', 'JobInputTypeCustomModel', 'JobInputTypeMLFlowModel', 'JobInputTypeTritonModel' + JobInputType JobInputType `json:"jobInputType,omitempty"` +} + +// URIFileJobOutput ... +type URIFileJobOutput struct { + // Mode - Output Asset Delivery Mode. Possible values include: 'OutputDeliveryModeReadWriteMount', 'OutputDeliveryModeUpload' + Mode OutputDeliveryMode `json:"mode,omitempty"` + // URI - Output Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the output. + Description *string `json:"description,omitempty"` + // JobOutputType - [Required] Specifies the type of job. Possible values include: 'JobOutputTypeURIFile', 'JobOutputTypeURIFolder', 'JobOutputTypeMLTable', 'JobOutputTypeCustomModel', 'JobOutputTypeMLFlowModel', 'JobOutputTypeTritonModel' + JobOutputType JobOutputType `json:"jobOutputType,omitempty"` +} + +// URIFolderDataVersion uri-folder data version entity +type URIFolderDataVersion struct { + // DataURI - [Required] Uri of the data. Usage/meaning depends on Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20220201Preview.Assets.DataVersionBase.DataType + DataURI *string `json:"dataUri,omitempty"` + // DataType - Possible values include: 'DataTypeDataVersionBase', 'DataTypeMLTable', 'DataTypeURIFile', 'DataTypeURIFolder' + DataType DataTypeBasicDataVersionBase `json:"dataType,omitempty"` + // IsAnonymous - If the name version are system generated (anonymous registration). + IsAnonymous *bool `json:"isAnonymous,omitempty"` + // IsArchived - Is the asset archived? + IsArchived *bool `json:"isArchived,omitempty"` + // 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 URIFolderDataVersion. +func (ufdv URIFolderDataVersion) MarshalJSON() ([]byte, error) { + ufdv.DataType = DataTypeURIFolder + objectMap := make(map[string]interface{}) + if ufdv.DataURI != nil { + objectMap["dataUri"] = ufdv.DataURI + } + if ufdv.DataType != "" { + objectMap["dataType"] = ufdv.DataType + } + if ufdv.IsAnonymous != nil { + objectMap["isAnonymous"] = ufdv.IsAnonymous + } + if ufdv.IsArchived != nil { + objectMap["isArchived"] = ufdv.IsArchived + } + if ufdv.Description != nil { + objectMap["description"] = ufdv.Description + } + if ufdv.Properties != nil { + objectMap["properties"] = ufdv.Properties + } + if ufdv.Tags != nil { + objectMap["tags"] = ufdv.Tags + } + return json.Marshal(objectMap) +} + +// AsMLTableData is the BasicDataVersionBase implementation for URIFolderDataVersion. +func (ufdv URIFolderDataVersion) AsMLTableData() (*MLTableData, bool) { + return nil, false +} + +// AsURIFileDataVersion is the BasicDataVersionBase implementation for URIFolderDataVersion. +func (ufdv URIFolderDataVersion) AsURIFileDataVersion() (*URIFileDataVersion, bool) { + return nil, false +} + +// AsURIFolderDataVersion is the BasicDataVersionBase implementation for URIFolderDataVersion. +func (ufdv URIFolderDataVersion) AsURIFolderDataVersion() (*URIFolderDataVersion, bool) { + return &ufdv, true +} + +// AsDataVersionBase is the BasicDataVersionBase implementation for URIFolderDataVersion. +func (ufdv URIFolderDataVersion) AsDataVersionBase() (*DataVersionBase, bool) { + return nil, false +} + +// AsBasicDataVersionBase is the BasicDataVersionBase implementation for URIFolderDataVersion. +func (ufdv URIFolderDataVersion) AsBasicDataVersionBase() (BasicDataVersionBase, bool) { + return &ufdv, true +} + +// URIFolderJobInput ... +type URIFolderJobInput struct { + // Mode - Input Asset Delivery Mode. Possible values include: 'ReadOnlyMount', 'ReadWriteMount', 'Download', 'Direct', 'EvalMount', 'EvalDownload' + Mode InputDeliveryMode `json:"mode,omitempty"` + // URI - [Required] Input Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the input. + Description *string `json:"description,omitempty"` + // JobInputType - [Required] Specifies the type of job. Possible values include: 'JobInputTypeLiteral', 'JobInputTypeURIFile', 'JobInputTypeURIFolder', 'JobInputTypeMLTable', 'JobInputTypeCustomModel', 'JobInputTypeMLFlowModel', 'JobInputTypeTritonModel' + JobInputType JobInputType `json:"jobInputType,omitempty"` +} + +// URIFolderJobOutput ... +type URIFolderJobOutput struct { + // Mode - Output Asset Delivery Mode. Possible values include: 'OutputDeliveryModeReadWriteMount', 'OutputDeliveryModeUpload' + Mode OutputDeliveryMode `json:"mode,omitempty"` + // URI - Output Asset URI. + URI *string `json:"uri,omitempty"` + // Description - Description for the output. + Description *string `json:"description,omitempty"` + // JobOutputType - [Required] Specifies the type of job. Possible values include: 'JobOutputTypeURIFile', 'JobOutputTypeURIFolder', 'JobOutputTypeMLTable', 'JobOutputTypeCustomModel', 'JobOutputTypeMLFlowModel', 'JobOutputTypeTritonModel' + JobOutputType JobOutputType `json:"jobOutputType,omitempty"` +} + +// 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 properties +type UserAssignedIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of the assigned identity. + PrincipalID *uuid.UUID `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client ID of the assigned identity. + ClientID *uuid.UUID `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) +} + +// UserIdentity user identity configuration. +type UserIdentity struct { + // IdentityType - Possible values include: 'IdentityTypeIdentityConfiguration', 'IdentityTypeAMLToken', 'IdentityTypeManaged', 'IdentityTypeUserIdentity' + IdentityType IdentityType `json:"identityType,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserIdentity. +func (UI UserIdentity) MarshalJSON() ([]byte, error) { + UI.IdentityType = IdentityTypeUserIdentity + objectMap := make(map[string]interface{}) + if UI.IdentityType != "" { + objectMap["identityType"] = UI.IdentityType + } + return json.Marshal(objectMap) +} + +// AsAmlToken is the BasicIdentityConfiguration implementation for UserIdentity. +func (UI UserIdentity) AsAmlToken() (*AmlToken, bool) { + return nil, false +} + +// AsManagedIdentity is the BasicIdentityConfiguration implementation for UserIdentity. +func (UI UserIdentity) AsManagedIdentity() (*ManagedIdentity, bool) { + return nil, false +} + +// AsUserIdentity is the BasicIdentityConfiguration implementation for UserIdentity. +func (UI UserIdentity) AsUserIdentity() (*UserIdentity, bool) { + return &UI, true +} + +// AsIdentityConfiguration is the BasicIdentityConfiguration implementation for UserIdentity. +func (UI UserIdentity) AsIdentityConfiguration() (*IdentityConfiguration, bool) { + return nil, false +} + +// AsBasicIdentityConfiguration is the BasicIdentityConfiguration implementation for UserIdentity. +func (UI UserIdentity) AsBasicIdentityConfiguration() (BasicIdentityConfiguration, bool) { + return &UI, true +} + +// ValidationDataSettings validation settings. +type ValidationDataSettings struct { + // Data - Validation data MLTable. + Data *MLTableJobInput `json:"data,omitempty"` + // ValidationDataSize - The fraction of training dataset that needs to be set aside for validation purpose. + // Values between (0.0 , 1.0) + // Applied when validation dataset is not provided. + ValidationDataSize *float64 `json:"validationDataSize,omitempty"` +} + +// VirtualMachine a Machine Learning compute based on Azure Virtual Machines. +type VirtualMachine struct { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // ComputeLocation - READ-ONLY; 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 *VirtualMachineProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualMachine. +func (VM VirtualMachine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if VM.ComputeType != "" { + objectMap["computeType"] = VM.ComputeType + } + 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.Properties != nil { + objectMap["properties"] = VM.Properties + } + return json.Marshal(objectMap) +} + +// 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"` + // NotebookServerPort - Notebook server port open for ssh connections. + NotebookServerPort *int32 `json:"notebookServerPort,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"` +} + +// VirtualMachineSchema ... +type VirtualMachineSchema struct { + Properties *VirtualMachineProperties `json:"properties,omitempty"` +} + +// VirtualMachineSecrets secrets related to a Machine Learning compute based on AKS. +type VirtualMachineSecrets struct { + // ComputeType - The type of compute. Possible values include: 'ComputeTypeAKS', 'ComputeTypeKubernetes', 'ComputeTypeAmlCompute', 'ComputeTypeComputeInstance', 'ComputeTypeDataFactory', 'ComputeTypeVirtualMachine', 'ComputeTypeHDInsight', 'ComputeTypeDatabricks', 'ComputeTypeDataLakeAnalytics', 'ComputeTypeSynapseSpark' + ComputeType ComputeType `json:"computeType,omitempty"` + // AdministratorAccount - Admin credentials for virtual machine. + AdministratorAccount *VirtualMachineSSHCredentials `json:"administratorAccount,omitempty"` +} + +// VirtualMachineSecretsSchema ... +type VirtualMachineSecretsSchema struct { + // AdministratorAccount - Admin credentials for virtual machine. + AdministratorAccount *VirtualMachineSSHCredentials `json:"administratorAccount,omitempty"` +} + +// 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"` + // SupportedComputeTypes - Specifies the compute types supported by the virtual machine size. + SupportedComputeTypes *[]string `json:"supportedComputeTypes,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 + } + if vms.SupportedComputeTypes != nil { + objectMap["supportedComputeTypes"] = vms.SupportedComputeTypes + } + 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 *ManagedServiceIdentity `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"` + // 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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 + } + 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 ManagedServiceIdentity + 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 "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 + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + w.SystemData = &systemData + } + } + } + + return nil +} + +// WorkspaceConnection workspace connection. +type WorkspaceConnection struct { + autorest.Response `json:"-"` + // WorkspaceConnectionProps - Properties of workspace connection. + *WorkspaceConnectionProps `json:"properties,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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 "properties": + if v != nil { + var workspaceConnectionProps WorkspaceConnectionProps + err = json.Unmarshal(*v, &workspaceConnectionProps) + if err != nil { + return err + } + wc.WorkspaceConnectionProps = &workspaceConnectionProps + } + 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 "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + wc.SystemData = &systemData + } + } + } + + 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. + ApplicationInsights *string `json:"applicationInsights,omitempty"` + // ContainerRegistry - ARM id of the container registry associated with this workspace. + 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"` + // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,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"` + // StorageHnsEnabled - READ-ONLY; If the storage associated with the workspace has hierarchical namespace(HNS) enabled. + StorageHnsEnabled *bool `json:"storageHnsEnabled,omitempty"` + // MlFlowTrackingURI - READ-ONLY; The URI associated with this workspace that machine learning flow must point at to set up tracking. + MlFlowTrackingURI *string `json:"mlFlowTrackingUri,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.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = wp.PublicNetworkAccess + } + 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"` + // PublicNetworkAccess - Whether requests from Public Network are allowed. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // ApplicationInsights - ARM id of the application insights associated with this workspace. + ApplicationInsights *string `json:"applicationInsights,omitempty"` + // ContainerRegistry - ARM id of the container registry associated with this workspace. + ContainerRegistry *string `json:"containerRegistry,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 +} + +// WorkspacesDiagnoseFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WorkspacesDiagnoseFuture 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) (DiagnoseResponseResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WorkspacesDiagnoseFuture) 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 WorkspacesDiagnoseFuture.Result. +func (future *WorkspacesDiagnoseFuture) result(client WorkspacesClient) (drr DiagnoseResponseResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesDiagnoseFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + drr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.WorkspacesDiagnoseFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if drr.Response.Response, err = future.GetResult(sender); err == nil && drr.Response.Response.StatusCode != http.StatusNoContent { + drr, err = client.DiagnoseResponder(drr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesDiagnoseFuture", "Result", drr.Response.Response, "Failure responding to request") + } + } + return +} + +// 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 +} + +// WorkspacesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WorkspacesUpdateFuture 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 *WorkspacesUpdateFuture) 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 WorkspacesUpdateFuture.Result. +func (future *WorkspacesUpdateFuture) 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.WorkspacesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + w.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("machinelearningservices.WorkspacesUpdateFuture") + 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.UpdateResponder(w.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesUpdateFuture", "Result", w.Response.Response, "Failure responding to request") + } + } + 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 *ManagedServiceIdentity `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 ManagedServiceIdentity + 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/2022-02-01-preview/machinelearningservices/modelversions.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/modelversions.go new file mode 100644 index 000000000000..567f8318b68b --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/modelversions.go @@ -0,0 +1,476 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// version - version identifier. This is case-sensitive. +// body - version entity to create or update. +func (client ModelVersionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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: 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: name, + Constraints: []validation.Constraint{{Target: "name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("machinelearningservices.ModelVersionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, name, version, 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, resourceGroupName string, workspaceName string, name string, version 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 = "2022-02-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}/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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// version - version identifier. This is case-sensitive. +func (client ModelVersionsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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, resourceGroupName, workspaceName, name, version) + 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, resourceGroupName string, workspaceName string, name string, version 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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - container name. This is case-sensitive. +// version - version identifier. This is case-sensitive. +func (client ModelVersionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, name string, version 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, resourceGroupName, workspaceName, name, version) + 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, resourceGroupName string, workspaceName string, name string, version 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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// name - model name. This is case-sensitive. +// 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 +// feed - name of the feed. +// listViewType - view type for including/excluding (for example) archived entities. +func (client ModelVersionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, name string, skip string, orderBy string, top *int32, version string, description string, offset *int32, tags string, properties string, feed string, listViewType ListViewType) (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, resourceGroupName, workspaceName, name, skip, orderBy, top, version, description, offset, tags, properties, feed, listViewType) + 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, resourceGroupName string, workspaceName string, name string, skip string, orderBy string, top *int32, version string, description string, offset *int32, tags string, properties string, feed string, listViewType ListViewType) (*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 = "2022-02-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) + } + if len(feed) > 0 { + queryParameters["feed"] = autorest.Encode("query", feed) + } + if len(string(listViewType)) > 0 { + queryParameters["listViewType"] = autorest.Encode("query", listViewType) + } else { + queryParameters["listViewType"] = autorest.Encode("query", "ActiveOnly") + } + + 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, resourceGroupName string, workspaceName string, name string, skip string, orderBy string, top *int32, version string, description string, offset *int32, tags string, properties string, feed string, listViewType ListViewType) (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, resourceGroupName, workspaceName, name, skip, orderBy, top, version, description, offset, tags, properties, feed, listViewType) + return +} diff --git a/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/onlinedeployments.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/onlinedeployments.go new file mode 100644 index 000000000000..61dcb8fc1c52 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/onlinedeployments.go @@ -0,0 +1,786 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference endpoint name. +// deploymentName - inference Endpoint Deployment name. +// body - inference Endpoint entity to apply during operation. +func (client OnlineDeploymentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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: 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: 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: body, + Constraints: []validation.Constraint{{Target: "body.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineDeploymentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, endpointName, deploymentName, 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", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client OnlineDeploymentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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 = "2022-02-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}/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 + future.FutureAPI = &azure.Future{} + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference endpoint name. +// deploymentName - inference Endpoint Deployment name. +func (client OnlineDeploymentsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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, resourceGroupName, workspaceName, endpointName, deploymentName) + 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", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client OnlineDeploymentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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 = "2022-02-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 + future.FutureAPI = &azure.Future{} + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference endpoint name. +// deploymentName - inference Endpoint Deployment name. +func (client OnlineDeploymentsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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, resourceGroupName, workspaceName, endpointName, deploymentName) + 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, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference endpoint name. +// deploymentName - the name and identifier for the endpoint. +// body - the request containing parameters for retrieving logs. +func (client OnlineDeploymentsClient) GetLogs(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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, resourceGroupName, workspaceName, endpointName, deploymentName, 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, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference endpoint name. +// orderBy - ordering of list. +// top - top of list. +// skip - continuation token for pagination. +func (client OnlineDeploymentsClient) List(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName, 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, resourceGroupName string, workspaceName string, endpointName 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 = "2022-02-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, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName, orderBy, top, skip) + return +} + +// ListSkus sends the list skus request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - inference endpoint name. +// deploymentName - inference Endpoint Deployment name. +// count - number of Skus to be retrieved in a page of results. +// skip - continuation token for pagination. +func (client OnlineDeploymentsClient) ListSkus(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, count *int32, skip string) (result SkuResourceArmPaginatedResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineDeploymentsClient.ListSkus") + defer func() { + sc := -1 + if result.srapr.Response.Response != nil { + sc = result.srapr.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", "ListSkus", err.Error()) + } + + result.fn = client.listSkusNextResults + req, err := client.ListSkusPreparer(ctx, resourceGroupName, workspaceName, endpointName, deploymentName, count, skip) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "ListSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.srapr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "ListSkus", resp, "Failure sending request") + return + } + + result.srapr, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "ListSkus", resp, "Failure responding to request") + return + } + if result.srapr.hasNextLink() && result.srapr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListSkusPreparer prepares the ListSkus request. +func (client OnlineDeploymentsClient) ListSkusPreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, count *int32, skip 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 = "2022-02-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}/onlineEndpoints/{endpointName}/deployments/{deploymentName}/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSkusSender sends the ListSkus request. The method will close the +// http.Response Body if it receives an error. +func (client OnlineDeploymentsClient) ListSkusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSkusResponder handles the response to the ListSkus request. The method always +// closes the http.Response Body. +func (client OnlineDeploymentsClient) ListSkusResponder(resp *http.Response) (result SkuResourceArmPaginatedResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSkusNextResults retrieves the next set of results, if any. +func (client OnlineDeploymentsClient) listSkusNextResults(ctx context.Context, lastResults SkuResourceArmPaginatedResult) (result SkuResourceArmPaginatedResult, err error) { + req, err := lastResults.skuResourceArmPaginatedResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "listSkusNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "listSkusNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.OnlineDeploymentsClient", "listSkusNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSkusComplete enumerates all values, automatically crossing page boundaries as required. +func (client OnlineDeploymentsClient) ListSkusComplete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName string, count *int32, skip string) (result SkuResourceArmPaginatedResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OnlineDeploymentsClient.ListSkus") + 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.ListSkus(ctx, resourceGroupName, workspaceName, endpointName, deploymentName, count, skip) + return +} + +// Update sends the update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - online Endpoint name. +// deploymentName - inference Endpoint Deployment name. +// body - online Endpoint entity to apply during operation. +func (client OnlineDeploymentsClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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: 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: 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}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineDeploymentsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, endpointName, deploymentName, 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", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client OnlineDeploymentsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName string, deploymentName 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 = "2022-02-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 + future.FutureAPI = &azure.Future{} + 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/2022-02-01-preview/machinelearningservices/onlineendpoints.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/onlineendpoints.go new file mode 100644 index 000000000000..b811e285980b --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/onlineendpoints.go @@ -0,0 +1,823 @@ +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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - online Endpoint name. +// body - online Endpoint entity to apply during operation. +func (client OnlineEndpointsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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: 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: endpointName, + Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$`, Chain: nil}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "body.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("machinelearningservices.OnlineEndpointsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, endpointName, 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", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client OnlineEndpointsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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 = "2022-02-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}/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 + future.FutureAPI = &azure.Future{} + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - online Endpoint name. +func (client OnlineEndpointsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName) + 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", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client OnlineEndpointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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 = "2022-02-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 + future.FutureAPI = &azure.Future{} + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - online Endpoint name. +func (client OnlineEndpointsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName) + 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, resourceGroupName string, workspaceName string, endpointName 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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - online Endpoint name. +func (client OnlineEndpointsClient) GetToken(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName) + 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, resourceGroupName string, workspaceName string, endpointName 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 = "2022-02-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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - online Endpoint name. +func (client OnlineEndpointsClient) ListKeys(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName) + 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, resourceGroupName string, workspaceName string, endpointName 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 = "2022-02-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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - online Endpoint name. +// body - regenerateKeys request . +func (client OnlineEndpointsClient) RegenerateKeys(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName, 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", result.Response(), "Failure sending request") + return + } + + return +} + +// RegenerateKeysPreparer prepares the RegenerateKeys request. +func (client OnlineEndpointsClient) RegenerateKeysPreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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 = "2022-02-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 + future.FutureAPI = &azure.Future{} + 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: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// endpointName - online Endpoint name. +// body - online Endpoint entity to apply during operation. +func (client OnlineEndpointsClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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, resourceGroupName, workspaceName, endpointName, 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", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client OnlineEndpointsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, endpointName 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 = "2022-02-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 + future.FutureAPI = &azure.Future{} + 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/2022-02-01-preview/machinelearningservices/operations.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/operations.go new file mode 100644 index 000000000000..a8dfed16ebf5 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-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 AmlOperationListResult, 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 = "2022-02-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 AmlOperationListResult, 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/2022-02-01-preview/machinelearningservices/privateendpointconnections.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/privateendpointconnections.go new file mode 100644 index 000000000000..9cb8d15a906a --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/privateendpointconnections.go @@ -0,0 +1,387 @@ +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}}}, + {Target: "properties.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "properties.Sku.Name", 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 = "2022-02-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 = "2022-02-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 = "2022-02-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 = "2022-02-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/2022-02-01-preview/machinelearningservices/privatelinkresources.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/privatelinkresources.go new file mode 100644 index 000000000000..358138685aae --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-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 = "2022-02-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/2022-02-01-preview/machinelearningservices/quotas.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/quotas.go new file mode 100644 index 000000000000..2b5b1b1b4e66 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-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 = "2022-02-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 = "2022-02-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/2022-02-01-preview/machinelearningservices/usages.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/usages.go new file mode 100644 index 000000000000..3c9c156f6d9e --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-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 = "2022-02-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/2022-02-01-preview/machinelearningservices/version.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/version.go new file mode 100644 index 000000000000..650959272083 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-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/2022-02-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/2022-02-01-preview/machinelearningservices/virtualmachinesizes.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/virtualmachinesizes.go new file mode 100644 index 000000000000..ec71d3deaf07 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-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 = "2022-02-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/2022-02-01-preview/machinelearningservices/workspaceconnections.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/workspaceconnections.go new file mode 100644 index 000000000000..88f30b290090 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/workspaceconnections.go @@ -0,0 +1,390 @@ +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 = "2022-02-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}/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 = "2022-02-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 = "2022-02-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 = "2022-02-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/2022-02-01-preview/machinelearningservices/workspacefeatures.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/workspacefeatures.go new file mode 100644 index 000000000000..b477feff385f --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-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 = "2022-02-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/2022-02-01-preview/machinelearningservices/workspaces.go b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/workspaces.go new file mode 100644 index 000000000000..9888fc879430 --- /dev/null +++ b/services/preview/machinelearningservices/mgmt/2022-02-01-preview/machinelearningservices/workspaces.go @@ -0,0 +1,1346 @@ +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}, + }}, + }}, + }}, + {Target: "parameters.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Sku.Name", 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", result.Response(), "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 = "2022-02-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 + future.FutureAPI = &azure.Future{} + 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.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", result.Response(), "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 = "2022-02-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 + future.FutureAPI = &azure.Future{} + 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 +} + +// Diagnose sends the diagnose request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +// parameters - the parameter of diagnosing workspace health +func (client WorkspacesClient) Diagnose(ctx context.Context, resourceGroupName string, workspaceName string, parameters *DiagnoseWorkspaceParameters) (result WorkspacesDiagnoseFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.Diagnose") + 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", "Diagnose", err.Error()) + } + + req, err := client.DiagnosePreparer(ctx, resourceGroupName, workspaceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "Diagnose", nil, "Failure preparing request") + return + } + + result, err = client.DiagnoseSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "Diagnose", result.Response(), "Failure sending request") + return + } + + return +} + +// DiagnosePreparer prepares the Diagnose request. +func (client WorkspacesClient) DiagnosePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters *DiagnoseWorkspaceParameters) (*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 = "2022-02-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}/diagnose", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DiagnoseSender sends the Diagnose request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) DiagnoseSender(req *http.Request) (future WorkspacesDiagnoseFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 +} + +// DiagnoseResponder handles the response to the Diagnose request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) DiagnoseResponder(resp *http.Response) (result DiagnoseResponseResult, 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 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 = "2022-02-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 = "2022-02-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 = "2022-02-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 = "2022-02-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 = "2022-02-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 list keys of a notebook. +// 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 = "2022-02-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 +} + +// ListOutboundNetworkDependenciesEndpoints sends the list outbound network dependencies endpoints request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - name of Azure Machine Learning workspace. +func (client WorkspacesClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, workspaceName string) (result ExternalFQDNResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListOutboundNetworkDependenciesEndpoints") + 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", "ListOutboundNetworkDependenciesEndpoints", err.Error()) + } + + req, err := client.ListOutboundNetworkDependenciesEndpointsPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure sending request") + return + } + + result, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure responding to request") + return + } + + return +} + +// ListOutboundNetworkDependenciesEndpointsPreparer prepares the ListOutboundNetworkDependenciesEndpoints request. +func (client WorkspacesClient) ListOutboundNetworkDependenciesEndpointsPreparer(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 = "2022-02-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}/outboundNetworkDependenciesEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListOutboundNetworkDependenciesEndpointsSender sends the ListOutboundNetworkDependenciesEndpoints request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) ListOutboundNetworkDependenciesEndpointsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListOutboundNetworkDependenciesEndpointsResponder handles the response to the ListOutboundNetworkDependenciesEndpoints request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) ListOutboundNetworkDependenciesEndpointsResponder(resp *http.Response) (result ExternalFQDNResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListStorageAccountKeys list storage account keys of a workspace. +// 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 = "2022-02-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 prepare a notebook. +// 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", result.Response(), "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 = "2022-02-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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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 = "2022-02-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 + future.FutureAPI = &azure.Future{} + 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 WorkspacesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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.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 + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "machinelearningservices.WorkspacesClient", "Update", result.Response(), "Failure sending 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 = "2022-02-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) (future WorkspacesUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 WorkspacesClient) UpdateResponder(resp *http.Response) (result Workspace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +}