diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/cassandraresources.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/cassandraresources.go index 221f72e33a25..f1bc3045d203 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/cassandraresources.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/cassandraresources.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// CassandraResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API +// CassandraResourcesClient is the client for the CassandraResources methods of the Documentdb service. type CassandraResourcesClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/client.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/client.go index 0ad2ff76e31b..b521db6d91ec 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/client.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/client.go @@ -1,6 +1,6 @@ // Package documentdb implements the Azure ARM Documentdb service API version . // -// Azure Cosmos DB Database Service Resource Provider REST API +// package documentdb // Copyright (c) Microsoft and contributors. All rights reserved. diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collection.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collection.go index 042a9ec74ad4..bcdb63768ee9 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collection.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collection.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// CollectionClient is the azure Cosmos DB Database Service Resource Provider REST API +// CollectionClient is the client for the Collection methods of the Documentdb service. type CollectionClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionpartition.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionpartition.go index 6f45e417c6cc..fac480d87779 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionpartition.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionpartition.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// CollectionPartitionClient is the azure Cosmos DB Database Service Resource Provider REST API +// CollectionPartitionClient is the client for the CollectionPartition methods of the Documentdb service. type CollectionPartitionClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionpartitionregion.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionpartitionregion.go index 260e46efdf6a..4f9bbfb78c6f 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionpartitionregion.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionpartitionregion.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// CollectionPartitionRegionClient is the azure Cosmos DB Database Service Resource Provider REST API +// CollectionPartitionRegionClient is the client for the CollectionPartitionRegion methods of the Documentdb service. type CollectionPartitionRegionClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionregion.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionregion.go index 20d64d82f26c..dde6860be9c7 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionregion.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/collectionregion.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// CollectionRegionClient is the azure Cosmos DB Database Service Resource Provider REST API +// CollectionRegionClient is the client for the CollectionRegion methods of the Documentdb service. type CollectionRegionClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/database.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/database.go index 9bd952646e6e..469addb186c9 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/database.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/database.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// DatabaseClient is the azure Cosmos DB Database Service Resource Provider REST API +// DatabaseClient is the client for the Database methods of the Documentdb service. type DatabaseClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/databaseaccountregion.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/databaseaccountregion.go index cb81c45eb4c0..3f7d54b98c21 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/databaseaccountregion.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/databaseaccountregion.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// DatabaseAccountRegionClient is the azure Cosmos DB Database Service Resource Provider REST API +// DatabaseAccountRegionClient is the client for the DatabaseAccountRegion methods of the Documentdb service. type DatabaseAccountRegionClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/databaseaccounts.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/databaseaccounts.go index 59bed9976e97..49c6e7fb87a9 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/databaseaccounts.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/databaseaccounts.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// DatabaseAccountsClient is the azure Cosmos DB Database Service Resource Provider REST API +// DatabaseAccountsClient is the client for the DatabaseAccounts methods of the Documentdb service. type DatabaseAccountsClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/documentdbapi/interfaces.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/documentdbapi/interfaces.go index f0e14683b377..2fa717776afe 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/documentdbapi/interfaces.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/documentdbapi/interfaces.go @@ -141,11 +141,15 @@ var _ PartitionKeyRangeIDRegionClientAPI = (*documentdb.PartitionKeyRangeIDRegio type SQLResourcesClientAPI interface { CreateUpdateSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters documentdb.SQLContainerCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLContainerFuture, err error) CreateUpdateSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters documentdb.SQLDatabaseCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLDatabaseFuture, err error) + CreateUpdateSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string, createUpdateSQLRoleAssignmentParameters documentdb.SQLRoleAssignmentCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLRoleAssignmentFuture, err error) + CreateUpdateSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string, createUpdateSQLRoleDefinitionParameters documentdb.SQLRoleDefinitionCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLRoleDefinitionFuture, err error) CreateUpdateSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters documentdb.SQLStoredProcedureCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLStoredProcedureFuture, err error) CreateUpdateSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters documentdb.SQLTriggerCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLTriggerFuture, err error) CreateUpdateSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters documentdb.SQLUserDefinedFunctionCreateUpdateParameters) (result documentdb.SQLResourcesCreateUpdateSQLUserDefinedFunctionFuture, err error) DeleteSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLResourcesDeleteSQLContainerFuture, err error) DeleteSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLResourcesDeleteSQLDatabaseFuture, err error) + DeleteSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (result documentdb.SQLResourcesDeleteSQLRoleAssignmentFuture, err error) + DeleteSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (result documentdb.SQLResourcesDeleteSQLRoleDefinitionFuture, err error) DeleteSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result documentdb.SQLResourcesDeleteSQLStoredProcedureFuture, err error) DeleteSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result documentdb.SQLResourcesDeleteSQLTriggerFuture, err error) DeleteSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result documentdb.SQLResourcesDeleteSQLUserDefinedFunctionFuture, err error) @@ -153,11 +157,15 @@ type SQLResourcesClientAPI interface { GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.ThroughputSettingsGetResults, err error) GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLDatabaseGetResults, err error) GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.ThroughputSettingsGetResults, err error) + GetSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (result documentdb.SQLRoleAssignmentGetResults, err error) + GetSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (result documentdb.SQLRoleDefinitionGetResults, err error) GetSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string) (result documentdb.SQLStoredProcedureGetResults, err error) GetSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string) (result documentdb.SQLTriggerGetResults, err error) GetSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string) (result documentdb.SQLUserDefinedFunctionGetResults, err error) ListSQLContainers(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result documentdb.SQLContainerListResult, err error) ListSQLDatabases(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.SQLDatabaseListResult, err error) + ListSQLRoleAssignments(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.SQLRoleAssignmentListResult, err error) + ListSQLRoleDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result documentdb.SQLRoleDefinitionListResult, err error) ListSQLStoredProcedures(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLStoredProcedureListResult, err error) ListSQLTriggers(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLTriggerListResult, err error) ListSQLUserDefinedFunctions(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result documentdb.SQLUserDefinedFunctionListResult, err error) diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/enums.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/enums.go index bec098908268..ea6e6364d202 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/enums.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/enums.go @@ -301,7 +301,7 @@ const ( // ResourceIdentityTypeSystemAssigned ... ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" // ResourceIdentityTypeSystemAssignedUserAssigned ... - ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned,UserAssigned" // ResourceIdentityTypeUserAssigned ... ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" ) @@ -324,6 +324,21 @@ func PossibleRestoreModeValues() []RestoreMode { return []RestoreMode{PointInTime} } +// RoleDefinitionType enumerates the values for role definition type. +type RoleDefinitionType string + +const ( + // BuiltInRole ... + BuiltInRole RoleDefinitionType = "BuiltInRole" + // CustomRole ... + CustomRole RoleDefinitionType = "CustomRole" +) + +// PossibleRoleDefinitionTypeValues returns an array of possible values for the RoleDefinitionType const type. +func PossibleRoleDefinitionTypeValues() []RoleDefinitionType { + return []RoleDefinitionType{BuiltInRole, CustomRole} +} + // ServerVersion enumerates the values for server version. type ServerVersion string diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/gremlinresources.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/gremlinresources.go index 88727f7d600c..12bdc38e1e7c 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/gremlinresources.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/gremlinresources.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// GremlinResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API +// GremlinResourcesClient is the client for the GremlinResources methods of the Documentdb service. type GremlinResourcesClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/models.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/models.go index 8b4e4583c395..b332f490de48 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/models.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/models.go @@ -37,8 +37,8 @@ type APIProperties struct { ServerVersion ServerVersion `json:"serverVersion,omitempty"` } -// ARMProxyResource the resource model definition for a ARM proxy resource. It will have everything other than -// required location and tags +// ARMProxyResource the resource model definition for a ARM proxy resource. It will have everything other +// than required location and tags type ARMProxyResource struct { // ID - READ-ONLY; The unique resource identifier of the database account. ID *string `json:"id,omitempty"` @@ -111,15 +111,15 @@ type AutoUpgradePolicyResource struct { ThroughputPolicy *ThroughputPolicyResource `json:"throughputPolicy,omitempty"` } -// AzureEntityResource the resource model definition for a Azure Resource Manager resource with an etag. +// 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 - 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. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty"` } @@ -325,7 +325,8 @@ func (ckcup *CassandraKeyspaceCreateUpdateParameters) UnmarshalJSON(body []byte) return nil } -// CassandraKeyspaceCreateUpdateProperties properties to create and update Azure Cosmos DB Cassandra keyspace. +// CassandraKeyspaceCreateUpdateProperties properties to create and update Azure Cosmos DB Cassandra +// keyspace. type CassandraKeyspaceCreateUpdateProperties struct { // Resource - The standard JSON format of a Cassandra keyspace Resource *CassandraKeyspaceResource `json:"resource,omitempty"` @@ -530,8 +531,8 @@ func (future *CassandraResourcesCreateUpdateCassandraKeyspaceFuture) Result(clie return } -// CassandraResourcesCreateUpdateCassandraTableFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. +// CassandraResourcesCreateUpdateCassandraTableFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. type CassandraResourcesCreateUpdateCassandraTableFuture struct { azure.Future } @@ -559,8 +560,8 @@ func (future *CassandraResourcesCreateUpdateCassandraTableFuture) Result(client return } -// CassandraResourcesDeleteCassandraKeyspaceFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. +// CassandraResourcesDeleteCassandraKeyspaceFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. type CassandraResourcesDeleteCassandraKeyspaceFuture struct { azure.Future } @@ -582,8 +583,8 @@ func (future *CassandraResourcesDeleteCassandraKeyspaceFuture) Result(client Cas return } -// CassandraResourcesDeleteCassandraTableFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. +// CassandraResourcesDeleteCassandraTableFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. type CassandraResourcesDeleteCassandraTableFuture struct { azure.Future } @@ -605,8 +606,8 @@ func (future *CassandraResourcesDeleteCassandraTableFuture) Result(client Cassan return } -// CassandraResourcesUpdateCassandraKeyspaceThroughputFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. +// CassandraResourcesUpdateCassandraKeyspaceThroughputFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. type CassandraResourcesUpdateCassandraKeyspaceThroughputFuture struct { azure.Future } @@ -1020,8 +1021,8 @@ type ConsistencyPolicy struct { MaxIntervalInSeconds *int32 `json:"maxIntervalInSeconds,omitempty"` } -// ContainerPartitionKey the configuration of the partition key to be used for partitioning data into multiple -// partitions +// ContainerPartitionKey the configuration of the partition key to be used for partitioning data into +// multiple partitions type ContainerPartitionKey struct { // Paths - List of paths using which data within the container can be partitioned Paths *[]string `json:"paths,omitempty"` @@ -1067,8 +1068,22 @@ func (cmbp ContinuousModeBackupPolicy) AsBasicBackupPolicy() (BasicBackupPolicy, return &cmbp, true } -// CreateUpdateOptions createUpdateOptions are a list of key-value pairs that describe the resource. Supported -// keys are "If-Match", "If-None-Match", "Session-Token" and "Throughput" +// CorsPolicy the CORS policy for the Cosmos DB database account. +type CorsPolicy struct { + // AllowedOrigins - The origin domains that are permitted to make a request against the service via CORS. + AllowedOrigins *string `json:"allowedOrigins,omitempty"` + // AllowedMethods - The methods (HTTP request verbs) that the origin domain may use for a CORS request. + AllowedMethods *string `json:"allowedMethods,omitempty"` + // AllowedHeaders - The request headers that the origin domain may specify on the CORS request. + AllowedHeaders *string `json:"allowedHeaders,omitempty"` + // ExposedHeaders - The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer. + ExposedHeaders *string `json:"exposedHeaders,omitempty"` + // MaxAgeInSeconds - The maximum amount time that a browser should cache the preflight OPTIONS request. + MaxAgeInSeconds *int64 `json:"maxAgeInSeconds,omitempty"` +} + +// CreateUpdateOptions createUpdateOptions are a list of key-value pairs that describe the resource. +// Supported keys are "If-Match", "If-None-Match", "Session-Token" and "Throughput" type CreateUpdateOptions struct { // Throughput - Request Units per second. For example, "throughput": 10000. Throughput *int32 `json:"throughput,omitempty"` @@ -1251,6 +1266,8 @@ type DatabaseAccountCreateUpdateProperties struct { EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` // BackupPolicy - The object representing the policy for taking backups on an account. BackupPolicy BasicBackupPolicy `json:"backupPolicy,omitempty"` + // Cors - The CORS policy for the Cosmos DB database account. + Cors *[]CorsPolicy `json:"cors,omitempty"` // CreateMode - Possible values include: 'CreateModeDatabaseAccountCreateUpdateProperties', 'CreateModeDefault', 'CreateModeRestore' CreateMode CreateModeBasicDatabaseAccountCreateUpdateProperties `json:"createMode,omitempty"` } @@ -1352,6 +1369,9 @@ func (dacup DatabaseAccountCreateUpdateProperties) MarshalJSON() ([]byte, error) objectMap["enableAnalyticalStorage"] = dacup.EnableAnalyticalStorage } objectMap["backupPolicy"] = dacup.BackupPolicy + if dacup.Cors != nil { + objectMap["cors"] = dacup.Cors + } if dacup.CreateMode != "" { objectMap["createMode"] = dacup.CreateMode } @@ -1548,6 +1568,15 @@ func (dacup *DatabaseAccountCreateUpdateProperties) UnmarshalJSON(body []byte) e } dacup.BackupPolicy = backupPolicy } + case "cors": + if v != nil { + var cors []CorsPolicy + err = json.Unmarshal(*v, &cors) + if err != nil { + return err + } + dacup.Cors = &cors + } case "createMode": if v != nil { var createMode CreateModeBasicDatabaseAccountCreateUpdateProperties @@ -1618,6 +1647,8 @@ type DatabaseAccountGetProperties struct { RestoreParameters *RestoreParameters `json:"restoreParameters,omitempty"` // BackupPolicy - The object representing the policy for taking backups on an account. BackupPolicy BasicBackupPolicy `json:"backupPolicy,omitempty"` + // Cors - The CORS policy for the Cosmos DB database account. + Cors *[]CorsPolicy `json:"cors,omitempty"` } // MarshalJSON is the custom marshaler for DatabaseAccountGetProperties. @@ -1678,6 +1709,9 @@ func (dagp DatabaseAccountGetProperties) MarshalJSON() ([]byte, error) { objectMap["restoreParameters"] = dagp.RestoreParameters } objectMap["backupPolicy"] = dagp.BackupPolicy + if dagp.Cors != nil { + objectMap["cors"] = dagp.Cors + } return json.Marshal(objectMap) } @@ -1932,6 +1966,15 @@ func (dagp *DatabaseAccountGetProperties) UnmarshalJSON(body []byte) error { } dagp.BackupPolicy = backupPolicy } + case "cors": + if v != nil { + var cors []CorsPolicy + err = json.Unmarshal(*v, &cors) + if err != nil { + return err + } + dagp.Cors = &cors + } } } @@ -2162,8 +2205,8 @@ func (future *DatabaseAccountsDeleteFuture) Result(client DatabaseAccountsClient return } -// DatabaseAccountsFailoverPriorityChangeFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. +// DatabaseAccountsFailoverPriorityChangeFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. type DatabaseAccountsFailoverPriorityChangeFuture struct { azure.Future } @@ -2297,6 +2340,7 @@ type DatabaseAccountUpdateParameters struct { // Location - The location of the resource group to which the resource belongs. Location *string `json:"location,omitempty"` *DatabaseAccountUpdateProperties `json:"properties,omitempty"` + Identity *ManagedServiceIdentity `json:"identity,omitempty"` } // MarshalJSON is the custom marshaler for DatabaseAccountUpdateParameters. @@ -2311,6 +2355,9 @@ func (daup DatabaseAccountUpdateParameters) MarshalJSON() ([]byte, error) { if daup.DatabaseAccountUpdateProperties != nil { objectMap["properties"] = daup.DatabaseAccountUpdateProperties } + if daup.Identity != nil { + objectMap["identity"] = daup.Identity + } return json.Marshal(objectMap) } @@ -2350,6 +2397,15 @@ func (daup *DatabaseAccountUpdateParameters) UnmarshalJSON(body []byte) error { } daup.DatabaseAccountUpdateProperties = &databaseAccountUpdateProperties } + case "identity": + if v != nil { + var identity ManagedServiceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + daup.Identity = &identity + } } } @@ -2392,6 +2448,8 @@ type DatabaseAccountUpdateProperties struct { EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` // BackupPolicy - The object representing the policy for taking backups on an account. BackupPolicy BasicBackupPolicy `json:"backupPolicy,omitempty"` + // Cors - The CORS policy for the Cosmos DB database account. + Cors *[]CorsPolicy `json:"cors,omitempty"` } // UnmarshalJSON is the custom unmarshaler for DatabaseAccountUpdateProperties struct. @@ -2555,6 +2613,15 @@ func (daup *DatabaseAccountUpdateProperties) UnmarshalJSON(body []byte) error { } daup.BackupPolicy = backupPolicy } + case "cors": + if v != nil { + var cors []CorsPolicy + err = json.Unmarshal(*v, &cors) + if err != nil { + return err + } + daup.Cors = &cors + } } } @@ -2569,6 +2636,11 @@ type DatabaseRestoreResource struct { CollectionNames *[]string `json:"collectionNames,omitempty"` } +// DefaultErrorResponse an error response from the service. +type DefaultErrorResponse struct { + Error *ErrorResponse `json:"error,omitempty"` +} + // DefaultRequestDatabaseAccountCreateUpdateProperties properties for non-restore Azure Cosmos DB database // account requests. type DefaultRequestDatabaseAccountCreateUpdateProperties struct { @@ -2608,6 +2680,8 @@ type DefaultRequestDatabaseAccountCreateUpdateProperties struct { EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` // BackupPolicy - The object representing the policy for taking backups on an account. BackupPolicy BasicBackupPolicy `json:"backupPolicy,omitempty"` + // Cors - The CORS policy for the Cosmos DB database account. + Cors *[]CorsPolicy `json:"cors,omitempty"` // CreateMode - Possible values include: 'CreateModeDatabaseAccountCreateUpdateProperties', 'CreateModeDefault', 'CreateModeRestore' CreateMode CreateModeBasicDatabaseAccountCreateUpdateProperties `json:"createMode,omitempty"` } @@ -2668,6 +2742,9 @@ func (drdacup DefaultRequestDatabaseAccountCreateUpdateProperties) MarshalJSON() objectMap["enableAnalyticalStorage"] = drdacup.EnableAnalyticalStorage } objectMap["backupPolicy"] = drdacup.BackupPolicy + if drdacup.Cors != nil { + objectMap["cors"] = drdacup.Cors + } if drdacup.CreateMode != "" { objectMap["createMode"] = drdacup.CreateMode } @@ -2864,6 +2941,15 @@ func (drdacup *DefaultRequestDatabaseAccountCreateUpdateProperties) UnmarshalJSO } drdacup.BackupPolicy = backupPolicy } + case "cors": + if v != nil { + var cors []CorsPolicy + err = json.Unmarshal(*v, &cors) + if err != nil { + return err + } + drdacup.Cors = &cors + } case "createMode": if v != nil { var createMode CreateModeBasicDatabaseAccountCreateUpdateProperties @@ -2887,11 +2973,6 @@ type ErrorResponse struct { Message *string `json:"message,omitempty"` } -// ErrorResponseUpdatedFormat an error response from the service. -type ErrorResponseUpdatedFormat struct { - Error *ErrorResponse `json:"error,omitempty"` -} - // ExcludedPath ... type ExcludedPath struct { // Path - The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) @@ -3535,8 +3616,8 @@ type GremlinGraphResource struct { ConflictResolutionPolicy *ConflictResolutionPolicy `json:"conflictResolutionPolicy,omitempty"` } -// GremlinResourcesCreateUpdateGremlinDatabaseFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. +// GremlinResourcesCreateUpdateGremlinDatabaseFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. type GremlinResourcesCreateUpdateGremlinDatabaseFuture struct { azure.Future } @@ -3564,8 +3645,8 @@ func (future *GremlinResourcesCreateUpdateGremlinDatabaseFuture) Result(client G return } -// GremlinResourcesCreateUpdateGremlinGraphFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. +// GremlinResourcesCreateUpdateGremlinGraphFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. type GremlinResourcesCreateUpdateGremlinGraphFuture struct { azure.Future } @@ -3593,8 +3674,8 @@ func (future *GremlinResourcesCreateUpdateGremlinGraphFuture) Result(client Grem return } -// GremlinResourcesDeleteGremlinDatabaseFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. +// GremlinResourcesDeleteGremlinDatabaseFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. type GremlinResourcesDeleteGremlinDatabaseFuture struct { azure.Future } @@ -3668,8 +3749,8 @@ func (future *GremlinResourcesUpdateGremlinDatabaseThroughputFuture) Result(clie return } -// GremlinResourcesUpdateGremlinGraphThroughputFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. +// GremlinResourcesUpdateGremlinGraphThroughputFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. type GremlinResourcesUpdateGremlinGraphThroughputFuture struct { azure.Future } @@ -3776,8 +3857,10 @@ type ManagedServiceIdentity struct { PrincipalID *string `json:"principalId,omitempty"` // TenantID - READ-ONLY; The tenant id of the system assigned identity. This property will only be provided for a system assigned identity. TenantID *string `json:"tenantId,omitempty"` - // Type - The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' + // Type - The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' Type ResourceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The list of user identities associated with 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]*ManagedServiceIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` } // MarshalJSON is the custom marshaler for ManagedServiceIdentity. @@ -3786,9 +3869,20 @@ func (msi ManagedServiceIdentity) MarshalJSON() ([]byte, error) { if msi.Type != "" { objectMap["type"] = msi.Type } + if msi.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = msi.UserAssignedIdentities + } return json.Marshal(objectMap) } +// ManagedServiceIdentityUserAssignedIdentitiesValue ... +type ManagedServiceIdentityUserAssignedIdentitiesValue struct { + // PrincipalID - READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + // Metric metric data type Metric struct { // StartTime - READ-ONLY; The start time for the metric (ISO-8601 format). @@ -3995,7 +4089,8 @@ func (mdccup *MongoDBCollectionCreateUpdateParameters) UnmarshalJSON(body []byte return nil } -// MongoDBCollectionCreateUpdateProperties properties to create and update Azure Cosmos DB MongoDB collection. +// MongoDBCollectionCreateUpdateProperties properties to create and update Azure Cosmos DB MongoDB +// collection. type MongoDBCollectionCreateUpdateProperties struct { // Resource - The standard JSON format of a MongoDB collection Resource *MongoDBCollectionResource `json:"resource,omitempty"` @@ -4486,8 +4581,8 @@ type MongoDBDatabaseResource struct { ID *string `json:"id,omitempty"` } -// MongoDBResourcesCreateUpdateMongoDBCollectionFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. +// MongoDBResourcesCreateUpdateMongoDBCollectionFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. type MongoDBResourcesCreateUpdateMongoDBCollectionFuture struct { azure.Future } @@ -4515,8 +4610,8 @@ func (future *MongoDBResourcesCreateUpdateMongoDBCollectionFuture) Result(client return } -// MongoDBResourcesCreateUpdateMongoDBDatabaseFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. +// MongoDBResourcesCreateUpdateMongoDBDatabaseFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. type MongoDBResourcesCreateUpdateMongoDBDatabaseFuture struct { azure.Future } @@ -4544,8 +4639,8 @@ func (future *MongoDBResourcesCreateUpdateMongoDBDatabaseFuture) Result(client M return } -// MongoDBResourcesDeleteMongoDBCollectionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. +// MongoDBResourcesDeleteMongoDBCollectionFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. type MongoDBResourcesDeleteMongoDBCollectionFuture struct { azure.Future } @@ -4567,8 +4662,8 @@ func (future *MongoDBResourcesDeleteMongoDBCollectionFuture) Result(client Mongo return } -// MongoDBResourcesDeleteMongoDBDatabaseFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. +// MongoDBResourcesDeleteMongoDBDatabaseFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. type MongoDBResourcesDeleteMongoDBDatabaseFuture struct { azure.Future } @@ -4806,8 +4901,8 @@ func (future *NotebookWorkspacesCreateOrUpdateFuture) Result(client NotebookWork return } -// NotebookWorkspacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. +// NotebookWorkspacesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. type NotebookWorkspacesDeleteFuture struct { azure.Future } @@ -4829,8 +4924,8 @@ func (future *NotebookWorkspacesDeleteFuture) Result(client NotebookWorkspacesCl return } -// NotebookWorkspacesRegenerateAuthTokenFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. +// NotebookWorkspacesRegenerateAuthTokenFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. type NotebookWorkspacesRegenerateAuthTokenFuture struct { azure.Future } @@ -5048,8 +5143,11 @@ func (page OperationListResultPage) Values() []Operation { } // Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{fn: getNextPage} +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } } // OptionsResource cosmos DB options resource object @@ -5241,16 +5339,24 @@ type PeriodicModeProperties struct { BackupRetentionIntervalInHours *int32 `json:"backupRetentionIntervalInHours,omitempty"` } +// Permission the set of data plane operations permitted through this Role Definition. +type Permission struct { + // DataActions - An array of data actions that are allowed. + DataActions *[]string `json:"dataActions,omitempty"` + // NotDataActions - An array of data actions that are denied. + NotDataActions *[]string `json:"notDataActions,omitempty"` +} + // PrivateEndpointConnection a private endpoint connection type PrivateEndpointConnection struct { autorest.Response `json:"-"` // PrivateEndpointConnectionProperties - Resource properties. *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // 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. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty"` } @@ -5333,8 +5439,8 @@ type PrivateEndpointConnectionProperties struct { ProvisioningState *string `json:"provisioningState,omitempty"` } -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. +// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. type PrivateEndpointConnectionsCreateOrUpdateFuture struct { azure.Future } @@ -5503,14 +5609,14 @@ func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, e return json.Marshal(objectMap) } -// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than -// required location and tags +// 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 - 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. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty"` } @@ -5520,13 +5626,13 @@ type RegionForOnlineOffline struct { Region *string `json:"region,omitempty"` } -// Resource ... +// 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 - 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. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty"` } @@ -5665,7 +5771,7 @@ type RestorableDatabaseAccountsListResult struct { type RestoreParameters struct { // RestoreMode - Describes the mode of the restore. Possible values include: 'PointInTime' RestoreMode RestoreMode `json:"restoreMode,omitempty"` - // RestoreSource - Path of the source account from which the restore has to be initiated + // RestoreSource - The id of the restorable database account from which the restore has to be initiated. For example: /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName} RestoreSource *string `json:"restoreSource,omitempty"` // RestoreTimestampInUtc - Time to which the account has to be restored (ISO-8601 format). RestoreTimestampInUtc *date.Time `json:"restoreTimestampInUtc,omitempty"` @@ -5673,7 +5779,8 @@ type RestoreParameters struct { DatabasesToRestore *[]DatabaseRestoreResource `json:"databasesToRestore,omitempty"` } -// RestoreReqeustDatabaseAccountCreateUpdateProperties properties to restore Azure Cosmos DB database account. +// RestoreReqeustDatabaseAccountCreateUpdateProperties properties to restore Azure Cosmos DB database +// account. type RestoreReqeustDatabaseAccountCreateUpdateProperties struct { // RestoreParameters - Parameters to indicate the information about the restore. RestoreParameters *RestoreParameters `json:"restoreParameters,omitempty"` @@ -5713,6 +5820,8 @@ type RestoreReqeustDatabaseAccountCreateUpdateProperties struct { EnableAnalyticalStorage *bool `json:"enableAnalyticalStorage,omitempty"` // BackupPolicy - The object representing the policy for taking backups on an account. BackupPolicy BasicBackupPolicy `json:"backupPolicy,omitempty"` + // Cors - The CORS policy for the Cosmos DB database account. + Cors *[]CorsPolicy `json:"cors,omitempty"` // CreateMode - Possible values include: 'CreateModeDatabaseAccountCreateUpdateProperties', 'CreateModeDefault', 'CreateModeRestore' CreateMode CreateModeBasicDatabaseAccountCreateUpdateProperties `json:"createMode,omitempty"` } @@ -5776,6 +5885,9 @@ func (rrdacup RestoreReqeustDatabaseAccountCreateUpdateProperties) MarshalJSON() objectMap["enableAnalyticalStorage"] = rrdacup.EnableAnalyticalStorage } objectMap["backupPolicy"] = rrdacup.BackupPolicy + if rrdacup.Cors != nil { + objectMap["cors"] = rrdacup.Cors + } if rrdacup.CreateMode != "" { objectMap["createMode"] = rrdacup.CreateMode } @@ -5981,6 +6093,15 @@ func (rrdacup *RestoreReqeustDatabaseAccountCreateUpdateProperties) UnmarshalJSO } rrdacup.BackupPolicy = backupPolicy } + case "cors": + if v != nil { + var cors []CorsPolicy + err = json.Unmarshal(*v, &cors) + if err != nil { + return err + } + rrdacup.Cors = &cors + } case "createMode": if v != nil { var createMode CreateModeBasicDatabaseAccountCreateUpdateProperties @@ -6669,8 +6790,66 @@ func (future *SQLResourcesCreateUpdateSQLDatabaseFuture) Result(client SQLResour return } -// SQLResourcesCreateUpdateSQLStoredProcedureFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. +// SQLResourcesCreateUpdateSQLRoleAssignmentFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type SQLResourcesCreateUpdateSQLRoleAssignmentFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *SQLResourcesCreateUpdateSQLRoleAssignmentFuture) Result(client SQLResourcesClient) (sragr SQLRoleAssignmentGetResults, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLRoleAssignmentFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLRoleAssignmentFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sragr.Response.Response, err = future.GetResult(sender); err == nil && sragr.Response.Response.StatusCode != http.StatusNoContent { + sragr, err = client.CreateUpdateSQLRoleAssignmentResponder(sragr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLRoleAssignmentFuture", "Result", sragr.Response.Response, "Failure responding to request") + } + } + return +} + +// SQLResourcesCreateUpdateSQLRoleDefinitionFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type SQLResourcesCreateUpdateSQLRoleDefinitionFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *SQLResourcesCreateUpdateSQLRoleDefinitionFuture) Result(client SQLResourcesClient) (srdgr SQLRoleDefinitionGetResults, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLRoleDefinitionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesCreateUpdateSQLRoleDefinitionFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if srdgr.Response.Response, err = future.GetResult(sender); err == nil && srdgr.Response.Response.StatusCode != http.StatusNoContent { + srdgr, err = client.CreateUpdateSQLRoleDefinitionResponder(srdgr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesCreateUpdateSQLRoleDefinitionFuture", "Result", srdgr.Response.Response, "Failure responding to request") + } + } + return +} + +// SQLResourcesCreateUpdateSQLStoredProcedureFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. type SQLResourcesCreateUpdateSQLStoredProcedureFuture struct { azure.Future } @@ -6802,6 +6981,52 @@ func (future *SQLResourcesDeleteSQLDatabaseFuture) Result(client SQLResourcesCli return } +// SQLResourcesDeleteSQLRoleAssignmentFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SQLResourcesDeleteSQLRoleAssignmentFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *SQLResourcesDeleteSQLRoleAssignmentFuture) Result(client SQLResourcesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLRoleAssignmentFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLRoleAssignmentFuture") + return + } + ar.Response = future.Response() + return +} + +// SQLResourcesDeleteSQLRoleDefinitionFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SQLResourcesDeleteSQLRoleDefinitionFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *SQLResourcesDeleteSQLRoleDefinitionFuture) Result(client SQLResourcesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesDeleteSQLRoleDefinitionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("documentdb.SQLResourcesDeleteSQLRoleDefinitionFuture") + return + } + ar.Response = future.Response() + return +} + // SQLResourcesDeleteSQLStoredProcedureFuture an abstraction for monitoring and retrieving the results of a // long-running operation. type SQLResourcesDeleteSQLStoredProcedureFuture struct { @@ -6848,8 +7073,8 @@ func (future *SQLResourcesDeleteSQLTriggerFuture) Result(client SQLResourcesClie return } -// SQLResourcesDeleteSQLUserDefinedFunctionFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. +// SQLResourcesDeleteSQLUserDefinedFunctionFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. type SQLResourcesDeleteSQLUserDefinedFunctionFuture struct { azure.Future } @@ -6871,8 +7096,8 @@ func (future *SQLResourcesDeleteSQLUserDefinedFunctionFuture) Result(client SQLR return } -// SQLResourcesUpdateSQLContainerThroughputFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. +// SQLResourcesUpdateSQLContainerThroughputFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. type SQLResourcesUpdateSQLContainerThroughputFuture struct { azure.Future } @@ -6900,8 +7125,8 @@ func (future *SQLResourcesUpdateSQLContainerThroughputFuture) Result(client SQLR return } -// SQLResourcesUpdateSQLDatabaseThroughputFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. +// SQLResourcesUpdateSQLDatabaseThroughputFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. type SQLResourcesUpdateSQLDatabaseThroughputFuture struct { azure.Future } @@ -6929,6 +7154,268 @@ func (future *SQLResourcesUpdateSQLDatabaseThroughputFuture) Result(client SQLRe return } +// SQLRoleAssignmentCreateUpdateParameters parameters to create and update an Azure Cosmos DB SQL Role +// Assignment. +type SQLRoleAssignmentCreateUpdateParameters struct { + // SQLRoleAssignmentResource - Properties to create and update an Azure Cosmos DB SQL Role Assignment. + *SQLRoleAssignmentResource `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLRoleAssignmentCreateUpdateParameters. +func (sracup SQLRoleAssignmentCreateUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sracup.SQLRoleAssignmentResource != nil { + objectMap["properties"] = sracup.SQLRoleAssignmentResource + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SQLRoleAssignmentCreateUpdateParameters struct. +func (sracup *SQLRoleAssignmentCreateUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var SQLRoleAssignmentResource SQLRoleAssignmentResource + err = json.Unmarshal(*v, &SQLRoleAssignmentResource) + if err != nil { + return err + } + sracup.SQLRoleAssignmentResource = &SQLRoleAssignmentResource + } + } + } + + return nil +} + +// SQLRoleAssignmentGetResults an Azure Cosmos DB Role Assignment +type SQLRoleAssignmentGetResults struct { + autorest.Response `json:"-"` + // SQLRoleAssignmentResource - Properties related to the Role Assignment. + *SQLRoleAssignmentResource `json:"properties,omitempty"` + // ID - READ-ONLY; The unique resource identifier of the database account. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the database account. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of Azure resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLRoleAssignmentGetResults. +func (sragr SQLRoleAssignmentGetResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sragr.SQLRoleAssignmentResource != nil { + objectMap["properties"] = sragr.SQLRoleAssignmentResource + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SQLRoleAssignmentGetResults struct. +func (sragr *SQLRoleAssignmentGetResults) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var SQLRoleAssignmentResource SQLRoleAssignmentResource + err = json.Unmarshal(*v, &SQLRoleAssignmentResource) + if err != nil { + return err + } + sragr.SQLRoleAssignmentResource = &SQLRoleAssignmentResource + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sragr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sragr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sragr.Type = &typeVar + } + } + } + + return nil +} + +// SQLRoleAssignmentListResult the relevant Role Assignments. +type SQLRoleAssignmentListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Role Assignments and their properties + Value *[]SQLRoleAssignmentGetResults `json:"value,omitempty"` +} + +// SQLRoleAssignmentResource azure Cosmos DB SQL Role Assignment resource object. +type SQLRoleAssignmentResource struct { + // RoleDefinitionID - The unique identifier for the associated Role Definition. + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // Scope - The data plane resource path for which access is being granted through this Role Assignment. + Scope *string `json:"scope,omitempty"` + // PrincipalID - The unique identifier for the associated AAD principal in the AAD graph to which access is being granted through this Role Assignment. Tenant ID for the principal is inferred using the tenant associated with the subscription. + PrincipalID *string `json:"principalId,omitempty"` +} + +// SQLRoleDefinitionCreateUpdateParameters parameters to create and update an Azure Cosmos DB SQL Role +// Definition. +type SQLRoleDefinitionCreateUpdateParameters struct { + // SQLRoleDefinitionResource - Properties to create and update an Azure Cosmos DB SQL Role Definition. + *SQLRoleDefinitionResource `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLRoleDefinitionCreateUpdateParameters. +func (srdcup SQLRoleDefinitionCreateUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if srdcup.SQLRoleDefinitionResource != nil { + objectMap["properties"] = srdcup.SQLRoleDefinitionResource + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SQLRoleDefinitionCreateUpdateParameters struct. +func (srdcup *SQLRoleDefinitionCreateUpdateParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var SQLRoleDefinitionResource SQLRoleDefinitionResource + err = json.Unmarshal(*v, &SQLRoleDefinitionResource) + if err != nil { + return err + } + srdcup.SQLRoleDefinitionResource = &SQLRoleDefinitionResource + } + } + } + + return nil +} + +// SQLRoleDefinitionGetResults an Azure Cosmos DB SQL Role Definition. +type SQLRoleDefinitionGetResults struct { + autorest.Response `json:"-"` + // SQLRoleDefinitionResource - Properties related to the Role Definition. + *SQLRoleDefinitionResource `json:"properties,omitempty"` + // ID - READ-ONLY; The unique resource identifier of the database account. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the database account. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of Azure resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLRoleDefinitionGetResults. +func (srdgr SQLRoleDefinitionGetResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if srdgr.SQLRoleDefinitionResource != nil { + objectMap["properties"] = srdgr.SQLRoleDefinitionResource + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SQLRoleDefinitionGetResults struct. +func (srdgr *SQLRoleDefinitionGetResults) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var SQLRoleDefinitionResource SQLRoleDefinitionResource + err = json.Unmarshal(*v, &SQLRoleDefinitionResource) + if err != nil { + return err + } + srdgr.SQLRoleDefinitionResource = &SQLRoleDefinitionResource + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + srdgr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + srdgr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + srdgr.Type = &typeVar + } + } + } + + return nil +} + +// SQLRoleDefinitionListResult the relevant Role Definitions. +type SQLRoleDefinitionListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Role Definitions and their properties. + Value *[]SQLRoleDefinitionGetResults `json:"value,omitempty"` +} + +// SQLRoleDefinitionResource azure Cosmos DB SQL Role Definition resource object. +type SQLRoleDefinitionResource struct { + // RoleName - A user-friendly name for the Role Definition. Must be unique for the database account. + RoleName *string `json:"roleName,omitempty"` + // Type - Indicates whether the Role Definition was built-in or user created. Possible values include: 'BuiltInRole', 'CustomRole' + Type RoleDefinitionType `json:"type,omitempty"` + // AssignableScopes - A set of fully qualified Scopes at or below which Role Assignments may be created using this Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Must have at least one element. Scopes higher than Database account are not enforceable as assignable Scopes. Note that resources referenced in assignable Scopes need not exist. + AssignableScopes *[]string `json:"assignableScopes,omitempty"` + // Permissions - The set of operations allowed through this Role Definition. + Permissions *[]Permission `json:"permissions,omitempty"` +} + // SQLStoredProcedureCreateUpdateParameters parameters to create and update Cosmos DB storedProcedure. type SQLStoredProcedureCreateUpdateParameters struct { // SQLStoredProcedureCreateUpdateProperties - Properties to create and update Azure Cosmos DB storedProcedure. @@ -7041,7 +7528,8 @@ func (sspcup *SQLStoredProcedureCreateUpdateParameters) UnmarshalJSON(body []byt return nil } -// SQLStoredProcedureCreateUpdateProperties properties to create and update Azure Cosmos DB storedProcedure. +// SQLStoredProcedureCreateUpdateProperties properties to create and update Azure Cosmos DB +// storedProcedure. type SQLStoredProcedureCreateUpdateProperties struct { // Resource - The standard JSON format of a storedProcedure Resource *SQLStoredProcedureResource `json:"resource,omitempty"` @@ -7502,7 +7990,8 @@ type SQLTriggerResource struct { TriggerOperation TriggerOperation `json:"triggerOperation,omitempty"` } -// SQLUserDefinedFunctionCreateUpdateParameters parameters to create and update Cosmos DB userDefinedFunction. +// SQLUserDefinedFunctionCreateUpdateParameters parameters to create and update Cosmos DB +// userDefinedFunction. type SQLUserDefinedFunctionCreateUpdateParameters struct { // SQLUserDefinedFunctionCreateUpdateProperties - Properties to create and update Azure Cosmos DB userDefinedFunction. *SQLUserDefinedFunctionCreateUpdateProperties `json:"properties,omitempty"` @@ -8109,8 +8598,8 @@ func (future *TableResourcesCreateUpdateTableFuture) Result(client TableResource return } -// TableResourcesDeleteTableFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. +// TableResourcesDeleteTableFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. type TableResourcesDeleteTableFuture struct { azure.Future } @@ -8460,17 +8949,18 @@ type ThroughputSettingsUpdateProperties struct { Resource *ThroughputSettingsResource `json:"resource,omitempty"` } -// TrackedResource the resource model definition for a ARM tracked top level resource +// 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 - 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. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty"` } @@ -8486,15 +8976,15 @@ func (tr TrackedResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UniqueKey the unique key on that enforces uniqueness constraint on documents in the collection in the Azure -// Cosmos DB service. +// UniqueKey the unique key on that enforces uniqueness constraint on documents in the collection in the +// Azure Cosmos DB service. type UniqueKey struct { // Paths - List of paths must be unique for each document in the Azure Cosmos DB service Paths *[]string `json:"paths,omitempty"` } -// UniqueKeyPolicy the unique key policy configuration for specifying uniqueness constraints on documents in -// the collection in the Azure Cosmos DB service. +// UniqueKeyPolicy the unique key policy configuration for specifying uniqueness constraints on documents +// in the collection in the Azure Cosmos DB service. type UniqueKeyPolicy struct { // UniqueKeys - List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. UniqueKeys *[]UniqueKey `json:"uniqueKeys,omitempty"` diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/mongodbresources.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/mongodbresources.go index d55b78f3fc50..987616f21663 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/mongodbresources.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/mongodbresources.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// MongoDBResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API +// MongoDBResourcesClient is the client for the MongoDBResources methods of the Documentdb service. type MongoDBResourcesClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/notebookworkspaces.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/notebookworkspaces.go index c3b4eaf11e6e..c46178549a81 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/notebookworkspaces.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/notebookworkspaces.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// NotebookWorkspacesClient is the azure Cosmos DB Database Service Resource Provider REST API +// NotebookWorkspacesClient is the client for the NotebookWorkspaces methods of the Documentdb service. type NotebookWorkspacesClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/operations.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/operations.go index e5c58c1760e9..263e5437e84a 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/operations.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/operations.go @@ -25,7 +25,7 @@ import ( "net/http" ) -// OperationsClient is the azure Cosmos DB Database Service Resource Provider REST API +// OperationsClient is the client for the Operations methods of the Documentdb service. type OperationsClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/partitionkeyrangeid.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/partitionkeyrangeid.go index 275e4da06783..0252fea11731 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/partitionkeyrangeid.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/partitionkeyrangeid.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// PartitionKeyRangeIDClient is the azure Cosmos DB Database Service Resource Provider REST API +// PartitionKeyRangeIDClient is the client for the PartitionKeyRangeID methods of the Documentdb service. type PartitionKeyRangeIDClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/partitionkeyrangeidregion.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/partitionkeyrangeidregion.go index e81b232abd75..a01649eeece4 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/partitionkeyrangeidregion.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/partitionkeyrangeidregion.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// PartitionKeyRangeIDRegionClient is the azure Cosmos DB Database Service Resource Provider REST API +// PartitionKeyRangeIDRegionClient is the client for the PartitionKeyRangeIDRegion methods of the Documentdb service. type PartitionKeyRangeIDRegionClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentile.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentile.go index 9cb644e5cd83..d0a37f06dbc4 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentile.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentile.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// PercentileClient is the azure Cosmos DB Database Service Resource Provider REST API +// PercentileClient is the client for the Percentile methods of the Documentdb service. type PercentileClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentilesourcetarget.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentilesourcetarget.go index 764979bb4c4e..8c78e13a26af 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentilesourcetarget.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentilesourcetarget.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// PercentileSourceTargetClient is the azure Cosmos DB Database Service Resource Provider REST API +// PercentileSourceTargetClient is the client for the PercentileSourceTarget methods of the Documentdb service. type PercentileSourceTargetClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentiletarget.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentiletarget.go index d2865c6d4558..b279efe640b0 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentiletarget.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/percentiletarget.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// PercentileTargetClient is the azure Cosmos DB Database Service Resource Provider REST API +// PercentileTargetClient is the client for the PercentileTarget methods of the Documentdb service. type PercentileTargetClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/privateendpointconnections.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/privateendpointconnections.go index e4646d97e623..03e3d0218317 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/privateendpointconnections.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/privateendpointconnections.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// PrivateEndpointConnectionsClient is the azure Cosmos DB Database Service Resource Provider REST API +// PrivateEndpointConnectionsClient is the client for the PrivateEndpointConnections methods of the Documentdb service. type PrivateEndpointConnectionsClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/privatelinkresources.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/privatelinkresources.go index 1d64a0c10774..38c39d8bbe04 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/privatelinkresources.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/privatelinkresources.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// PrivateLinkResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API +// PrivateLinkResourcesClient is the client for the PrivateLinkResources methods of the Documentdb service. type PrivateLinkResourcesClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorabledatabaseaccounts.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorabledatabaseaccounts.go index 250bfab9e03e..9dd543bae10b 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorabledatabaseaccounts.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/restorabledatabaseaccounts.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// RestorableDatabaseAccountsClient is the azure Cosmos DB Database Service Resource Provider REST API +// RestorableDatabaseAccountsClient is the client for the RestorableDatabaseAccounts methods of the Documentdb service. type RestorableDatabaseAccountsClient struct { BaseClient } diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/sqlresources.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/sqlresources.go index 726b51ebd61b..4e5e066830f0 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/sqlresources.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/sqlresources.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// SQLResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API +// SQLResourcesClient is the client for the SQLResources methods of the Documentdb service. type SQLResourcesClient struct { BaseClient } @@ -251,6 +251,194 @@ func (client SQLResourcesClient) CreateUpdateSQLDatabaseResponder(resp *http.Res return } +// CreateUpdateSQLRoleAssignment creates or updates an Azure Cosmos DB SQL Role Assignment. +// Parameters: +// roleAssignmentID - the GUID for the Role Assignment. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - cosmos DB database account name. +// createUpdateSQLRoleAssignmentParameters - the properties required to create or update a Role Assignment. +func (client SQLResourcesClient) CreateUpdateSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string, createUpdateSQLRoleAssignmentParameters SQLRoleAssignmentCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLRoleAssignmentFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLRoleAssignment") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {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}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { + return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLRoleAssignment", err.Error()) + } + + req, err := client.CreateUpdateSQLRoleAssignmentPreparer(ctx, roleAssignmentID, resourceGroupName, accountName, createUpdateSQLRoleAssignmentParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLRoleAssignment", nil, "Failure preparing request") + return + } + + result, err = client.CreateUpdateSQLRoleAssignmentSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLRoleAssignment", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateUpdateSQLRoleAssignmentPreparer prepares the CreateUpdateSQLRoleAssignment request. +func (client SQLResourcesClient) CreateUpdateSQLRoleAssignmentPreparer(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string, createUpdateSQLRoleAssignmentParameters SQLRoleAssignmentCreateUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleAssignmentId": autorest.Encode("path", roleAssignmentID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}", pathParameters), + autorest.WithJSON(createUpdateSQLRoleAssignmentParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateUpdateSQLRoleAssignmentSender sends the CreateUpdateSQLRoleAssignment request. The method will close the +// http.Response Body if it receives an error. +func (client SQLResourcesClient) CreateUpdateSQLRoleAssignmentSender(req *http.Request) (future SQLResourcesCreateUpdateSQLRoleAssignmentFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateUpdateSQLRoleAssignmentResponder handles the response to the CreateUpdateSQLRoleAssignment request. The method always +// closes the http.Response Body. +func (client SQLResourcesClient) CreateUpdateSQLRoleAssignmentResponder(resp *http.Response) (result SQLRoleAssignmentGetResults, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateUpdateSQLRoleDefinition creates or updates an Azure Cosmos DB SQL Role Definition. +// Parameters: +// roleDefinitionID - the GUID for the Role Definition. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - cosmos DB database account name. +// createUpdateSQLRoleDefinitionParameters - the properties required to create or update a Role Definition. +func (client SQLResourcesClient) CreateUpdateSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string, createUpdateSQLRoleDefinitionParameters SQLRoleDefinitionCreateUpdateParameters) (result SQLResourcesCreateUpdateSQLRoleDefinitionFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.CreateUpdateSQLRoleDefinition") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {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}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { + return result, validation.NewError("documentdb.SQLResourcesClient", "CreateUpdateSQLRoleDefinition", err.Error()) + } + + req, err := client.CreateUpdateSQLRoleDefinitionPreparer(ctx, roleDefinitionID, resourceGroupName, accountName, createUpdateSQLRoleDefinitionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLRoleDefinition", nil, "Failure preparing request") + return + } + + result, err = client.CreateUpdateSQLRoleDefinitionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "CreateUpdateSQLRoleDefinition", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateUpdateSQLRoleDefinitionPreparer prepares the CreateUpdateSQLRoleDefinition request. +func (client SQLResourcesClient) CreateUpdateSQLRoleDefinitionPreparer(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string, createUpdateSQLRoleDefinitionParameters SQLRoleDefinitionCreateUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleDefinitionId": autorest.Encode("path", roleDefinitionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}", pathParameters), + autorest.WithJSON(createUpdateSQLRoleDefinitionParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateUpdateSQLRoleDefinitionSender sends the CreateUpdateSQLRoleDefinition request. The method will close the +// http.Response Body if it receives an error. +func (client SQLResourcesClient) CreateUpdateSQLRoleDefinitionSender(req *http.Request) (future SQLResourcesCreateUpdateSQLRoleDefinitionFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateUpdateSQLRoleDefinitionResponder handles the response to the CreateUpdateSQLRoleDefinition request. The method always +// closes the http.Response Body. +func (client SQLResourcesClient) CreateUpdateSQLRoleDefinitionResponder(resp *http.Response) (result SQLRoleDefinitionGetResults, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // CreateUpdateSQLStoredProcedure create or update an Azure Cosmos DB SQL storedProcedure // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. @@ -746,6 +934,186 @@ func (client SQLResourcesClient) DeleteSQLDatabaseResponder(resp *http.Response) return } +// DeleteSQLRoleAssignment deletes an existing Azure Cosmos DB SQL Role Assignment. +// Parameters: +// roleAssignmentID - the GUID for the Role Assignment. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - cosmos DB database account name. +func (client SQLResourcesClient) DeleteSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (result SQLResourcesDeleteSQLRoleAssignmentFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLRoleAssignment") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {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}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { + return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLRoleAssignment", err.Error()) + } + + req, err := client.DeleteSQLRoleAssignmentPreparer(ctx, roleAssignmentID, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLRoleAssignment", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSQLRoleAssignmentSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLRoleAssignment", result.Response(), "Failure sending request") + return + } + + return +} + +// DeleteSQLRoleAssignmentPreparer prepares the DeleteSQLRoleAssignment request. +func (client SQLResourcesClient) DeleteSQLRoleAssignmentPreparer(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleAssignmentId": autorest.Encode("path", roleAssignmentID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSQLRoleAssignmentSender sends the DeleteSQLRoleAssignment request. The method will close the +// http.Response Body if it receives an error. +func (client SQLResourcesClient) DeleteSQLRoleAssignmentSender(req *http.Request) (future SQLResourcesDeleteSQLRoleAssignmentFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteSQLRoleAssignmentResponder handles the response to the DeleteSQLRoleAssignment request. The method always +// closes the http.Response Body. +func (client SQLResourcesClient) DeleteSQLRoleAssignmentResponder(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 +} + +// DeleteSQLRoleDefinition deletes an existing Azure Cosmos DB SQL Role Definition. +// Parameters: +// roleDefinitionID - the GUID for the Role Definition. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - cosmos DB database account name. +func (client SQLResourcesClient) DeleteSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (result SQLResourcesDeleteSQLRoleDefinitionFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.DeleteSQLRoleDefinition") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {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}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { + return result, validation.NewError("documentdb.SQLResourcesClient", "DeleteSQLRoleDefinition", err.Error()) + } + + req, err := client.DeleteSQLRoleDefinitionPreparer(ctx, roleDefinitionID, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLRoleDefinition", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSQLRoleDefinitionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "DeleteSQLRoleDefinition", result.Response(), "Failure sending request") + return + } + + return +} + +// DeleteSQLRoleDefinitionPreparer prepares the DeleteSQLRoleDefinition request. +func (client SQLResourcesClient) DeleteSQLRoleDefinitionPreparer(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleDefinitionId": autorest.Encode("path", roleDefinitionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSQLRoleDefinitionSender sends the DeleteSQLRoleDefinition request. The method will close the +// http.Response Body if it receives an error. +func (client SQLResourcesClient) DeleteSQLRoleDefinitionSender(req *http.Request) (future SQLResourcesDeleteSQLRoleDefinitionFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteSQLRoleDefinitionResponder handles the response to the DeleteSQLRoleDefinition request. The method always +// closes the http.Response Body. +func (client SQLResourcesClient) DeleteSQLRoleDefinitionResponder(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 +} + // DeleteSQLStoredProcedure deletes an existing Azure Cosmos DB SQL storedProcedure. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. @@ -1033,10 +1401,196 @@ func (client SQLResourcesClient) DeleteSQLUserDefinedFunctionResponder(resp *htt // resourceGroupName - the name of the resource group. The name is case insensitive. // accountName - cosmos DB database account name. // databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) GetSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLContainerGetResults, err error) { +// containerName - cosmos DB container name. +func (client SQLResourcesClient) GetSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result SQLContainerGetResults, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainer") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {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}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { + return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainer", err.Error()) + } + + req, err := client.GetSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", nil, "Failure preparing request") + return + } + + resp, err := client.GetSQLContainerSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure sending request") + return + } + + result, err = client.GetSQLContainerResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure responding to request") + } + + return +} + +// GetSQLContainerPreparer prepares the GetSQLContainer request. +func (client SQLResourcesClient) GetSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "containerName": autorest.Encode("path", containerName), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSQLContainerSender sends the GetSQLContainer request. The method will close the +// http.Response Body if it receives an error. +func (client SQLResourcesClient) GetSQLContainerSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSQLContainerResponder handles the response to the GetSQLContainer request. The method always +// closes the http.Response Body. +func (client SQLResourcesClient) GetSQLContainerResponder(resp *http.Response) (result SQLContainerGetResults, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSQLContainerThroughput gets the RUs per second of the SQL container under an existing Azure Cosmos DB database +// account. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - cosmos DB database account name. +// databaseName - cosmos DB database name. +// containerName - cosmos DB container name. +func (client SQLResourcesClient) GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result ThroughputSettingsGetResults, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainerThroughput") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {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}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { + return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainerThroughput", err.Error()) + } + + req, err := client.GetSQLContainerThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", nil, "Failure preparing request") + return + } + + resp, err := client.GetSQLContainerThroughputSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure sending request") + return + } + + result, err = client.GetSQLContainerThroughputResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure responding to request") + } + + return +} + +// GetSQLContainerThroughputPreparer prepares the GetSQLContainerThroughput request. +func (client SQLResourcesClient) GetSQLContainerThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "accountName": autorest.Encode("path", accountName), + "containerName": autorest.Encode("path", containerName), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSQLContainerThroughputSender sends the GetSQLContainerThroughput request. The method will close the +// http.Response Body if it receives an error. +func (client SQLResourcesClient) GetSQLContainerThroughputSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSQLContainerThroughputResponder handles the response to the GetSQLContainerThroughput request. The method always +// closes the http.Response Body. +func (client SQLResourcesClient) GetSQLContainerThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSQLDatabase gets the SQL database under an existing Azure Cosmos DB database account with the provided name. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - cosmos DB database account name. +// databaseName - cosmos DB database name. +func (client SQLResourcesClient) GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLDatabaseGetResults, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainer") + ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabase") defer func() { sc := -1 if result.Response.Response != nil { @@ -1056,35 +1610,34 @@ func (client SQLResourcesClient) GetSQLContainer(ctx context.Context, resourceGr Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainer", err.Error()) + return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabase", err.Error()) } - req, err := client.GetSQLContainerPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) + req, err := client.GetSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", nil, "Failure preparing request") return } - resp, err := client.GetSQLContainerSender(req) + resp, err := client.GetSQLDatabaseSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure sending request") return } - result, err = client.GetSQLContainerResponder(resp) + result, err = client.GetSQLDatabaseResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainer", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure responding to request") } return } -// GetSQLContainerPreparer prepares the GetSQLContainer request. -func (client SQLResourcesClient) GetSQLContainerPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { +// GetSQLDatabasePreparer prepares the GetSQLDatabase request. +func (client SQLResourcesClient) GetSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), "databaseName": autorest.Encode("path", databaseName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), @@ -1098,20 +1651,20 @@ func (client SQLResourcesClient) GetSQLContainerPreparer(ctx context.Context, re preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// GetSQLContainerSender sends the GetSQLContainer request. The method will close the +// GetSQLDatabaseSender sends the GetSQLDatabase request. The method will close the // http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLContainerSender(req *http.Request) (*http.Response, error) { +func (client SQLResourcesClient) GetSQLDatabaseSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } -// GetSQLContainerResponder handles the response to the GetSQLContainer request. The method always +// GetSQLDatabaseResponder handles the response to the GetSQLDatabase request. The method always // closes the http.Response Body. -func (client SQLResourcesClient) GetSQLContainerResponder(resp *http.Response) (result SQLContainerGetResults, err error) { +func (client SQLResourcesClient) GetSQLDatabaseResponder(resp *http.Response) (result SQLDatabaseGetResults, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -1121,16 +1674,15 @@ func (client SQLResourcesClient) GetSQLContainerResponder(resp *http.Response) ( return } -// GetSQLContainerThroughput gets the RUs per second of the SQL container under an existing Azure Cosmos DB database -// account. +// GetSQLDatabaseThroughput gets the RUs per second of the SQL database under an existing Azure Cosmos DB database +// account with the provided name. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. // accountName - cosmos DB database account name. // databaseName - cosmos DB database name. -// containerName - cosmos DB container name. -func (client SQLResourcesClient) GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (result ThroughputSettingsGetResults, err error) { +func (client SQLResourcesClient) GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLContainerThroughput") + ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabaseThroughput") defer func() { sc := -1 if result.Response.Response != nil { @@ -1150,35 +1702,34 @@ func (client SQLResourcesClient) GetSQLContainerThroughput(ctx context.Context, Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLContainerThroughput", err.Error()) + return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", err.Error()) } - req, err := client.GetSQLContainerThroughputPreparer(ctx, resourceGroupName, accountName, databaseName, containerName) + req, err := client.GetSQLDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", nil, "Failure preparing request") return } - resp, err := client.GetSQLContainerThroughputSender(req) + resp, err := client.GetSQLDatabaseThroughputSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure sending request") return } - result, err = client.GetSQLContainerThroughputResponder(resp) + result, err = client.GetSQLDatabaseThroughputResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLContainerThroughput", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure responding to request") } return } -// GetSQLContainerThroughputPreparer prepares the GetSQLContainerThroughput request. -func (client SQLResourcesClient) GetSQLContainerThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string) (*http.Request, error) { +// GetSQLDatabaseThroughputPreparer prepares the GetSQLDatabaseThroughput request. +func (client SQLResourcesClient) GetSQLDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), - "containerName": autorest.Encode("path", containerName), "databaseName": autorest.Encode("path", databaseName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), @@ -1192,20 +1743,20 @@ func (client SQLResourcesClient) GetSQLContainerThroughputPreparer(ctx context.C preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// GetSQLContainerThroughputSender sends the GetSQLContainerThroughput request. The method will close the +// GetSQLDatabaseThroughputSender sends the GetSQLDatabaseThroughput request. The method will close the // http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLContainerThroughputSender(req *http.Request) (*http.Response, error) { +func (client SQLResourcesClient) GetSQLDatabaseThroughputSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } -// GetSQLContainerThroughputResponder handles the response to the GetSQLContainerThroughput request. The method always +// GetSQLDatabaseThroughputResponder handles the response to the GetSQLDatabaseThroughput request. The method always // closes the http.Response Body. -func (client SQLResourcesClient) GetSQLContainerThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { +func (client SQLResourcesClient) GetSQLDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -1215,14 +1766,14 @@ func (client SQLResourcesClient) GetSQLContainerThroughputResponder(resp *http.R return } -// GetSQLDatabase gets the SQL database under an existing Azure Cosmos DB database account with the provided name. +// GetSQLRoleAssignment retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. // Parameters: +// roleAssignmentID - the GUID for the Role Assignment. // resourceGroupName - the name of the resource group. The name is case insensitive. // accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result SQLDatabaseGetResults, err error) { +func (client SQLResourcesClient) GetSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (result SQLRoleAssignmentGetResults, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabase") + ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLRoleAssignment") defer func() { sc := -1 if result.Response.Response != nil { @@ -1242,36 +1793,36 @@ func (client SQLResourcesClient) GetSQLDatabase(ctx context.Context, resourceGro Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabase", err.Error()) + return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLRoleAssignment", err.Error()) } - req, err := client.GetSQLDatabasePreparer(ctx, resourceGroupName, accountName, databaseName) + req, err := client.GetSQLRoleAssignmentPreparer(ctx, roleAssignmentID, resourceGroupName, accountName) if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleAssignment", nil, "Failure preparing request") return } - resp, err := client.GetSQLDatabaseSender(req) + resp, err := client.GetSQLRoleAssignmentSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleAssignment", resp, "Failure sending request") return } - result, err = client.GetSQLDatabaseResponder(resp) + result, err = client.GetSQLRoleAssignmentResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabase", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleAssignment", resp, "Failure responding to request") } return } -// GetSQLDatabasePreparer prepares the GetSQLDatabase request. -func (client SQLResourcesClient) GetSQLDatabasePreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { +// GetSQLRoleAssignmentPreparer prepares the GetSQLRoleAssignment request. +func (client SQLResourcesClient) GetSQLRoleAssignmentPreparer(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleAssignmentId": autorest.Encode("path", roleAssignmentID), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -1283,20 +1834,20 @@ func (client SQLResourcesClient) GetSQLDatabasePreparer(ctx context.Context, res preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// GetSQLDatabaseSender sends the GetSQLDatabase request. The method will close the +// GetSQLRoleAssignmentSender sends the GetSQLRoleAssignment request. The method will close the // http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLDatabaseSender(req *http.Request) (*http.Response, error) { +func (client SQLResourcesClient) GetSQLRoleAssignmentSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } -// GetSQLDatabaseResponder handles the response to the GetSQLDatabase request. The method always +// GetSQLRoleAssignmentResponder handles the response to the GetSQLRoleAssignment request. The method always // closes the http.Response Body. -func (client SQLResourcesClient) GetSQLDatabaseResponder(resp *http.Response) (result SQLDatabaseGetResults, err error) { +func (client SQLResourcesClient) GetSQLRoleAssignmentResponder(resp *http.Response) (result SQLRoleAssignmentGetResults, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -1306,15 +1857,14 @@ func (client SQLResourcesClient) GetSQLDatabaseResponder(resp *http.Response) (r return } -// GetSQLDatabaseThroughput gets the RUs per second of the SQL database under an existing Azure Cosmos DB database -// account with the provided name. +// GetSQLRoleDefinition retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. // Parameters: +// roleDefinitionID - the GUID for the Role Definition. // resourceGroupName - the name of the resource group. The name is case insensitive. // accountName - cosmos DB database account name. -// databaseName - cosmos DB database name. -func (client SQLResourcesClient) GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (result ThroughputSettingsGetResults, err error) { +func (client SQLResourcesClient) GetSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (result SQLRoleDefinitionGetResults, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLDatabaseThroughput") + ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.GetSQLRoleDefinition") defer func() { sc := -1 if result.Response.Response != nil { @@ -1334,36 +1884,36 @@ func (client SQLResourcesClient) GetSQLDatabaseThroughput(ctx context.Context, r Constraints: []validation.Constraint{{Target: "accountName", Name: validation.MaxLength, Rule: 50, Chain: nil}, {Target: "accountName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { - return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", err.Error()) + return result, validation.NewError("documentdb.SQLResourcesClient", "GetSQLRoleDefinition", err.Error()) } - req, err := client.GetSQLDatabaseThroughputPreparer(ctx, resourceGroupName, accountName, databaseName) + req, err := client.GetSQLRoleDefinitionPreparer(ctx, roleDefinitionID, resourceGroupName, accountName) if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleDefinition", nil, "Failure preparing request") return } - resp, err := client.GetSQLDatabaseThroughputSender(req) + resp, err := client.GetSQLRoleDefinitionSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleDefinition", resp, "Failure sending request") return } - result, err = client.GetSQLDatabaseThroughputResponder(resp) + result, err = client.GetSQLRoleDefinitionResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLDatabaseThroughput", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "GetSQLRoleDefinition", resp, "Failure responding to request") } return } -// GetSQLDatabaseThroughputPreparer prepares the GetSQLDatabaseThroughput request. -func (client SQLResourcesClient) GetSQLDatabaseThroughputPreparer(ctx context.Context, resourceGroupName string, accountName string, databaseName string) (*http.Request, error) { +// GetSQLRoleDefinitionPreparer prepares the GetSQLRoleDefinition request. +func (client SQLResourcesClient) GetSQLRoleDefinitionPreparer(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "accountName": autorest.Encode("path", accountName), - "databaseName": autorest.Encode("path", databaseName), "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleDefinitionId": autorest.Encode("path", roleDefinitionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -1375,20 +1925,20 @@ func (client SQLResourcesClient) GetSQLDatabaseThroughputPreparer(ctx context.Co preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// GetSQLDatabaseThroughputSender sends the GetSQLDatabaseThroughput request. The method will close the +// GetSQLRoleDefinitionSender sends the GetSQLRoleDefinition request. The method will close the // http.Response Body if it receives an error. -func (client SQLResourcesClient) GetSQLDatabaseThroughputSender(req *http.Request) (*http.Response, error) { +func (client SQLResourcesClient) GetSQLRoleDefinitionSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } -// GetSQLDatabaseThroughputResponder handles the response to the GetSQLDatabaseThroughput request. The method always +// GetSQLRoleDefinitionResponder handles the response to the GetSQLRoleDefinition request. The method always // closes the http.Response Body. -func (client SQLResourcesClient) GetSQLDatabaseThroughputResponder(resp *http.Response) (result ThroughputSettingsGetResults, err error) { +func (client SQLResourcesClient) GetSQLRoleDefinitionResponder(resp *http.Response) (result SQLRoleDefinitionGetResults, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -1863,6 +2413,184 @@ func (client SQLResourcesClient) ListSQLDatabasesResponder(resp *http.Response) return } +// ListSQLRoleAssignments retrieves the list of all Azure Cosmos DB SQL Role Assignments. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - cosmos DB database account name. +func (client SQLResourcesClient) ListSQLRoleAssignments(ctx context.Context, resourceGroupName string, accountName string) (result SQLRoleAssignmentListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLRoleAssignments") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {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}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { + return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLRoleAssignments", err.Error()) + } + + req, err := client.ListSQLRoleAssignmentsPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleAssignments", nil, "Failure preparing request") + return + } + + resp, err := client.ListSQLRoleAssignmentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleAssignments", resp, "Failure sending request") + return + } + + result, err = client.ListSQLRoleAssignmentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleAssignments", resp, "Failure responding to request") + } + + return +} + +// ListSQLRoleAssignmentsPreparer prepares the ListSQLRoleAssignments request. +func (client SQLResourcesClient) ListSQLRoleAssignmentsPreparer(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 = "2020-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSQLRoleAssignmentsSender sends the ListSQLRoleAssignments request. The method will close the +// http.Response Body if it receives an error. +func (client SQLResourcesClient) ListSQLRoleAssignmentsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSQLRoleAssignmentsResponder handles the response to the ListSQLRoleAssignments request. The method always +// closes the http.Response Body. +func (client SQLResourcesClient) ListSQLRoleAssignmentsResponder(resp *http.Response) (result SQLRoleAssignmentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSQLRoleDefinitions retrieves the list of all Azure Cosmos DB SQL Role Definitions. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// accountName - cosmos DB database account name. +func (client SQLResourcesClient) ListSQLRoleDefinitions(ctx context.Context, resourceGroupName string, accountName string) (result SQLRoleDefinitionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SQLResourcesClient.ListSQLRoleDefinitions") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {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}, + {Target: "accountName", Name: validation.Pattern, Rule: `^[a-z0-9]+(-[a-z0-9]+)*`, Chain: nil}}}}); err != nil { + return result, validation.NewError("documentdb.SQLResourcesClient", "ListSQLRoleDefinitions", err.Error()) + } + + req, err := client.ListSQLRoleDefinitionsPreparer(ctx, resourceGroupName, accountName) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleDefinitions", nil, "Failure preparing request") + return + } + + resp, err := client.ListSQLRoleDefinitionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleDefinitions", resp, "Failure sending request") + return + } + + result, err = client.ListSQLRoleDefinitionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "documentdb.SQLResourcesClient", "ListSQLRoleDefinitions", resp, "Failure responding to request") + } + + return +} + +// ListSQLRoleDefinitionsPreparer prepares the ListSQLRoleDefinitions request. +func (client SQLResourcesClient) ListSQLRoleDefinitionsPreparer(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 = "2020-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSQLRoleDefinitionsSender sends the ListSQLRoleDefinitions request. The method will close the +// http.Response Body if it receives an error. +func (client SQLResourcesClient) ListSQLRoleDefinitionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSQLRoleDefinitionsResponder handles the response to the ListSQLRoleDefinitions request. The method always +// closes the http.Response Body. +func (client SQLResourcesClient) ListSQLRoleDefinitionsResponder(resp *http.Response) (result SQLRoleDefinitionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // ListSQLStoredProcedures lists the SQL storedProcedure under an existing Azure Cosmos DB database account. // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. diff --git a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/tableresources.go b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/tableresources.go index c672d83dd0cb..8b879a2115b8 100644 --- a/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/tableresources.go +++ b/services/preview/cosmos-db/mgmt/2020-06-01-preview/documentdb/tableresources.go @@ -26,7 +26,7 @@ import ( "net/http" ) -// TableResourcesClient is the azure Cosmos DB Database Service Resource Provider REST API +// TableResourcesClient is the client for the TableResources methods of the Documentdb service. type TableResourcesClient struct { BaseClient }