From 6b87ce751c384acce50adba849a3f1d760926238 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 27 Apr 2018 00:46:02 +0000 Subject: [PATCH 1/4] Generated from f874740b2a678460b05083d316f0332701c43df7 fix the compiling error for the json --- .../cosmos-db/mgmt/documentdb/models.go | 2 + .../cosmos-db/mgmt/documentdb/models.go | 2 + .../mgmt/2015-04-08/documentdb/collection.go | 34 +-- .../documentdb/collectionpartition.go | 26 +- .../documentdb/collectionpartitionregion.go | 15 +- .../2015-04-08/documentdb/collectionregion.go | 15 +- .../mgmt/2015-04-08/documentdb/database.go | 29 +-- .../documentdb/databaseaccountregion.go | 12 +- .../2015-04-08/documentdb/databaseaccounts.go | 246 ++++++++++++++---- .../mgmt/2015-04-08/documentdb/models.go | 98 +++++++ .../documentdb/partitionkeyrangeid.go | 15 +- .../documentdb/partitionkeyrangeidregion.go | 13 +- .../mgmt/2015-04-08/documentdb/percentile.go | 11 +- .../documentdb/percentilesourcetarget.go | 17 +- .../2015-04-08/documentdb/percentiletarget.go | 14 +- 15 files changed, 382 insertions(+), 167 deletions(-) diff --git a/profiles/latest/cosmos-db/mgmt/documentdb/models.go b/profiles/latest/cosmos-db/mgmt/documentdb/models.go index 706e5caa9124..95abf925447e 100644 --- a/profiles/latest/cosmos-db/mgmt/documentdb/models.go +++ b/profiles/latest/cosmos-db/mgmt/documentdb/models.go @@ -106,6 +106,8 @@ type DatabaseAccountsCreateOrUpdateFuture = original.DatabaseAccountsCreateOrUpd type DatabaseAccountsDeleteFuture = original.DatabaseAccountsDeleteFuture type DatabaseAccountsFailoverPriorityChangeFuture = original.DatabaseAccountsFailoverPriorityChangeFuture type DatabaseAccountsListResult = original.DatabaseAccountsListResult +type DatabaseAccountsOfflineRegionFuture = original.DatabaseAccountsOfflineRegionFuture +type DatabaseAccountsOnlineRegionFuture = original.DatabaseAccountsOnlineRegionFuture type DatabaseAccountsPatchFuture = original.DatabaseAccountsPatchFuture type DatabaseAccountsRegenerateKeyFuture = original.DatabaseAccountsRegenerateKeyFuture type FailoverPolicies = original.FailoverPolicies diff --git a/profiles/preview/cosmos-db/mgmt/documentdb/models.go b/profiles/preview/cosmos-db/mgmt/documentdb/models.go index 673d393d8e6a..c4b9fff1f875 100644 --- a/profiles/preview/cosmos-db/mgmt/documentdb/models.go +++ b/profiles/preview/cosmos-db/mgmt/documentdb/models.go @@ -106,6 +106,8 @@ type DatabaseAccountsCreateOrUpdateFuture = original.DatabaseAccountsCreateOrUpd type DatabaseAccountsDeleteFuture = original.DatabaseAccountsDeleteFuture type DatabaseAccountsFailoverPriorityChangeFuture = original.DatabaseAccountsFailoverPriorityChangeFuture type DatabaseAccountsListResult = original.DatabaseAccountsListResult +type DatabaseAccountsOfflineRegionFuture = original.DatabaseAccountsOfflineRegionFuture +type DatabaseAccountsOnlineRegionFuture = original.DatabaseAccountsOnlineRegionFuture type DatabaseAccountsPatchFuture = original.DatabaseAccountsPatchFuture type DatabaseAccountsRegenerateKeyFuture = original.DatabaseAccountsRegenerateKeyFuture type FailoverPolicies = original.FailoverPolicies diff --git a/services/cosmos-db/mgmt/2015-04-08/documentdb/collection.go b/services/cosmos-db/mgmt/2015-04-08/documentdb/collection.go index 2fd8131f1cfa..03a00d8d9492 100644 --- a/services/cosmos-db/mgmt/2015-04-08/documentdb/collection.go +++ b/services/cosmos-db/mgmt/2015-04-08/documentdb/collection.go @@ -41,11 +41,9 @@ func NewCollectionClientWithBaseURI(baseURI string, subscriptionID string) Colle } // ListMetricDefinitions retrieves metric defintions for the given collection. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +// databaseRid is cosmos DB database rid. collectionRid is cosmos DB collection rid. func (client CollectionClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string) (result MetricDefinitionsListResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -123,14 +121,12 @@ func (client CollectionClient) ListMetricDefinitionsResponder(resp *http.Respons } // ListMetrics retrieves the metrics determined by the given filter for the given database account and collection. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +// databaseRid is cosmos DB database rid. collectionRid is cosmos DB collection rid. filter is an OData filter +// expression that describes a subset of metrics to return. The parameters that can be filtered are name.value +// (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported +// operator is eq. func (client CollectionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result MetricListResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -209,13 +205,11 @@ func (client CollectionClient) ListMetricsResponder(resp *http.Response) (result } // ListUsages retrieves the usages (most recent storage data) for the given collection. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// 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). +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +// databaseRid is cosmos DB database rid. collectionRid is cosmos DB collection rid. filter is 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 CollectionClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result UsagesResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, diff --git a/services/cosmos-db/mgmt/2015-04-08/documentdb/collectionpartition.go b/services/cosmos-db/mgmt/2015-04-08/documentdb/collectionpartition.go index 8c1aab2512af..e895d340ce46 100644 --- a/services/cosmos-db/mgmt/2015-04-08/documentdb/collectionpartition.go +++ b/services/cosmos-db/mgmt/2015-04-08/documentdb/collectionpartition.go @@ -41,14 +41,12 @@ func NewCollectionPartitionClientWithBaseURI(baseURI string, subscriptionID stri } // ListMetrics retrieves the metrics determined by the given filter for the given collection, split by partition. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +// databaseRid is cosmos DB database rid. collectionRid is cosmos DB collection rid. filter is an OData filter +// expression that describes a subset of metrics to return. The parameters that can be filtered are name.value +// (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported +// operator is eq. func (client CollectionPartitionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result PartitionMetricListResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -127,13 +125,11 @@ func (client CollectionPartitionClient) ListMetricsResponder(resp *http.Response } // ListUsages retrieves the usages (most recent storage data) for the given collection, split by partition. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// 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). +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +// databaseRid is cosmos DB database rid. collectionRid is cosmos DB collection rid. filter is 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 CollectionPartitionClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, filter string) (result PartitionUsagesResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, diff --git a/services/cosmos-db/mgmt/2015-04-08/documentdb/collectionpartitionregion.go b/services/cosmos-db/mgmt/2015-04-08/documentdb/collectionpartitionregion.go index 6202ee61147f..46e010eaebff 100644 --- a/services/cosmos-db/mgmt/2015-04-08/documentdb/collectionpartitionregion.go +++ b/services/cosmos-db/mgmt/2015-04-08/documentdb/collectionpartitionregion.go @@ -42,15 +42,12 @@ func NewCollectionPartitionRegionClientWithBaseURI(baseURI string, subscriptionI // ListMetrics retrieves the metrics determined by the given filter for the given collection and region, split by // partition. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. region is +// cosmos DB region, with spaces between words and each word capitalized. databaseRid is cosmos DB database rid. +// collectionRid is cosmos DB collection rid. filter is an OData filter expression that describes a subset of +// metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of +// multiple names), startTime, endTime, and timeGrain. The supported operator is eq. func (client CollectionPartitionRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result PartitionMetricListResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, diff --git a/services/cosmos-db/mgmt/2015-04-08/documentdb/collectionregion.go b/services/cosmos-db/mgmt/2015-04-08/documentdb/collectionregion.go index 3877475c1c45..3dfcb252e1f5 100644 --- a/services/cosmos-db/mgmt/2015-04-08/documentdb/collectionregion.go +++ b/services/cosmos-db/mgmt/2015-04-08/documentdb/collectionregion.go @@ -42,15 +42,12 @@ func NewCollectionRegionClientWithBaseURI(baseURI string, subscriptionID string) // ListMetrics retrieves the metrics determined by the given filter for the given database account, collection and // region. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. region is +// cosmos DB region, with spaces between words and each word capitalized. databaseRid is cosmos DB database rid. +// collectionRid is cosmos DB collection rid. filter is an OData filter expression that describes a subset of +// metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of +// multiple names), startTime, endTime, and timeGrain. The supported operator is eq. func (client CollectionRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, filter string) (result MetricListResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, diff --git a/services/cosmos-db/mgmt/2015-04-08/documentdb/database.go b/services/cosmos-db/mgmt/2015-04-08/documentdb/database.go index a8354a634984..d0615b1a004c 100644 --- a/services/cosmos-db/mgmt/2015-04-08/documentdb/database.go +++ b/services/cosmos-db/mgmt/2015-04-08/documentdb/database.go @@ -41,10 +41,9 @@ func NewDatabaseClientWithBaseURI(baseURI string, subscriptionID string) Databas } // ListMetricDefinitions retrieves metric defintions for the given database. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +// databaseRid is cosmos DB database rid. func (client DatabaseClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string, databaseRid string) (result MetricDefinitionsListResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -121,13 +120,11 @@ func (client DatabaseClient) ListMetricDefinitionsResponder(resp *http.Response) } // ListMetrics retrieves the metrics determined by the given filter for the given database account and database. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +// databaseRid is cosmos DB database rid. filter is an OData filter expression that describes a subset of metrics +// to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple +// names), startTime, endTime, and timeGrain. The supported operator is eq. func (client DatabaseClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result MetricListResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -205,12 +202,10 @@ func (client DatabaseClient) ListMetricsResponder(resp *http.Response) (result M } // ListUsages retrieves the usages (most recent data) for the given database. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// 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). +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +// databaseRid is cosmos DB database rid. filter is 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 DatabaseClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, filter string) (result UsagesResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, diff --git a/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccountregion.go b/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccountregion.go index be1aa360e501..221bdc7cfbaa 100644 --- a/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccountregion.go +++ b/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccountregion.go @@ -41,13 +41,11 @@ func NewDatabaseAccountRegionClientWithBaseURI(baseURI string, subscriptionID st } // ListMetrics retrieves the metrics determined by the given filter for the given database account and region. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. region is +// cosmos DB region, with spaces between words and each word capitalized. filter is an OData filter expression that +// describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, +// can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. func (client DatabaseAccountRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, filter string) (result MetricListResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, diff --git a/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccounts.go b/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccounts.go index ca3c1b24d6bf..8f89d8b227d2 100644 --- a/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccounts.go +++ b/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccounts.go @@ -42,8 +42,8 @@ func NewDatabaseAccountsClientWithBaseURI(baseURI string, subscriptionID string) // CheckNameExists checks that the Azure Cosmos DB account name already exists. A valid account name may contain only // lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. -// Parameters: -// accountName - cosmos DB database account name. +// +// accountName is cosmos DB database account name. func (client DatabaseAccountsClient) CheckNameExists(ctx context.Context, accountName string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: accountName, @@ -112,10 +112,9 @@ func (client DatabaseAccountsClient) CheckNameExistsResponder(resp *http.Respons } // CreateOrUpdate creates or updates an Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// createUpdateParameters - the parameters to provide for the current database account. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +// createUpdateParameters is the parameters to provide for the current database account. func (client DatabaseAccountsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters) (result DatabaseAccountsCreateOrUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -210,9 +209,8 @@ func (client DatabaseAccountsClient) CreateOrUpdateResponder(resp *http.Response } // Delete deletes an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. func (client DatabaseAccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountsDeleteFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -291,10 +289,9 @@ func (client DatabaseAccountsClient) DeleteResponder(resp *http.Response) (resul // FailoverPriorityChange changes the failover priority for the Azure Cosmos DB database account. A failover priority // of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover // priority values must be unique for each of the regions in which the database account exists. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// failoverParameters - the new failover policies for the database account. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +// failoverParameters is the new failover policies for the database account. func (client DatabaseAccountsClient) FailoverPriorityChange(ctx context.Context, resourceGroupName string, accountName string, failoverParameters FailoverPolicies) (result DatabaseAccountsFailoverPriorityChangeFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -375,9 +372,8 @@ func (client DatabaseAccountsClient) FailoverPriorityChangeResponder(resp *http. } // Get retrieves the properties of an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. func (client DatabaseAccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccount, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -515,8 +511,8 @@ func (client DatabaseAccountsClient) ListResponder(resp *http.Response) (result } // ListByResourceGroup lists all the Azure Cosmos DB database accounts available under the given resource group. -// Parameters: -// resourceGroupName - name of an Azure resource group. +// +// resourceGroupName is name of an Azure resource group. func (client DatabaseAccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DatabaseAccountsListResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -588,9 +584,8 @@ func (client DatabaseAccountsClient) ListByResourceGroupResponder(resp *http.Res } // ListConnectionStrings lists the connection strings for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. func (client DatabaseAccountsClient) ListConnectionStrings(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListConnectionStringsResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -666,9 +661,8 @@ func (client DatabaseAccountsClient) ListConnectionStringsResponder(resp *http.R } // ListKeys lists the access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. func (client DatabaseAccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListKeysResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -744,9 +738,8 @@ func (client DatabaseAccountsClient) ListKeysResponder(resp *http.Response) (res } // ListMetricDefinitions retrieves metric defintions for the given database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. func (client DatabaseAccountsClient) ListMetricDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result MetricDefinitionsListResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -822,12 +815,11 @@ func (client DatabaseAccountsClient) ListMetricDefinitionsResponder(resp *http.R } // ListMetrics retrieves the metrics determined by the given filter for the given database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. filter is +// an OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are +// name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The +// supported operator is eq. func (client DatabaseAccountsClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result MetricListResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -904,9 +896,8 @@ func (client DatabaseAccountsClient) ListMetricsResponder(resp *http.Response) ( } // ListReadOnlyKeys lists the read-only access keys for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. func (client DatabaseAccountsClient) ListReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string) (result DatabaseAccountListReadOnlyKeysResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -982,11 +973,10 @@ func (client DatabaseAccountsClient) ListReadOnlyKeysResponder(resp *http.Respon } // ListUsages retrieves the usages (most recent data) for the given database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// 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). +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. filter is +// 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 DatabaseAccountsClient) ListUsages(ctx context.Context, resourceGroupName string, accountName string, filter string) (result UsagesResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -1064,11 +1054,170 @@ func (client DatabaseAccountsClient) ListUsagesResponder(resp *http.Response) (r return } +// OfflineRegion offline the specified region for the specified Azure Cosmos DB database account. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. region is +// cosmos DB region, with spaces between words and each word capitalized. +func (client DatabaseAccountsClient) OfflineRegion(ctx context.Context, resourceGroupName string, accountName string, region string) (result DatabaseAccountsOfflineRegionFuture, err error) { + 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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("documentdb.DatabaseAccountsClient", "OfflineRegion", err.Error()) + } + + req, err := client.OfflineRegionPreparer(ctx, resourceGroupName, accountName, region) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OfflineRegion", nil, "Failure preparing request") + return + } + + result, err = client.OfflineRegionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OfflineRegion", result.Response(), "Failure sending request") + return + } + + return +} + +// OfflineRegionPreparer prepares the OfflineRegion request. +func (client DatabaseAccountsClient) OfflineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, region string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "region": autorest.Encode("path", region), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// OfflineRegionSender sends the OfflineRegion request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseAccountsClient) OfflineRegionSender(req *http.Request) (future DatabaseAccountsOfflineRegionFuture, err error) { + sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) + future.Future = azure.NewFuture(req) + future.req = req + _, err = future.Done(sender) + if err != nil { + return + } + err = autorest.Respond(future.Response(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + return +} + +// OfflineRegionResponder handles the response to the OfflineRegion request. The method always +// closes the http.Response Body. +func (client DatabaseAccountsClient) OfflineRegionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// OnlineRegion online the specified region for the specified Azure Cosmos DB database account. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. region is +// cosmos DB region, with spaces between words and each word capitalized. +func (client DatabaseAccountsClient) OnlineRegion(ctx context.Context, resourceGroupName string, accountName string, region string) (result DatabaseAccountsOnlineRegionFuture, err error) { + 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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: accountName, + Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("documentdb.DatabaseAccountsClient", "OnlineRegion", err.Error()) + } + + req, err := client.OnlineRegionPreparer(ctx, resourceGroupName, accountName, region) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OnlineRegion", nil, "Failure preparing request") + return + } + + result, err = client.OnlineRegionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OnlineRegion", result.Response(), "Failure sending request") + return + } + + return +} + +// OnlineRegionPreparer prepares the OnlineRegion request. +func (client DatabaseAccountsClient) OnlineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, region string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "region": autorest.Encode("path", region), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-08" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// OnlineRegionSender sends the OnlineRegion request. The method will close the +// http.Response Body if it receives an error. +func (client DatabaseAccountsClient) OnlineRegionSender(req *http.Request) (future DatabaseAccountsOnlineRegionFuture, err error) { + sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) + future.Future = azure.NewFuture(req) + future.req = req + _, err = future.Done(sender) + if err != nil { + return + } + err = autorest.Respond(future.Response(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + return +} + +// OnlineRegionResponder handles the response to the OnlineRegion request. The method always +// closes the http.Response Body. +func (client DatabaseAccountsClient) OnlineRegionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + // Patch patches the properties of an existing Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// updateParameters - the tags parameter to patch for the current database account. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +// updateParameters is the tags parameter to patch for the current database account. func (client DatabaseAccountsClient) Patch(ctx context.Context, resourceGroupName string, accountName string, updateParameters DatabaseAccountPatchParameters) (result DatabaseAccountsPatchFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -1148,10 +1297,9 @@ func (client DatabaseAccountsClient) PatchResponder(resp *http.Response) (result } // RegenerateKey regenerates an access key for the specified Azure Cosmos DB database account. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// keyToRegenerate - the name of the key to regenerate. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +// keyToRegenerate is the name of the key to regenerate. func (client DatabaseAccountsClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters) (result DatabaseAccountsRegenerateKeyFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, diff --git a/services/cosmos-db/mgmt/2015-04-08/documentdb/models.go b/services/cosmos-db/mgmt/2015-04-08/documentdb/models.go index e831e0925975..e804baca8463 100644 --- a/services/cosmos-db/mgmt/2015-04-08/documentdb/models.go +++ b/services/cosmos-db/mgmt/2015-04-08/documentdb/models.go @@ -758,6 +758,104 @@ type DatabaseAccountsListResult struct { Value *[]DatabaseAccount `json:"value,omitempty"` } +// DatabaseAccountsOfflineRegionFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DatabaseAccountsOfflineRegionFuture struct { + azure.Future + req *http.Request +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future DatabaseAccountsOfflineRegionFuture) Result(client DatabaseAccountsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOfflineRegionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + return ar, azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsOfflineRegionFuture") + } + if future.PollingMethod() == azure.PollingLocation { + ar, err = client.OfflineRegionResponder(future.Response()) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOfflineRegionFuture", "Result", future.Response(), "Failure responding to request") + } + return + } + var req *http.Request + var resp *http.Response + if future.PollingURL() != "" { + req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + if err != nil { + return + } + } else { + req = autorest.ChangeToGet(future.req) + } + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOfflineRegionFuture", "Result", resp, "Failure sending request") + return + } + ar, err = client.OfflineRegionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOfflineRegionFuture", "Result", resp, "Failure responding to request") + } + return +} + +// DatabaseAccountsOnlineRegionFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DatabaseAccountsOnlineRegionFuture struct { + azure.Future + req *http.Request +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future DatabaseAccountsOnlineRegionFuture) Result(client DatabaseAccountsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOnlineRegionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + return ar, azure.NewAsyncOpIncompleteError("documentdb.DatabaseAccountsOnlineRegionFuture") + } + if future.PollingMethod() == azure.PollingLocation { + ar, err = client.OnlineRegionResponder(future.Response()) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOnlineRegionFuture", "Result", future.Response(), "Failure responding to request") + } + return + } + var req *http.Request + var resp *http.Response + if future.PollingURL() != "" { + req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + if err != nil { + return + } + } else { + req = autorest.ChangeToGet(future.req) + } + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOnlineRegionFuture", "Result", resp, "Failure sending request") + return + } + ar, err = client.OnlineRegionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsOnlineRegionFuture", "Result", resp, "Failure responding to request") + } + return +} + // DatabaseAccountsPatchFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type DatabaseAccountsPatchFuture struct { diff --git a/services/cosmos-db/mgmt/2015-04-08/documentdb/partitionkeyrangeid.go b/services/cosmos-db/mgmt/2015-04-08/documentdb/partitionkeyrangeid.go index f51432580480..1de1a9805665 100644 --- a/services/cosmos-db/mgmt/2015-04-08/documentdb/partitionkeyrangeid.go +++ b/services/cosmos-db/mgmt/2015-04-08/documentdb/partitionkeyrangeid.go @@ -41,15 +41,12 @@ func NewPartitionKeyRangeIDClientWithBaseURI(baseURI string, subscriptionID stri } // ListMetrics retrieves the metrics determined by the given filter for the given partition key range id. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// partitionKeyRangeID - partition Key Range Id for which to get data. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +// databaseRid is cosmos DB database rid. collectionRid is cosmos DB collection rid. partitionKeyRangeID is +// partition Key Range Id for which to get data. filter is an OData filter expression that describes a subset of +// metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of +// multiple names), startTime, endTime, and timeGrain. The supported operator is eq. func (client PartitionKeyRangeIDClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result PartitionMetricListResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, diff --git a/services/cosmos-db/mgmt/2015-04-08/documentdb/partitionkeyrangeidregion.go b/services/cosmos-db/mgmt/2015-04-08/documentdb/partitionkeyrangeidregion.go index 1592f6c455b7..c3067ba51c17 100644 --- a/services/cosmos-db/mgmt/2015-04-08/documentdb/partitionkeyrangeidregion.go +++ b/services/cosmos-db/mgmt/2015-04-08/documentdb/partitionkeyrangeidregion.go @@ -41,14 +41,11 @@ func NewPartitionKeyRangeIDRegionClientWithBaseURI(baseURI string, subscriptionI } // ListMetrics retrieves the metrics determined by the given filter for the given partition key range id and region. -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// region - cosmos DB region, with spaces between words and each word capitalized. -// databaseRid - cosmos DB database rid. -// collectionRid - cosmos DB collection rid. -// partitionKeyRangeID - partition Key Range Id for which to get data. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. region is +// cosmos DB region, with spaces between words and each word capitalized. databaseRid is cosmos DB database rid. +// collectionRid is cosmos DB collection rid. partitionKeyRangeID is partition Key Range Id for which to get data. +// filter is an OData filter expression that describes a subset of metrics to return. The parameters that can be // filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and // timeGrain. The supported operator is eq. func (client PartitionKeyRangeIDRegionClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, region string, databaseRid string, collectionRid string, partitionKeyRangeID string, filter string) (result PartitionMetricListResult, err error) { diff --git a/services/cosmos-db/mgmt/2015-04-08/documentdb/percentile.go b/services/cosmos-db/mgmt/2015-04-08/documentdb/percentile.go index 9cf2be4657cc..07ddaa7c7a3b 100644 --- a/services/cosmos-db/mgmt/2015-04-08/documentdb/percentile.go +++ b/services/cosmos-db/mgmt/2015-04-08/documentdb/percentile.go @@ -42,12 +42,11 @@ func NewPercentileClientWithBaseURI(baseURI string, subscriptionID string) Perce // ListMetrics retrieves the metrics determined by the given filter for the given database account. This url is only // for PBS and Replication Latency data -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. filter is +// an OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are +// name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The +// supported operator is eq. func (client PercentileClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, filter string) (result PercentileMetricListResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, diff --git a/services/cosmos-db/mgmt/2015-04-08/documentdb/percentilesourcetarget.go b/services/cosmos-db/mgmt/2015-04-08/documentdb/percentilesourcetarget.go index 31f1f3f6910e..f913350181f6 100644 --- a/services/cosmos-db/mgmt/2015-04-08/documentdb/percentilesourcetarget.go +++ b/services/cosmos-db/mgmt/2015-04-08/documentdb/percentilesourcetarget.go @@ -42,16 +42,13 @@ func NewPercentileSourceTargetClientWithBaseURI(baseURI string, subscriptionID s // ListMetrics retrieves the metrics determined by the given filter for the given account, source and target region. // This url is only for PBS and Replication Latency data -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// sourceRegion - source region from which data is written. Cosmos DB region, with spaces between words and -// each word capitalized. -// targetRegion - target region to which data is written. Cosmos DB region, with spaces between words and each -// word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +// sourceRegion is source region from which data is written. Cosmos DB region, with spaces between words and each +// word capitalized. targetRegion is target region to which data is written. Cosmos DB region, with spaces between +// words and each word capitalized. filter is an OData filter expression that describes a subset of metrics to +// return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple +// names), startTime, endTime, and timeGrain. The supported operator is eq. func (client PercentileSourceTargetClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, sourceRegion string, targetRegion string, filter string) (result PercentileMetricListResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, diff --git a/services/cosmos-db/mgmt/2015-04-08/documentdb/percentiletarget.go b/services/cosmos-db/mgmt/2015-04-08/documentdb/percentiletarget.go index 61ca372b388a..1357b5dcd2ea 100644 --- a/services/cosmos-db/mgmt/2015-04-08/documentdb/percentiletarget.go +++ b/services/cosmos-db/mgmt/2015-04-08/documentdb/percentiletarget.go @@ -42,14 +42,12 @@ func NewPercentileTargetClientWithBaseURI(baseURI string, subscriptionID string) // ListMetrics retrieves the metrics determined by the given filter for the given account target region. This url is // only for PBS and Replication Latency data -// Parameters: -// resourceGroupName - name of an Azure resource group. -// accountName - cosmos DB database account name. -// targetRegion - target region to which data is written. Cosmos DB region, with spaces between words and each -// word capitalized. -// filter - an OData filter expression that describes a subset of metrics to return. The parameters that can be -// filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and -// timeGrain. The supported operator is eq. +// +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +// targetRegion is target region to which data is written. Cosmos DB region, with spaces between words and each +// word capitalized. filter is an OData filter expression that describes a subset of metrics to return. The +// parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), +// startTime, endTime, and timeGrain. The supported operator is eq. func (client PercentileTargetClient) ListMetrics(ctx context.Context, resourceGroupName string, accountName string, targetRegion string, filter string) (result PercentileMetricListResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, From bb87b37634dee46be1a91fd31b557f8bd5e493f6 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 27 Apr 2018 00:57:37 +0000 Subject: [PATCH 2/4] Generated from fa9bc3028e4c1394bab3ee2c29bcfaaae752cb1b define a new region parameter for online/offline --- .../cosmos-db/mgmt/2015-04-08/documentdb/databaseaccounts.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccounts.go b/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccounts.go index 8f89d8b227d2..723ed1e7ac49 100644 --- a/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccounts.go +++ b/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccounts.go @@ -1089,7 +1089,6 @@ func (client DatabaseAccountsClient) OfflineRegion(ctx context.Context, resource func (client DatabaseAccountsClient) OfflineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, region string) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), - "region": autorest.Encode("path", region), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -1097,6 +1096,7 @@ func (client DatabaseAccountsClient) OfflineRegionPreparer(ctx context.Context, const APIVersion = "2015-04-08" queryParameters := map[string]interface{}{ "api-version": APIVersion, + "region": autorest.Encode("query", region), } preparer := autorest.CreatePreparer( @@ -1169,7 +1169,6 @@ func (client DatabaseAccountsClient) OnlineRegion(ctx context.Context, resourceG func (client DatabaseAccountsClient) OnlineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, region string) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), - "region": autorest.Encode("path", region), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -1177,6 +1176,7 @@ func (client DatabaseAccountsClient) OnlineRegionPreparer(ctx context.Context, r const APIVersion = "2015-04-08" queryParameters := map[string]interface{}{ "api-version": APIVersion, + "region": autorest.Encode("query", region), } preparer := autorest.CreatePreparer( From 664f0e3e57c66e14cd1324bceb4e79c1ada24480 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 30 Apr 2018 23:20:43 +0000 Subject: [PATCH 3/4] Generated from ab30108303e8b0af64abcac225babb39f1040974 actually fixing the bug where the region parameter was part of query instead of body --- .../cosmos-db/mgmt/documentdb/models.go | 1 + .../cosmos-db/mgmt/documentdb/models.go | 1 + .../2015-04-08/documentdb/databaseaccounts.go | 24 +++++++++---------- .../mgmt/2015-04-08/documentdb/models.go | 6 +++++ 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/profiles/latest/cosmos-db/mgmt/documentdb/models.go b/profiles/latest/cosmos-db/mgmt/documentdb/models.go index 95abf925447e..9505618e4bcd 100644 --- a/profiles/latest/cosmos-db/mgmt/documentdb/models.go +++ b/profiles/latest/cosmos-db/mgmt/documentdb/models.go @@ -132,6 +132,7 @@ type PartitionUsagesResult = original.PartitionUsagesResult type PercentileMetric = original.PercentileMetric type PercentileMetricListResult = original.PercentileMetricListResult type PercentileMetricValue = original.PercentileMetricValue +type RegionForOnlineOffline = original.RegionForOnlineOffline type Resource = original.Resource type Usage = original.Usage type UsagesResult = original.UsagesResult diff --git a/profiles/preview/cosmos-db/mgmt/documentdb/models.go b/profiles/preview/cosmos-db/mgmt/documentdb/models.go index c4b9fff1f875..39e7ccb81d5b 100644 --- a/profiles/preview/cosmos-db/mgmt/documentdb/models.go +++ b/profiles/preview/cosmos-db/mgmt/documentdb/models.go @@ -132,6 +132,7 @@ type PartitionUsagesResult = original.PartitionUsagesResult type PercentileMetric = original.PercentileMetric type PercentileMetricListResult = original.PercentileMetricListResult type PercentileMetricValue = original.PercentileMetricValue +type RegionForOnlineOffline = original.RegionForOnlineOffline type Resource = original.Resource type Usage = original.Usage type UsagesResult = original.UsagesResult diff --git a/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccounts.go b/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccounts.go index 723ed1e7ac49..5cee293bb3d0 100644 --- a/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccounts.go +++ b/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccounts.go @@ -1056,9 +1056,8 @@ func (client DatabaseAccountsClient) ListUsagesResponder(resp *http.Response) (r // OfflineRegion offline the specified region for the specified Azure Cosmos DB database account. // -// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. region is -// cosmos DB region, with spaces between words and each word capitalized. -func (client DatabaseAccountsClient) OfflineRegion(ctx context.Context, resourceGroupName string, accountName string, region string) (result DatabaseAccountsOfflineRegionFuture, err error) { +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +func (client DatabaseAccountsClient) OfflineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline) (result DatabaseAccountsOfflineRegionFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -1070,7 +1069,7 @@ func (client DatabaseAccountsClient) OfflineRegion(ctx context.Context, resource return result, validation.NewError("documentdb.DatabaseAccountsClient", "OfflineRegion", err.Error()) } - req, err := client.OfflineRegionPreparer(ctx, resourceGroupName, accountName, region) + req, err := client.OfflineRegionPreparer(ctx, resourceGroupName, accountName, regionParameterForOffline) if err != nil { err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OfflineRegion", nil, "Failure preparing request") return @@ -1086,7 +1085,7 @@ func (client DatabaseAccountsClient) OfflineRegion(ctx context.Context, resource } // OfflineRegionPreparer prepares the OfflineRegion request. -func (client DatabaseAccountsClient) OfflineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, region string) (*http.Request, error) { +func (client DatabaseAccountsClient) OfflineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -1096,13 +1095,14 @@ func (client DatabaseAccountsClient) OfflineRegionPreparer(ctx context.Context, const APIVersion = "2015-04-08" queryParameters := map[string]interface{}{ "api-version": APIVersion, - "region": autorest.Encode("query", region), } preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion", pathParameters), + autorest.WithJSON(regionParameterForOffline), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -1136,9 +1136,8 @@ func (client DatabaseAccountsClient) OfflineRegionResponder(resp *http.Response) // OnlineRegion online the specified region for the specified Azure Cosmos DB database account. // -// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. region is -// cosmos DB region, with spaces between words and each word capitalized. -func (client DatabaseAccountsClient) OnlineRegion(ctx context.Context, resourceGroupName string, accountName string, region string) (result DatabaseAccountsOnlineRegionFuture, err error) { +// resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +func (client DatabaseAccountsClient) OnlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline) (result DatabaseAccountsOnlineRegionFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, @@ -1150,7 +1149,7 @@ func (client DatabaseAccountsClient) OnlineRegion(ctx context.Context, resourceG return result, validation.NewError("documentdb.DatabaseAccountsClient", "OnlineRegion", err.Error()) } - req, err := client.OnlineRegionPreparer(ctx, resourceGroupName, accountName, region) + req, err := client.OnlineRegionPreparer(ctx, resourceGroupName, accountName, regionParameterForOnline) if err != nil { err = autorest.NewErrorWithError(err, "documentdb.DatabaseAccountsClient", "OnlineRegion", nil, "Failure preparing request") return @@ -1166,7 +1165,7 @@ func (client DatabaseAccountsClient) OnlineRegion(ctx context.Context, resourceG } // OnlineRegionPreparer prepares the OnlineRegion request. -func (client DatabaseAccountsClient) OnlineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, region string) (*http.Request, error) { +func (client DatabaseAccountsClient) OnlineRegionPreparer(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -1176,13 +1175,14 @@ func (client DatabaseAccountsClient) OnlineRegionPreparer(ctx context.Context, r const APIVersion = "2015-04-08" queryParameters := map[string]interface{}{ "api-version": APIVersion, - "region": autorest.Encode("query", region), } preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion", pathParameters), + autorest.WithJSON(regionParameterForOnline), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/cosmos-db/mgmt/2015-04-08/documentdb/models.go b/services/cosmos-db/mgmt/2015-04-08/documentdb/models.go index e804baca8463..347c0ad3974d 100644 --- a/services/cosmos-db/mgmt/2015-04-08/documentdb/models.go +++ b/services/cosmos-db/mgmt/2015-04-08/documentdb/models.go @@ -1287,6 +1287,12 @@ type PercentileMetricValue struct { Total *float64 `json:"total,omitempty"` } +// RegionForOnlineOffline cosmos DB region to online or offline. +type RegionForOnlineOffline struct { + // Region - Cosmos DB region, with spaces between words and each word capitalized. + Region *string `json:"region,omitempty"` +} + // Resource a database account resource. type Resource struct { // ID - The unique resource identifier of the database account. From e0570da44948d22c127de9ecd29bd649a9ac4ccd Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 30 Apr 2018 23:42:19 +0000 Subject: [PATCH 4/4] Generated from 05246bcf53fa84862f145b8ffda5258b4427faf3 actually fixing the bug where the region parameter was part of query instead of body and adding the description --- .../cosmos-db/mgmt/2015-04-08/documentdb/databaseaccounts.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccounts.go b/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccounts.go index 5cee293bb3d0..cda2901f9347 100644 --- a/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccounts.go +++ b/services/cosmos-db/mgmt/2015-04-08/documentdb/databaseaccounts.go @@ -1057,6 +1057,7 @@ func (client DatabaseAccountsClient) ListUsagesResponder(resp *http.Response) (r // OfflineRegion offline the specified region for the specified Azure Cosmos DB database account. // // resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +// regionParameterForOffline is cosmos DB region to offline for the database account. func (client DatabaseAccountsClient) OfflineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline) (result DatabaseAccountsOfflineRegionFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, @@ -1137,6 +1138,7 @@ func (client DatabaseAccountsClient) OfflineRegionResponder(resp *http.Response) // OnlineRegion online the specified region for the specified Azure Cosmos DB database account. // // resourceGroupName is name of an Azure resource group. accountName is cosmos DB database account name. +// regionParameterForOnline is cosmos DB region to online for the database account. func (client DatabaseAccountsClient) OnlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline) (result DatabaseAccountsOnlineRegionFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName,