From 4bcf9ee23dfa73d53f5082e92f1f339d6486922b Mon Sep 17 00:00:00 2001 From: JiahuiPeng <46921893+804873052@users.noreply.github.com> Date: Thu, 4 Nov 2021 15:06:41 +0800 Subject: [PATCH] Release v59.1.0 (#16085) * Generated from specification/network/resource-manager/readme.md tag package-2021-05 (commit hash: ad6f098218e4f5eab87e784f1b6fc8a713147cab) * Generated from specification/quota/resource-manager/readme.md tag package-2021-03-15-preview (commit hash: ad6f098218e4f5eab87e784f1b6fc8a713147cab) * Generated from specification/cognitiveservices/resource-manager/readme.md tag package-2021-10 (commit hash: ad6f098218e4f5eab87e784f1b6fc8a713147cab) * v59.1.0 --- CHANGELOG.md | 18 +- .../cognitiveservicesapi/models.go | 5 +- .../mgmt/cognitiveservices/models.go | 97 +- .../cognitiveservicesapi/models.go | 5 +- .../mgmt/cognitiveservices/models.go | 97 +- .../preview/quota/mgmt/quota/models.go | 2 +- .../2021-10-01/cognitiveservices/CHANGELOG.md | 2 + .../2021-10-01/cognitiveservices/_meta.json | 11 + .../2021-10-01/cognitiveservices/accounts.go | 1036 +++++++ .../2021-10-01/cognitiveservices/client.go | 217 ++ .../cognitiveservicesapi/interfaces.go | 111 + .../cognitiveservices/commitmentplans.go | 443 +++ .../cognitiveservices/commitmenttiers.go | 154 + .../cognitiveservices/deletedaccounts.go | 335 +++ .../cognitiveservices/deployments.go | 446 +++ .../2021-10-01/cognitiveservices/enums.go | 345 +++ .../2021-10-01/cognitiveservices/models.go | 2484 +++++++++++++++++ .../cognitiveservices/operations.go | 140 + .../privateendpointconnections.go | 411 +++ .../cognitiveservices/privatelinkresources.go | 122 + .../cognitiveservices/resourceskus.go | 151 + .../2021-10-01/cognitiveservices/version.go | 19 + .../mgmt/2021-05-01/network/_meta.json | 2 +- .../2021-03-15-preview/quota/CHANGELOG.md | 27 + .../mgmt/2021-03-15-preview/quota/_meta.json | 2 +- .../mgmt/2021-03-15-preview/quota/enums.go | 4 +- .../mgmt/2021-03-15-preview/quota/models.go | 56 +- version/version.go | 2 +- 28 files changed, 6720 insertions(+), 24 deletions(-) create mode 100644 services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/CHANGELOG.md create mode 100644 services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/_meta.json create mode 100644 services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/accounts.go create mode 100644 services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/client.go create mode 100644 services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/cognitiveservicesapi/interfaces.go create mode 100644 services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/commitmentplans.go create mode 100644 services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/commitmenttiers.go create mode 100644 services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/deletedaccounts.go create mode 100644 services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/deployments.go create mode 100644 services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/enums.go create mode 100644 services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/models.go create mode 100644 services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/operations.go create mode 100644 services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/privateendpointconnections.go create mode 100644 services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/privatelinkresources.go create mode 100644 services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/resourceskus.go create mode 100644 services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/version.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 31633a77ec0d..f5ea4ca2da4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # CHANGELOG +## `v59.1.0` + +### New Packages + +- `github.com/Azure/azure-sdk-for-go/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices` + +### Breaking Changes + +| Package Path | Changelog | +| :--- | :---: | +| `github.com/Azure/azure-sdk-for-go/services/preview/quota/mgmt/2021-03-15-preview/quota` | [details](https://github.com/Azure/azure-sdk-for-go/tree/main/services/preview/quota/mgmt/2021-03-15-preview/quota/CHANGELOG.md) | + ## `v59.0.0` ### New Packages @@ -15,9 +27,9 @@ | Package Path | Changelog | | :--- | :---: | -| `github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn` | [details](https://github.com/Azure/azure-sdk-for-go/tree/main/services/cdn/mgmt/2020-09-01/cdn/CHANGELOG.md) | -| `github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic` | [details](https://github.com/Azure/azure-sdk-for-go/tree/main/services/logic/mgmt/2019-05-01/logic/CHANGELOG.md) | -| `github.com/Azure/azure-sdk-for-go/services/preview/videoanalyzer/mgmt/2021-11-01-preview/videoanalyzer` | [details](https://github.com/Azure/azure-sdk-for-go/tree/main/services/preview/videoanalyzer/mgmt/2021-11-01-preview/videoanalyzer/CHANGELOG.md) | +| `github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2020-09-01/cdn` | [details](https://github.com/Azure/azure-sdk-for-go/blob/v59.0.0/services/cdn/mgmt/2020-09-01/cdn/CHANGELOG.md) | +| `github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic` | [details](https://github.com/Azure/azure-sdk-for-go/blob/v59.0.0/services/logic/mgmt/2019-05-01/logic/CHANGELOG.md) | +| `github.com/Azure/azure-sdk-for-go/services/preview/videoanalyzer/mgmt/2021-11-01-preview/videoanalyzer` | [details](https://github.com/Azure/azure-sdk-for-go/blob/v59.0.0/services/preview/videoanalyzer/mgmt/2021-11-01-preview/videoanalyzer/CHANGELOG.md) | ## `v58.3.0` diff --git a/profiles/latest/cognitiveservices/mgmt/cognitiveservices/cognitiveservicesapi/models.go b/profiles/latest/cognitiveservices/mgmt/cognitiveservices/cognitiveservicesapi/models.go index 5b3a38f5a9d5..dc08ae4feed1 100644 --- a/profiles/latest/cognitiveservices/mgmt/cognitiveservices/cognitiveservicesapi/models.go +++ b/profiles/latest/cognitiveservices/mgmt/cognitiveservices/cognitiveservicesapi/models.go @@ -9,11 +9,14 @@ package cognitiveservicesapi -import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/mgmt/2021-04-30/cognitiveservices/cognitiveservicesapi" +import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/cognitiveservicesapi" type AccountsClientAPI = original.AccountsClientAPI type BaseClientAPI = original.BaseClientAPI +type CommitmentPlansClientAPI = original.CommitmentPlansClientAPI +type CommitmentTiersClientAPI = original.CommitmentTiersClientAPI type DeletedAccountsClientAPI = original.DeletedAccountsClientAPI +type DeploymentsClientAPI = original.DeploymentsClientAPI type OperationsClientAPI = original.OperationsClientAPI type PrivateEndpointConnectionsClientAPI = original.PrivateEndpointConnectionsClientAPI type PrivateLinkResourcesClientAPI = original.PrivateLinkResourcesClientAPI diff --git a/profiles/latest/cognitiveservices/mgmt/cognitiveservices/models.go b/profiles/latest/cognitiveservices/mgmt/cognitiveservices/models.go index 3a5df3d2888b..d2f5cf3ae832 100644 --- a/profiles/latest/cognitiveservices/mgmt/cognitiveservices/models.go +++ b/profiles/latest/cognitiveservices/mgmt/cognitiveservices/models.go @@ -12,7 +12,7 @@ package cognitiveservices import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/mgmt/2021-04-30/cognitiveservices" + original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices" ) const ( @@ -34,6 +34,31 @@ const ( CreatedByTypeUser CreatedByType = original.CreatedByTypeUser ) +type DeploymentProvisioningState = original.DeploymentProvisioningState + +const ( + DeploymentProvisioningStateAccepted DeploymentProvisioningState = original.DeploymentProvisioningStateAccepted + DeploymentProvisioningStateCreating DeploymentProvisioningState = original.DeploymentProvisioningStateCreating + DeploymentProvisioningStateDeleting DeploymentProvisioningState = original.DeploymentProvisioningStateDeleting + DeploymentProvisioningStateFailed DeploymentProvisioningState = original.DeploymentProvisioningStateFailed + DeploymentProvisioningStateMoving DeploymentProvisioningState = original.DeploymentProvisioningStateMoving + DeploymentProvisioningStateSucceeded DeploymentProvisioningState = original.DeploymentProvisioningStateSucceeded +) + +type DeploymentScaleType = original.DeploymentScaleType + +const ( + DeploymentScaleTypeManual DeploymentScaleType = original.DeploymentScaleTypeManual +) + +type HostingModel = original.HostingModel + +const ( + HostingModelConnectedContainer HostingModel = original.HostingModelConnectedContainer + HostingModelDisconnectedContainer HostingModel = original.HostingModelDisconnectedContainer + HostingModelWeb HostingModel = original.HostingModelWeb +) + type KeyName = original.KeyName const ( @@ -171,8 +196,33 @@ type BaseClient = original.BaseClient type CallRateLimit = original.CallRateLimit type CheckDomainAvailabilityParameter = original.CheckDomainAvailabilityParameter type CheckSkuAvailabilityParameter = original.CheckSkuAvailabilityParameter +type CommitmentCost = original.CommitmentCost +type CommitmentPeriod = original.CommitmentPeriod +type CommitmentPlan = original.CommitmentPlan +type CommitmentPlanListResult = original.CommitmentPlanListResult +type CommitmentPlanListResultIterator = original.CommitmentPlanListResultIterator +type CommitmentPlanListResultPage = original.CommitmentPlanListResultPage +type CommitmentPlanProperties = original.CommitmentPlanProperties +type CommitmentPlansClient = original.CommitmentPlansClient +type CommitmentPlansDeleteFuture = original.CommitmentPlansDeleteFuture +type CommitmentQuota = original.CommitmentQuota +type CommitmentTier = original.CommitmentTier +type CommitmentTierListResult = original.CommitmentTierListResult +type CommitmentTierListResultIterator = original.CommitmentTierListResultIterator +type CommitmentTierListResultPage = original.CommitmentTierListResultPage +type CommitmentTiersClient = original.CommitmentTiersClient type DeletedAccountsClient = original.DeletedAccountsClient type DeletedAccountsPurgeFuture = original.DeletedAccountsPurgeFuture +type Deployment = original.Deployment +type DeploymentListResult = original.DeploymentListResult +type DeploymentListResultIterator = original.DeploymentListResultIterator +type DeploymentListResultPage = original.DeploymentListResultPage +type DeploymentModel = original.DeploymentModel +type DeploymentProperties = original.DeploymentProperties +type DeploymentScaleSettings = original.DeploymentScaleSettings +type DeploymentsClient = original.DeploymentsClient +type DeploymentsCreateOrUpdateFuture = original.DeploymentsCreateOrUpdateFuture +type DeploymentsDeleteFuture = original.DeploymentsDeleteFuture type DomainAvailability = original.DomainAvailability type Encryption = original.Encryption type ErrorAdditionalInfo = original.ErrorAdditionalInfo @@ -242,12 +292,48 @@ func NewAccountsClient(subscriptionID string) AccountsClient { func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { return original.NewAccountsClientWithBaseURI(baseURI, subscriptionID) } +func NewCommitmentPlanListResultIterator(page CommitmentPlanListResultPage) CommitmentPlanListResultIterator { + return original.NewCommitmentPlanListResultIterator(page) +} +func NewCommitmentPlanListResultPage(cur CommitmentPlanListResult, getNextPage func(context.Context, CommitmentPlanListResult) (CommitmentPlanListResult, error)) CommitmentPlanListResultPage { + return original.NewCommitmentPlanListResultPage(cur, getNextPage) +} +func NewCommitmentPlansClient(subscriptionID string) CommitmentPlansClient { + return original.NewCommitmentPlansClient(subscriptionID) +} +func NewCommitmentPlansClientWithBaseURI(baseURI string, subscriptionID string) CommitmentPlansClient { + return original.NewCommitmentPlansClientWithBaseURI(baseURI, subscriptionID) +} +func NewCommitmentTierListResultIterator(page CommitmentTierListResultPage) CommitmentTierListResultIterator { + return original.NewCommitmentTierListResultIterator(page) +} +func NewCommitmentTierListResultPage(cur CommitmentTierListResult, getNextPage func(context.Context, CommitmentTierListResult) (CommitmentTierListResult, error)) CommitmentTierListResultPage { + return original.NewCommitmentTierListResultPage(cur, getNextPage) +} +func NewCommitmentTiersClient(subscriptionID string) CommitmentTiersClient { + return original.NewCommitmentTiersClient(subscriptionID) +} +func NewCommitmentTiersClientWithBaseURI(baseURI string, subscriptionID string) CommitmentTiersClient { + return original.NewCommitmentTiersClientWithBaseURI(baseURI, subscriptionID) +} func NewDeletedAccountsClient(subscriptionID string) DeletedAccountsClient { return original.NewDeletedAccountsClient(subscriptionID) } func NewDeletedAccountsClientWithBaseURI(baseURI string, subscriptionID string) DeletedAccountsClient { return original.NewDeletedAccountsClientWithBaseURI(baseURI, subscriptionID) } +func NewDeploymentListResultIterator(page DeploymentListResultPage) DeploymentListResultIterator { + return original.NewDeploymentListResultIterator(page) +} +func NewDeploymentListResultPage(cur DeploymentListResult, getNextPage func(context.Context, DeploymentListResult) (DeploymentListResult, error)) DeploymentListResultPage { + return original.NewDeploymentListResultPage(cur, getNextPage) +} +func NewDeploymentsClient(subscriptionID string) DeploymentsClient { + return original.NewDeploymentsClient(subscriptionID) +} +func NewDeploymentsClientWithBaseURI(baseURI string, subscriptionID string) DeploymentsClient { + return original.NewDeploymentsClientWithBaseURI(baseURI, subscriptionID) +} func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { return original.NewOperationListResultIterator(page) } @@ -293,6 +379,15 @@ func PossibleActionTypeValues() []ActionType { func PossibleCreatedByTypeValues() []CreatedByType { return original.PossibleCreatedByTypeValues() } +func PossibleDeploymentProvisioningStateValues() []DeploymentProvisioningState { + return original.PossibleDeploymentProvisioningStateValues() +} +func PossibleDeploymentScaleTypeValues() []DeploymentScaleType { + return original.PossibleDeploymentScaleTypeValues() +} +func PossibleHostingModelValues() []HostingModel { + return original.PossibleHostingModelValues() +} func PossibleKeyNameValues() []KeyName { return original.PossibleKeyNameValues() } diff --git a/profiles/preview/cognitiveservices/mgmt/cognitiveservices/cognitiveservicesapi/models.go b/profiles/preview/cognitiveservices/mgmt/cognitiveservices/cognitiveservicesapi/models.go index 5b3a38f5a9d5..dc08ae4feed1 100644 --- a/profiles/preview/cognitiveservices/mgmt/cognitiveservices/cognitiveservicesapi/models.go +++ b/profiles/preview/cognitiveservices/mgmt/cognitiveservices/cognitiveservicesapi/models.go @@ -9,11 +9,14 @@ package cognitiveservicesapi -import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/mgmt/2021-04-30/cognitiveservices/cognitiveservicesapi" +import original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/cognitiveservicesapi" type AccountsClientAPI = original.AccountsClientAPI type BaseClientAPI = original.BaseClientAPI +type CommitmentPlansClientAPI = original.CommitmentPlansClientAPI +type CommitmentTiersClientAPI = original.CommitmentTiersClientAPI type DeletedAccountsClientAPI = original.DeletedAccountsClientAPI +type DeploymentsClientAPI = original.DeploymentsClientAPI type OperationsClientAPI = original.OperationsClientAPI type PrivateEndpointConnectionsClientAPI = original.PrivateEndpointConnectionsClientAPI type PrivateLinkResourcesClientAPI = original.PrivateLinkResourcesClientAPI diff --git a/profiles/preview/cognitiveservices/mgmt/cognitiveservices/models.go b/profiles/preview/cognitiveservices/mgmt/cognitiveservices/models.go index 2e10f51e7fec..d7e20b7572f8 100644 --- a/profiles/preview/cognitiveservices/mgmt/cognitiveservices/models.go +++ b/profiles/preview/cognitiveservices/mgmt/cognitiveservices/models.go @@ -12,7 +12,7 @@ package cognitiveservices import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/mgmt/2021-04-30/cognitiveservices" + original "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices" ) const ( @@ -34,6 +34,31 @@ const ( CreatedByTypeUser CreatedByType = original.CreatedByTypeUser ) +type DeploymentProvisioningState = original.DeploymentProvisioningState + +const ( + DeploymentProvisioningStateAccepted DeploymentProvisioningState = original.DeploymentProvisioningStateAccepted + DeploymentProvisioningStateCreating DeploymentProvisioningState = original.DeploymentProvisioningStateCreating + DeploymentProvisioningStateDeleting DeploymentProvisioningState = original.DeploymentProvisioningStateDeleting + DeploymentProvisioningStateFailed DeploymentProvisioningState = original.DeploymentProvisioningStateFailed + DeploymentProvisioningStateMoving DeploymentProvisioningState = original.DeploymentProvisioningStateMoving + DeploymentProvisioningStateSucceeded DeploymentProvisioningState = original.DeploymentProvisioningStateSucceeded +) + +type DeploymentScaleType = original.DeploymentScaleType + +const ( + DeploymentScaleTypeManual DeploymentScaleType = original.DeploymentScaleTypeManual +) + +type HostingModel = original.HostingModel + +const ( + HostingModelConnectedContainer HostingModel = original.HostingModelConnectedContainer + HostingModelDisconnectedContainer HostingModel = original.HostingModelDisconnectedContainer + HostingModelWeb HostingModel = original.HostingModelWeb +) + type KeyName = original.KeyName const ( @@ -171,8 +196,33 @@ type BaseClient = original.BaseClient type CallRateLimit = original.CallRateLimit type CheckDomainAvailabilityParameter = original.CheckDomainAvailabilityParameter type CheckSkuAvailabilityParameter = original.CheckSkuAvailabilityParameter +type CommitmentCost = original.CommitmentCost +type CommitmentPeriod = original.CommitmentPeriod +type CommitmentPlan = original.CommitmentPlan +type CommitmentPlanListResult = original.CommitmentPlanListResult +type CommitmentPlanListResultIterator = original.CommitmentPlanListResultIterator +type CommitmentPlanListResultPage = original.CommitmentPlanListResultPage +type CommitmentPlanProperties = original.CommitmentPlanProperties +type CommitmentPlansClient = original.CommitmentPlansClient +type CommitmentPlansDeleteFuture = original.CommitmentPlansDeleteFuture +type CommitmentQuota = original.CommitmentQuota +type CommitmentTier = original.CommitmentTier +type CommitmentTierListResult = original.CommitmentTierListResult +type CommitmentTierListResultIterator = original.CommitmentTierListResultIterator +type CommitmentTierListResultPage = original.CommitmentTierListResultPage +type CommitmentTiersClient = original.CommitmentTiersClient type DeletedAccountsClient = original.DeletedAccountsClient type DeletedAccountsPurgeFuture = original.DeletedAccountsPurgeFuture +type Deployment = original.Deployment +type DeploymentListResult = original.DeploymentListResult +type DeploymentListResultIterator = original.DeploymentListResultIterator +type DeploymentListResultPage = original.DeploymentListResultPage +type DeploymentModel = original.DeploymentModel +type DeploymentProperties = original.DeploymentProperties +type DeploymentScaleSettings = original.DeploymentScaleSettings +type DeploymentsClient = original.DeploymentsClient +type DeploymentsCreateOrUpdateFuture = original.DeploymentsCreateOrUpdateFuture +type DeploymentsDeleteFuture = original.DeploymentsDeleteFuture type DomainAvailability = original.DomainAvailability type Encryption = original.Encryption type ErrorAdditionalInfo = original.ErrorAdditionalInfo @@ -242,12 +292,48 @@ func NewAccountsClient(subscriptionID string) AccountsClient { func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { return original.NewAccountsClientWithBaseURI(baseURI, subscriptionID) } +func NewCommitmentPlanListResultIterator(page CommitmentPlanListResultPage) CommitmentPlanListResultIterator { + return original.NewCommitmentPlanListResultIterator(page) +} +func NewCommitmentPlanListResultPage(cur CommitmentPlanListResult, getNextPage func(context.Context, CommitmentPlanListResult) (CommitmentPlanListResult, error)) CommitmentPlanListResultPage { + return original.NewCommitmentPlanListResultPage(cur, getNextPage) +} +func NewCommitmentPlansClient(subscriptionID string) CommitmentPlansClient { + return original.NewCommitmentPlansClient(subscriptionID) +} +func NewCommitmentPlansClientWithBaseURI(baseURI string, subscriptionID string) CommitmentPlansClient { + return original.NewCommitmentPlansClientWithBaseURI(baseURI, subscriptionID) +} +func NewCommitmentTierListResultIterator(page CommitmentTierListResultPage) CommitmentTierListResultIterator { + return original.NewCommitmentTierListResultIterator(page) +} +func NewCommitmentTierListResultPage(cur CommitmentTierListResult, getNextPage func(context.Context, CommitmentTierListResult) (CommitmentTierListResult, error)) CommitmentTierListResultPage { + return original.NewCommitmentTierListResultPage(cur, getNextPage) +} +func NewCommitmentTiersClient(subscriptionID string) CommitmentTiersClient { + return original.NewCommitmentTiersClient(subscriptionID) +} +func NewCommitmentTiersClientWithBaseURI(baseURI string, subscriptionID string) CommitmentTiersClient { + return original.NewCommitmentTiersClientWithBaseURI(baseURI, subscriptionID) +} func NewDeletedAccountsClient(subscriptionID string) DeletedAccountsClient { return original.NewDeletedAccountsClient(subscriptionID) } func NewDeletedAccountsClientWithBaseURI(baseURI string, subscriptionID string) DeletedAccountsClient { return original.NewDeletedAccountsClientWithBaseURI(baseURI, subscriptionID) } +func NewDeploymentListResultIterator(page DeploymentListResultPage) DeploymentListResultIterator { + return original.NewDeploymentListResultIterator(page) +} +func NewDeploymentListResultPage(cur DeploymentListResult, getNextPage func(context.Context, DeploymentListResult) (DeploymentListResult, error)) DeploymentListResultPage { + return original.NewDeploymentListResultPage(cur, getNextPage) +} +func NewDeploymentsClient(subscriptionID string) DeploymentsClient { + return original.NewDeploymentsClient(subscriptionID) +} +func NewDeploymentsClientWithBaseURI(baseURI string, subscriptionID string) DeploymentsClient { + return original.NewDeploymentsClientWithBaseURI(baseURI, subscriptionID) +} func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { return original.NewOperationListResultIterator(page) } @@ -293,6 +379,15 @@ func PossibleActionTypeValues() []ActionType { func PossibleCreatedByTypeValues() []CreatedByType { return original.PossibleCreatedByTypeValues() } +func PossibleDeploymentProvisioningStateValues() []DeploymentProvisioningState { + return original.PossibleDeploymentProvisioningStateValues() +} +func PossibleDeploymentScaleTypeValues() []DeploymentScaleType { + return original.PossibleDeploymentScaleTypeValues() +} +func PossibleHostingModelValues() []HostingModel { + return original.PossibleHostingModelValues() +} func PossibleKeyNameValues() []KeyName { return original.PossibleKeyNameValues() } diff --git a/profiles/preview/preview/quota/mgmt/quota/models.go b/profiles/preview/preview/quota/mgmt/quota/models.go index 598498ca7876..eea592f11abc 100644 --- a/profiles/preview/preview/quota/mgmt/quota/models.go +++ b/profiles/preview/preview/quota/mgmt/quota/models.go @@ -23,6 +23,7 @@ type LimitObjectType = original.LimitObjectType const ( LimitObjectTypeLimitJSONObject LimitObjectType = original.LimitObjectTypeLimitJSONObject + LimitObjectTypeLimitValue LimitObjectType = original.LimitObjectTypeLimitValue ) type LimitType = original.LimitType @@ -66,7 +67,6 @@ type CurrentUsagesBase = original.CurrentUsagesBase type ExceptionResponse = original.ExceptionResponse type LimitJSONObject = original.LimitJSONObject type LimitObject = original.LimitObject -type LimitValue = original.LimitValue type Limits = original.Limits type LimitsIterator = original.LimitsIterator type LimitsPage = original.LimitsPage diff --git a/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/CHANGELOG.md b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/_meta.json b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/_meta.json new file mode 100644 index 000000000000..de9f07b28e65 --- /dev/null +++ b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "ad6f098218e4f5eab87e784f1b6fc8a713147cab", + "readme": "/_/azure-rest-api-specs/specification/cognitiveservices/resource-manager/readme.md", + "tag": "package-2021-10", + "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-10 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/cognitiveservices/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/accounts.go b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/accounts.go new file mode 100644 index 000000000000..f151e84bee17 --- /dev/null +++ b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/accounts.go @@ -0,0 +1,1036 @@ +package cognitiveservices + +// 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" +) + +// AccountsClient is the cognitive Services Management Client +type AccountsClient struct { + BaseClient +} + +// NewAccountsClient creates an instance of the AccountsClient client. +func NewAccountsClient(subscriptionID string) AccountsClient { + return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccountsClientWithBaseURI creates an instance of the AccountsClient 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 NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { + return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for +// developer to access intelligent APIs. It's also the resource type for billing. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +// account - the parameters to provide for the created account. +func (client AccountsClient) Create(ctx context.Context, resourceGroupName string, accountName string, account Account) (result AccountsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Create") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: account, + Constraints: []validation.Constraint{{Target: "account.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "account.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "account.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "account.Properties.APIProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "account.Properties.APIProperties.EventHubConnectionString", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "account.Properties.APIProperties.EventHubConnectionString", Name: validation.MaxLength, Rule: 1000, Chain: nil}, + {Target: "account.Properties.APIProperties.EventHubConnectionString", Name: validation.Pattern, Rule: `^( *)Endpoint=sb://(.*);( *)SharedAccessKeyName=(.*);( *)SharedAccessKey=(.*)$`, Chain: nil}, + }}, + {Target: "account.Properties.APIProperties.StorageAccountConnectionString", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "account.Properties.APIProperties.StorageAccountConnectionString", Name: validation.MaxLength, Rule: 1000, Chain: nil}, + {Target: "account.Properties.APIProperties.StorageAccountConnectionString", Name: validation.Pattern, Rule: `^(( *)DefaultEndpointsProtocol=(http|https)( *);( *))?AccountName=(.*)AccountKey=(.*)EndpointSuffix=(.*)$`, Chain: nil}, + }}, + {Target: "account.Properties.APIProperties.AadClientID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "account.Properties.APIProperties.AadClientID", Name: validation.MaxLength, Rule: 500, Chain: nil}}}, + {Target: "account.Properties.APIProperties.AadTenantID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "account.Properties.APIProperties.AadTenantID", Name: validation.MaxLength, Rule: 500, Chain: nil}}}, + {Target: "account.Properties.APIProperties.SuperUser", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "account.Properties.APIProperties.SuperUser", Name: validation.MaxLength, Rule: 500, Chain: nil}}}, + {Target: "account.Properties.APIProperties.WebsiteName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "account.Properties.APIProperties.WebsiteName", Name: validation.MaxLength, Rule: 500, Chain: nil}}}, + }}, + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.AccountsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, account) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client AccountsClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, account Account) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + account.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.CognitiveServices/accounts/{accountName}", pathParameters), + autorest.WithJSON(account), + 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 AccountsClient) CreateSender(req *http.Request) (future AccountsCreateFuture, 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 +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AccountsClient) CreateResponder(resp *http.Response) (result Account, 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 Cognitive Services account from the resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +func (client AccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result AccountsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.AccountsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AccountsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-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.CognitiveServices/accounts/{accountName}", 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 AccountsClient) DeleteSender(req *http.Request) (future AccountsDeleteFuture, 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 AccountsClient) 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 returns a Cognitive Services account specified by the parameters. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +func (client AccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result Account, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.AccountsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AccountsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-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.CognitiveServices/accounts/{accountName}", 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 AccountsClient) 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 AccountsClient) GetResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List returns all the resources of a particular type belonging to a subscription. +func (client AccountsClient) List(ctx context.Context) (result AccountListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.List") + defer func() { + sc := -1 + if result.alr.Response.Response != nil { + sc = result.alr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, 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("cognitiveservices.AccountsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.alr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "List", resp, "Failure sending request") + return + } + + result.alr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "List", resp, "Failure responding to request") + return + } + if result.alr.hasNextLink() && result.alr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AccountsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/accounts", 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 AccountsClient) 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 AccountsClient) ListResponder(resp *http.Response) (result AccountListResult, 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 AccountsClient) listNextResults(ctx context.Context, lastResults AccountListResult) (result AccountListResult, err error) { + req, err := lastResults.accountListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "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, "cognitiveservices.AccountsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccountsClient) ListComplete(ctx context.Context) (result AccountListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.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 +} + +// ListByResourceGroup returns all the resources of a particular type belonging to a resource group +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client AccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AccountListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.alr.Response.Response != nil { + sc = result.alr.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("cognitiveservices.AccountsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.alr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.alr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.alr.hasNextLink() && result.alr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AccountsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-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.CognitiveServices/accounts", 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 AccountsClient) 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 AccountsClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, 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 AccountsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AccountListResult) (result AccountListResult, err error) { + req, err := lastResults.accountListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "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, "cognitiveservices.AccountsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccountsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AccountListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.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) + return +} + +// ListKeys lists the account keys for the specified Cognitive Services account. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +func (client AccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result APIKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.AccountsClient", "ListKeys", err.Error()) + } + + req, err := client.ListKeysPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListKeys", resp, "Failure sending request") + return + } + + result, err = client.ListKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListKeysPreparer prepares the ListKeys request. +func (client AccountsClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-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.CognitiveServices/accounts/{accountName}/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 AccountsClient) 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 AccountsClient) ListKeysResponder(resp *http.Response) (result APIKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSkus list available SKUs for the requested Cognitive Services account +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +func (client AccountsClient) ListSkus(ctx context.Context, resourceGroupName string, accountName string) (result AccountSkuListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListSkus") + 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: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.AccountsClient", "ListSkus", err.Error()) + } + + req, err := client.ListSkusPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListSkus", resp, "Failure sending request") + return + } + + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListSkus", resp, "Failure responding to request") + return + } + + return +} + +// ListSkusPreparer prepares the ListSkus request. +func (client AccountsClient) ListSkusPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-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.CognitiveServices/accounts/{accountName}/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 AccountsClient) 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 AccountsClient) ListSkusResponder(resp *http.Response) (result AccountSkuListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListUsages get usages for the requested Cognitive Services account +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +// filter - an OData filter expression that describes a subset of usages to return. The supported parameter is +// name.value (name of the metric, can have an or of multiple names). +func (client AccountsClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result UsageListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListUsages") + 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: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.AccountsClient", "ListUsages", err.Error()) + } + + req, err := client.ListUsagesPreparer(ctx, resourceGroupName, accountName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListUsages", nil, "Failure preparing request") + return + } + + resp, err := client.ListUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListUsages", resp, "Failure sending request") + return + } + + result, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "ListUsages", resp, "Failure responding to request") + return + } + + return +} + +// ListUsagesPreparer prepares the ListUsages request. +func (client AccountsClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, accountName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListUsagesSender sends the ListUsages request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) ListUsagesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListUsagesResponder handles the response to the ListUsages request. The method always +// closes the http.Response Body. +func (client AccountsClient) ListUsagesResponder(resp *http.Response) (result UsageListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKey regenerates the specified account key for the specified Cognitive Services account. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +// parameters - regenerate key parameters. +func (client AccountsClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, parameters RegenerateKeyParameters) (result APIKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.RegenerateKey") + 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: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.AccountsClient", "RegenerateKey", err.Error()) + } + + req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, accountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "RegenerateKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "RegenerateKey", resp, "Failure responding to request") + return + } + + return +} + +// RegenerateKeyPreparer prepares the RegenerateKey request. +func (client AccountsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, accountName string, parameters RegenerateKeyParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-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.CognitiveServices/accounts/{accountName}/regenerateKey", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateKeySender sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (client AccountsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (client AccountsClient) RegenerateKeyResponder(resp *http.Response) (result APIKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates a Cognitive Services account +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +// account - the parameters to provide for the created account. +func (client AccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, account Account) (result AccountsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.AccountsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, account) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, account Account) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + account.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", pathParameters), + autorest.WithJSON(account), + 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 AccountsClient) UpdateSender(req *http.Request) (future AccountsUpdateFuture, 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 AccountsClient) UpdateResponder(resp *http.Response) (result Account, 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/cognitiveservices/mgmt/2021-10-01/cognitiveservices/client.go b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/client.go new file mode 100644 index 000000000000..fb50604a4a52 --- /dev/null +++ b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/client.go @@ -0,0 +1,217 @@ +// Package cognitiveservices implements the Azure ARM Cognitiveservices service API version 2021-10-01. +// +// Cognitive Services Management Client +package cognitiveservices + +// 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" +) + +const ( + // DefaultBaseURI is the default URI used for the service Cognitiveservices + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Cognitiveservices. +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, + } +} + +// CheckDomainAvailability check whether a domain is available. +// Parameters: +// parameters - check Domain Availability parameter. +func (client BaseClient) CheckDomainAvailability(ctx context.Context, parameters CheckDomainAvailabilityParameter) (result DomainAvailability, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CheckDomainAvailability") + 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: parameters, + Constraints: []validation.Constraint{{Target: "parameters.SubdomainName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.BaseClient", "CheckDomainAvailability", err.Error()) + } + + req, err := client.CheckDomainAvailabilityPreparer(ctx, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.BaseClient", "CheckDomainAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckDomainAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.BaseClient", "CheckDomainAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckDomainAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.BaseClient", "CheckDomainAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckDomainAvailabilityPreparer prepares the CheckDomainAvailability request. +func (client BaseClient) CheckDomainAvailabilityPreparer(ctx context.Context, parameters CheckDomainAvailabilityParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-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.CognitiveServices/checkDomainAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckDomainAvailabilitySender sends the CheckDomainAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) CheckDomainAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckDomainAvailabilityResponder handles the response to the CheckDomainAvailability request. The method always +// closes the http.Response Body. +func (client BaseClient) CheckDomainAvailabilityResponder(resp *http.Response) (result DomainAvailability, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CheckSkuAvailability check available SKUs. +// Parameters: +// location - resource location. +// parameters - check SKU Availability POST body. +func (client BaseClient) CheckSkuAvailability(ctx context.Context, location string, parameters CheckSkuAvailabilityParameter) (result SkuAvailabilityListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CheckSkuAvailability") + 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: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Skus", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Kind", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.BaseClient", "CheckSkuAvailability", err.Error()) + } + + req, err := client.CheckSkuAvailabilityPreparer(ctx, location, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.BaseClient", "CheckSkuAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckSkuAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.BaseClient", "CheckSkuAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckSkuAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.BaseClient", "CheckSkuAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckSkuAvailabilityPreparer prepares the CheckSkuAvailability request. +func (client BaseClient) CheckSkuAvailabilityPreparer(ctx context.Context, location string, parameters CheckSkuAvailabilityParameter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-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.CognitiveServices/locations/{location}/checkSkuAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckSkuAvailabilitySender sends the CheckSkuAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) CheckSkuAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckSkuAvailabilityResponder handles the response to the CheckSkuAvailability request. The method always +// closes the http.Response Body. +func (client BaseClient) CheckSkuAvailabilityResponder(resp *http.Response) (result SkuAvailabilityListResult, 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/cognitiveservices/mgmt/2021-10-01/cognitiveservices/cognitiveservicesapi/interfaces.go b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/cognitiveservicesapi/interfaces.go new file mode 100644 index 000000000000..74a5e0466817 --- /dev/null +++ b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/cognitiveservicesapi/interfaces.go @@ -0,0 +1,111 @@ +package cognitiveservicesapi + +// 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/cognitiveservices/mgmt/2021-10-01/cognitiveservices" +) + +// BaseClientAPI contains the set of methods on the BaseClient type. +type BaseClientAPI interface { + CheckDomainAvailability(ctx context.Context, parameters cognitiveservices.CheckDomainAvailabilityParameter) (result cognitiveservices.DomainAvailability, err error) + CheckSkuAvailability(ctx context.Context, location string, parameters cognitiveservices.CheckSkuAvailabilityParameter) (result cognitiveservices.SkuAvailabilityListResult, err error) +} + +var _ BaseClientAPI = (*cognitiveservices.BaseClient)(nil) + +// AccountsClientAPI contains the set of methods on the AccountsClient type. +type AccountsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, accountName string, account cognitiveservices.Account) (result cognitiveservices.AccountsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string) (result cognitiveservices.AccountsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string) (result cognitiveservices.Account, err error) + List(ctx context.Context) (result cognitiveservices.AccountListResultPage, err error) + ListComplete(ctx context.Context) (result cognitiveservices.AccountListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result cognitiveservices.AccountListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result cognitiveservices.AccountListResultIterator, err error) + ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result cognitiveservices.APIKeys, err error) + ListSkus(ctx context.Context, resourceGroupName string, accountName string) (result cognitiveservices.AccountSkuListResult, err error) + ListUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result cognitiveservices.UsageListResult, err error) + RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, parameters cognitiveservices.RegenerateKeyParameters) (result cognitiveservices.APIKeys, err error) + Update(ctx context.Context, resourceGroupName string, accountName string, account cognitiveservices.Account) (result cognitiveservices.AccountsUpdateFuture, err error) +} + +var _ AccountsClientAPI = (*cognitiveservices.AccountsClient)(nil) + +// DeletedAccountsClientAPI contains the set of methods on the DeletedAccountsClient type. +type DeletedAccountsClientAPI interface { + Get(ctx context.Context, location string, resourceGroupName string, accountName string) (result cognitiveservices.Account, err error) + List(ctx context.Context) (result cognitiveservices.AccountListResultPage, err error) + ListComplete(ctx context.Context) (result cognitiveservices.AccountListResultIterator, err error) + Purge(ctx context.Context, location string, resourceGroupName string, accountName string) (result cognitiveservices.DeletedAccountsPurgeFuture, err error) +} + +var _ DeletedAccountsClientAPI = (*cognitiveservices.DeletedAccountsClient)(nil) + +// ResourceSkusClientAPI contains the set of methods on the ResourceSkusClient type. +type ResourceSkusClientAPI interface { + List(ctx context.Context) (result cognitiveservices.ResourceSkuListResultPage, err error) + ListComplete(ctx context.Context) (result cognitiveservices.ResourceSkuListResultIterator, err error) +} + +var _ ResourceSkusClientAPI = (*cognitiveservices.ResourceSkusClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result cognitiveservices.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result cognitiveservices.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*cognitiveservices.OperationsClient)(nil) + +// CommitmentTiersClientAPI contains the set of methods on the CommitmentTiersClient type. +type CommitmentTiersClientAPI interface { + List(ctx context.Context, location string) (result cognitiveservices.CommitmentTierListResultPage, err error) + ListComplete(ctx context.Context, location string) (result cognitiveservices.CommitmentTierListResultIterator, err error) +} + +var _ CommitmentTiersClientAPI = (*cognitiveservices.CommitmentTiersClient)(nil) + +// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, properties cognitiveservices.PrivateEndpointConnection) (result cognitiveservices.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result cognitiveservices.PrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result cognitiveservices.PrivateEndpointConnection, err error) + List(ctx context.Context, resourceGroupName string, accountName string) (result cognitiveservices.PrivateEndpointConnectionListResult, err error) +} + +var _ PrivateEndpointConnectionsClientAPI = (*cognitiveservices.PrivateEndpointConnectionsClient)(nil) + +// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. +type PrivateLinkResourcesClientAPI interface { + List(ctx context.Context, resourceGroupName string, accountName string) (result cognitiveservices.PrivateLinkResourceListResult, err error) +} + +var _ PrivateLinkResourcesClientAPI = (*cognitiveservices.PrivateLinkResourcesClient)(nil) + +// DeploymentsClientAPI contains the set of methods on the DeploymentsClient type. +type DeploymentsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, deployment cognitiveservices.Deployment) (result cognitiveservices.DeploymentsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, deploymentName string) (result cognitiveservices.DeploymentsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, deploymentName string) (result cognitiveservices.Deployment, err error) + List(ctx context.Context, resourceGroupName string, accountName string) (result cognitiveservices.DeploymentListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, accountName string) (result cognitiveservices.DeploymentListResultIterator, err error) +} + +var _ DeploymentsClientAPI = (*cognitiveservices.DeploymentsClient)(nil) + +// CommitmentPlansClientAPI contains the set of methods on the CommitmentPlansClient type. +type CommitmentPlansClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string, commitmentPlan cognitiveservices.CommitmentPlan) (result cognitiveservices.CommitmentPlan, err error) + Delete(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string) (result cognitiveservices.CommitmentPlansDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string) (result cognitiveservices.CommitmentPlan, err error) + List(ctx context.Context, resourceGroupName string, accountName string) (result cognitiveservices.CommitmentPlanListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, accountName string) (result cognitiveservices.CommitmentPlanListResultIterator, err error) +} + +var _ CommitmentPlansClientAPI = (*cognitiveservices.CommitmentPlansClient)(nil) diff --git a/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/commitmentplans.go b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/commitmentplans.go new file mode 100644 index 000000000000..d7c31e3bff05 --- /dev/null +++ b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/commitmentplans.go @@ -0,0 +1,443 @@ +package cognitiveservices + +// 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" +) + +// CommitmentPlansClient is the cognitive Services Management Client +type CommitmentPlansClient struct { + BaseClient +} + +// NewCommitmentPlansClient creates an instance of the CommitmentPlansClient client. +func NewCommitmentPlansClient(subscriptionID string) CommitmentPlansClient { + return NewCommitmentPlansClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCommitmentPlansClientWithBaseURI creates an instance of the CommitmentPlansClient 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 NewCommitmentPlansClientWithBaseURI(baseURI string, subscriptionID string) CommitmentPlansClient { + return CommitmentPlansClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate update the state of specified commitmentPlans associated with the Cognitive Services account. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +// commitmentPlanName - the name of the commitmentPlan associated with the Cognitive Services Account +// commitmentPlan - the commitmentPlan properties. +func (client CommitmentPlansClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string, commitmentPlan CommitmentPlan) (result CommitmentPlan, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CommitmentPlansClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.CommitmentPlansClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, commitmentPlanName, commitmentPlan) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.CommitmentPlansClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.CommitmentPlansClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.CommitmentPlansClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CommitmentPlansClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string, commitmentPlan CommitmentPlan) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "commitmentPlanName": autorest.Encode("path", commitmentPlanName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + commitmentPlan.SystemData = nil + commitmentPlan.Etag = 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.CognitiveServices/accounts/{accountName}/commitmentPlans/{commitmentPlanName}", pathParameters), + autorest.WithJSON(commitmentPlan), + 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 CommitmentPlansClient) 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 CommitmentPlansClient) CreateOrUpdateResponder(resp *http.Response) (result CommitmentPlan, 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 the specified commitmentPlan associated with the Cognitive Services account. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +// commitmentPlanName - the name of the commitmentPlan associated with the Cognitive Services Account +func (client CommitmentPlansClient) Delete(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string) (result CommitmentPlansDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CommitmentPlansClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.CommitmentPlansClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, commitmentPlanName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.CommitmentPlansClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.CommitmentPlansClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CommitmentPlansClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "commitmentPlanName": autorest.Encode("path", commitmentPlanName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-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.CognitiveServices/accounts/{accountName}/commitmentPlans/{commitmentPlanName}", 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 CommitmentPlansClient) DeleteSender(req *http.Request) (future CommitmentPlansDeleteFuture, 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 CommitmentPlansClient) 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 specified commitmentPlans associated with the Cognitive Services account. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +// commitmentPlanName - the name of the commitmentPlan associated with the Cognitive Services Account +func (client CommitmentPlansClient) Get(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string) (result CommitmentPlan, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CommitmentPlansClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.CommitmentPlansClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, commitmentPlanName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.CommitmentPlansClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.CommitmentPlansClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.CommitmentPlansClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client CommitmentPlansClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, commitmentPlanName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "commitmentPlanName": autorest.Encode("path", commitmentPlanName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-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.CognitiveServices/accounts/{accountName}/commitmentPlans/{commitmentPlanName}", 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 CommitmentPlansClient) 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 CommitmentPlansClient) GetResponder(resp *http.Response) (result CommitmentPlan, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets the commitmentPlans associated with the Cognitive Services account. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +func (client CommitmentPlansClient) List(ctx context.Context, resourceGroupName string, accountName string) (result CommitmentPlanListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CommitmentPlansClient.List") + defer func() { + sc := -1 + if result.cplr.Response.Response != nil { + sc = result.cplr.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: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.CommitmentPlansClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.CommitmentPlansClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.cplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.CommitmentPlansClient", "List", resp, "Failure sending request") + return + } + + result.cplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.CommitmentPlansClient", "List", resp, "Failure responding to request") + return + } + if result.cplr.hasNextLink() && result.cplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client CommitmentPlansClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-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.CognitiveServices/accounts/{accountName}/commitmentPlans", 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 CommitmentPlansClient) 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 CommitmentPlansClient) ListResponder(resp *http.Response) (result CommitmentPlanListResult, 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 CommitmentPlansClient) listNextResults(ctx context.Context, lastResults CommitmentPlanListResult) (result CommitmentPlanListResult, err error) { + req, err := lastResults.commitmentPlanListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cognitiveservices.CommitmentPlansClient", "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, "cognitiveservices.CommitmentPlansClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.CommitmentPlansClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client CommitmentPlansClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string) (result CommitmentPlanListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CommitmentPlansClient.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, accountName) + return +} diff --git a/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/commitmenttiers.go b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/commitmenttiers.go new file mode 100644 index 000000000000..f64e51750668 --- /dev/null +++ b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/commitmenttiers.go @@ -0,0 +1,154 @@ +package cognitiveservices + +// 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" +) + +// CommitmentTiersClient is the cognitive Services Management Client +type CommitmentTiersClient struct { + BaseClient +} + +// NewCommitmentTiersClient creates an instance of the CommitmentTiersClient client. +func NewCommitmentTiersClient(subscriptionID string) CommitmentTiersClient { + return NewCommitmentTiersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCommitmentTiersClientWithBaseURI creates an instance of the CommitmentTiersClient 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 NewCommitmentTiersClientWithBaseURI(baseURI string, subscriptionID string) CommitmentTiersClient { + return CommitmentTiersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list Commitment Tiers. +// Parameters: +// location - resource location. +func (client CommitmentTiersClient) List(ctx context.Context, location string) (result CommitmentTierListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CommitmentTiersClient.List") + defer func() { + sc := -1 + if result.ctlr.Response.Response != nil { + sc = result.ctlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, 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("cognitiveservices.CommitmentTiersClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.CommitmentTiersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ctlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.CommitmentTiersClient", "List", resp, "Failure sending request") + return + } + + result.ctlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.CommitmentTiersClient", "List", resp, "Failure responding to request") + return + } + if result.ctlr.hasNextLink() && result.ctlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client CommitmentTiersClient) 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-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/commitmentTiers", 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 CommitmentTiersClient) 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 CommitmentTiersClient) ListResponder(resp *http.Response) (result CommitmentTierListResult, 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 CommitmentTiersClient) listNextResults(ctx context.Context, lastResults CommitmentTierListResult) (result CommitmentTierListResult, err error) { + req, err := lastResults.commitmentTierListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cognitiveservices.CommitmentTiersClient", "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, "cognitiveservices.CommitmentTiersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.CommitmentTiersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client CommitmentTiersClient) ListComplete(ctx context.Context, location string) (result CommitmentTierListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CommitmentTiersClient.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/cognitiveservices/mgmt/2021-10-01/cognitiveservices/deletedaccounts.go b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/deletedaccounts.go new file mode 100644 index 000000000000..c1f2d8c0ebaf --- /dev/null +++ b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/deletedaccounts.go @@ -0,0 +1,335 @@ +package cognitiveservices + +// 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" +) + +// DeletedAccountsClient is the cognitive Services Management Client +type DeletedAccountsClient struct { + BaseClient +} + +// NewDeletedAccountsClient creates an instance of the DeletedAccountsClient client. +func NewDeletedAccountsClient(subscriptionID string) DeletedAccountsClient { + return NewDeletedAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDeletedAccountsClientWithBaseURI creates an instance of the DeletedAccountsClient 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 NewDeletedAccountsClientWithBaseURI(baseURI string, subscriptionID string) DeletedAccountsClient { + return DeletedAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get returns a Cognitive Services account specified by the parameters. +// Parameters: +// location - resource location. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +func (client DeletedAccountsClient) Get(ctx context.Context, location string, resourceGroupName string, accountName string) (result Account, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedAccountsClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.DeletedAccountsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, location, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeletedAccountsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.DeletedAccountsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeletedAccountsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DeletedAccountsClient) GetPreparer(ctx context.Context, location string, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "location": autorest.Encode("path", location), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName}", 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 DeletedAccountsClient) 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 DeletedAccountsClient) GetResponder(resp *http.Response) (result Account, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List returns all the resources of a particular type belonging to a subscription. +func (client DeletedAccountsClient) List(ctx context.Context) (result AccountListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedAccountsClient.List") + defer func() { + sc := -1 + if result.alr.Response.Response != nil { + sc = result.alr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, 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("cognitiveservices.DeletedAccountsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeletedAccountsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.alr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.DeletedAccountsClient", "List", resp, "Failure sending request") + return + } + + result.alr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeletedAccountsClient", "List", resp, "Failure responding to request") + return + } + if result.alr.hasNextLink() && result.alr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DeletedAccountsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/deletedAccounts", 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 DeletedAccountsClient) 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 DeletedAccountsClient) ListResponder(resp *http.Response) (result AccountListResult, 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 DeletedAccountsClient) listNextResults(ctx context.Context, lastResults AccountListResult) (result AccountListResult, err error) { + req, err := lastResults.accountListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cognitiveservices.DeletedAccountsClient", "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, "cognitiveservices.DeletedAccountsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeletedAccountsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeletedAccountsClient) ListComplete(ctx context.Context) (result AccountListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedAccountsClient.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 +} + +// Purge deletes a Cognitive Services account from the resource group. +// Parameters: +// location - resource location. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +func (client DeletedAccountsClient) Purge(ctx context.Context, location string, resourceGroupName string, accountName string) (result DeletedAccountsPurgeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedAccountsClient.Purge") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.DeletedAccountsClient", "Purge", err.Error()) + } + + req, err := client.PurgePreparer(ctx, location, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeletedAccountsClient", "Purge", nil, "Failure preparing request") + return + } + + result, err = client.PurgeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeletedAccountsClient", "Purge", result.Response(), "Failure sending request") + return + } + + return +} + +// PurgePreparer prepares the Purge request. +func (client DeletedAccountsClient) PurgePreparer(ctx context.Context, location string, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "location": autorest.Encode("path", location), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PurgeSender sends the Purge request. The method will close the +// http.Response Body if it receives an error. +func (client DeletedAccountsClient) PurgeSender(req *http.Request) (future DeletedAccountsPurgeFuture, 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 +} + +// PurgeResponder handles the response to the Purge request. The method always +// closes the http.Response Body. +func (client DeletedAccountsClient) PurgeResponder(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 +} diff --git a/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/deployments.go b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/deployments.go new file mode 100644 index 000000000000..cd4c158da37a --- /dev/null +++ b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/deployments.go @@ -0,0 +1,446 @@ +package cognitiveservices + +// 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" +) + +// DeploymentsClient is the cognitive Services Management Client +type DeploymentsClient struct { + BaseClient +} + +// NewDeploymentsClient creates an instance of the DeploymentsClient client. +func NewDeploymentsClient(subscriptionID string) DeploymentsClient { + return NewDeploymentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDeploymentsClientWithBaseURI creates an instance of the DeploymentsClient 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 NewDeploymentsClientWithBaseURI(baseURI string, subscriptionID string) DeploymentsClient { + return DeploymentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate update the state of specified deployments associated with the Cognitive Services account. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +// deploymentName - the name of the deployment associated with the Cognitive Services Account +// deployment - the deployment properties. +func (client DeploymentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, deployment Deployment) (result DeploymentsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.DeploymentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, deploymentName, deployment) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeploymentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeploymentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DeploymentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, deploymentName string, deployment Deployment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + deployment.SystemData = nil + deployment.Etag = 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.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}", pathParameters), + autorest.WithJSON(deployment), + 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 DeploymentsClient) CreateOrUpdateSender(req *http.Request) (future DeploymentsCreateOrUpdateFuture, 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 DeploymentsClient) CreateOrUpdateResponder(resp *http.Response) (result Deployment, 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 the specified deployment associated with the Cognitive Services account. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +// deploymentName - the name of the deployment associated with the Cognitive Services Account +func (client DeploymentsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, deploymentName string) (result DeploymentsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.DeploymentsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeploymentsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeploymentsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DeploymentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-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.CognitiveServices/accounts/{accountName}/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 DeploymentsClient) DeleteSender(req *http.Request) (future DeploymentsDeleteFuture, 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 DeploymentsClient) 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 specified deployments associated with the Cognitive Services account. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +// deploymentName - the name of the deployment associated with the Cognitive Services Account +func (client DeploymentsClient) Get(ctx context.Context, resourceGroupName string, accountName string, deploymentName string) (result Deployment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.DeploymentsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeploymentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.DeploymentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeploymentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DeploymentsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-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.CognitiveServices/accounts/{accountName}/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 DeploymentsClient) 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 DeploymentsClient) GetResponder(resp *http.Response) (result Deployment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets the deployments associated with the Cognitive Services account. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +func (client DeploymentsClient) List(ctx context.Context, resourceGroupName string, accountName string) (result DeploymentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.List") + defer func() { + sc := -1 + if result.dlr.Response.Response != nil { + sc = result.dlr.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: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.DeploymentsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeploymentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.DeploymentsClient", "List", resp, "Failure sending request") + return + } + + result.dlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeploymentsClient", "List", resp, "Failure responding to request") + return + } + if result.dlr.hasNextLink() && result.dlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DeploymentsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-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.CognitiveServices/accounts/{accountName}/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 DeploymentsClient) 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 DeploymentsClient) ListResponder(resp *http.Response) (result DeploymentListResult, 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 DeploymentsClient) listNextResults(ctx context.Context, lastResults DeploymentListResult) (result DeploymentListResult, err error) { + req, err := lastResults.deploymentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cognitiveservices.DeploymentsClient", "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, "cognitiveservices.DeploymentsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeploymentsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeploymentsClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string) (result DeploymentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.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, accountName) + return +} diff --git a/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/enums.go b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/enums.go new file mode 100644 index 000000000000..7bf0311a9833 --- /dev/null +++ b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/enums.go @@ -0,0 +1,345 @@ +package cognitiveservices + +// 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. + +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // ActionTypeInternal ... + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ActionTypeInternal} +} + +// 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} +} + +// DeploymentProvisioningState enumerates the values for deployment provisioning state. +type DeploymentProvisioningState string + +const ( + // DeploymentProvisioningStateAccepted ... + DeploymentProvisioningStateAccepted DeploymentProvisioningState = "Accepted" + // DeploymentProvisioningStateCreating ... + DeploymentProvisioningStateCreating DeploymentProvisioningState = "Creating" + // DeploymentProvisioningStateDeleting ... + DeploymentProvisioningStateDeleting DeploymentProvisioningState = "Deleting" + // DeploymentProvisioningStateFailed ... + DeploymentProvisioningStateFailed DeploymentProvisioningState = "Failed" + // DeploymentProvisioningStateMoving ... + DeploymentProvisioningStateMoving DeploymentProvisioningState = "Moving" + // DeploymentProvisioningStateSucceeded ... + DeploymentProvisioningStateSucceeded DeploymentProvisioningState = "Succeeded" +) + +// PossibleDeploymentProvisioningStateValues returns an array of possible values for the DeploymentProvisioningState const type. +func PossibleDeploymentProvisioningStateValues() []DeploymentProvisioningState { + return []DeploymentProvisioningState{DeploymentProvisioningStateAccepted, DeploymentProvisioningStateCreating, DeploymentProvisioningStateDeleting, DeploymentProvisioningStateFailed, DeploymentProvisioningStateMoving, DeploymentProvisioningStateSucceeded} +} + +// DeploymentScaleType enumerates the values for deployment scale type. +type DeploymentScaleType string + +const ( + // DeploymentScaleTypeManual ... + DeploymentScaleTypeManual DeploymentScaleType = "Manual" +) + +// PossibleDeploymentScaleTypeValues returns an array of possible values for the DeploymentScaleType const type. +func PossibleDeploymentScaleTypeValues() []DeploymentScaleType { + return []DeploymentScaleType{DeploymentScaleTypeManual} +} + +// HostingModel enumerates the values for hosting model. +type HostingModel string + +const ( + // HostingModelConnectedContainer ... + HostingModelConnectedContainer HostingModel = "ConnectedContainer" + // HostingModelDisconnectedContainer ... + HostingModelDisconnectedContainer HostingModel = "DisconnectedContainer" + // HostingModelWeb ... + HostingModelWeb HostingModel = "Web" +) + +// PossibleHostingModelValues returns an array of possible values for the HostingModel const type. +func PossibleHostingModelValues() []HostingModel { + return []HostingModel{HostingModelConnectedContainer, HostingModelDisconnectedContainer, HostingModelWeb} +} + +// KeyName enumerates the values for key name. +type KeyName string + +const ( + // KeyNameKey1 ... + KeyNameKey1 KeyName = "Key1" + // KeyNameKey2 ... + KeyNameKey2 KeyName = "Key2" +) + +// PossibleKeyNameValues returns an array of possible values for the KeyName const type. +func PossibleKeyNameValues() []KeyName { + return []KeyName{KeyNameKey1, KeyNameKey2} +} + +// KeySource enumerates the values for key source. +type KeySource string + +const ( + // KeySourceMicrosoftCognitiveServices ... + KeySourceMicrosoftCognitiveServices KeySource = "Microsoft.CognitiveServices" + // KeySourceMicrosoftKeyVault ... + KeySourceMicrosoftKeyVault KeySource = "Microsoft.KeyVault" +) + +// PossibleKeySourceValues returns an array of possible values for the KeySource const type. +func PossibleKeySourceValues() []KeySource { + return []KeySource{KeySourceMicrosoftCognitiveServices, KeySourceMicrosoftKeyVault} +} + +// NetworkRuleAction enumerates the values for network rule action. +type NetworkRuleAction string + +const ( + // NetworkRuleActionAllow ... + NetworkRuleActionAllow NetworkRuleAction = "Allow" + // NetworkRuleActionDeny ... + NetworkRuleActionDeny NetworkRuleAction = "Deny" +) + +// PossibleNetworkRuleActionValues returns an array of possible values for the NetworkRuleAction const type. +func PossibleNetworkRuleActionValues() []NetworkRuleAction { + return []NetworkRuleAction{NetworkRuleActionAllow, NetworkRuleActionDeny} +} + +// Origin enumerates the values for origin. +type Origin string + +const ( + // OriginSystem ... + OriginSystem Origin = "system" + // OriginUser ... + OriginUser Origin = "user" + // OriginUsersystem ... + OriginUsersystem Origin = "user,system" +) + +// PossibleOriginValues returns an array of possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{OriginSystem, OriginUser, OriginUsersystem} +} + +// 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 ( + // PrivateEndpointServiceConnectionStatusApproved ... + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + // PrivateEndpointServiceConnectionStatusPending ... + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + // PrivateEndpointServiceConnectionStatusRejected ... + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateEndpointServiceConnectionStatusValues returns an array of possible values for the PrivateEndpointServiceConnectionStatus const type. +func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { + return []PrivateEndpointServiceConnectionStatus{PrivateEndpointServiceConnectionStatusApproved, PrivateEndpointServiceConnectionStatusPending, PrivateEndpointServiceConnectionStatusRejected} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateAccepted ... + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateMoving ... + ProvisioningStateMoving ProvisioningState = "Moving" + // ProvisioningStateResolvingDNS ... + ProvisioningStateResolvingDNS ProvisioningState = "ResolvingDNS" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateAccepted, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMoving, ProvisioningStateResolvingDNS, ProvisioningStateSucceeded} +} + +// 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} +} + +// QuotaUsageStatus enumerates the values for quota usage status. +type QuotaUsageStatus string + +const ( + // QuotaUsageStatusBlocked ... + QuotaUsageStatusBlocked QuotaUsageStatus = "Blocked" + // QuotaUsageStatusIncluded ... + QuotaUsageStatusIncluded QuotaUsageStatus = "Included" + // QuotaUsageStatusInOverage ... + QuotaUsageStatusInOverage QuotaUsageStatus = "InOverage" + // QuotaUsageStatusUnknown ... + QuotaUsageStatusUnknown QuotaUsageStatus = "Unknown" +) + +// PossibleQuotaUsageStatusValues returns an array of possible values for the QuotaUsageStatus const type. +func PossibleQuotaUsageStatusValues() []QuotaUsageStatus { + return []QuotaUsageStatus{QuotaUsageStatusBlocked, QuotaUsageStatusIncluded, QuotaUsageStatusInOverage, QuotaUsageStatusUnknown} +} + +// 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} +} + +// ResourceSkuRestrictionsReasonCode enumerates the values for resource sku restrictions reason code. +type ResourceSkuRestrictionsReasonCode string + +const ( + // ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription ... + ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription ResourceSkuRestrictionsReasonCode = "NotAvailableForSubscription" + // ResourceSkuRestrictionsReasonCodeQuotaID ... + ResourceSkuRestrictionsReasonCodeQuotaID ResourceSkuRestrictionsReasonCode = "QuotaId" +) + +// PossibleResourceSkuRestrictionsReasonCodeValues returns an array of possible values for the ResourceSkuRestrictionsReasonCode const type. +func PossibleResourceSkuRestrictionsReasonCodeValues() []ResourceSkuRestrictionsReasonCode { + return []ResourceSkuRestrictionsReasonCode{ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription, ResourceSkuRestrictionsReasonCodeQuotaID} +} + +// ResourceSkuRestrictionsType enumerates the values for resource sku restrictions type. +type ResourceSkuRestrictionsType string + +const ( + // ResourceSkuRestrictionsTypeLocation ... + ResourceSkuRestrictionsTypeLocation ResourceSkuRestrictionsType = "Location" + // ResourceSkuRestrictionsTypeZone ... + ResourceSkuRestrictionsTypeZone ResourceSkuRestrictionsType = "Zone" +) + +// PossibleResourceSkuRestrictionsTypeValues returns an array of possible values for the ResourceSkuRestrictionsType const type. +func PossibleResourceSkuRestrictionsTypeValues() []ResourceSkuRestrictionsType { + return []ResourceSkuRestrictionsType{ResourceSkuRestrictionsTypeLocation, ResourceSkuRestrictionsTypeZone} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // SkuTierBasic ... + SkuTierBasic SkuTier = "Basic" + // SkuTierEnterprise ... + SkuTierEnterprise SkuTier = "Enterprise" + // SkuTierFree ... + SkuTierFree SkuTier = "Free" + // SkuTierPremium ... + SkuTierPremium SkuTier = "Premium" + // SkuTierStandard ... + SkuTierStandard SkuTier = "Standard" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{SkuTierBasic, SkuTierEnterprise, SkuTierFree, SkuTierPremium, SkuTierStandard} +} + +// UnitType enumerates the values for unit type. +type UnitType string + +const ( + // UnitTypeBytes ... + UnitTypeBytes UnitType = "Bytes" + // UnitTypeBytesPerSecond ... + UnitTypeBytesPerSecond UnitType = "BytesPerSecond" + // UnitTypeCount ... + UnitTypeCount UnitType = "Count" + // UnitTypeCountPerSecond ... + UnitTypeCountPerSecond UnitType = "CountPerSecond" + // UnitTypeMilliseconds ... + UnitTypeMilliseconds UnitType = "Milliseconds" + // UnitTypePercent ... + UnitTypePercent UnitType = "Percent" + // UnitTypeSeconds ... + UnitTypeSeconds UnitType = "Seconds" +) + +// PossibleUnitTypeValues returns an array of possible values for the UnitType const type. +func PossibleUnitTypeValues() []UnitType { + return []UnitType{UnitTypeBytes, UnitTypeBytesPerSecond, UnitTypeCount, UnitTypeCountPerSecond, UnitTypeMilliseconds, UnitTypePercent, UnitTypeSeconds} +} diff --git a/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/models.go b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/models.go new file mode 100644 index 000000000000..6e7a3d730940 --- /dev/null +++ b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/models.go @@ -0,0 +1,2484 @@ +package cognitiveservices + +// 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/cognitiveservices/mgmt/2021-10-01/cognitiveservices" + +// Account cognitive Services account is an Azure resource representing the provisioned account, it's type, +// location and SKU. +type Account struct { + autorest.Response `json:"-"` + // Kind - The Kind of the resource. + Kind *string `json:"kind,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Identity *Identity `json:"identity,omitempty"` + // SystemData - READ-ONLY + 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"` + // Properties - Properties of Cognitive Services account. + Properties *AccountProperties `json:"properties,omitempty"` + // 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 Account. +func (a Account) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.Kind != nil { + objectMap["kind"] = a.Kind + } + if a.Sku != nil { + objectMap["sku"] = a.Sku + } + if a.Identity != nil { + objectMap["identity"] = a.Identity + } + if a.Tags != nil { + objectMap["tags"] = a.Tags + } + if a.Location != nil { + objectMap["location"] = a.Location + } + if a.Properties != nil { + objectMap["properties"] = a.Properties + } + return json.Marshal(objectMap) +} + +// AccountListResult the list of cognitive services accounts operation response. +type AccountListResult struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of accounts. + NextLink *string `json:"nextLink,omitempty"` + // Value - READ-ONLY; Gets the list of Cognitive Services accounts and their properties. + Value *[]Account `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountListResult. +func (alr AccountListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if alr.NextLink != nil { + objectMap["nextLink"] = alr.NextLink + } + return json.Marshal(objectMap) +} + +// AccountListResultIterator provides access to a complete listing of Account values. +type AccountListResultIterator struct { + i int + page AccountListResultPage +} + +// 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 *AccountListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultIterator.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 *AccountListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AccountListResultIterator) 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 AccountListResultIterator) Response() AccountListResult { + 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 AccountListResultIterator) Value() Account { + if !iter.page.NotDone() { + return Account{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AccountListResultIterator type. +func NewAccountListResultIterator(page AccountListResultPage) AccountListResultIterator { + return AccountListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (alr AccountListResult) IsEmpty() bool { + return alr.Value == nil || len(*alr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (alr AccountListResult) hasNextLink() bool { + return alr.NextLink != nil && len(*alr.NextLink) != 0 +} + +// accountListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (alr AccountListResult) accountListResultPreparer(ctx context.Context) (*http.Request, error) { + if !alr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(alr.NextLink))) +} + +// AccountListResultPage contains a page of Account values. +type AccountListResultPage struct { + fn func(context.Context, AccountListResult) (AccountListResult, error) + alr AccountListResult +} + +// 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 *AccountListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultPage.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.alr) + if err != nil { + return err + } + page.alr = 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 *AccountListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AccountListResultPage) NotDone() bool { + return !page.alr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AccountListResultPage) Response() AccountListResult { + return page.alr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AccountListResultPage) Values() []Account { + if page.alr.IsEmpty() { + return nil + } + return *page.alr.Value +} + +// Creates a new instance of the AccountListResultPage type. +func NewAccountListResultPage(cur AccountListResult, getNextPage func(context.Context, AccountListResult) (AccountListResult, error)) AccountListResultPage { + return AccountListResultPage{ + fn: getNextPage, + alr: cur, + } +} + +// AccountProperties properties of Cognitive Services account. +type AccountProperties struct { + // ProvisioningState - READ-ONLY; Gets the status of the cognitive services account at the time the operation was called. Possible values include: 'ProvisioningStateAccepted', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateMoving', 'ProvisioningStateFailed', 'ProvisioningStateSucceeded', 'ProvisioningStateResolvingDNS' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Endpoint - READ-ONLY; Endpoint of the created account. + Endpoint *string `json:"endpoint,omitempty"` + // InternalID - READ-ONLY; The internal identifier (deprecated, do not use this property). + InternalID *string `json:"internalId,omitempty"` + // Capabilities - READ-ONLY; Gets the capabilities of the cognitive services account. Each item indicates the capability of a specific feature. The values are read-only and for reference only. + Capabilities *[]SkuCapability `json:"capabilities,omitempty"` + // IsMigrated - READ-ONLY; If the resource is migrated from an existing key. + IsMigrated *bool `json:"isMigrated,omitempty"` + // MigrationToken - Resource migration token. + MigrationToken *string `json:"migrationToken,omitempty"` + // SkuChangeInfo - READ-ONLY; Sku change info of account. + SkuChangeInfo *SkuChangeInfo `json:"skuChangeInfo,omitempty"` + // CustomSubDomainName - Optional subdomain name used for token-based authentication. + CustomSubDomainName *string `json:"customSubDomainName,omitempty"` + // NetworkAcls - A collection of rules governing the accessibility from specific network locations. + NetworkAcls *NetworkRuleSet `json:"networkAcls,omitempty"` + // Encryption - The encryption properties for this resource. + Encryption *Encryption `json:"encryption,omitempty"` + // UserOwnedStorage - The storage accounts for this resource. + UserOwnedStorage *[]UserOwnedStorage `json:"userOwnedStorage,omitempty"` + // PrivateEndpointConnections - READ-ONLY; The private endpoint connection associated with the Cognitive Services account. + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // PublicNetworkAccess - Whether or not public endpoint access is allowed for this account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // APIProperties - The api properties for special APIs. + APIProperties *APIProperties `json:"apiProperties,omitempty"` + // DateCreated - READ-ONLY; Gets the date of cognitive services account creation. + DateCreated *string `json:"dateCreated,omitempty"` + // CallRateLimit - READ-ONLY + CallRateLimit *CallRateLimit `json:"callRateLimit,omitempty"` + // QuotaLimit - READ-ONLY + QuotaLimit *QuotaLimit `json:"quotaLimit,omitempty"` + RestrictOutboundNetworkAccess *bool `json:"restrictOutboundNetworkAccess,omitempty"` + AllowedFqdnList *[]string `json:"allowedFqdnList,omitempty"` + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + // Endpoints - READ-ONLY + Endpoints map[string]*string `json:"endpoints"` + Restore *bool `json:"restore,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountProperties. +func (ap AccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ap.MigrationToken != nil { + objectMap["migrationToken"] = ap.MigrationToken + } + if ap.CustomSubDomainName != nil { + objectMap["customSubDomainName"] = ap.CustomSubDomainName + } + if ap.NetworkAcls != nil { + objectMap["networkAcls"] = ap.NetworkAcls + } + if ap.Encryption != nil { + objectMap["encryption"] = ap.Encryption + } + if ap.UserOwnedStorage != nil { + objectMap["userOwnedStorage"] = ap.UserOwnedStorage + } + if ap.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = ap.PublicNetworkAccess + } + if ap.APIProperties != nil { + objectMap["apiProperties"] = ap.APIProperties + } + if ap.RestrictOutboundNetworkAccess != nil { + objectMap["restrictOutboundNetworkAccess"] = ap.RestrictOutboundNetworkAccess + } + if ap.AllowedFqdnList != nil { + objectMap["allowedFqdnList"] = ap.AllowedFqdnList + } + if ap.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = ap.DisableLocalAuth + } + if ap.Restore != nil { + objectMap["restore"] = ap.Restore + } + return json.Marshal(objectMap) +} + +// AccountsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AccountsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountsClient) (Account, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountsCreateFuture) 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 AccountsCreateFuture.Result. +func (future *AccountsCreateFuture) result(client AccountsClient) (a Account, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + a.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cognitiveservices.AccountsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { + a, err = client.CreateResponder(a.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsCreateFuture", "Result", a.Response.Response, "Failure responding to request") + } + } + return +} + +// AccountsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AccountsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountsDeleteFuture) 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 AccountsDeleteFuture.Result. +func (future *AccountsDeleteFuture) result(client AccountsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cognitiveservices.AccountsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AccountSku cognitive Services resource type and SKU. +type AccountSku struct { + // ResourceType - Resource Namespace and Type + ResourceType *string `json:"resourceType,omitempty"` + // Sku - The SKU of Cognitive Services account. + Sku *Sku `json:"sku,omitempty"` +} + +// AccountSkuListResult the list of cognitive services accounts operation response. +type AccountSkuListResult struct { + autorest.Response `json:"-"` + // Value - Gets the list of Cognitive Services accounts and their properties. + Value *[]AccountSku `json:"value,omitempty"` +} + +// AccountsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AccountsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AccountsClient) (Account, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AccountsUpdateFuture) 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 AccountsUpdateFuture.Result. +func (future *AccountsUpdateFuture) result(client AccountsClient) (a Account, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + a.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cognitiveservices.AccountsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { + a, err = client.UpdateResponder(a.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.AccountsUpdateFuture", "Result", a.Response.Response, "Failure responding to request") + } + } + return +} + +// APIKeys the access keys for the cognitive services account. +type APIKeys struct { + autorest.Response `json:"-"` + // Key1 - Gets the value of key 1. + Key1 *string `json:"key1,omitempty"` + // Key2 - Gets the value of key 2. + Key2 *string `json:"key2,omitempty"` +} + +// APIProperties the api properties for special APIs. +type APIProperties struct { + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // QnaRuntimeEndpoint - (QnAMaker Only) The runtime endpoint of QnAMaker. + QnaRuntimeEndpoint *string `json:"qnaRuntimeEndpoint,omitempty"` + // QnaAzureSearchEndpointKey - (QnAMaker Only) The Azure Search endpoint key of QnAMaker. + QnaAzureSearchEndpointKey *string `json:"qnaAzureSearchEndpointKey,omitempty"` + // QnaAzureSearchEndpointID - (QnAMaker Only) The Azure Search endpoint id of QnAMaker. + QnaAzureSearchEndpointID *string `json:"qnaAzureSearchEndpointId,omitempty"` + // StatisticsEnabled - (Bing Search Only) The flag to enable statistics of Bing Search. + StatisticsEnabled *bool `json:"statisticsEnabled,omitempty"` + // EventHubConnectionString - (Personalization Only) The flag to enable statistics of Bing Search. + EventHubConnectionString *string `json:"eventHubConnectionString,omitempty"` + // StorageAccountConnectionString - (Personalization Only) The storage account connection string. + StorageAccountConnectionString *string `json:"storageAccountConnectionString,omitempty"` + // AadClientID - (Metrics Advisor Only) The Azure AD Client Id (Application Id). + AadClientID *string `json:"aadClientId,omitempty"` + // AadTenantID - (Metrics Advisor Only) The Azure AD Tenant Id. + AadTenantID *string `json:"aadTenantId,omitempty"` + // SuperUser - (Metrics Advisor Only) The super user of Metrics Advisor. + SuperUser *string `json:"superUser,omitempty"` + // WebsiteName - (Metrics Advisor Only) The website name of Metrics Advisor. + WebsiteName *string `json:"websiteName,omitempty"` +} + +// MarshalJSON is the custom marshaler for APIProperties. +func (ap APIProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ap.QnaRuntimeEndpoint != nil { + objectMap["qnaRuntimeEndpoint"] = ap.QnaRuntimeEndpoint + } + if ap.QnaAzureSearchEndpointKey != nil { + objectMap["qnaAzureSearchEndpointKey"] = ap.QnaAzureSearchEndpointKey + } + if ap.QnaAzureSearchEndpointID != nil { + objectMap["qnaAzureSearchEndpointId"] = ap.QnaAzureSearchEndpointID + } + if ap.StatisticsEnabled != nil { + objectMap["statisticsEnabled"] = ap.StatisticsEnabled + } + if ap.EventHubConnectionString != nil { + objectMap["eventHubConnectionString"] = ap.EventHubConnectionString + } + if ap.StorageAccountConnectionString != nil { + objectMap["storageAccountConnectionString"] = ap.StorageAccountConnectionString + } + if ap.AadClientID != nil { + objectMap["aadClientId"] = ap.AadClientID + } + if ap.AadTenantID != nil { + objectMap["aadTenantId"] = ap.AadTenantID + } + if ap.SuperUser != nil { + objectMap["superUser"] = ap.SuperUser + } + if ap.WebsiteName != nil { + objectMap["websiteName"] = ap.WebsiteName + } + for k, v := range ap.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for APIProperties struct. +func (ap *APIProperties) 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 { + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if ap.AdditionalProperties == nil { + ap.AdditionalProperties = make(map[string]interface{}) + } + ap.AdditionalProperties[k] = additionalProperties + } + case "qnaRuntimeEndpoint": + if v != nil { + var qnaRuntimeEndpoint string + err = json.Unmarshal(*v, &qnaRuntimeEndpoint) + if err != nil { + return err + } + ap.QnaRuntimeEndpoint = &qnaRuntimeEndpoint + } + case "qnaAzureSearchEndpointKey": + if v != nil { + var qnaAzureSearchEndpointKey string + err = json.Unmarshal(*v, &qnaAzureSearchEndpointKey) + if err != nil { + return err + } + ap.QnaAzureSearchEndpointKey = &qnaAzureSearchEndpointKey + } + case "qnaAzureSearchEndpointId": + if v != nil { + var qnaAzureSearchEndpointID string + err = json.Unmarshal(*v, &qnaAzureSearchEndpointID) + if err != nil { + return err + } + ap.QnaAzureSearchEndpointID = &qnaAzureSearchEndpointID + } + case "statisticsEnabled": + if v != nil { + var statisticsEnabled bool + err = json.Unmarshal(*v, &statisticsEnabled) + if err != nil { + return err + } + ap.StatisticsEnabled = &statisticsEnabled + } + case "eventHubConnectionString": + if v != nil { + var eventHubConnectionString string + err = json.Unmarshal(*v, &eventHubConnectionString) + if err != nil { + return err + } + ap.EventHubConnectionString = &eventHubConnectionString + } + case "storageAccountConnectionString": + if v != nil { + var storageAccountConnectionString string + err = json.Unmarshal(*v, &storageAccountConnectionString) + if err != nil { + return err + } + ap.StorageAccountConnectionString = &storageAccountConnectionString + } + case "aadClientId": + if v != nil { + var aadClientID string + err = json.Unmarshal(*v, &aadClientID) + if err != nil { + return err + } + ap.AadClientID = &aadClientID + } + case "aadTenantId": + if v != nil { + var aadTenantID string + err = json.Unmarshal(*v, &aadTenantID) + if err != nil { + return err + } + ap.AadTenantID = &aadTenantID + } + case "superUser": + if v != nil { + var superUser string + err = json.Unmarshal(*v, &superUser) + if err != nil { + return err + } + ap.SuperUser = &superUser + } + case "websiteName": + if v != nil { + var websiteName string + err = json.Unmarshal(*v, &websiteName) + if err != nil { + return err + } + ap.WebsiteName = &websiteName + } + } + } + + 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) +} + +// CallRateLimit the call rate limit Cognitive Services account. +type CallRateLimit struct { + // Count - The count value of Call Rate Limit. + Count *float64 `json:"count,omitempty"` + // RenewalPeriod - The renewal period in seconds of Call Rate Limit. + RenewalPeriod *float64 `json:"renewalPeriod,omitempty"` + Rules *[]ThrottlingRule `json:"rules,omitempty"` +} + +// CheckDomainAvailabilityParameter check Domain availability parameter. +type CheckDomainAvailabilityParameter struct { + // SubdomainName - The subdomain name to use. + SubdomainName *string `json:"subdomainName,omitempty"` + // Type - The Type of the resource. + Type *string `json:"type,omitempty"` + // Kind - The Kind of the resource. + Kind *string `json:"kind,omitempty"` +} + +// CheckSkuAvailabilityParameter check SKU availability parameter. +type CheckSkuAvailabilityParameter struct { + // Skus - The SKU of the resource. + Skus *[]string `json:"skus,omitempty"` + // Kind - The Kind of the resource. + Kind *string `json:"kind,omitempty"` + // Type - The Type of the resource. + Type *string `json:"type,omitempty"` +} + +// CommitmentCost cognitive Services account commitment cost. +type CommitmentCost struct { + // CommitmentMeterID - Commitment meter Id. + CommitmentMeterID *string `json:"commitmentMeterId,omitempty"` + // OverageMeterID - Overage meter Id. + OverageMeterID *string `json:"overageMeterId,omitempty"` +} + +// CommitmentPeriod cognitive Services account commitment period. +type CommitmentPeriod struct { + // Tier - Commitment period commitment tier. + Tier *string `json:"tier,omitempty"` + // Count - Commitment period commitment count. + Count *int32 `json:"count,omitempty"` + // Quota - READ-ONLY + Quota *CommitmentQuota `json:"quota,omitempty"` + // StartDate - READ-ONLY; Commitment period start date. + StartDate *string `json:"startDate,omitempty"` + // EndDate - READ-ONLY; Commitment period end date. + EndDate *string `json:"endDate,omitempty"` +} + +// MarshalJSON is the custom marshaler for CommitmentPeriod. +func (cp CommitmentPeriod) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.Tier != nil { + objectMap["tier"] = cp.Tier + } + if cp.Count != nil { + objectMap["count"] = cp.Count + } + return json.Marshal(objectMap) +} + +// CommitmentPlan cognitive Services account commitment plan. +type CommitmentPlan struct { + autorest.Response `json:"-"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // Properties - Properties of Cognitive Services account commitment plan. + Properties *CommitmentPlanProperties `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"` +} + +// MarshalJSON is the custom marshaler for CommitmentPlan. +func (cp CommitmentPlan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.Properties != nil { + objectMap["properties"] = cp.Properties + } + return json.Marshal(objectMap) +} + +// CommitmentPlanListResult the list of cognitive services accounts operation response. +type CommitmentPlanListResult struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of CommitmentPlan. + NextLink *string `json:"nextLink,omitempty"` + // Value - READ-ONLY; Gets the list of Cognitive Services accounts CommitmentPlan and their properties. + Value *[]CommitmentPlan `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for CommitmentPlanListResult. +func (cplr CommitmentPlanListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cplr.NextLink != nil { + objectMap["nextLink"] = cplr.NextLink + } + return json.Marshal(objectMap) +} + +// CommitmentPlanListResultIterator provides access to a complete listing of CommitmentPlan values. +type CommitmentPlanListResultIterator struct { + i int + page CommitmentPlanListResultPage +} + +// 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 *CommitmentPlanListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CommitmentPlanListResultIterator.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 *CommitmentPlanListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CommitmentPlanListResultIterator) 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 CommitmentPlanListResultIterator) Response() CommitmentPlanListResult { + 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 CommitmentPlanListResultIterator) Value() CommitmentPlan { + if !iter.page.NotDone() { + return CommitmentPlan{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CommitmentPlanListResultIterator type. +func NewCommitmentPlanListResultIterator(page CommitmentPlanListResultPage) CommitmentPlanListResultIterator { + return CommitmentPlanListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cplr CommitmentPlanListResult) IsEmpty() bool { + return cplr.Value == nil || len(*cplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cplr CommitmentPlanListResult) hasNextLink() bool { + return cplr.NextLink != nil && len(*cplr.NextLink) != 0 +} + +// commitmentPlanListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cplr CommitmentPlanListResult) commitmentPlanListResultPreparer(ctx context.Context) (*http.Request, error) { + if !cplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cplr.NextLink))) +} + +// CommitmentPlanListResultPage contains a page of CommitmentPlan values. +type CommitmentPlanListResultPage struct { + fn func(context.Context, CommitmentPlanListResult) (CommitmentPlanListResult, error) + cplr CommitmentPlanListResult +} + +// 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 *CommitmentPlanListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CommitmentPlanListResultPage.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.cplr) + if err != nil { + return err + } + page.cplr = 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 *CommitmentPlanListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CommitmentPlanListResultPage) NotDone() bool { + return !page.cplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CommitmentPlanListResultPage) Response() CommitmentPlanListResult { + return page.cplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CommitmentPlanListResultPage) Values() []CommitmentPlan { + if page.cplr.IsEmpty() { + return nil + } + return *page.cplr.Value +} + +// Creates a new instance of the CommitmentPlanListResultPage type. +func NewCommitmentPlanListResultPage(cur CommitmentPlanListResult, getNextPage func(context.Context, CommitmentPlanListResult) (CommitmentPlanListResult, error)) CommitmentPlanListResultPage { + return CommitmentPlanListResultPage{ + fn: getNextPage, + cplr: cur, + } +} + +// CommitmentPlanProperties properties of Cognitive Services account commitment plan. +type CommitmentPlanProperties struct { + // HostingModel - Account hosting model. Possible values include: 'HostingModelWeb', 'HostingModelConnectedContainer', 'HostingModelDisconnectedContainer' + HostingModel HostingModel `json:"hostingModel,omitempty"` + // PlanType - Commitment plan type. + PlanType *string `json:"planType,omitempty"` + Current *CommitmentPeriod `json:"current,omitempty"` + // AutoRenew - AutoRenew commitment plan. + AutoRenew *bool `json:"autoRenew,omitempty"` + Next *CommitmentPeriod `json:"next,omitempty"` + // Last - READ-ONLY + Last *CommitmentPeriod `json:"last,omitempty"` +} + +// MarshalJSON is the custom marshaler for CommitmentPlanProperties. +func (cpp CommitmentPlanProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cpp.HostingModel != "" { + objectMap["hostingModel"] = cpp.HostingModel + } + if cpp.PlanType != nil { + objectMap["planType"] = cpp.PlanType + } + if cpp.Current != nil { + objectMap["current"] = cpp.Current + } + if cpp.AutoRenew != nil { + objectMap["autoRenew"] = cpp.AutoRenew + } + if cpp.Next != nil { + objectMap["next"] = cpp.Next + } + return json.Marshal(objectMap) +} + +// CommitmentPlansDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CommitmentPlansDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CommitmentPlansClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CommitmentPlansDeleteFuture) 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 CommitmentPlansDeleteFuture.Result. +func (future *CommitmentPlansDeleteFuture) result(client CommitmentPlansClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.CommitmentPlansDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cognitiveservices.CommitmentPlansDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// CommitmentQuota cognitive Services account commitment quota. +type CommitmentQuota struct { + // Quantity - Commitment quota quantity. + Quantity *int64 `json:"quantity,omitempty"` + // Unit - Commitment quota unit. + Unit *string `json:"unit,omitempty"` +} + +// CommitmentTier cognitive Services account commitment tier. +type CommitmentTier struct { + // Kind - The Kind of the resource. + Kind *string `json:"kind,omitempty"` + // SkuName - The name of the SKU. Ex - P3. It is typically a letter+number code + SkuName *string `json:"skuName,omitempty"` + // HostingModel - Account hosting model. Possible values include: 'HostingModelWeb', 'HostingModelConnectedContainer', 'HostingModelDisconnectedContainer' + HostingModel HostingModel `json:"hostingModel,omitempty"` + // PlanType - Commitment plan type. + PlanType *string `json:"planType,omitempty"` + // Tier - Commitment period commitment tier. + Tier *string `json:"tier,omitempty"` + // MaxCount - Commitment period commitment max count. + MaxCount *int32 `json:"maxCount,omitempty"` + Quota *CommitmentQuota `json:"quota,omitempty"` + Cost *CommitmentCost `json:"cost,omitempty"` +} + +// CommitmentTierListResult the list of cognitive services accounts operation response. +type CommitmentTierListResult struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of CommitmentTier. + NextLink *string `json:"nextLink,omitempty"` + // Value - READ-ONLY; Gets the list of Cognitive Services accounts CommitmentTier and their properties. + Value *[]CommitmentTier `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for CommitmentTierListResult. +func (ctlr CommitmentTierListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ctlr.NextLink != nil { + objectMap["nextLink"] = ctlr.NextLink + } + return json.Marshal(objectMap) +} + +// CommitmentTierListResultIterator provides access to a complete listing of CommitmentTier values. +type CommitmentTierListResultIterator struct { + i int + page CommitmentTierListResultPage +} + +// 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 *CommitmentTierListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CommitmentTierListResultIterator.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 *CommitmentTierListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CommitmentTierListResultIterator) 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 CommitmentTierListResultIterator) Response() CommitmentTierListResult { + 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 CommitmentTierListResultIterator) Value() CommitmentTier { + if !iter.page.NotDone() { + return CommitmentTier{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CommitmentTierListResultIterator type. +func NewCommitmentTierListResultIterator(page CommitmentTierListResultPage) CommitmentTierListResultIterator { + return CommitmentTierListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ctlr CommitmentTierListResult) IsEmpty() bool { + return ctlr.Value == nil || len(*ctlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ctlr CommitmentTierListResult) hasNextLink() bool { + return ctlr.NextLink != nil && len(*ctlr.NextLink) != 0 +} + +// commitmentTierListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ctlr CommitmentTierListResult) commitmentTierListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ctlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ctlr.NextLink))) +} + +// CommitmentTierListResultPage contains a page of CommitmentTier values. +type CommitmentTierListResultPage struct { + fn func(context.Context, CommitmentTierListResult) (CommitmentTierListResult, error) + ctlr CommitmentTierListResult +} + +// 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 *CommitmentTierListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CommitmentTierListResultPage.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.ctlr) + if err != nil { + return err + } + page.ctlr = 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 *CommitmentTierListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CommitmentTierListResultPage) NotDone() bool { + return !page.ctlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CommitmentTierListResultPage) Response() CommitmentTierListResult { + return page.ctlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CommitmentTierListResultPage) Values() []CommitmentTier { + if page.ctlr.IsEmpty() { + return nil + } + return *page.ctlr.Value +} + +// Creates a new instance of the CommitmentTierListResultPage type. +func NewCommitmentTierListResultPage(cur CommitmentTierListResult, getNextPage func(context.Context, CommitmentTierListResult) (CommitmentTierListResult, error)) CommitmentTierListResultPage { + return CommitmentTierListResultPage{ + fn: getNextPage, + ctlr: cur, + } +} + +// DeletedAccountsPurgeFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeletedAccountsPurgeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeletedAccountsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeletedAccountsPurgeFuture) 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 DeletedAccountsPurgeFuture.Result. +func (future *DeletedAccountsPurgeFuture) result(client DeletedAccountsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeletedAccountsPurgeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cognitiveservices.DeletedAccountsPurgeFuture") + return + } + ar.Response = future.Response() + return +} + +// Deployment cognitive Services account deployment. +type Deployment struct { + autorest.Response `json:"-"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // Properties - Properties of Cognitive Services account deployment. + Properties *DeploymentProperties `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"` +} + +// MarshalJSON is the custom marshaler for Deployment. +func (d Deployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.Properties != nil { + objectMap["properties"] = d.Properties + } + return json.Marshal(objectMap) +} + +// DeploymentListResult the list of cognitive services accounts operation response. +type DeploymentListResult struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of Deployment. + NextLink *string `json:"nextLink,omitempty"` + // Value - READ-ONLY; Gets the list of Cognitive Services accounts Deployment and their properties. + Value *[]Deployment `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentListResult. +func (dlr DeploymentListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dlr.NextLink != nil { + objectMap["nextLink"] = dlr.NextLink + } + return json.Marshal(objectMap) +} + +// DeploymentListResultIterator provides access to a complete listing of Deployment values. +type DeploymentListResultIterator struct { + i int + page DeploymentListResultPage +} + +// 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 *DeploymentListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentListResultIterator.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 *DeploymentListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeploymentListResultIterator) 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 DeploymentListResultIterator) Response() DeploymentListResult { + 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 DeploymentListResultIterator) Value() Deployment { + if !iter.page.NotDone() { + return Deployment{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DeploymentListResultIterator type. +func NewDeploymentListResultIterator(page DeploymentListResultPage) DeploymentListResultIterator { + return DeploymentListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dlr DeploymentListResult) IsEmpty() bool { + return dlr.Value == nil || len(*dlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dlr DeploymentListResult) hasNextLink() bool { + return dlr.NextLink != nil && len(*dlr.NextLink) != 0 +} + +// deploymentListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dlr DeploymentListResult) deploymentListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dlr.NextLink))) +} + +// DeploymentListResultPage contains a page of Deployment values. +type DeploymentListResultPage struct { + fn func(context.Context, DeploymentListResult) (DeploymentListResult, error) + dlr DeploymentListResult +} + +// 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 *DeploymentListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentListResultPage.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.dlr) + if err != nil { + return err + } + page.dlr = 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 *DeploymentListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeploymentListResultPage) NotDone() bool { + return !page.dlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeploymentListResultPage) Response() DeploymentListResult { + return page.dlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeploymentListResultPage) Values() []Deployment { + if page.dlr.IsEmpty() { + return nil + } + return *page.dlr.Value +} + +// Creates a new instance of the DeploymentListResultPage type. +func NewDeploymentListResultPage(cur DeploymentListResult, getNextPage func(context.Context, DeploymentListResult) (DeploymentListResult, error)) DeploymentListResultPage { + return DeploymentListResultPage{ + fn: getNextPage, + dlr: cur, + } +} + +// DeploymentModel properties of Cognitive Services account deployment model. +type DeploymentModel struct { + // Format - Deployment model format. + Format *string `json:"format,omitempty"` + // Name - Deployment model name. + Name *string `json:"name,omitempty"` + // Version - Deployment model version. + Version *string `json:"version,omitempty"` +} + +// DeploymentProperties properties of Cognitive Services account deployment. +type DeploymentProperties struct { + // ProvisioningState - READ-ONLY; Gets the status of the resource at the time the operation was called. Possible values include: 'DeploymentProvisioningStateAccepted', 'DeploymentProvisioningStateCreating', 'DeploymentProvisioningStateDeleting', 'DeploymentProvisioningStateMoving', 'DeploymentProvisioningStateFailed', 'DeploymentProvisioningStateSucceeded' + ProvisioningState DeploymentProvisioningState `json:"provisioningState,omitempty"` + Model *DeploymentModel `json:"model,omitempty"` + ScaleSettings *DeploymentScaleSettings `json:"scaleSettings,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentProperties. +func (dp DeploymentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dp.Model != nil { + objectMap["model"] = dp.Model + } + if dp.ScaleSettings != nil { + objectMap["scaleSettings"] = dp.ScaleSettings + } + return json.Marshal(objectMap) +} + +// DeploymentScaleSettings properties of Cognitive Services account deployment model. +type DeploymentScaleSettings struct { + // ScaleType - Deployment scale type. Possible values include: 'DeploymentScaleTypeManual' + ScaleType DeploymentScaleType `json:"scaleType,omitempty"` + // Capacity - Deployment capacity. + Capacity *int32 `json:"capacity,omitempty"` +} + +// DeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (Deployment, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsCreateOrUpdateFuture) 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 DeploymentsCreateOrUpdateFuture.Result. +func (future *DeploymentsCreateOrUpdateFuture) result(client DeploymentsClient) (d Deployment, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeploymentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + d.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cognitiveservices.DeploymentsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { + d, err = client.CreateOrUpdateResponder(d.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeploymentsCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsDeleteFuture) 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 DeploymentsDeleteFuture.Result. +func (future *DeploymentsDeleteFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.DeploymentsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cognitiveservices.DeploymentsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DomainAvailability domain availability. +type DomainAvailability struct { + autorest.Response `json:"-"` + // IsSubdomainAvailable - Indicates the given SKU is available or not. + IsSubdomainAvailable *bool `json:"isSubdomainAvailable,omitempty"` + // Reason - Reason why the SKU is not available. + Reason *string `json:"reason,omitempty"` + // SubdomainName - The subdomain name to use. + SubdomainName *string `json:"subdomainName,omitempty"` + // Type - The Type of the resource. + Type *string `json:"type,omitempty"` + // Kind - The Kind of the resource. + Kind *string `json:"kind,omitempty"` +} + +// Encryption properties to configure Encryption +type Encryption struct { + // KeyVaultProperties - Properties of KeyVault + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` + // KeySource - Enumerates the possible value of keySource for Encryption. Possible values include: 'KeySourceMicrosoftCognitiveServices', 'KeySourceMicrosoftKeyVault' + KeySource KeySource `json:"keySource,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"` +} + +// Identity identity for the resource. +type Identity struct { + // Type - The identity type. Possible values include: 'ResourceIdentityTypeNone', 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned' + Type ResourceIdentityType `json:"type,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // UserAssignedIdentities - The list of user assigned identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} + 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) +} + +// IPRule a rule governing the accessibility from a specific ip address or ip range. +type IPRule struct { + // Value - An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). + Value *string `json:"value,omitempty"` +} + +// KeyVaultProperties properties to configure keyVault Properties +type KeyVaultProperties struct { + // KeyName - Name of the Key from KeyVault + KeyName *string `json:"keyName,omitempty"` + // KeyVersion - Version of the Key from KeyVault + KeyVersion *string `json:"keyVersion,omitempty"` + // KeyVaultURI - Uri of KeyVault + KeyVaultURI *string `json:"keyVaultUri,omitempty"` + IdentityClientID *string `json:"identityClientId,omitempty"` +} + +// MetricName a metric name. +type MetricName struct { + // Value - The name of the metric. + Value *string `json:"value,omitempty"` + // LocalizedValue - The friendly name of the metric. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// NetworkRuleSet a set of rules governing the network accessibility. +type NetworkRuleSet struct { + // DefaultAction - The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. Possible values include: 'NetworkRuleActionAllow', 'NetworkRuleActionDeny' + DefaultAction NetworkRuleAction `json:"defaultAction,omitempty"` + // IPRules - The list of IP address rules. + IPRules *[]IPRule `json:"ipRules,omitempty"` + // VirtualNetworkRules - The list of virtual network rules. + VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` +} + +// Operation details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Name - READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + Name *string `json:"name,omitempty"` + // IsDataAction - READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. + IsDataAction *bool `json:"isDataAction,omitempty"` + // Display - Localized display information for this particular operation. + Display *OperationDisplay `json:"display,omitempty"` + // Origin - READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". Possible values include: 'OriginUser', 'OriginSystem', 'OriginUsersystem' + Origin Origin `json:"origin,omitempty"` + // ActionType - READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. Possible values include: 'ActionTypeInternal' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.Display != nil { + objectMap["display"] = o.Display + } + return json.Marshal(objectMap) +} + +// OperationDisplay localized display information for this particular operation. +type OperationDisplay struct { + // Provider - READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + Provider *string `json:"provider,omitempty"` + // Resource - READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + Resource *string `json:"resource,omitempty"` + // Operation - READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + Operation *string `json:"operation,omitempty"` + // Description - READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationListResult a list of REST API operations supported by an Azure Resource Provider. It contains +// an URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of operations supported by the resource provider + Value *[]Operation `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationListResult. +func (olr OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// 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 *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.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 *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) 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 OperationListResultIterator) Response() OperationListResult { + 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 OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// 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 *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.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.olr) + if err != nil { + return err + } + page.olr = 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 *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// PrivateEndpoint the Private Endpoint resource. +type PrivateEndpoint struct { + // ID - READ-ONLY; The ARM identifier for Private Endpoint + ID *string `json:"id,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:"-"` + // Properties - Resource properties. + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` + // Location - The location of the private endpoint connection + Location *string `json:"location,omitempty"` + // 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 PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.Properties != nil { + objectMap["properties"] = pec.Properties + } + if pec.Location != nil { + objectMap["location"] = pec.Location + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionListResult a list of private endpoint connections +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"` + // GroupIds - The private link resource group ids. + GroupIds *[]string `json:"groupIds,omitempty"` +} + +// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type PrivateEndpointConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) 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 PrivateEndpointConnectionsCreateOrUpdateFuture.Result. +func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pec.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cognitiveservices.PrivateEndpointConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { + pec, err = client.CreateOrUpdateResponder(pec.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. +func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("cognitiveservices.PrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkResource a private link resource +type PrivateLinkResource struct { + // Properties - Resource properties. + Properties *PrivateLinkResourceProperties `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"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResource. +func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.Properties != nil { + objectMap["properties"] = plr.Properties + } + return json.Marshal(objectMap) +} + +// 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"` + // DisplayName - READ-ONLY; The private link resource display name. + DisplayName *string `json:"displayName,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: 'PrivateEndpointServiceConnectionStatusPending', 'PrivateEndpointServiceConnectionStatusApproved', 'PrivateEndpointServiceConnectionStatusRejected' + 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) +} + +// QuotaLimit ... +type QuotaLimit struct { + Count *float64 `json:"count,omitempty"` + RenewalPeriod *float64 `json:"renewalPeriod,omitempty"` + Rules *[]ThrottlingRule `json:"rules,omitempty"` +} + +// RegenerateKeyParameters regenerate key parameters. +type RegenerateKeyParameters struct { + // KeyName - key name to generate (Key1|Key2). Possible values include: 'KeyNameKey1', 'KeyNameKey2' + KeyName KeyName `json:"keyName,omitempty"` +} + +// RequestMatchPattern ... +type RequestMatchPattern struct { + Path *string `json:"path,omitempty"` + Method *string `json:"method,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"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceSku describes an available Cognitive Services SKU. +type ResourceSku struct { + // ResourceType - The type of resource the SKU applies to. + ResourceType *string `json:"resourceType,omitempty"` + // Name - The name of SKU. + Name *string `json:"name,omitempty"` + // Tier - Specifies the tier of Cognitive Services account. + Tier *string `json:"tier,omitempty"` + // Kind - The Kind of resources that are supported in this SKU. + Kind *string `json:"kind,omitempty"` + // Locations - The set of locations that the SKU is available. + Locations *[]string `json:"locations,omitempty"` + // Restrictions - The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. + Restrictions *[]ResourceSkuRestrictions `json:"restrictions,omitempty"` +} + +// ResourceSkuListResult the Get Skus operation response. +type ResourceSkuListResult struct { + autorest.Response `json:"-"` + // Value - The list of skus available for the subscription. + Value *[]ResourceSku `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of Skus. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceSkuListResultIterator provides access to a complete listing of ResourceSku values. +type ResourceSkuListResultIterator struct { + i int + page ResourceSkuListResultPage +} + +// 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 *ResourceSkuListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkuListResultIterator.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 *ResourceSkuListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceSkuListResultIterator) 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 ResourceSkuListResultIterator) Response() ResourceSkuListResult { + 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 ResourceSkuListResultIterator) Value() ResourceSku { + if !iter.page.NotDone() { + return ResourceSku{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceSkuListResultIterator type. +func NewResourceSkuListResultIterator(page ResourceSkuListResultPage) ResourceSkuListResultIterator { + return ResourceSkuListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rslr ResourceSkuListResult) IsEmpty() bool { + return rslr.Value == nil || len(*rslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rslr ResourceSkuListResult) hasNextLink() bool { + return rslr.NextLink != nil && len(*rslr.NextLink) != 0 +} + +// resourceSkuListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rslr ResourceSkuListResult) resourceSkuListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rslr.NextLink))) +} + +// ResourceSkuListResultPage contains a page of ResourceSku values. +type ResourceSkuListResultPage struct { + fn func(context.Context, ResourceSkuListResult) (ResourceSkuListResult, error) + rslr ResourceSkuListResult +} + +// 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 *ResourceSkuListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkuListResultPage.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.rslr) + if err != nil { + return err + } + page.rslr = 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 *ResourceSkuListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceSkuListResultPage) NotDone() bool { + return !page.rslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceSkuListResultPage) Response() ResourceSkuListResult { + return page.rslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceSkuListResultPage) Values() []ResourceSku { + if page.rslr.IsEmpty() { + return nil + } + return *page.rslr.Value +} + +// Creates a new instance of the ResourceSkuListResultPage type. +func NewResourceSkuListResultPage(cur ResourceSkuListResult, getNextPage func(context.Context, ResourceSkuListResult) (ResourceSkuListResult, error)) ResourceSkuListResultPage { + return ResourceSkuListResultPage{ + fn: getNextPage, + rslr: cur, + } +} + +// ResourceSkuRestrictionInfo ... +type ResourceSkuRestrictionInfo struct { + // Locations - Locations where the SKU is restricted + Locations *[]string `json:"locations,omitempty"` + // Zones - List of availability zones where the SKU is restricted. + Zones *[]string `json:"zones,omitempty"` +} + +// ResourceSkuRestrictions describes restrictions of a SKU. +type ResourceSkuRestrictions struct { + // Type - The type of restrictions. Possible values include: 'ResourceSkuRestrictionsTypeLocation', 'ResourceSkuRestrictionsTypeZone' + Type ResourceSkuRestrictionsType `json:"type,omitempty"` + // Values - 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"` + // RestrictionInfo - The information about the restriction where the SKU cannot be used. + RestrictionInfo *ResourceSkuRestrictionInfo `json:"restrictionInfo,omitempty"` + // ReasonCode - The reason for restriction. Possible values include: 'ResourceSkuRestrictionsReasonCodeQuotaID', 'ResourceSkuRestrictionsReasonCodeNotAvailableForSubscription' + ReasonCode ResourceSkuRestrictionsReasonCode `json:"reasonCode,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 - 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: 'SkuTierFree', 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium', 'SkuTierEnterprise' + 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"` +} + +// SkuAvailability SKU availability. +type SkuAvailability struct { + // Kind - The Kind of the resource. + Kind *string `json:"kind,omitempty"` + // Type - The Type of the resource. + Type *string `json:"type,omitempty"` + // SkuName - The SKU of Cognitive Services account. + SkuName *string `json:"skuName,omitempty"` + // SkuAvailable - Indicates the given SKU is available or not. + SkuAvailable *bool `json:"skuAvailable,omitempty"` + // Reason - Reason why the SKU is not available. + Reason *string `json:"reason,omitempty"` + // Message - Additional error message. + Message *string `json:"message,omitempty"` +} + +// SkuAvailabilityListResult check SKU availability result list. +type SkuAvailabilityListResult struct { + autorest.Response `json:"-"` + // Value - Check SKU availability result list. + Value *[]SkuAvailability `json:"value,omitempty"` +} + +// SkuCapability skuCapability indicates the capability of a certain feature. +type SkuCapability struct { + // Name - The name of the SkuCapability. + Name *string `json:"name,omitempty"` + // Value - The value of the SkuCapability. + Value *string `json:"value,omitempty"` +} + +// SkuChangeInfo sku change info of account. +type SkuChangeInfo struct { + // CountOfDowngrades - Gets the count of downgrades. + CountOfDowngrades *float64 `json:"countOfDowngrades,omitempty"` + // CountOfUpgradesAfterDowngrades - Gets the count of upgrades after downgrades. + CountOfUpgradesAfterDowngrades *float64 `json:"countOfUpgradesAfterDowngrades,omitempty"` + // LastChangeDate - Gets the last change date. + LastChangeDate *string `json:"lastChangeDate,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"` +} + +// ThrottlingRule ... +type ThrottlingRule struct { + Key *string `json:"key,omitempty"` + RenewalPeriod *float64 `json:"renewalPeriod,omitempty"` + Count *float64 `json:"count,omitempty"` + MinCount *float64 `json:"minCount,omitempty"` + DynamicThrottlingEnabled *bool `json:"dynamicThrottlingEnabled,omitempty"` + MatchPatterns *[]RequestMatchPattern `json:"matchPatterns,omitempty"` +} + +// 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) +} + +// Usage the usage data for a usage request. +type Usage struct { + // Unit - The unit of the metric. Possible values include: 'UnitTypeCount', 'UnitTypeBytes', 'UnitTypeSeconds', 'UnitTypePercent', 'UnitTypeCountPerSecond', 'UnitTypeBytesPerSecond', 'UnitTypeMilliseconds' + Unit UnitType `json:"unit,omitempty"` + // Name - The name information for the metric. + Name *MetricName `json:"name,omitempty"` + // QuotaPeriod - The quota period used to summarize the usage values. + QuotaPeriod *string `json:"quotaPeriod,omitempty"` + // Limit - Maximum value for this metric. + Limit *float64 `json:"limit,omitempty"` + // CurrentValue - Current value for this metric. + CurrentValue *float64 `json:"currentValue,omitempty"` + // NextResetTime - Next reset time for current quota. + NextResetTime *string `json:"nextResetTime,omitempty"` + // Status - Cognitive Services account quota usage status. Possible values include: 'QuotaUsageStatusIncluded', 'QuotaUsageStatusBlocked', 'QuotaUsageStatusInOverage', 'QuotaUsageStatusUnknown' + Status QuotaUsageStatus `json:"status,omitempty"` +} + +// UsageListResult the response to a list usage request. +type UsageListResult struct { + autorest.Response `json:"-"` + // Value - The list of usages for Cognitive Service account. + Value *[]Usage `json:"value,omitempty"` +} + +// UserAssignedIdentity user-assigned managed identity. +type UserAssignedIdentity struct { + // PrincipalID - READ-ONLY; Azure Active Directory principal ID associated with this Identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; Client App Id associated with this 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) +} + +// UserOwnedStorage the user owned storage for Cognitive Services account. +type UserOwnedStorage struct { + // ResourceID - Full resource id of a Microsoft.Storage resource. + ResourceID *string `json:"resourceId,omitempty"` + IdentityClientID *string `json:"identityClientId,omitempty"` +} + +// VirtualNetworkRule a rule governing the accessibility from a specific virtual network. +type VirtualNetworkRule struct { + // ID - Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + ID *string `json:"id,omitempty"` + // State - Gets the state of virtual network rule. + State *string `json:"state,omitempty"` + // IgnoreMissingVnetServiceEndpoint - Ignore missing vnet service endpoint or not. + IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` +} diff --git a/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/operations.go b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/operations.go new file mode 100644 index 000000000000..10f9c594a3c8 --- /dev/null +++ b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/operations.go @@ -0,0 +1,140 @@ +package cognitiveservices + +// 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 cognitive Services Management Client +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 the available Cognitive Services account operations. +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.CognitiveServices/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 +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cognitiveservices.OperationsClient", "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, "cognitiveservices.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.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/cognitiveservices/mgmt/2021-10-01/cognitiveservices/privateendpointconnections.go b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/privateendpointconnections.go new file mode 100644 index 000000000000..011b45ddb126 --- /dev/null +++ b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/privateendpointconnections.go @@ -0,0 +1,411 @@ +package cognitiveservices + +// 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 cognitive Services Management Client +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 Cognitive Services +// account. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +// privateEndpointConnectionName - the name of the private endpoint connection associated with the Cognitive +// Services Account +// properties - the private endpoint connection properties. +func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, properties PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: properties, + Constraints: []validation.Constraint{{Target: "properties.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "properties.Properties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("cognitiveservices.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName, properties) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, properties PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + properties.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.CognitiveServices/accounts/{accountName}/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) (future PrivateEndpointConnectionsCreateOrUpdateFuture, 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 PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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 the specified private endpoint connection associated with the Cognitive Services account. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +// privateEndpointConnectionName - the name of the private endpoint connection associated with the Cognitive +// Services Account +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.PrivateEndpointConnectionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-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.CognitiveServices/accounts/{accountName}/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) (future PrivateEndpointConnectionsDeleteFuture, 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 PrivateEndpointConnectionsClient) 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 specified private endpoint connection associated with the Cognitive Services account. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +// privateEndpointConnectionName - the name of the private endpoint connection associated with the Cognitive +// Services Account +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.PrivateEndpointConnectionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, accountName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.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, "cognitiveservices.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-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.CognitiveServices/accounts/{accountName}/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 gets the private endpoint connections associated with the Cognitive Services account. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, accountName 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: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.PrivateEndpointConnectionsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.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, "cognitiveservices.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-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.CognitiveServices/accounts/{accountName}/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/cognitiveservices/mgmt/2021-10-01/cognitiveservices/privatelinkresources.go b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/privatelinkresources.go new file mode 100644 index 000000000000..98fae1305ca0 --- /dev/null +++ b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/privatelinkresources.go @@ -0,0 +1,122 @@ +package cognitiveservices + +// 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 cognitive Services Management Client +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 Cognitive Services account. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - the name of Cognitive Services account. +func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, accountName 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 2, Chain: nil}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("cognitiveservices.PrivateLinkResourcesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.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, "cognitiveservices.PrivateLinkResourcesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-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.CognitiveServices/accounts/{accountName}/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/cognitiveservices/mgmt/2021-10-01/cognitiveservices/resourceskus.go b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/resourceskus.go new file mode 100644 index 000000000000..d7c43018b153 --- /dev/null +++ b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/resourceskus.go @@ -0,0 +1,151 @@ +package cognitiveservices + +// 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" +) + +// ResourceSkusClient is the cognitive Services Management Client +type ResourceSkusClient struct { + BaseClient +} + +// NewResourceSkusClient creates an instance of the ResourceSkusClient client. +func NewResourceSkusClient(subscriptionID string) ResourceSkusClient { + return NewResourceSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewResourceSkusClientWithBaseURI creates an instance of the ResourceSkusClient 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 NewResourceSkusClientWithBaseURI(baseURI string, subscriptionID string) ResourceSkusClient { + return ResourceSkusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets the list of Microsoft.CognitiveServices SKUs available for your Subscription. +func (client ResourceSkusClient) List(ctx context.Context) (result ResourceSkuListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusClient.List") + defer func() { + sc := -1 + if result.rslr.Response.Response != nil { + sc = result.rslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, 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("cognitiveservices.ResourceSkusClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.ResourceSkusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "cognitiveservices.ResourceSkusClient", "List", resp, "Failure sending request") + return + } + + result.rslr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.ResourceSkusClient", "List", resp, "Failure responding to request") + return + } + if result.rslr.hasNextLink() && result.rslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ResourceSkusClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/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 ResourceSkusClient) 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 ResourceSkusClient) ListResponder(resp *http.Response) (result ResourceSkuListResult, 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 ResourceSkusClient) listNextResults(ctx context.Context, lastResults ResourceSkuListResult) (result ResourceSkuListResult, err error) { + req, err := lastResults.resourceSkuListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "cognitiveservices.ResourceSkusClient", "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, "cognitiveservices.ResourceSkusClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "cognitiveservices.ResourceSkusClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ResourceSkusClient) ListComplete(ctx context.Context) (result ResourceSkuListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkusClient.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/cognitiveservices/mgmt/2021-10-01/cognitiveservices/version.go b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/version.go new file mode 100644 index 000000000000..30390c35b65c --- /dev/null +++ b/services/cognitiveservices/mgmt/2021-10-01/cognitiveservices/version.go @@ -0,0 +1,19 @@ +package cognitiveservices + +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() + " cognitiveservices/2021-10-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/network/mgmt/2021-05-01/network/_meta.json b/services/network/mgmt/2021-05-01/network/_meta.json index f659bb4edb65..411cc8dd9ba1 100644 --- a/services/network/mgmt/2021-05-01/network/_meta.json +++ b/services/network/mgmt/2021-05-01/network/_meta.json @@ -1,5 +1,5 @@ { - "commit": "2b56c8a3da0e04aea6f6d80a9ac04741d1ae5904", + "commit": "ad6f098218e4f5eab87e784f1b6fc8a713147cab", "readme": "/_/azure-rest-api-specs/specification/network/resource-manager/readme.md", "tag": "package-2021-05", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/quota/mgmt/2021-03-15-preview/quota/CHANGELOG.md b/services/preview/quota/mgmt/2021-03-15-preview/quota/CHANGELOG.md index 52911e4cc5e4..c47f65f5cc27 100644 --- a/services/preview/quota/mgmt/2021-03-15-preview/quota/CHANGELOG.md +++ b/services/preview/quota/mgmt/2021-03-15-preview/quota/CHANGELOG.md @@ -1,2 +1,29 @@ # Change History +## Breaking Changes + +### Struct Changes + +#### Removed Structs + +1. LimitValue + +### Signature Changes + +#### Struct Fields + +1. LimitObject.LimitObjectType changed type from LimitType to LimitObjectType + +## Additive Changes + +### New Constants + +1. LimitObjectType.LimitObjectTypeLimitValue + +### New Funcs + +1. LimitJSONObject.AsLimitObject() (*LimitObject, bool) +1. LimitObject.AsBasicLimitJSONObject() (BasicLimitJSONObject, bool) +1. LimitObject.AsLimitJSONObject() (*LimitJSONObject, bool) +1. LimitObject.AsLimitObject() (*LimitObject, bool) +1. LimitObject.MarshalJSON() ([]byte, error) diff --git a/services/preview/quota/mgmt/2021-03-15-preview/quota/_meta.json b/services/preview/quota/mgmt/2021-03-15-preview/quota/_meta.json index aa2d9e569b5e..e07033c5401e 100644 --- a/services/preview/quota/mgmt/2021-03-15-preview/quota/_meta.json +++ b/services/preview/quota/mgmt/2021-03-15-preview/quota/_meta.json @@ -1,5 +1,5 @@ { - "commit": "296412a72eeb85c73377e9c626953bf7513a59d6", + "commit": "ad6f098218e4f5eab87e784f1b6fc8a713147cab", "readme": "/_/azure-rest-api-specs/specification/quota/resource-manager/readme.md", "tag": "package-2021-03-15-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/quota/mgmt/2021-03-15-preview/quota/enums.go b/services/preview/quota/mgmt/2021-03-15-preview/quota/enums.go index c61f17293d6d..7fc42b80ef4b 100644 --- a/services/preview/quota/mgmt/2021-03-15-preview/quota/enums.go +++ b/services/preview/quota/mgmt/2021-03-15-preview/quota/enums.go @@ -12,11 +12,13 @@ type LimitObjectType string const ( // LimitObjectTypeLimitJSONObject ... LimitObjectTypeLimitJSONObject LimitObjectType = "LimitJsonObject" + // LimitObjectTypeLimitValue ... + LimitObjectTypeLimitValue LimitObjectType = "LimitValue" ) // PossibleLimitObjectTypeValues returns an array of possible values for the LimitObjectType const type. func PossibleLimitObjectTypeValues() []LimitObjectType { - return []LimitObjectType{LimitObjectTypeLimitJSONObject} + return []LimitObjectType{LimitObjectTypeLimitJSONObject, LimitObjectTypeLimitValue} } // LimitType enumerates the values for limit type. diff --git a/services/preview/quota/mgmt/2021-03-15-preview/quota/models.go b/services/preview/quota/mgmt/2021-03-15-preview/quota/models.go index bddd9db2c39e..6927475d70de 100644 --- a/services/preview/quota/mgmt/2021-03-15-preview/quota/models.go +++ b/services/preview/quota/mgmt/2021-03-15-preview/quota/models.go @@ -137,12 +137,13 @@ type ExceptionResponse struct { // BasicLimitJSONObject limitJson abstract class. type BasicLimitJSONObject interface { + AsLimitObject() (*LimitObject, bool) AsLimitJSONObject() (*LimitJSONObject, bool) } // LimitJSONObject limitJson abstract class. type LimitJSONObject struct { - // LimitObjectType - Possible values include: 'LimitObjectTypeLimitJSONObject' + // LimitObjectType - Possible values include: 'LimitObjectTypeLimitJSONObject', 'LimitObjectTypeLimitValue' LimitObjectType LimitObjectType `json:"limitObjectType,omitempty"` } @@ -154,6 +155,10 @@ func unmarshalBasicLimitJSONObject(body []byte) (BasicLimitJSONObject, error) { } switch m["limitObjectType"] { + case string(LimitObjectTypeLimitValue): + var lo LimitObject + err := json.Unmarshal(body, &lo) + return lo, err default: var ljo LimitJSONObject err := json.Unmarshal(body, &ljo) @@ -189,6 +194,11 @@ func (ljo LimitJSONObject) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// AsLimitObject is the BasicLimitJSONObject implementation for LimitJSONObject. +func (ljo LimitJSONObject) AsLimitObject() (*LimitObject, bool) { + return nil, false +} + // AsLimitJSONObject is the BasicLimitJSONObject implementation for LimitJSONObject. func (ljo LimitJSONObject) AsLimitJSONObject() (*LimitJSONObject, bool) { return &ljo, true @@ -203,10 +213,41 @@ func (ljo LimitJSONObject) AsBasicLimitJSONObject() (BasicLimitJSONObject, bool) type LimitObject struct { // Value - The quota/limit value Value *int32 `json:"value,omitempty"` - // LimitObjectType - Possible values include: 'LimitTypeLimitValue' - LimitObjectType LimitType `json:"limitObjectType,omitempty"` // LimitType - Possible values include: 'LimitTypesIndependent', 'LimitTypesShared' LimitType LimitTypes `json:"limitType,omitempty"` + // LimitObjectType - Possible values include: 'LimitObjectTypeLimitJSONObject', 'LimitObjectTypeLimitValue' + LimitObjectType LimitObjectType `json:"limitObjectType,omitempty"` +} + +// MarshalJSON is the custom marshaler for LimitObject. +func (lo LimitObject) MarshalJSON() ([]byte, error) { + lo.LimitObjectType = LimitObjectTypeLimitValue + objectMap := make(map[string]interface{}) + if lo.Value != nil { + objectMap["value"] = lo.Value + } + if lo.LimitType != "" { + objectMap["limitType"] = lo.LimitType + } + if lo.LimitObjectType != "" { + objectMap["limitObjectType"] = lo.LimitObjectType + } + return json.Marshal(objectMap) +} + +// AsLimitObject is the BasicLimitJSONObject implementation for LimitObject. +func (lo LimitObject) AsLimitObject() (*LimitObject, bool) { + return &lo, true +} + +// AsLimitJSONObject is the BasicLimitJSONObject implementation for LimitObject. +func (lo LimitObject) AsLimitJSONObject() (*LimitJSONObject, bool) { + return nil, false +} + +// AsBasicLimitJSONObject is the BasicLimitJSONObject implementation for LimitObject. +func (lo LimitObject) AsBasicLimitJSONObject() (BasicLimitJSONObject, bool) { + return &lo, true } // Limits quota limits. @@ -376,15 +417,6 @@ type LimitsResponse struct { NextLink *string `json:"nextLink,omitempty"` } -// LimitValue the resource quota limit. -type LimitValue struct { - LimitObjectType *string `json:"limitObjectType,omitempty"` - // Value - The quota/limit value - Value *int32 `json:"value,omitempty"` - // LimitType - Possible values include: 'LimitTypesIndependent', 'LimitTypesShared' - LimitType LimitTypes `json:"limitType,omitempty"` -} - // OperationDisplay ... type OperationDisplay struct { // Provider - Provider name. diff --git a/version/version.go b/version/version.go index d6b7e3819664..be28022f3312 100644 --- a/version/version.go +++ b/version/version.go @@ -4,4 +4,4 @@ package version // Licensed under the MIT License. See License.txt in the project root for license information. // Number contains the semantic version of this SDK. -const Number = "v59.0.0" +const Number = "v59.1.0"