diff --git a/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md b/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md index 4db1e7ddec2d..86f2ebf85a63 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md +++ b/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md @@ -1,5 +1,232 @@ # Release History +## 4.0.0-beta.1 (2024-09-09) +### Breaking Changes + +- Field `Readwrite` of struct `CommandPostBody` has been removed + +### Features Added + +- Type of `CommandPostBody.Arguments` has been changed from `map[string]*string` to `any` +- New value `ServerVersionSeven0` added to enum type `ServerVersion` +- New value `StatusCanceled`, `StatusFailed`, `StatusSucceeded`, `StatusUpdating` added to enum type `Status` +- New enum type `AccessRuleDirection` with values `AccessRuleDirectionInbound`, `AccessRuleDirectionOutbound` +- New enum type `AutoReplicate` with values `AutoReplicateAllKeyspaces`, `AutoReplicateNone`, `AutoReplicateSystemKeyspaces` +- New enum type `BackupState` with values `BackupStateFailed`, `BackupStateInProgress`, `BackupStateInitiated`, `BackupStateSucceeded` +- New enum type `CapacityMode` with values `CapacityModeNone`, `CapacityModeProvisioned`, `CapacityModeServerless` +- New enum type `CapacityModeTransitionStatus` with values `CapacityModeTransitionStatusCompleted`, `CapacityModeTransitionStatusFailed`, `CapacityModeTransitionStatusInProgress`, `CapacityModeTransitionStatusInitialized`, `CapacityModeTransitionStatusInvalid` +- New enum type `ClusterType` with values `ClusterTypeNonProduction`, `ClusterTypeProduction` +- New enum type `CommandStatus` with values `CommandStatusDone`, `CommandStatusEnqueue`, `CommandStatusFailed`, `CommandStatusFinished`, `CommandStatusProcessing`, `CommandStatusRunning` +- New enum type `DataTransferComponent` with values `DataTransferComponentAzureBlobStorage`, `DataTransferComponentCosmosDBCassandra`, `DataTransferComponentCosmosDBMongo`, `DataTransferComponentCosmosDBMongoVCore`, `DataTransferComponentCosmosDBSQL` +- New enum type `DataTransferJobMode` with values `DataTransferJobModeOffline`, `DataTransferJobModeOnline` +- New enum type `DefaultPriorityLevel` with values `DefaultPriorityLevelHigh`, `DefaultPriorityLevelLow` +- New enum type `EnableFullTextQuery` with values `EnableFullTextQueryFalse`, `EnableFullTextQueryNone`, `EnableFullTextQueryTrue` +- New enum type `IssueType` with values `IssueTypeConfigurationPropagationFailure`, `IssueTypeMissingIdentityConfiguration`, `IssueTypeMissingPerimeterConfiguration`, `IssueTypeUnknown` +- New enum type `NetworkSecurityPerimeterConfigurationProvisioningState` with values `NetworkSecurityPerimeterConfigurationProvisioningStateAccepted`, `NetworkSecurityPerimeterConfigurationProvisioningStateCanceled`, `NetworkSecurityPerimeterConfigurationProvisioningStateCreating`, `NetworkSecurityPerimeterConfigurationProvisioningStateDeleting`, `NetworkSecurityPerimeterConfigurationProvisioningStateFailed`, `NetworkSecurityPerimeterConfigurationProvisioningStateSucceeded`, `NetworkSecurityPerimeterConfigurationProvisioningStateUpdating` +- New enum type `ResourceAssociationAccessMode` with values `ResourceAssociationAccessModeAudit`, `ResourceAssociationAccessModeEnforced`, `ResourceAssociationAccessModeLearning` +- New enum type `ScheduledEventStrategy` with values `ScheduledEventStrategyIgnore`, `ScheduledEventStrategyStopAny`, `ScheduledEventStrategyStopByRack` +- New enum type `Severity` with values `SeverityError`, `SeverityWarning` +- New enum type `SupportedActions` with values `SupportedActionsDisable`, `SupportedActionsEnable` +- New enum type `ThroughputPolicyType` with values `ThroughputPolicyTypeCustom`, `ThroughputPolicyTypeEqual`, `ThroughputPolicyTypeNone` +- New function `*AzureBlobDataTransferDataSourceSink.GetDataTransferDataSourceSink() *DataTransferDataSourceSink` +- New function `*BaseCosmosDataTransferDataSourceSink.GetBaseCosmosDataTransferDataSourceSink() *BaseCosmosDataTransferDataSourceSink` +- New function `*BaseCosmosDataTransferDataSourceSink.GetDataTransferDataSourceSink() *DataTransferDataSourceSink` +- New function `*CassandraClustersClient.GetBackup(context.Context, string, string, string, *CassandraClustersClientGetBackupOptions) (CassandraClustersClientGetBackupResponse, error)` +- New function `*CassandraClustersClient.GetCommandAsync(context.Context, string, string, string, *CassandraClustersClientGetCommandAsyncOptions) (CassandraClustersClientGetCommandAsyncResponse, error)` +- New function `*CassandraClustersClient.BeginInvokeCommandAsync(context.Context, string, string, CommandPostBody, *CassandraClustersClientBeginInvokeCommandAsyncOptions) (*runtime.Poller[CassandraClustersClientInvokeCommandAsyncResponse], error)` +- New function `*CassandraClustersClient.NewListBackupsPager(string, string, *CassandraClustersClientListBackupsOptions) *runtime.Pager[CassandraClustersClientListBackupsResponse]` +- New function `*CassandraClustersClient.NewListCommandPager(string, string, *CassandraClustersClientListCommandOptions) *runtime.Pager[CassandraClustersClientListCommandResponse]` +- New function `*CassandraDataTransferDataSourceSink.GetBaseCosmosDataTransferDataSourceSink() *BaseCosmosDataTransferDataSourceSink` +- New function `*CassandraDataTransferDataSourceSink.GetDataTransferDataSourceSink() *DataTransferDataSourceSink` +- New function `*CassandraResourcesClient.BeginCreateUpdateCassandraView(context.Context, string, string, string, string, CassandraViewCreateUpdateParameters, *CassandraResourcesClientBeginCreateUpdateCassandraViewOptions) (*runtime.Poller[CassandraResourcesClientCreateUpdateCassandraViewResponse], error)` +- New function `*CassandraResourcesClient.BeginDeleteCassandraView(context.Context, string, string, string, string, *CassandraResourcesClientBeginDeleteCassandraViewOptions) (*runtime.Poller[CassandraResourcesClientDeleteCassandraViewResponse], error)` +- New function `*CassandraResourcesClient.GetCassandraView(context.Context, string, string, string, string, *CassandraResourcesClientGetCassandraViewOptions) (CassandraResourcesClientGetCassandraViewResponse, error)` +- New function `*CassandraResourcesClient.GetCassandraViewThroughput(context.Context, string, string, string, string, *CassandraResourcesClientGetCassandraViewThroughputOptions) (CassandraResourcesClientGetCassandraViewThroughputResponse, error)` +- New function `*CassandraResourcesClient.NewListCassandraViewsPager(string, string, string, *CassandraResourcesClientListCassandraViewsOptions) *runtime.Pager[CassandraResourcesClientListCassandraViewsResponse]` +- New function `*CassandraResourcesClient.BeginMigrateCassandraViewToAutoscale(context.Context, string, string, string, string, *CassandraResourcesClientBeginMigrateCassandraViewToAutoscaleOptions) (*runtime.Poller[CassandraResourcesClientMigrateCassandraViewToAutoscaleResponse], error)` +- New function `*CassandraResourcesClient.BeginMigrateCassandraViewToManualThroughput(context.Context, string, string, string, string, *CassandraResourcesClientBeginMigrateCassandraViewToManualThroughputOptions) (*runtime.Poller[CassandraResourcesClientMigrateCassandraViewToManualThroughputResponse], error)` +- New function `*CassandraResourcesClient.BeginUpdateCassandraViewThroughput(context.Context, string, string, string, string, ThroughputSettingsUpdateParameters, *CassandraResourcesClientBeginUpdateCassandraViewThroughputOptions) (*runtime.Poller[CassandraResourcesClientUpdateCassandraViewThroughputResponse], error)` +- New function `NewChaosFaultClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ChaosFaultClient, error)` +- New function `*ChaosFaultClient.BeginEnableDisable(context.Context, string, string, string, ChaosFaultResource, *ChaosFaultClientBeginEnableDisableOptions) (*runtime.Poller[ChaosFaultClientEnableDisableResponse], error)` +- New function `*ChaosFaultClient.Get(context.Context, string, string, string, *ChaosFaultClientGetOptions) (ChaosFaultClientGetResponse, error)` +- New function `*ChaosFaultClient.NewListPager(string, string, *ChaosFaultClientListOptions) *runtime.Pager[ChaosFaultClientListResponse]` +- New function `*ClientFactory.NewChaosFaultClient() *ChaosFaultClient` +- New function `*ClientFactory.NewDataTransferJobsClient() *DataTransferJobsClient` +- New function `*ClientFactory.NewGraphResourcesClient() *GraphResourcesClient` +- New function `*ClientFactory.NewNetworkSecurityPerimeterConfigurationsClient() *NetworkSecurityPerimeterConfigurationsClient` +- New function `*ClientFactory.NewThroughputPoolAccountClient() *ThroughputPoolAccountClient` +- New function `*ClientFactory.NewThroughputPoolAccountsClient() *ThroughputPoolAccountsClient` +- New function `*ClientFactory.NewThroughputPoolClient() *ThroughputPoolClient` +- New function `*ClientFactory.NewThroughputPoolsClient() *ThroughputPoolsClient` +- New function `*DataTransferDataSourceSink.GetDataTransferDataSourceSink() *DataTransferDataSourceSink` +- New function `NewDataTransferJobsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DataTransferJobsClient, error)` +- New function `*DataTransferJobsClient.Cancel(context.Context, string, string, string, *DataTransferJobsClientCancelOptions) (DataTransferJobsClientCancelResponse, error)` +- New function `*DataTransferJobsClient.Complete(context.Context, string, string, string, *DataTransferJobsClientCompleteOptions) (DataTransferJobsClientCompleteResponse, error)` +- New function `*DataTransferJobsClient.Create(context.Context, string, string, string, CreateJobRequest, *DataTransferJobsClientCreateOptions) (DataTransferJobsClientCreateResponse, error)` +- New function `*DataTransferJobsClient.Get(context.Context, string, string, string, *DataTransferJobsClientGetOptions) (DataTransferJobsClientGetResponse, error)` +- New function `*DataTransferJobsClient.NewListByDatabaseAccountPager(string, string, *DataTransferJobsClientListByDatabaseAccountOptions) *runtime.Pager[DataTransferJobsClientListByDatabaseAccountResponse]` +- New function `*DataTransferJobsClient.Pause(context.Context, string, string, string, *DataTransferJobsClientPauseOptions) (DataTransferJobsClientPauseResponse, error)` +- New function `*DataTransferJobsClient.Resume(context.Context, string, string, string, *DataTransferJobsClientResumeOptions) (DataTransferJobsClientResumeResponse, error)` +- New function `NewGraphResourcesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*GraphResourcesClient, error)` +- New function `*GraphResourcesClient.BeginCreateUpdateGraph(context.Context, string, string, string, GraphResourceCreateUpdateParameters, *GraphResourcesClientBeginCreateUpdateGraphOptions) (*runtime.Poller[GraphResourcesClientCreateUpdateGraphResponse], error)` +- New function `*GraphResourcesClient.BeginDeleteGraphResource(context.Context, string, string, string, *GraphResourcesClientBeginDeleteGraphResourceOptions) (*runtime.Poller[GraphResourcesClientDeleteGraphResourceResponse], error)` +- New function `*GraphResourcesClient.GetGraph(context.Context, string, string, string, *GraphResourcesClientGetGraphOptions) (GraphResourcesClientGetGraphResponse, error)` +- New function `*GraphResourcesClient.NewListGraphsPager(string, string, *GraphResourcesClientListGraphsOptions) *runtime.Pager[GraphResourcesClientListGraphsResponse]` +- New function `*MongoDBResourcesClient.BeginListMongoDBCollectionPartitionMerge(context.Context, string, string, string, string, MergeParameters, *MongoDBResourcesClientBeginListMongoDBCollectionPartitionMergeOptions) (*runtime.Poller[MongoDBResourcesClientListMongoDBCollectionPartitionMergeResponse], error)` +- New function `*MongoDBResourcesClient.BeginMongoDBContainerRedistributeThroughput(context.Context, string, string, string, string, RedistributeThroughputParameters, *MongoDBResourcesClientBeginMongoDBContainerRedistributeThroughputOptions) (*runtime.Poller[MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse], error)` +- New function `*MongoDBResourcesClient.BeginMongoDBContainerRetrieveThroughputDistribution(context.Context, string, string, string, string, RetrieveThroughputParameters, *MongoDBResourcesClientBeginMongoDBContainerRetrieveThroughputDistributionOptions) (*runtime.Poller[MongoDBResourcesClientMongoDBContainerRetrieveThroughputDistributionResponse], error)` +- New function `*MongoDBResourcesClient.BeginMongoDBDatabasePartitionMerge(context.Context, string, string, string, MergeParameters, *MongoDBResourcesClientBeginMongoDBDatabasePartitionMergeOptions) (*runtime.Poller[MongoDBResourcesClientMongoDBDatabasePartitionMergeResponse], error)` +- New function `*MongoDBResourcesClient.BeginMongoDBDatabaseRedistributeThroughput(context.Context, string, string, string, RedistributeThroughputParameters, *MongoDBResourcesClientBeginMongoDBDatabaseRedistributeThroughputOptions) (*runtime.Poller[MongoDBResourcesClientMongoDBDatabaseRedistributeThroughputResponse], error)` +- New function `*MongoDBResourcesClient.BeginMongoDBDatabaseRetrieveThroughputDistribution(context.Context, string, string, string, RetrieveThroughputParameters, *MongoDBResourcesClientBeginMongoDBDatabaseRetrieveThroughputDistributionOptions) (*runtime.Poller[MongoDBResourcesClientMongoDBDatabaseRetrieveThroughputDistributionResponse], error)` +- New function `*MongoDataTransferDataSourceSink.GetBaseCosmosDataTransferDataSourceSink() *BaseCosmosDataTransferDataSourceSink` +- New function `*MongoDataTransferDataSourceSink.GetDataTransferDataSourceSink() *DataTransferDataSourceSink` +- New function `*MongoVCoreDataTransferDataSourceSink.GetDataTransferDataSourceSink() *DataTransferDataSourceSink` +- New function `*SQLDataTransferDataSourceSink.GetBaseCosmosDataTransferDataSourceSink() *BaseCosmosDataTransferDataSourceSink` +- New function `*SQLDataTransferDataSourceSink.GetDataTransferDataSourceSink() *DataTransferDataSourceSink` +- New function `*SQLResourcesClient.BeginListSQLContainerPartitionMerge(context.Context, string, string, string, string, MergeParameters, *SQLResourcesClientBeginListSQLContainerPartitionMergeOptions) (*runtime.Poller[SQLResourcesClientListSQLContainerPartitionMergeResponse], error)` +- New function `*SQLResourcesClient.BeginSQLContainerRedistributeThroughput(context.Context, string, string, string, string, RedistributeThroughputParameters, *SQLResourcesClientBeginSQLContainerRedistributeThroughputOptions) (*runtime.Poller[SQLResourcesClientSQLContainerRedistributeThroughputResponse], error)` +- New function `*SQLResourcesClient.BeginSQLContainerRetrieveThroughputDistribution(context.Context, string, string, string, string, RetrieveThroughputParameters, *SQLResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions) (*runtime.Poller[SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse], error)` +- New function `*SQLResourcesClient.BeginSQLDatabasePartitionMerge(context.Context, string, string, string, MergeParameters, *SQLResourcesClientBeginSQLDatabasePartitionMergeOptions) (*runtime.Poller[SQLResourcesClientSQLDatabasePartitionMergeResponse], error)` +- New function `*SQLResourcesClient.BeginSQLDatabaseRedistributeThroughput(context.Context, string, string, string, RedistributeThroughputParameters, *SQLResourcesClientBeginSQLDatabaseRedistributeThroughputOptions) (*runtime.Poller[SQLResourcesClientSQLDatabaseRedistributeThroughputResponse], error)` +- New function `*SQLResourcesClient.BeginSQLDatabaseRetrieveThroughputDistribution(context.Context, string, string, string, RetrieveThroughputParameters, *SQLResourcesClientBeginSQLDatabaseRetrieveThroughputDistributionOptions) (*runtime.Poller[SQLResourcesClientSQLDatabaseRetrieveThroughputDistributionResponse], error)` +- New function `NewThroughputPoolAccountClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ThroughputPoolAccountClient, error)` +- New function `*ThroughputPoolAccountClient.BeginCreate(context.Context, string, string, string, ThroughputPoolAccountResource, *ThroughputPoolAccountClientBeginCreateOptions) (*runtime.Poller[ThroughputPoolAccountClientCreateResponse], error)` +- New function `*ThroughputPoolAccountClient.BeginDelete(context.Context, string, string, string, *ThroughputPoolAccountClientBeginDeleteOptions) (*runtime.Poller[ThroughputPoolAccountClientDeleteResponse], error)` +- New function `*ThroughputPoolAccountClient.Get(context.Context, string, string, string, *ThroughputPoolAccountClientGetOptions) (ThroughputPoolAccountClientGetResponse, error)` +- New function `NewThroughputPoolAccountsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ThroughputPoolAccountsClient, error)` +- New function `*ThroughputPoolAccountsClient.NewListPager(string, string, *ThroughputPoolAccountsClientListOptions) *runtime.Pager[ThroughputPoolAccountsClientListResponse]` +- New function `NewThroughputPoolClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ThroughputPoolClient, error)` +- New function `*ThroughputPoolClient.BeginCreateOrUpdate(context.Context, string, string, ThroughputPoolResource, *ThroughputPoolClientBeginCreateOrUpdateOptions) (*runtime.Poller[ThroughputPoolClientCreateOrUpdateResponse], error)` +- New function `*ThroughputPoolClient.BeginDelete(context.Context, string, string, *ThroughputPoolClientBeginDeleteOptions) (*runtime.Poller[ThroughputPoolClientDeleteResponse], error)` +- New function `*ThroughputPoolClient.Get(context.Context, string, string, *ThroughputPoolClientGetOptions) (ThroughputPoolClientGetResponse, error)` +- New function `*ThroughputPoolClient.BeginUpdate(context.Context, string, string, *ThroughputPoolClientBeginUpdateOptions) (*runtime.Poller[ThroughputPoolClientUpdateResponse], error)` +- New function `NewThroughputPoolsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ThroughputPoolsClient, error)` +- New function `*ThroughputPoolsClient.NewListByResourceGroupPager(string, *ThroughputPoolsClientListByResourceGroupOptions) *runtime.Pager[ThroughputPoolsClientListByResourceGroupResponse]` +- New function `*ThroughputPoolsClient.NewListPager(*ThroughputPoolsClientListOptions) *runtime.Pager[ThroughputPoolsClientListResponse]` +- New function `NewNetworkSecurityPerimeterConfigurationsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*NetworkSecurityPerimeterConfigurationsClient, error)` +- New function `*NetworkSecurityPerimeterConfigurationsClient.Get(context.Context, string, string, string, *NetworkSecurityPerimeterConfigurationsClientGetOptions) (NetworkSecurityPerimeterConfigurationsClientGetResponse, error)` +- New function `*NetworkSecurityPerimeterConfigurationsClient.NewListPager(string, string, *NetworkSecurityPerimeterConfigurationsClientListOptions) *runtime.Pager[NetworkSecurityPerimeterConfigurationsClientListResponse]` +- New function `*NetworkSecurityPerimeterConfigurationsClient.BeginReconcile(context.Context, string, string, string, *NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions) (*runtime.Poller[NetworkSecurityPerimeterConfigurationsClientReconcileResponse], error)` +- New struct `AccessRule` +- New struct `AccessRuleProperties` +- New struct `AccessRulePropertiesSubscriptionsItem` +- New struct `AzureBlobDataTransferDataSourceSink` +- New struct `BackupResource` +- New struct `BackupSchedule` +- New struct `CapacityModeChangeTransitionState` +- New struct `CassandraDataTransferDataSourceSink` +- New struct `CassandraViewCreateUpdateParameters` +- New struct `CassandraViewCreateUpdateProperties` +- New struct `CassandraViewGetProperties` +- New struct `CassandraViewGetPropertiesOptions` +- New struct `CassandraViewGetPropertiesResource` +- New struct `CassandraViewGetResults` +- New struct `CassandraViewListResult` +- New struct `CassandraViewResource` +- New struct `ChaosFaultListResponse` +- New struct `ChaosFaultProperties` +- New struct `ChaosFaultResource` +- New struct `CommandPublicResource` +- New struct `CreateJobRequest` +- New struct `DataTransferJobFeedResults` +- New struct `DataTransferJobGetResults` +- New struct `DataTransferJobProperties` +- New struct `DiagnosticLogSettings` +- New struct `ErrorAdditionalInfo` +- New struct `ErrorDetail` +- New struct `ErrorResponseAutoGenerated` +- New struct `GraphResource` +- New struct `GraphResourceCreateUpdateParameters` +- New struct `GraphResourceCreateUpdateProperties` +- New struct `GraphResourceGetProperties` +- New struct `GraphResourceGetPropertiesOptions` +- New struct `GraphResourceGetPropertiesResource` +- New struct `GraphResourceGetResults` +- New struct `GraphResourcesListResult` +- New struct `ListBackups` +- New struct `ListCommands` +- New struct `MaterializedViewDefinition` +- New struct `MergeParameters` +- New struct `MongoDataTransferDataSourceSink` +- New struct `MongoVCoreDataTransferDataSourceSink` +- New struct `NetworkSecurityPerimeter` +- New struct `NetworkSecurityPerimeterConfiguration` +- New struct `NetworkSecurityPerimeterConfigurationListResult` +- New struct `NetworkSecurityPerimeterConfigurationProperties` +- New struct `NetworkSecurityProfile` +- New struct `PhysicalPartitionID` +- New struct `PhysicalPartitionStorageInfo` +- New struct `PhysicalPartitionStorageInfoCollection` +- New struct `PhysicalPartitionThroughputInfoProperties` +- New struct `PhysicalPartitionThroughputInfoResource` +- New struct `PhysicalPartitionThroughputInfoResult` +- New struct `PhysicalPartitionThroughputInfoResultProperties` +- New struct `PhysicalPartitionThroughputInfoResultPropertiesResource` +- New struct `ProvisioningIssue` +- New struct `ProvisioningIssueProperties` +- New struct `RedistributeThroughputParameters` +- New struct `RedistributeThroughputProperties` +- New struct `RedistributeThroughputPropertiesResource` +- New struct `ResourceAssociation` +- New struct `RetrieveThroughputParameters` +- New struct `RetrieveThroughputProperties` +- New struct `RetrieveThroughputPropertiesResource` +- New struct `SQLDataTransferDataSourceSink` +- New struct `ThroughputPoolAccountCreateParameters` +- New struct `ThroughputPoolAccountCreateProperties` +- New struct `ThroughputPoolAccountProperties` +- New struct `ThroughputPoolAccountResource` +- New struct `ThroughputPoolAccountsListResult` +- New struct `ThroughputPoolProperties` +- New struct `ThroughputPoolResource` +- New struct `ThroughputPoolUpdate` +- New struct `ThroughputPoolsListResult` +- New struct `TrackedResource` +- New field `Identity` in struct `ARMResourceProperties` +- New field `XMSForceDeallocate` in struct `CassandraClustersClientBeginDeallocateOptions` +- New field `Identity` in struct `CassandraKeyspaceCreateUpdateParameters` +- New field `Identity` in struct `CassandraKeyspaceGetResults` +- New field `Identity` in struct `CassandraTableCreateUpdateParameters` +- New field `Identity` in struct `CassandraTableGetResults` +- New field `AutoReplicate`, `BackupSchedules`, `ClusterType`, `Extensions`, `ExternalDataCenters`, `ScheduledEventStrategy` in struct `ClusterResourceProperties` +- New field `ReadWrite` in struct `CommandPostBody` +- New field `IsLatestModel` in struct `ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems` +- New field `CapacityMode`, `DefaultPriorityLevel`, `DiagnosticLogSettings`, `EnableMaterializedViews`, `EnablePerRegionPerPartitionAutoscale`, `EnablePriorityBasedExecution` in struct `DatabaseAccountCreateUpdateProperties` +- New field `CapacityMode`, `CapacityModeChangeTransitionState`, `DefaultPriorityLevel`, `DiagnosticLogSettings`, `EnableMaterializedViews`, `EnablePerRegionPerPartitionAutoscale`, `EnablePriorityBasedExecution` in struct `DatabaseAccountGetProperties` +- New field `CapacityMode`, `DefaultPriorityLevel`, `DiagnosticLogSettings`, `EnableMaterializedViews`, `EnablePerRegionPerPartitionAutoscale`, `EnablePriorityBasedExecution` in struct `DatabaseAccountUpdateProperties` +- New field `Identity` in struct `GremlinDatabaseCreateUpdateParameters` +- New field `Identity` in struct `GremlinDatabaseGetResults` +- New field `Identity` in struct `GremlinGraphCreateUpdateParameters` +- New field `Identity` in struct `GremlinGraphGetResults` +- New field `Identity` in struct `MongoDBCollectionCreateUpdateParameters` +- New field `Identity` in struct `MongoDBCollectionGetResults` +- New field `Identity` in struct `MongoDBDatabaseCreateUpdateParameters` +- New field `Identity` in struct `MongoDBDatabaseGetResults` +- New field `SystemData` in struct `PrivateEndpointConnection` +- New field `SystemData` in struct `ProxyResource` +- New field `SystemData` in struct `Resource` +- New field `RestoreWithTTLDisabled` in struct `ResourceRestoreParameters` +- New field `MaterializedViewDefinition` in struct `RestorableSQLContainerPropertiesResourceContainer` +- New field `RestoreWithTTLDisabled`, `SourceBackupLocation` in struct `RestoreParameters` +- New field `RestoreWithTTLDisabled` in struct `RestoreParametersBase` +- New field `Identity` in struct `SQLContainerCreateUpdateParameters` +- New field `MaterializedViewDefinition` in struct `SQLContainerGetPropertiesResource` +- New field `Identity` in struct `SQLContainerGetResults` +- New field `MaterializedViewDefinition` in struct `SQLContainerResource` +- New field `Identity` in struct `SQLDatabaseCreateUpdateParameters` +- New field `Identity` in struct `SQLDatabaseGetResults` +- New field `Identity` in struct `SQLStoredProcedureCreateUpdateParameters` +- New field `Identity` in struct `SQLStoredProcedureGetResults` +- New field `Identity` in struct `SQLTriggerCreateUpdateParameters` +- New field `Identity` in struct `SQLTriggerGetResults` +- New field `Identity` in struct `SQLUserDefinedFunctionCreateUpdateParameters` +- New field `Identity` in struct `SQLUserDefinedFunctionGetResults` +- New field `Identity` in struct `TableCreateUpdateParameters` +- New field `Identity` in struct `TableGetResults` +- New field `Identity` in struct `ThroughputSettingsGetResults` +- New field `Identity` in struct `ThroughputSettingsUpdateParameters` + + ## 3.0.0 (2024-06-21) ### Breaking Changes diff --git a/sdk/resourcemanager/cosmos/armcosmos/README.md b/sdk/resourcemanager/cosmos/armcosmos/README.md index a89c0a2a69f2..b2ea49e9a605 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/README.md +++ b/sdk/resourcemanager/cosmos/armcosmos/README.md @@ -1,6 +1,6 @@ # Azure Cosmos DB Module for Go -[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3) +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4) The `armcosmos` module provides operations for working with Azure Cosmos DB. @@ -20,7 +20,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Cosmos DB module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3 +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4 ``` ## Authorization diff --git a/sdk/resourcemanager/cosmos/armcosmos/autorest.md b/sdk/resourcemanager/cosmos/armcosmos/autorest.md index 42476ad964e5..4d6f873eb0c1 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/autorest.md +++ b/sdk/resourcemanager/cosmos/armcosmos/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/cosmos-db/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 3.0.0 -tag: package-2024-05 +module-version: 4.0.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/cosmos/armcosmos/cassandraclusters_client.go b/sdk/resourcemanager/cosmos/armcosmos/cassandraclusters_client.go index 30f4ae9f2ce6..efa02554c0b8 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/cassandraclusters_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/cassandraclusters_client.go @@ -47,7 +47,7 @@ func NewCassandraClustersClient(subscriptionID string, credential azcore.TokenCr // To update only some properties, use PATCH. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - Managed Cassandra cluster name. // - body - The properties specifying the desired state of the managed Cassandra cluster. @@ -74,7 +74,7 @@ func (client *CassandraClustersClient) BeginCreateUpdate(ctx context.Context, re // update only some properties, use PATCH. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraClustersClient) createUpdate(ctx context.Context, resourceGroupName string, clusterName string, body ClusterResource, options *CassandraClustersClientBeginCreateUpdateOptions) (*http.Response, error) { var err error const operationName = "CassandraClustersClient.BeginCreateUpdate" @@ -116,7 +116,7 @@ func (client *CassandraClustersClient) createUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -130,7 +130,7 @@ func (client *CassandraClustersClient) createUpdateCreateRequest(ctx context.Con // already deallocated cluster. Use Start to restart the cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - Managed Cassandra cluster name. // - options - CassandraClustersClientBeginDeallocateOptions contains the optional parameters for the CassandraClustersClient.BeginDeallocate @@ -157,7 +157,7 @@ func (client *CassandraClustersClient) BeginDeallocate(ctx context.Context, reso // already deallocated cluster. Use Start to restart the cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraClustersClient) deallocate(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersClientBeginDeallocateOptions) (*http.Response, error) { var err error const operationName = "CassandraClustersClient.BeginDeallocate" @@ -199,16 +199,19 @@ func (client *CassandraClustersClient) deallocateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.XMSForceDeallocate != nil { + req.Raw().Header["x-ms-force-deallocate"] = []string{*options.XMSForceDeallocate} + } return req, nil } // BeginDelete - Deletes a managed Cassandra cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - Managed Cassandra cluster name. // - options - CassandraClustersClientBeginDeleteOptions contains the optional parameters for the CassandraClustersClient.BeginDelete @@ -233,7 +236,7 @@ func (client *CassandraClustersClient) BeginDelete(ctx context.Context, resource // Delete - Deletes a managed Cassandra cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CassandraClustersClient.BeginDelete" @@ -275,7 +278,7 @@ func (client *CassandraClustersClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -284,7 +287,7 @@ func (client *CassandraClustersClient) deleteCreateRequest(ctx context.Context, // Get - Get the properties of a managed Cassandra cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - Managed Cassandra cluster name. // - options - CassandraClustersClientGetOptions contains the optional parameters for the CassandraClustersClient.Get method. @@ -330,7 +333,7 @@ func (client *CassandraClustersClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -345,10 +348,150 @@ func (client *CassandraClustersClient) getHandleResponse(resp *http.Response) (C return result, nil } +// GetBackup - Get the properties of an individual backup of this cluster that is available to restore. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - Managed Cassandra cluster name. +// - backupID - Id of a restorable backup of a Cassandra cluster. +// - options - CassandraClustersClientGetBackupOptions contains the optional parameters for the CassandraClustersClient.GetBackup +// method. +func (client *CassandraClustersClient) GetBackup(ctx context.Context, resourceGroupName string, clusterName string, backupID string, options *CassandraClustersClientGetBackupOptions) (CassandraClustersClientGetBackupResponse, error) { + var err error + const operationName = "CassandraClustersClient.GetBackup" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getBackupCreateRequest(ctx, resourceGroupName, clusterName, backupID, options) + if err != nil { + return CassandraClustersClientGetBackupResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CassandraClustersClientGetBackupResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CassandraClustersClientGetBackupResponse{}, err + } + resp, err := client.getBackupHandleResponse(httpResp) + return resp, err +} + +// getBackupCreateRequest creates the GetBackup request. +func (client *CassandraClustersClient) getBackupCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, backupID string, options *CassandraClustersClientGetBackupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if backupID == "" { + return nil, errors.New("parameter backupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupId}", url.PathEscape(backupID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getBackupHandleResponse handles the GetBackup response. +func (client *CassandraClustersClient) getBackupHandleResponse(resp *http.Response) (CassandraClustersClientGetBackupResponse, error) { + result := CassandraClustersClientGetBackupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BackupResource); err != nil { + return CassandraClustersClientGetBackupResponse{}, err + } + return result, nil +} + +// GetCommandAsync - Get details about a specified command that was run asynchronously. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - Managed Cassandra cluster name. +// - commandID - Managed Cassandra cluster command id. +// - options - CassandraClustersClientGetCommandAsyncOptions contains the optional parameters for the CassandraClustersClient.GetCommandAsync +// method. +func (client *CassandraClustersClient) GetCommandAsync(ctx context.Context, resourceGroupName string, clusterName string, commandID string, options *CassandraClustersClientGetCommandAsyncOptions) (CassandraClustersClientGetCommandAsyncResponse, error) { + var err error + const operationName = "CassandraClustersClient.GetCommandAsync" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCommandAsyncCreateRequest(ctx, resourceGroupName, clusterName, commandID, options) + if err != nil { + return CassandraClustersClientGetCommandAsyncResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CassandraClustersClientGetCommandAsyncResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CassandraClustersClientGetCommandAsyncResponse{}, err + } + resp, err := client.getCommandAsyncHandleResponse(httpResp) + return resp, err +} + +// getCommandAsyncCreateRequest creates the GetCommandAsync request. +func (client *CassandraClustersClient) getCommandAsyncCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, commandID string, options *CassandraClustersClientGetCommandAsyncOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/commands/{commandId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if commandID == "" { + return nil, errors.New("parameter commandID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{commandId}", url.PathEscape(commandID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getCommandAsyncHandleResponse handles the GetCommandAsync response. +func (client *CassandraClustersClient) getCommandAsyncHandleResponse(resp *http.Response) (CassandraClustersClientGetCommandAsyncResponse, error) { + result := CassandraClustersClientGetCommandAsyncResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListCommands); err != nil { + return CassandraClustersClientGetCommandAsyncResponse{}, err + } + return result, nil +} + // BeginInvokeCommand - Invoke a command like nodetool for cassandra maintenance // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - Managed Cassandra cluster name. // - body - Specification which command to run where @@ -374,7 +517,7 @@ func (client *CassandraClustersClient) BeginInvokeCommand(ctx context.Context, r // InvokeCommand - Invoke a command like nodetool for cassandra maintenance // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraClustersClient) invokeCommand(ctx context.Context, resourceGroupName string, clusterName string, body CommandPostBody, options *CassandraClustersClientBeginInvokeCommandOptions) (*http.Response, error) { var err error const operationName = "CassandraClustersClient.BeginInvokeCommand" @@ -416,7 +559,7 @@ func (client *CassandraClustersClient) invokeCommandCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -425,9 +568,155 @@ func (client *CassandraClustersClient) invokeCommandCreateRequest(ctx context.Co return req, nil } +// BeginInvokeCommandAsync - Invoke a command like nodetool for cassandra maintenance asynchronously +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - Managed Cassandra cluster name. +// - body - Specification which command to run where +// - options - CassandraClustersClientBeginInvokeCommandAsyncOptions contains the optional parameters for the CassandraClustersClient.BeginInvokeCommandAsync +// method. +func (client *CassandraClustersClient) BeginInvokeCommandAsync(ctx context.Context, resourceGroupName string, clusterName string, body CommandPostBody, options *CassandraClustersClientBeginInvokeCommandAsyncOptions) (*runtime.Poller[CassandraClustersClientInvokeCommandAsyncResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.invokeCommandAsync(ctx, resourceGroupName, clusterName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CassandraClustersClientInvokeCommandAsyncResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CassandraClustersClientInvokeCommandAsyncResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// InvokeCommandAsync - Invoke a command like nodetool for cassandra maintenance asynchronously +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *CassandraClustersClient) invokeCommandAsync(ctx context.Context, resourceGroupName string, clusterName string, body CommandPostBody, options *CassandraClustersClientBeginInvokeCommandAsyncOptions) (*http.Response, error) { + var err error + const operationName = "CassandraClustersClient.BeginInvokeCommandAsync" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.invokeCommandAsyncCreateRequest(ctx, resourceGroupName, clusterName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// invokeCommandAsyncCreateRequest creates the InvokeCommandAsync request. +func (client *CassandraClustersClient) invokeCommandAsyncCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, body CommandPostBody, options *CassandraClustersClientBeginInvokeCommandAsyncOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/invokeCommandAsync" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// NewListBackupsPager - List the backups of this cluster that are available to restore. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - Managed Cassandra cluster name. +// - options - CassandraClustersClientListBackupsOptions contains the optional parameters for the CassandraClustersClient.NewListBackupsPager +// method. +func (client *CassandraClustersClient) NewListBackupsPager(resourceGroupName string, clusterName string, options *CassandraClustersClientListBackupsOptions) *runtime.Pager[CassandraClustersClientListBackupsResponse] { + return runtime.NewPager(runtime.PagingHandler[CassandraClustersClientListBackupsResponse]{ + More: func(page CassandraClustersClientListBackupsResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *CassandraClustersClientListBackupsResponse) (CassandraClustersClientListBackupsResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CassandraClustersClient.NewListBackupsPager") + req, err := client.listBackupsCreateRequest(ctx, resourceGroupName, clusterName, options) + if err != nil { + return CassandraClustersClientListBackupsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CassandraClustersClientListBackupsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CassandraClustersClientListBackupsResponse{}, runtime.NewResponseError(resp) + } + return client.listBackupsHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBackupsCreateRequest creates the ListBackups request. +func (client *CassandraClustersClient) listBackupsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersClientListBackupsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBackupsHandleResponse handles the ListBackups response. +func (client *CassandraClustersClient) listBackupsHandleResponse(resp *http.Response) (CassandraClustersClientListBackupsResponse, error) { + result := CassandraClustersClientListBackupsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListBackups); err != nil { + return CassandraClustersClientListBackupsResponse{}, err + } + return result, nil +} + // NewListByResourceGroupPager - List all managed Cassandra clusters in this resource group. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - CassandraClustersClientListByResourceGroupOptions contains the optional parameters for the CassandraClustersClient.NewListByResourceGroupPager // method. @@ -471,7 +760,7 @@ func (client *CassandraClustersClient) listByResourceGroupCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -488,7 +777,7 @@ func (client *CassandraClustersClient) listByResourceGroupHandleResponse(resp *h // NewListBySubscriptionPager - List all managed Cassandra clusters in this subscription. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - options - CassandraClustersClientListBySubscriptionOptions contains the optional parameters for the CassandraClustersClient.NewListBySubscriptionPager // method. func (client *CassandraClustersClient) NewListBySubscriptionPager(options *CassandraClustersClientListBySubscriptionOptions) *runtime.Pager[CassandraClustersClientListBySubscriptionResponse] { @@ -527,7 +816,7 @@ func (client *CassandraClustersClient) listBySubscriptionCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -542,12 +831,78 @@ func (client *CassandraClustersClient) listBySubscriptionHandleResponse(resp *ht return result, nil } +// NewListCommandPager - List all commands currently running on ring info +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - Managed Cassandra cluster name. +// - options - CassandraClustersClientListCommandOptions contains the optional parameters for the CassandraClustersClient.NewListCommandPager +// method. +func (client *CassandraClustersClient) NewListCommandPager(resourceGroupName string, clusterName string, options *CassandraClustersClientListCommandOptions) *runtime.Pager[CassandraClustersClientListCommandResponse] { + return runtime.NewPager(runtime.PagingHandler[CassandraClustersClientListCommandResponse]{ + More: func(page CassandraClustersClientListCommandResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *CassandraClustersClientListCommandResponse) (CassandraClustersClientListCommandResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CassandraClustersClient.NewListCommandPager") + req, err := client.listCommandCreateRequest(ctx, resourceGroupName, clusterName, options) + if err != nil { + return CassandraClustersClientListCommandResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CassandraClustersClientListCommandResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CassandraClustersClientListCommandResponse{}, runtime.NewResponseError(resp) + } + return client.listCommandHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCommandCreateRequest creates the ListCommand request. +func (client *CassandraClustersClient) listCommandCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersClientListCommandOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/commands" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listCommandHandleResponse handles the ListCommand response. +func (client *CassandraClustersClient) listCommandHandleResponse(resp *http.Response) (CassandraClustersClientListCommandResponse, error) { + result := CassandraClustersClientListCommandResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListCommands); err != nil { + return CassandraClustersClientListCommandResponse{}, err + } + return result, nil +} + // BeginStart - Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine // of this cluster with reserved data disk. This won't do anything on an already running // cluster. Use Deallocate to deallocate the cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - Managed Cassandra cluster name. // - options - CassandraClustersClientBeginStartOptions contains the optional parameters for the CassandraClustersClient.BeginStart @@ -574,7 +929,7 @@ func (client *CassandraClustersClient) BeginStart(ctx context.Context, resourceG // cluster. Use Deallocate to deallocate the cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraClustersClient) start(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "CassandraClustersClient.BeginStart" @@ -616,7 +971,7 @@ func (client *CassandraClustersClient) startCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -625,7 +980,7 @@ func (client *CassandraClustersClient) startCreateRequest(ctx context.Context, r // Status - Gets the CPU, memory, and disk usage statistics for each Cassandra node in a cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - Managed Cassandra cluster name. // - options - CassandraClustersClientStatusOptions contains the optional parameters for the CassandraClustersClient.Status @@ -672,7 +1027,7 @@ func (client *CassandraClustersClient) statusCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -690,7 +1045,7 @@ func (client *CassandraClustersClient) statusHandleResponse(resp *http.Response) // BeginUpdate - Updates some of the properties of a managed Cassandra cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - Managed Cassandra cluster name. // - body - Parameters to provide for specifying the managed Cassandra cluster. @@ -716,7 +1071,7 @@ func (client *CassandraClustersClient) BeginUpdate(ctx context.Context, resource // Update - Updates some of the properties of a managed Cassandra cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraClustersClient) update(ctx context.Context, resourceGroupName string, clusterName string, body ClusterResource, options *CassandraClustersClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "CassandraClustersClient.BeginUpdate" @@ -758,7 +1113,7 @@ func (client *CassandraClustersClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/cosmos/armcosmos/cassandraclusters_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/cassandraclusters_client_example_test.go deleted file mode 100644 index 095c9e99db18..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/cassandraclusters_client_example_test.go +++ /dev/null @@ -1,713 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBManagedCassandraClusterListBySubscription.json -func ExampleCassandraClustersClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCassandraClustersClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListClusters = armcosmos.ListClusters{ - // Value: []*armcosmos.ClusterResource{ - // { - // Name: to.Ptr("cassandra-prod"), - // Type: to.Ptr("Microsoft.DocumentDB/cassandraClusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DocumentDB/cassandraClusters"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ClusterResourceProperties{ - // AuthenticationMethod: to.Ptr(armcosmos.AuthenticationMethodCassandra), - // CassandraVersion: to.Ptr("3.11"), - // ClientCertificates: []*armcosmos.Certificate{ - // { - // Pem: to.Ptr("-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----"), - // }}, - // ClusterNameOverride: to.Ptr("ClusterNameIllegalForAzureResource"), - // DelegatedManagementSubnetID: to.Ptr("/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/management"), - // ExternalGossipCertificates: []*armcosmos.Certificate{ - // { - // Pem: to.Ptr("-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----"), - // }}, - // ExternalSeedNodes: []*armcosmos.SeedNode{ - // { - // IPAddress: to.Ptr("10.52.221.2"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.3"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.4"), - // }}, - // GossipCertificates: []*armcosmos.Certificate{ - // { - // Pem: to.Ptr("-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----"), - // }}, - // HoursBetweenBackups: to.Ptr[int32](24), - // ProvisioningState: to.Ptr(armcosmos.ManagedCassandraProvisioningStateSucceeded), - // SeedNodes: []*armcosmos.SeedNode{ - // { - // IPAddress: to.Ptr("10.52.221.2"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.3"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.4"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.2"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.3"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.4"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBManagedCassandraClusterListByResourceGroup.json -func ExampleCassandraClustersClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCassandraClustersClient().NewListByResourceGroupPager("cassandra-prod-rg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListClusters = armcosmos.ListClusters{ - // Value: []*armcosmos.ClusterResource{ - // { - // Name: to.Ptr("cassandra-prod"), - // Type: to.Ptr("Microsoft.DocumentDB/cassandraClusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cassandra-prod-rg/providers/Microsoft.DocumentDB/cassandraClusters"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ClusterResourceProperties{ - // AuthenticationMethod: to.Ptr(armcosmos.AuthenticationMethodCassandra), - // CassandraVersion: to.Ptr("3.11"), - // ClientCertificates: []*armcosmos.Certificate{ - // { - // Pem: to.Ptr("-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----"), - // }}, - // ClusterNameOverride: to.Ptr("ClusterNameIllegalForAzureResource"), - // DelegatedManagementSubnetID: to.Ptr("/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/management"), - // ExternalGossipCertificates: []*armcosmos.Certificate{ - // { - // Pem: to.Ptr("-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----"), - // }}, - // ExternalSeedNodes: []*armcosmos.SeedNode{ - // { - // IPAddress: to.Ptr("10.52.221.2"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.3"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.4"), - // }}, - // GossipCertificates: []*armcosmos.Certificate{ - // { - // Pem: to.Ptr("-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----"), - // }}, - // HoursBetweenBackups: to.Ptr[int32](24), - // ProvisioningState: to.Ptr(armcosmos.ManagedCassandraProvisioningStateSucceeded), - // SeedNodes: []*armcosmos.SeedNode{ - // { - // IPAddress: to.Ptr("10.52.221.2"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.3"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.4"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.2"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.3"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.4"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBManagedCassandraClusterGet.json -func ExampleCassandraClustersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCassandraClustersClient().Get(ctx, "cassandra-prod-rg", "cassandra-prod", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ClusterResource = armcosmos.ClusterResource{ - // Name: to.Ptr("cassandra-prod"), - // Type: to.Ptr("Microsoft.DocumentDB/cassandraClusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cassandra-prod-rg/providers/Microsoft.DocumentDB/cassandraClusters/cassandra-prod"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ClusterResourceProperties{ - // AuthenticationMethod: to.Ptr(armcosmos.AuthenticationMethodCassandra), - // CassandraVersion: to.Ptr("3.11"), - // ClientCertificates: []*armcosmos.Certificate{ - // { - // Pem: to.Ptr("-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----"), - // }}, - // ClusterNameOverride: to.Ptr("ClusterNameIllegalForAzureResource"), - // DelegatedManagementSubnetID: to.Ptr("/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/management"), - // ExternalGossipCertificates: []*armcosmos.Certificate{ - // { - // Pem: to.Ptr("-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----"), - // }}, - // ExternalSeedNodes: []*armcosmos.SeedNode{ - // { - // IPAddress: to.Ptr("10.52.221.2"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.3"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.4"), - // }}, - // GossipCertificates: []*armcosmos.Certificate{ - // { - // Pem: to.Ptr("-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----"), - // }}, - // HoursBetweenBackups: to.Ptr[int32](24), - // ProvisioningState: to.Ptr(armcosmos.ManagedCassandraProvisioningStateSucceeded), - // SeedNodes: []*armcosmos.SeedNode{ - // { - // IPAddress: to.Ptr("10.52.221.2"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.3"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.4"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.2"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.3"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.4"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBManagedCassandraClusterDelete.json -func ExampleCassandraClustersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraClustersClient().BeginDelete(ctx, "cassandra-prod-rg", "cassandra-prod", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBManagedCassandraClusterCreate.json -func ExampleCassandraClustersClient_BeginCreateUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraClustersClient().BeginCreateUpdate(ctx, "cassandra-prod-rg", "cassandra-prod", armcosmos.ClusterResource{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.ClusterResourceProperties{ - AuthenticationMethod: to.Ptr(armcosmos.AuthenticationMethodCassandra), - CassandraVersion: to.Ptr("3.11"), - ClientCertificates: []*armcosmos.Certificate{ - { - Pem: to.Ptr("-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----"), - }}, - ClusterNameOverride: to.Ptr("ClusterNameIllegalForAzureResource"), - DelegatedManagementSubnetID: to.Ptr("/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/management"), - ExternalGossipCertificates: []*armcosmos.Certificate{ - { - Pem: to.Ptr("-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----"), - }}, - ExternalSeedNodes: []*armcosmos.SeedNode{ - { - IPAddress: to.Ptr("10.52.221.2"), - }, - { - IPAddress: to.Ptr("10.52.221.3"), - }, - { - IPAddress: to.Ptr("10.52.221.4"), - }}, - HoursBetweenBackups: to.Ptr[int32](24), - InitialCassandraAdminPassword: to.Ptr("mypassword"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ClusterResource = armcosmos.ClusterResource{ - // Name: to.Ptr("cassandra-prod"), - // Type: to.Ptr("Microsoft.DocumentDB/cassandraClusters"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/cassandra-prod-rg/providers/Microsoft.DocumentDB/cassandraClusters/cassandra-prod"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ClusterResourceProperties{ - // AuthenticationMethod: to.Ptr(armcosmos.AuthenticationMethodCassandra), - // CassandraVersion: to.Ptr("3.11"), - // ClientCertificates: []*armcosmos.Certificate{ - // { - // Pem: to.Ptr("-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----"), - // }}, - // ClusterNameOverride: to.Ptr("ClusterNameIllegalForAzureResource"), - // DelegatedManagementSubnetID: to.Ptr("/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/management"), - // ExternalGossipCertificates: []*armcosmos.Certificate{ - // { - // Pem: to.Ptr("-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----"), - // }}, - // ExternalSeedNodes: []*armcosmos.SeedNode{ - // { - // IPAddress: to.Ptr("10.52.221.2"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.3"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.4"), - // }}, - // GossipCertificates: []*armcosmos.Certificate{ - // { - // Pem: to.Ptr("-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----"), - // }}, - // HoursBetweenBackups: to.Ptr[int32](24), - // ProvisioningState: to.Ptr(armcosmos.ManagedCassandraProvisioningStateSucceeded), - // SeedNodes: []*armcosmos.SeedNode{ - // { - // IPAddress: to.Ptr("10.52.221.2"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.3"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.4"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.2"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.3"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.4"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBManagedCassandraClusterPatch.json -func ExampleCassandraClustersClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraClustersClient().BeginUpdate(ctx, "cassandra-prod-rg", "cassandra-prod", armcosmos.ClusterResource{ - Tags: map[string]*string{ - "owner": to.Ptr("mike"), - }, - Properties: &armcosmos.ClusterResourceProperties{ - AuthenticationMethod: to.Ptr(armcosmos.AuthenticationMethodNone), - ExternalGossipCertificates: []*armcosmos.Certificate{ - { - Pem: to.Ptr("-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----"), - }}, - ExternalSeedNodes: []*armcosmos.SeedNode{ - { - IPAddress: to.Ptr("10.52.221.2"), - }, - { - IPAddress: to.Ptr("10.52.221.3"), - }, - { - IPAddress: to.Ptr("10.52.221.4"), - }}, - HoursBetweenBackups: to.Ptr[int32](12), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ClusterResource = armcosmos.ClusterResource{ - // Name: to.Ptr("cassandra-prod"), - // Type: to.Ptr("Microsoft.DocumentDB/cassandraClusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cassandra-prod-rg/providers/Microsoft.DocumentDB/cassandraClusters/cassandra-prod"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ClusterResourceProperties{ - // AuthenticationMethod: to.Ptr(armcosmos.AuthenticationMethodCassandra), - // CassandraVersion: to.Ptr("3.11"), - // ClientCertificates: []*armcosmos.Certificate{ - // { - // Pem: to.Ptr("-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----"), - // }}, - // ClusterNameOverride: to.Ptr("ClusterNameIllegalForAzureResource"), - // DelegatedManagementSubnetID: to.Ptr("/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/management"), - // ExternalGossipCertificates: []*armcosmos.Certificate{ - // { - // Pem: to.Ptr("-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----"), - // }}, - // ExternalSeedNodes: []*armcosmos.SeedNode{ - // { - // IPAddress: to.Ptr("10.52.221.2"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.3"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.4"), - // }}, - // GossipCertificates: []*armcosmos.Certificate{ - // { - // Pem: to.Ptr("-----BEGIN CERTIFICATE-----\n...Base64 encoded certificate...\n-----END CERTIFICATE-----"), - // }}, - // HoursBetweenBackups: to.Ptr[int32](24), - // ProvisioningState: to.Ptr(armcosmos.ManagedCassandraProvisioningStateSucceeded), - // SeedNodes: []*armcosmos.SeedNode{ - // { - // IPAddress: to.Ptr("10.52.221.2"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.3"), - // }, - // { - // IPAddress: to.Ptr("10.52.221.4"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.2"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.3"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.4"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBManagedCassandraCommand.json -func ExampleCassandraClustersClient_BeginInvokeCommand() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraClustersClient().BeginInvokeCommand(ctx, "cassandra-prod-rg", "cassandra-prod", armcosmos.CommandPostBody{ - Command: to.Ptr("nodetool status"), - Host: to.Ptr("10.0.1.12"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBManagedCassandraClusterDeallocate.json -func ExampleCassandraClustersClient_BeginDeallocate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraClustersClient().BeginDeallocate(ctx, "cassandra-prod-rg", "cassandra-prod", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBManagedCassandraClusterStart.json -func ExampleCassandraClustersClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraClustersClient().BeginStart(ctx, "cassandra-prod-rg", "cassandra-prod", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBManagedCassandraStatus.json -func ExampleCassandraClustersClient_Status() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCassandraClustersClient().Status(ctx, "cassandra-prod-rg", "cassandra-prod", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CassandraClusterPublicStatus = armcosmos.CassandraClusterPublicStatus{ - // ConnectionErrors: []*armcosmos.ConnectionError{ - // }, - // DataCenters: []*armcosmos.CassandraClusterPublicStatusDataCentersItem{ - // { - // Name: to.Ptr("cassandra-westus2-vmss"), - // Nodes: []*armcosmos.ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems{ - // { - // Address: to.Ptr("10.0.8.10"), - // CassandraProcessStatus: to.Ptr("Running"), - // CPUUsage: to.Ptr[float64](0.9), - // DiskFreeKB: to.Ptr[int64](1001260056), - // DiskUsedKB: to.Ptr[int64](749836), - // HostID: to.Ptr("8ccc00a7-9e22-4ac2-aa63-e5327aa0dc51"), - // Load: to.Ptr("84.61 MiB"), - // MemoryBuffersAndCachedKB: to.Ptr[int64](10817580), - // MemoryFreeKB: to.Ptr[int64](35731832), - // MemoryTotalKB: to.Ptr[int64](57610444), - // MemoryUsedKB: to.Ptr[int64](11061032), - // Rack: to.Ptr("rack1"), - // Size: to.Ptr[int32](16), - // State: to.Ptr(armcosmos.NodeStateNormal), - // Status: to.Ptr("Up"), - // Timestamp: to.Ptr("10/05/2021, 14:35:20.028"), - // Tokens: []*string{ - // to.Ptr("-7785254003841681178"), - // to.Ptr("-6756518164561476165"), - // to.Ptr("-4269720020504480060"), - // to.Ptr("-2697657908817852783"), - // to.Ptr("-2622387897201218249"), - // to.Ptr("-2177258200443022948"), - // to.Ptr("-129203941752875603"), - // to.Ptr("1738406920822650025"), - // to.Ptr("2598053056312400240"), - // to.Ptr("3227346424117996872"), - // to.Ptr("3644347038875498376"), - // to.Ptr("4823546474906050895"), - // to.Ptr("5293156680707616627"), - // to.Ptr("5485806686603256557"), - // to.Ptr("6250058817756969464"), - // to.Ptr("7991328665766267709")}, - // }, - // { - // Address: to.Ptr("10.0.8.11"), - // CassandraProcessStatus: to.Ptr("Running"), - // CPUUsage: to.Ptr[float64](1.2), - // DiskFreeKB: to.Ptr[int64](1001283028), - // DiskUsedKB: to.Ptr[int64](726864), - // HostID: to.Ptr("14092117-4f77-4ec0-8984-c5b860b88a47"), - // Load: to.Ptr("59.67 MiB"), - // MemoryBuffersAndCachedKB: to.Ptr[int64](10691520), - // MemoryFreeKB: to.Ptr[int64](35863248), - // MemoryTotalKB: to.Ptr[int64](57610444), - // MemoryUsedKB: to.Ptr[int64](11055676), - // Rack: to.Ptr("rack2"), - // Size: to.Ptr[int32](16), - // State: to.Ptr(armcosmos.NodeStateNormal), - // Status: to.Ptr("Up"), - // Timestamp: to.Ptr("10/05/2021, 14:35:20.028"), - // Tokens: []*string{ - // to.Ptr("-8726238055665903210"), - // to.Ptr("-6687985003871487470"), - // to.Ptr("-5269140854976433359"), - // to.Ptr("-3989177686905645288"), - // to.Ptr("-3957362495277148220"), - // to.Ptr("-2539287458896988944"), - // to.Ptr("-2460716365393303466"), - // to.Ptr("-1848370030729221440"), - // to.Ptr("137707733677015122"), - // to.Ptr("579467328507000597"), - // to.Ptr("1698264534774619627"), - // to.Ptr("1904235159942090722"), - // to.Ptr("3312208865519999146"), - // to.Ptr("4035940456270983993"), - // to.Ptr("4412314431151736777"), - // to.Ptr("8232565668795426078")}, - // }, - // { - // Address: to.Ptr("10.0.8.12"), - // CassandraProcessStatus: to.Ptr("Running"), - // CPUUsage: to.Ptr[float64](0.4), - // DiskFreeKB: to.Ptr[int64](1001252352), - // DiskUsedKB: to.Ptr[int64](757540), - // HostID: to.Ptr("e16ada14-39db-462b-9f9e-5b5f6beb8bbd"), - // Load: to.Ptr("93.2 MiB"), - // MemoryBuffersAndCachedKB: to.Ptr[int64](10453856), - // MemoryFreeKB: to.Ptr[int64](36104980), - // MemoryTotalKB: to.Ptr[int64](57610444), - // MemoryUsedKB: to.Ptr[int64](11051608), - // Rack: to.Ptr("rack3"), - // Size: to.Ptr[int32](16), - // State: to.Ptr(armcosmos.NodeStateNormal), - // Status: to.Ptr("Up"), - // Timestamp: to.Ptr("10/05/2021, 14:35:20.028"), - // Tokens: []*string{ - // to.Ptr("-5679481051867296621"), - // to.Ptr("-4574115287969297989"), - // to.Ptr("-3444578133211470522"), - // to.Ptr("-2755931580714972271"), - // to.Ptr("-2304431590844389550"), - // to.Ptr("-1961946736975068713"), - // to.Ptr("-940120277889446704"), - // to.Ptr("554469308917912318"), - // to.Ptr("1030447162050118004"), - // to.Ptr("2745632329542596589"), - // to.Ptr("4564547712926446283"), - // to.Ptr("5185613478135944116"), - // to.Ptr("7280237939830623824"), - // to.Ptr("7504213835759531710"), - // to.Ptr("7631994478195429959"), - // to.Ptr("8139769477321226157")}, - // }}, - // SeedNodes: []*string{ - // to.Ptr("10.0.8.10"), - // to.Ptr("10.0.8.11"), - // to.Ptr("10.0.8.12")}, - // }}, - // ETag: to.Ptr("A350A2CE7E91B6D5A102A5E5EC222B882D981092"), - // ReaperStatus: &armcosmos.ManagedCassandraReaperStatus{ - // Healthy: to.Ptr(true), - // RepairRunIDs: map[string]*string{ - // }, - // RepairSchedules: map[string]*string{ - // "00000000-0000-0001-0000-000000000000": to.Ptr("ACTIVE"), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/cassandradatacenters_client.go b/sdk/resourcemanager/cosmos/armcosmos/cassandradatacenters_client.go index 3e7afc241834..4c087bee546e 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/cassandradatacenters_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/cassandradatacenters_client.go @@ -47,7 +47,7 @@ func NewCassandraDataCentersClient(subscriptionID string, credential azcore.Toke // only some properties, use PATCH. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - Managed Cassandra cluster name. // - dataCenterName - Data center name in a managed Cassandra cluster. @@ -75,7 +75,7 @@ func (client *CassandraDataCentersClient) BeginCreateUpdate(ctx context.Context, // some properties, use PATCH. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraDataCentersClient) createUpdate(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string, body DataCenterResource, options *CassandraDataCentersClientBeginCreateUpdateOptions) (*http.Response, error) { var err error const operationName = "CassandraDataCentersClient.BeginCreateUpdate" @@ -121,7 +121,7 @@ func (client *CassandraDataCentersClient) createUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -133,7 +133,7 @@ func (client *CassandraDataCentersClient) createUpdateCreateRequest(ctx context. // BeginDelete - Delete a managed Cassandra data center. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - Managed Cassandra cluster name. // - dataCenterName - Data center name in a managed Cassandra cluster. @@ -159,7 +159,7 @@ func (client *CassandraDataCentersClient) BeginDelete(ctx context.Context, resou // Delete - Delete a managed Cassandra data center. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraDataCentersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string, options *CassandraDataCentersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CassandraDataCentersClient.BeginDelete" @@ -205,7 +205,7 @@ func (client *CassandraDataCentersClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +214,7 @@ func (client *CassandraDataCentersClient) deleteCreateRequest(ctx context.Contex // Get - Get the properties of a managed Cassandra data center. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - Managed Cassandra cluster name. // - dataCenterName - Data center name in a managed Cassandra cluster. @@ -266,7 +266,7 @@ func (client *CassandraDataCentersClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +283,7 @@ func (client *CassandraDataCentersClient) getHandleResponse(resp *http.Response) // NewListPager - List all data centers in a particular managed Cassandra cluster. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - Managed Cassandra cluster name. // - options - CassandraDataCentersClientListOptions contains the optional parameters for the CassandraDataCentersClient.NewListPager @@ -332,7 +332,7 @@ func (client *CassandraDataCentersClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -350,7 +350,7 @@ func (client *CassandraDataCentersClient) listHandleResponse(resp *http.Response // BeginUpdate - Update some of the properties of a managed Cassandra data center. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - Managed Cassandra cluster name. // - dataCenterName - Data center name in a managed Cassandra cluster. @@ -377,7 +377,7 @@ func (client *CassandraDataCentersClient) BeginUpdate(ctx context.Context, resou // Update - Update some of the properties of a managed Cassandra data center. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraDataCentersClient) update(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string, body DataCenterResource, options *CassandraDataCentersClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "CassandraDataCentersClient.BeginUpdate" @@ -423,7 +423,7 @@ func (client *CassandraDataCentersClient) updateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/cosmos/armcosmos/cassandradatacenters_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/cassandradatacenters_client_example_test.go deleted file mode 100644 index ae52b59b7da8..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/cassandradatacenters_client_example_test.go +++ /dev/null @@ -1,237 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBManagedCassandraDataCenterList.json -func ExampleCassandraDataCentersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCassandraDataCentersClient().NewListPager("cassandra-prod-rg", "cassandra-prod", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListDataCenters = armcosmos.ListDataCenters{ - // Value: []*armcosmos.DataCenterResource{ - // { - // Name: to.Ptr("dc1"), - // Type: to.Ptr("Microsoft.DocumentDB/cassandraClusters/dataCenters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cassandra-prod-rg/providers/Microsoft.DocumentDB/cassandraClusters/cassandra-prod/dataCenters"), - // Properties: &armcosmos.DataCenterResourceProperties{ - // Base64EncodedCassandraYamlFragment: to.Ptr("Y29tcGFjdGlvbl90aHJvdWdocHV0X21iX3Blcl9zZWM6IDMyCmNvbXBhY3Rpb25fbGFyZ2VfcGFydGl0aW9uX3dhcm5pbmdfdGhyZXNob2xkX21iOiAxMDA="), - // DataCenterLocation: to.Ptr("West US 2"), - // DelegatedSubnetID: to.Ptr("/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/dc1"), - // NodeCount: to.Ptr[int32](9), - // ProvisioningState: to.Ptr(armcosmos.ManagedCassandraProvisioningStateSucceeded), - // SeedNodes: []*armcosmos.SeedNode{ - // { - // IPAddress: to.Ptr("192.168.12.2"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.3"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.4"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBManagedCassandraDataCenterGet.json -func ExampleCassandraDataCentersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCassandraDataCentersClient().Get(ctx, "cassandra-prod-rg", "cassandra-prod", "dc1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCenterResource = armcosmos.DataCenterResource{ - // Name: to.Ptr("dc1"), - // Type: to.Ptr("Microsoft.DocumentDB/cassandraClusters/dataCenters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cassandra-prod-rg/providers/Microsoft.DocumentDB/cassandraClusters/cassandra-prod/dataCenters/dc1"), - // Properties: &armcosmos.DataCenterResourceProperties{ - // Base64EncodedCassandraYamlFragment: to.Ptr("Y29tcGFjdGlvbl90aHJvdWdocHV0X21iX3Blcl9zZWM6IDMyCmNvbXBhY3Rpb25fbGFyZ2VfcGFydGl0aW9uX3dhcm5pbmdfdGhyZXNob2xkX21iOiAxMDA="), - // DataCenterLocation: to.Ptr("West US 2"), - // DelegatedSubnetID: to.Ptr("/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/dc1"), - // NodeCount: to.Ptr[int32](9), - // ProvisioningState: to.Ptr(armcosmos.ManagedCassandraProvisioningStateSucceeded), - // SeedNodes: []*armcosmos.SeedNode{ - // { - // IPAddress: to.Ptr("192.168.12.2"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.3"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.4"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBManagedCassandraDataCenterDelete.json -func ExampleCassandraDataCentersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraDataCentersClient().BeginDelete(ctx, "cassandra-prod-rg", "cassandra-prod", "dc1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBManagedCassandraDataCenterCreate.json -func ExampleCassandraDataCentersClient_BeginCreateUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraDataCentersClient().BeginCreateUpdate(ctx, "cassandra-prod-rg", "cassandra-prod", "dc1", armcosmos.DataCenterResource{ - Properties: &armcosmos.DataCenterResourceProperties{ - Base64EncodedCassandraYamlFragment: to.Ptr("Y29tcGFjdGlvbl90aHJvdWdocHV0X21iX3Blcl9zZWM6IDMyCmNvbXBhY3Rpb25fbGFyZ2VfcGFydGl0aW9uX3dhcm5pbmdfdGhyZXNob2xkX21iOiAxMDA="), - DataCenterLocation: to.Ptr("West US 2"), - DelegatedSubnetID: to.Ptr("/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/dc1-subnet"), - NodeCount: to.Ptr[int32](9), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCenterResource = armcosmos.DataCenterResource{ - // Name: to.Ptr("dc1"), - // Type: to.Ptr("Microsoft.DocumentDB/cassandraClusters/dataCenters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cassandra-prod-rg/providers/Microsoft.DocumentDB/cassandraClusters/cassandra-prod/dataCenters/dc1"), - // Properties: &armcosmos.DataCenterResourceProperties{ - // DataCenterLocation: to.Ptr("West US 2"), - // DelegatedSubnetID: to.Ptr("/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/dc1"), - // NodeCount: to.Ptr[int32](9), - // ProvisioningState: to.Ptr(armcosmos.ManagedCassandraProvisioningStateSucceeded), - // SeedNodes: []*armcosmos.SeedNode{ - // { - // IPAddress: to.Ptr("192.168.12.2"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.3"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.4"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBManagedCassandraDataCenterPatch.json -func ExampleCassandraDataCentersClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraDataCentersClient().BeginUpdate(ctx, "cassandra-prod-rg", "cassandra-prod", "dc1", armcosmos.DataCenterResource{ - Properties: &armcosmos.DataCenterResourceProperties{ - Base64EncodedCassandraYamlFragment: to.Ptr("Y29tcGFjdGlvbl90aHJvdWdocHV0X21iX3Blcl9zZWM6IDMyCmNvbXBhY3Rpb25fbGFyZ2VfcGFydGl0aW9uX3dhcm5pbmdfdGhyZXNob2xkX21iOiAxMDA="), - DataCenterLocation: to.Ptr("West US 2"), - DelegatedSubnetID: to.Ptr("/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/dc1-subnet"), - NodeCount: to.Ptr[int32](9), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataCenterResource = armcosmos.DataCenterResource{ - // Name: to.Ptr("dc1"), - // Type: to.Ptr("Microsoft.DocumentDB/cassandraClusters/dataCenters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cassandra-prod-rg/providers/Microsoft.DocumentDB/cassandraClusters/cassandra-prod/dataCenters/dc1"), - // Properties: &armcosmos.DataCenterResourceProperties{ - // Base64EncodedCassandraYamlFragment: to.Ptr("Y29tcGFjdGlvbl90aHJvdWdocHV0X21iX3Blcl9zZWM6IDMyCmNvbXBhY3Rpb25fbGFyZ2VfcGFydGl0aW9uX3dhcm5pbmdfdGhyZXNob2xkX21iOiAxMDA="), - // DataCenterLocation: to.Ptr("West US 2"), - // DelegatedSubnetID: to.Ptr("/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/dc1"), - // NodeCount: to.Ptr[int32](9), - // ProvisioningState: to.Ptr(armcosmos.ManagedCassandraProvisioningStateSucceeded), - // SeedNodes: []*armcosmos.SeedNode{ - // { - // IPAddress: to.Ptr("192.168.12.2"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.3"), - // }, - // { - // IPAddress: to.Ptr("192.168.12.4"), - // }}, - // }, - // } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/cassandraresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/cassandraresources_client.go index fc26661be0f0..374cd0ac0d25 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/cassandraresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/cassandraresources_client.go @@ -46,7 +46,7 @@ func NewCassandraResourcesClient(subscriptionID string, credential azcore.TokenC // BeginCreateUpdateCassandraKeyspace - Create or update an Azure Cosmos DB Cassandra keyspace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -73,7 +73,7 @@ func (client *CassandraResourcesClient) BeginCreateUpdateCassandraKeyspace(ctx c // CreateUpdateCassandraKeyspace - Create or update an Azure Cosmos DB Cassandra keyspace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraResourcesClient) createUpdateCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters CassandraKeyspaceCreateUpdateParameters, options *CassandraResourcesClientBeginCreateUpdateCassandraKeyspaceOptions) (*http.Response, error) { var err error const operationName = "CassandraResourcesClient.BeginCreateUpdateCassandraKeyspace" @@ -119,7 +119,7 @@ func (client *CassandraResourcesClient) createUpdateCassandraKeyspaceCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateCassandraKeyspaceParameters); err != nil { @@ -131,7 +131,7 @@ func (client *CassandraResourcesClient) createUpdateCassandraKeyspaceCreateReque // BeginCreateUpdateCassandraTable - Create or update an Azure Cosmos DB Cassandra Table // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -159,7 +159,7 @@ func (client *CassandraResourcesClient) BeginCreateUpdateCassandraTable(ctx cont // CreateUpdateCassandraTable - Create or update an Azure Cosmos DB Cassandra Table // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraResourcesClient) createUpdateCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters CassandraTableCreateUpdateParameters, options *CassandraResourcesClientBeginCreateUpdateCassandraTableOptions) (*http.Response, error) { var err error const operationName = "CassandraResourcesClient.BeginCreateUpdateCassandraTable" @@ -209,7 +209,7 @@ func (client *CassandraResourcesClient) createUpdateCassandraTableCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateCassandraTableParameters); err != nil { @@ -218,10 +218,100 @@ func (client *CassandraResourcesClient) createUpdateCassandraTableCreateRequest( return req, nil } +// BeginCreateUpdateCassandraView - Create or update an Azure Cosmos DB Cassandra View +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - keyspaceName - Cosmos DB keyspace name. +// - viewName - Cosmos DB view name. +// - createUpdateCassandraViewParameters - The parameters to provide for the current Cassandra View. +// - options - CassandraResourcesClientBeginCreateUpdateCassandraViewOptions contains the optional parameters for the CassandraResourcesClient.BeginCreateUpdateCassandraView +// method. +func (client *CassandraResourcesClient) BeginCreateUpdateCassandraView(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, createUpdateCassandraViewParameters CassandraViewCreateUpdateParameters, options *CassandraResourcesClientBeginCreateUpdateCassandraViewOptions) (*runtime.Poller[CassandraResourcesClientCreateUpdateCassandraViewResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createUpdateCassandraView(ctx, resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CassandraResourcesClientCreateUpdateCassandraViewResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CassandraResourcesClientCreateUpdateCassandraViewResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateUpdateCassandraView - Create or update an Azure Cosmos DB Cassandra View +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *CassandraResourcesClient) createUpdateCassandraView(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, createUpdateCassandraViewParameters CassandraViewCreateUpdateParameters, options *CassandraResourcesClientBeginCreateUpdateCassandraViewOptions) (*http.Response, error) { + var err error + const operationName = "CassandraResourcesClient.BeginCreateUpdateCassandraView" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createUpdateCassandraViewCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createUpdateCassandraViewCreateRequest creates the CreateUpdateCassandraView request. +func (client *CassandraResourcesClient) createUpdateCassandraViewCreateRequest(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, createUpdateCassandraViewParameters CassandraViewCreateUpdateParameters, options *CassandraResourcesClientBeginCreateUpdateCassandraViewOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if keyspaceName == "" { + return nil, errors.New("parameter keyspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{keyspaceName}", url.PathEscape(keyspaceName)) + if viewName == "" { + return nil, errors.New("parameter viewName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, createUpdateCassandraViewParameters); err != nil { + return nil, err + } + return req, nil +} + // BeginDeleteCassandraKeyspace - Deletes an existing Azure Cosmos DB Cassandra keyspace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -247,7 +337,7 @@ func (client *CassandraResourcesClient) BeginDeleteCassandraKeyspace(ctx context // DeleteCassandraKeyspace - Deletes an existing Azure Cosmos DB Cassandra keyspace. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraResourcesClient) deleteCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, options *CassandraResourcesClientBeginDeleteCassandraKeyspaceOptions) (*http.Response, error) { var err error const operationName = "CassandraResourcesClient.BeginDeleteCassandraKeyspace" @@ -293,7 +383,7 @@ func (client *CassandraResourcesClient) deleteCassandraKeyspaceCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -301,7 +391,7 @@ func (client *CassandraResourcesClient) deleteCassandraKeyspaceCreateRequest(ctx // BeginDeleteCassandraTable - Deletes an existing Azure Cosmos DB Cassandra table. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -328,7 +418,7 @@ func (client *CassandraResourcesClient) BeginDeleteCassandraTable(ctx context.Co // DeleteCassandraTable - Deletes an existing Azure Cosmos DB Cassandra table. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraResourcesClient) deleteCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, options *CassandraResourcesClientBeginDeleteCassandraTableOptions) (*http.Response, error) { var err error const operationName = "CassandraResourcesClient.BeginDeleteCassandraTable" @@ -378,7 +468,92 @@ func (client *CassandraResourcesClient) deleteCassandraTableCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// BeginDeleteCassandraView - Deletes an existing Azure Cosmos DB Cassandra view. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - keyspaceName - Cosmos DB keyspace name. +// - viewName - Cosmos DB view name. +// - options - CassandraResourcesClientBeginDeleteCassandraViewOptions contains the optional parameters for the CassandraResourcesClient.BeginDeleteCassandraView +// method. +func (client *CassandraResourcesClient) BeginDeleteCassandraView(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesClientBeginDeleteCassandraViewOptions) (*runtime.Poller[CassandraResourcesClientDeleteCassandraViewResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteCassandraView(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CassandraResourcesClientDeleteCassandraViewResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CassandraResourcesClientDeleteCassandraViewResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// DeleteCassandraView - Deletes an existing Azure Cosmos DB Cassandra view. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *CassandraResourcesClient) deleteCassandraView(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesClientBeginDeleteCassandraViewOptions) (*http.Response, error) { + var err error + const operationName = "CassandraResourcesClient.BeginDeleteCassandraView" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCassandraViewCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCassandraViewCreateRequest creates the DeleteCassandraView request. +func (client *CassandraResourcesClient) deleteCassandraViewCreateRequest(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesClientBeginDeleteCassandraViewOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if keyspaceName == "" { + return nil, errors.New("parameter keyspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{keyspaceName}", url.PathEscape(keyspaceName)) + if viewName == "" { + return nil, errors.New("parameter viewName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -387,7 +562,7 @@ func (client *CassandraResourcesClient) deleteCassandraTableCreateRequest(ctx co // name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -439,7 +614,7 @@ func (client *CassandraResourcesClient) getCassandraKeyspaceCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -458,7 +633,7 @@ func (client *CassandraResourcesClient) getCassandraKeyspaceHandleResponse(resp // account with the provided name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -510,7 +685,7 @@ func (client *CassandraResourcesClient) getCassandraKeyspaceThroughputCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -528,7 +703,7 @@ func (client *CassandraResourcesClient) getCassandraKeyspaceThroughputHandleResp // GetCassandraTable - Gets the Cassandra table under an existing Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -585,7 +760,7 @@ func (client *CassandraResourcesClient) getCassandraTableCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -604,7 +779,7 @@ func (client *CassandraResourcesClient) getCassandraTableHandleResponse(resp *ht // account with the provided name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -661,7 +836,7 @@ func (client *CassandraResourcesClient) getCassandraTableThroughputCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -676,9 +851,160 @@ func (client *CassandraResourcesClient) getCassandraTableThroughputHandleRespons return result, nil } +// GetCassandraView - Gets the Cassandra view under an existing Azure Cosmos DB database account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - keyspaceName - Cosmos DB keyspace name. +// - viewName - Cosmos DB view name. +// - options - CassandraResourcesClientGetCassandraViewOptions contains the optional parameters for the CassandraResourcesClient.GetCassandraView +// method. +func (client *CassandraResourcesClient) GetCassandraView(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesClientGetCassandraViewOptions) (CassandraResourcesClientGetCassandraViewResponse, error) { + var err error + const operationName = "CassandraResourcesClient.GetCassandraView" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCassandraViewCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) + if err != nil { + return CassandraResourcesClientGetCassandraViewResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CassandraResourcesClientGetCassandraViewResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CassandraResourcesClientGetCassandraViewResponse{}, err + } + resp, err := client.getCassandraViewHandleResponse(httpResp) + return resp, err +} + +// getCassandraViewCreateRequest creates the GetCassandraView request. +func (client *CassandraResourcesClient) getCassandraViewCreateRequest(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesClientGetCassandraViewOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if keyspaceName == "" { + return nil, errors.New("parameter keyspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{keyspaceName}", url.PathEscape(keyspaceName)) + if viewName == "" { + return nil, errors.New("parameter viewName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getCassandraViewHandleResponse handles the GetCassandraView response. +func (client *CassandraResourcesClient) getCassandraViewHandleResponse(resp *http.Response) (CassandraResourcesClientGetCassandraViewResponse, error) { + result := CassandraResourcesClientGetCassandraViewResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CassandraViewGetResults); err != nil { + return CassandraResourcesClientGetCassandraViewResponse{}, err + } + return result, nil +} + +// GetCassandraViewThroughput - Gets the RUs per second of the Cassandra view under an existing Azure Cosmos DB database account +// with the provided name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - keyspaceName - Cosmos DB keyspace name. +// - viewName - Cosmos DB view name. +// - options - CassandraResourcesClientGetCassandraViewThroughputOptions contains the optional parameters for the CassandraResourcesClient.GetCassandraViewThroughput +// method. +func (client *CassandraResourcesClient) GetCassandraViewThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesClientGetCassandraViewThroughputOptions) (CassandraResourcesClientGetCassandraViewThroughputResponse, error) { + var err error + const operationName = "CassandraResourcesClient.GetCassandraViewThroughput" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCassandraViewThroughputCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) + if err != nil { + return CassandraResourcesClientGetCassandraViewThroughputResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CassandraResourcesClientGetCassandraViewThroughputResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CassandraResourcesClientGetCassandraViewThroughputResponse{}, err + } + resp, err := client.getCassandraViewThroughputHandleResponse(httpResp) + return resp, err +} + +// getCassandraViewThroughputCreateRequest creates the GetCassandraViewThroughput request. +func (client *CassandraResourcesClient) getCassandraViewThroughputCreateRequest(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesClientGetCassandraViewThroughputOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if keyspaceName == "" { + return nil, errors.New("parameter keyspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{keyspaceName}", url.PathEscape(keyspaceName)) + if viewName == "" { + return nil, errors.New("parameter viewName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getCassandraViewThroughputHandleResponse handles the GetCassandraViewThroughput response. +func (client *CassandraResourcesClient) getCassandraViewThroughputHandleResponse(resp *http.Response) (CassandraResourcesClientGetCassandraViewThroughputResponse, error) { + result := CassandraResourcesClientGetCassandraViewThroughputResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ThroughputSettingsGetResults); err != nil { + return CassandraResourcesClientGetCassandraViewThroughputResponse{}, err + } + return result, nil +} + // NewListCassandraKeyspacesPager - Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - CassandraResourcesClientListCassandraKeyspacesOptions contains the optional parameters for the CassandraResourcesClient.NewListCassandraKeyspacesPager @@ -727,7 +1053,7 @@ func (client *CassandraResourcesClient) listCassandraKeyspacesCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -744,7 +1070,7 @@ func (client *CassandraResourcesClient) listCassandraKeyspacesHandleResponse(res // NewListCassandraTablesPager - Lists the Cassandra table under an existing Azure Cosmos DB database account. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -798,7 +1124,7 @@ func (client *CassandraResourcesClient) listCassandraTablesCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -813,10 +1139,81 @@ func (client *CassandraResourcesClient) listCassandraTablesHandleResponse(resp * return result, nil } +// NewListCassandraViewsPager - Lists the Cassandra materialized views under an existing Azure Cosmos DB database account. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - keyspaceName - Cosmos DB keyspace name. +// - options - CassandraResourcesClientListCassandraViewsOptions contains the optional parameters for the CassandraResourcesClient.NewListCassandraViewsPager +// method. +func (client *CassandraResourcesClient) NewListCassandraViewsPager(resourceGroupName string, accountName string, keyspaceName string, options *CassandraResourcesClientListCassandraViewsOptions) *runtime.Pager[CassandraResourcesClientListCassandraViewsResponse] { + return runtime.NewPager(runtime.PagingHandler[CassandraResourcesClientListCassandraViewsResponse]{ + More: func(page CassandraResourcesClientListCassandraViewsResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *CassandraResourcesClientListCassandraViewsResponse) (CassandraResourcesClientListCassandraViewsResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CassandraResourcesClient.NewListCassandraViewsPager") + req, err := client.listCassandraViewsCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, options) + if err != nil { + return CassandraResourcesClientListCassandraViewsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CassandraResourcesClientListCassandraViewsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CassandraResourcesClientListCassandraViewsResponse{}, runtime.NewResponseError(resp) + } + return client.listCassandraViewsHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCassandraViewsCreateRequest creates the ListCassandraViews request. +func (client *CassandraResourcesClient) listCassandraViewsCreateRequest(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, options *CassandraResourcesClientListCassandraViewsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if keyspaceName == "" { + return nil, errors.New("parameter keyspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{keyspaceName}", url.PathEscape(keyspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listCassandraViewsHandleResponse handles the ListCassandraViews response. +func (client *CassandraResourcesClient) listCassandraViewsHandleResponse(resp *http.Response) (CassandraResourcesClientListCassandraViewsResponse, error) { + result := CassandraResourcesClientListCassandraViewsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CassandraViewListResult); err != nil { + return CassandraResourcesClientListCassandraViewsResponse{}, err + } + return result, nil +} + // BeginMigrateCassandraKeyspaceToAutoscale - Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -842,7 +1239,7 @@ func (client *CassandraResourcesClient) BeginMigrateCassandraKeyspaceToAutoscale // MigrateCassandraKeyspaceToAutoscale - Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraResourcesClient) migrateCassandraKeyspaceToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, options *CassandraResourcesClientBeginMigrateCassandraKeyspaceToAutoscaleOptions) (*http.Response, error) { var err error const operationName = "CassandraResourcesClient.BeginMigrateCassandraKeyspaceToAutoscale" @@ -888,7 +1285,7 @@ func (client *CassandraResourcesClient) migrateCassandraKeyspaceToAutoscaleCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -898,7 +1295,7 @@ func (client *CassandraResourcesClient) migrateCassandraKeyspaceToAutoscaleCreat // throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -924,7 +1321,7 @@ func (client *CassandraResourcesClient) BeginMigrateCassandraKeyspaceToManualThr // MigrateCassandraKeyspaceToManualThroughput - Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraResourcesClient) migrateCassandraKeyspaceToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, options *CassandraResourcesClientBeginMigrateCassandraKeyspaceToManualThroughputOptions) (*http.Response, error) { var err error const operationName = "CassandraResourcesClient.BeginMigrateCassandraKeyspaceToManualThroughput" @@ -970,7 +1367,7 @@ func (client *CassandraResourcesClient) migrateCassandraKeyspaceToManualThroughp return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -979,7 +1376,7 @@ func (client *CassandraResourcesClient) migrateCassandraKeyspaceToManualThroughp // BeginMigrateCassandraTableToAutoscale - Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -1006,7 +1403,7 @@ func (client *CassandraResourcesClient) BeginMigrateCassandraTableToAutoscale(ct // MigrateCassandraTableToAutoscale - Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraResourcesClient) migrateCassandraTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, options *CassandraResourcesClientBeginMigrateCassandraTableToAutoscaleOptions) (*http.Response, error) { var err error const operationName = "CassandraResourcesClient.BeginMigrateCassandraTableToAutoscale" @@ -1056,7 +1453,7 @@ func (client *CassandraResourcesClient) migrateCassandraTableToAutoscaleCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1065,7 +1462,7 @@ func (client *CassandraResourcesClient) migrateCassandraTableToAutoscaleCreateRe // BeginMigrateCassandraTableToManualThroughput - Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -1092,7 +1489,7 @@ func (client *CassandraResourcesClient) BeginMigrateCassandraTableToManualThroug // MigrateCassandraTableToManualThroughput - Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraResourcesClient) migrateCassandraTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, options *CassandraResourcesClientBeginMigrateCassandraTableToManualThroughputOptions) (*http.Response, error) { var err error const operationName = "CassandraResourcesClient.BeginMigrateCassandraTableToManualThroughput" @@ -1142,7 +1539,179 @@ func (client *CassandraResourcesClient) migrateCassandraTableToManualThroughputC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginMigrateCassandraViewToAutoscale - Migrate an Azure Cosmos DB Cassandra view from manual throughput to autoscale +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - keyspaceName - Cosmos DB keyspace name. +// - viewName - Cosmos DB view name. +// - options - CassandraResourcesClientBeginMigrateCassandraViewToAutoscaleOptions contains the optional parameters for the +// CassandraResourcesClient.BeginMigrateCassandraViewToAutoscale method. +func (client *CassandraResourcesClient) BeginMigrateCassandraViewToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesClientBeginMigrateCassandraViewToAutoscaleOptions) (*runtime.Poller[CassandraResourcesClientMigrateCassandraViewToAutoscaleResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.migrateCassandraViewToAutoscale(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CassandraResourcesClientMigrateCassandraViewToAutoscaleResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CassandraResourcesClientMigrateCassandraViewToAutoscaleResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// MigrateCassandraViewToAutoscale - Migrate an Azure Cosmos DB Cassandra view from manual throughput to autoscale +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *CassandraResourcesClient) migrateCassandraViewToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesClientBeginMigrateCassandraViewToAutoscaleOptions) (*http.Response, error) { + var err error + const operationName = "CassandraResourcesClient.BeginMigrateCassandraViewToAutoscale" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.migrateCassandraViewToAutoscaleCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// migrateCassandraViewToAutoscaleCreateRequest creates the MigrateCassandraViewToAutoscale request. +func (client *CassandraResourcesClient) migrateCassandraViewToAutoscaleCreateRequest(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesClientBeginMigrateCassandraViewToAutoscaleOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToAutoscale" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if keyspaceName == "" { + return nil, errors.New("parameter keyspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{keyspaceName}", url.PathEscape(keyspaceName)) + if viewName == "" { + return nil, errors.New("parameter viewName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginMigrateCassandraViewToManualThroughput - Migrate an Azure Cosmos DB Cassandra view from autoscale to manual throughput +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - keyspaceName - Cosmos DB keyspace name. +// - viewName - Cosmos DB view name. +// - options - CassandraResourcesClientBeginMigrateCassandraViewToManualThroughputOptions contains the optional parameters for +// the CassandraResourcesClient.BeginMigrateCassandraViewToManualThroughput method. +func (client *CassandraResourcesClient) BeginMigrateCassandraViewToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesClientBeginMigrateCassandraViewToManualThroughputOptions) (*runtime.Poller[CassandraResourcesClientMigrateCassandraViewToManualThroughputResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.migrateCassandraViewToManualThroughput(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CassandraResourcesClientMigrateCassandraViewToManualThroughputResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CassandraResourcesClientMigrateCassandraViewToManualThroughputResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// MigrateCassandraViewToManualThroughput - Migrate an Azure Cosmos DB Cassandra view from autoscale to manual throughput +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *CassandraResourcesClient) migrateCassandraViewToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesClientBeginMigrateCassandraViewToManualThroughputOptions) (*http.Response, error) { + var err error + const operationName = "CassandraResourcesClient.BeginMigrateCassandraViewToManualThroughput" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.migrateCassandraViewToManualThroughputCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// migrateCassandraViewToManualThroughputCreateRequest creates the MigrateCassandraViewToManualThroughput request. +func (client *CassandraResourcesClient) migrateCassandraViewToManualThroughputCreateRequest(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesClientBeginMigrateCassandraViewToManualThroughputOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToManualThroughput" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if keyspaceName == "" { + return nil, errors.New("parameter keyspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{keyspaceName}", url.PathEscape(keyspaceName)) + if viewName == "" { + return nil, errors.New("parameter viewName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1151,7 +1720,7 @@ func (client *CassandraResourcesClient) migrateCassandraTableToManualThroughputC // BeginUpdateCassandraKeyspaceThroughput - Update RUs per second of an Azure Cosmos DB Cassandra Keyspace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -1178,7 +1747,7 @@ func (client *CassandraResourcesClient) BeginUpdateCassandraKeyspaceThroughput(c // UpdateCassandraKeyspaceThroughput - Update RUs per second of an Azure Cosmos DB Cassandra Keyspace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraResourcesClient) updateCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *CassandraResourcesClientBeginUpdateCassandraKeyspaceThroughputOptions) (*http.Response, error) { var err error const operationName = "CassandraResourcesClient.BeginUpdateCassandraKeyspaceThroughput" @@ -1224,7 +1793,7 @@ func (client *CassandraResourcesClient) updateCassandraKeyspaceThroughputCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { @@ -1236,7 +1805,7 @@ func (client *CassandraResourcesClient) updateCassandraKeyspaceThroughputCreateR // BeginUpdateCassandraTableThroughput - Update RUs per second of an Azure Cosmos DB Cassandra table // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -1264,7 +1833,7 @@ func (client *CassandraResourcesClient) BeginUpdateCassandraTableThroughput(ctx // UpdateCassandraTableThroughput - Update RUs per second of an Azure Cosmos DB Cassandra table // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *CassandraResourcesClient) updateCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *CassandraResourcesClientBeginUpdateCassandraTableThroughputOptions) (*http.Response, error) { var err error const operationName = "CassandraResourcesClient.BeginUpdateCassandraTableThroughput" @@ -1314,7 +1883,97 @@ func (client *CassandraResourcesClient) updateCassandraTableThroughputCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpdateCassandraViewThroughput - Update RUs per second of an Azure Cosmos DB Cassandra view +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - keyspaceName - Cosmos DB keyspace name. +// - viewName - Cosmos DB view name. +// - updateThroughputParameters - The RUs per second of the parameters to provide for the current Cassandra view. +// - options - CassandraResourcesClientBeginUpdateCassandraViewThroughputOptions contains the optional parameters for the CassandraResourcesClient.BeginUpdateCassandraViewThroughput +// method. +func (client *CassandraResourcesClient) BeginUpdateCassandraViewThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *CassandraResourcesClientBeginUpdateCassandraViewThroughputOptions) (*runtime.Poller[CassandraResourcesClientUpdateCassandraViewThroughputResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateCassandraViewThroughput(ctx, resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CassandraResourcesClientUpdateCassandraViewThroughputResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[CassandraResourcesClientUpdateCassandraViewThroughputResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// UpdateCassandraViewThroughput - Update RUs per second of an Azure Cosmos DB Cassandra view +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *CassandraResourcesClient) updateCassandraViewThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *CassandraResourcesClientBeginUpdateCassandraViewThroughputOptions) (*http.Response, error) { + var err error + const operationName = "CassandraResourcesClient.BeginUpdateCassandraViewThroughput" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCassandraViewThroughputCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCassandraViewThroughputCreateRequest creates the UpdateCassandraViewThroughput request. +func (client *CassandraResourcesClient) updateCassandraViewThroughputCreateRequest(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *CassandraResourcesClientBeginUpdateCassandraViewThroughputOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if keyspaceName == "" { + return nil, errors.New("parameter keyspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{keyspaceName}", url.PathEscape(keyspaceName)) + if viewName == "" { + return nil, errors.New("parameter viewName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { diff --git a/sdk/resourcemanager/cosmos/armcosmos/cassandraresources_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/cassandraresources_client_example_test.go deleted file mode 100644 index 4e4bc5ca5b75..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/cassandraresources_client_example_test.go +++ /dev/null @@ -1,702 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCassandraKeyspaceList.json -func ExampleCassandraResourcesClient_NewListCassandraKeyspacesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCassandraResourcesClient().NewListCassandraKeyspacesPager("rgName", "ddb1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CassandraKeyspaceListResult = armcosmos.CassandraKeyspaceListResult{ - // Value: []*armcosmos.CassandraKeyspaceGetResults{ - // { - // Name: to.Ptr("keyspaceName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/cassandraKeyspaces/keyspaceName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.CassandraKeyspaceGetProperties{ - // Resource: &armcosmos.CassandraKeyspaceGetPropertiesResource{ - // ID: to.Ptr("keyspaceName"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCassandraKeyspaceGet.json -func ExampleCassandraResourcesClient_GetCassandraKeyspace() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCassandraResourcesClient().GetCassandraKeyspace(ctx, "rg1", "ddb1", "keyspaceName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CassandraKeyspaceGetResults = armcosmos.CassandraKeyspaceGetResults{ - // Name: to.Ptr("keyspaceName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/cassandraKeyspaces/keyspaceName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.CassandraKeyspaceGetProperties{ - // Resource: &armcosmos.CassandraKeyspaceGetPropertiesResource{ - // ID: to.Ptr("keyspaceName"), - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCassandraKeyspaceCreateUpdate.json -func ExampleCassandraResourcesClient_BeginCreateUpdateCassandraKeyspace() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraResourcesClient().BeginCreateUpdateCassandraKeyspace(ctx, "rg1", "ddb1", "keyspaceName", armcosmos.CassandraKeyspaceCreateUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.CassandraKeyspaceCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.CassandraKeyspaceResource{ - ID: to.Ptr("keyspaceName"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CassandraKeyspaceGetResults = armcosmos.CassandraKeyspaceGetResults{ - // Name: to.Ptr("keyspaceName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/cassandraKeyspaces/keyspaceName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.CassandraKeyspaceGetProperties{ - // Resource: &armcosmos.CassandraKeyspaceGetPropertiesResource{ - // ID: to.Ptr("keyspaceName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCassandraKeyspaceDelete.json -func ExampleCassandraResourcesClient_BeginDeleteCassandraKeyspace() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraResourcesClient().BeginDeleteCassandraKeyspace(ctx, "rg1", "ddb1", "keyspaceName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCassandraKeyspaceThroughputGet.json -func ExampleCassandraResourcesClient_GetCassandraKeyspaceThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCassandraResourcesClient().GetCassandraKeyspaceThroughput(ctx, "rg1", "ddb1", "keyspaceName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/cassandraKeyspaces/keyspaceName/throughputSettings/default"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // InstantMaximumThroughput: to.Ptr("10000"), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // SoftAllowedMaximumThroughput: to.Ptr("1000000"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCassandraKeyspaceThroughputUpdate.json -func ExampleCassandraResourcesClient_BeginUpdateCassandraKeyspaceThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraResourcesClient().BeginUpdateCassandraKeyspaceThroughput(ctx, "rg1", "ddb1", "keyspaceName", armcosmos.ThroughputSettingsUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.ThroughputSettingsUpdateProperties{ - Resource: &armcosmos.ThroughputSettingsResource{ - Throughput: to.Ptr[int32](400), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/cassandraKeyspaces/keyspaceName/throughputSettings/default"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCassandraKeyspaceMigrateToAutoscale.json -func ExampleCassandraResourcesClient_BeginMigrateCassandraKeyspaceToAutoscale() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraResourcesClient().BeginMigrateCassandraKeyspaceToAutoscale(ctx, "rg1", "ddb1", "keyspaceName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // AutoscaleSettings: &armcosmos.AutoscaleSettingsResource{ - // MaxThroughput: to.Ptr[int32](4000), - // }, - // MinimumThroughput: to.Ptr("4000"), - // OfferReplacePending: to.Ptr("false"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCassandraKeyspaceMigrateToManualThroughput.json -func ExampleCassandraResourcesClient_BeginMigrateCassandraKeyspaceToManualThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraResourcesClient().BeginMigrateCassandraKeyspaceToManualThroughput(ctx, "rg1", "ddb1", "keyspaceName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("false"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCassandraTableList.json -func ExampleCassandraResourcesClient_NewListCassandraTablesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCassandraResourcesClient().NewListCassandraTablesPager("rgName", "ddb1", "keyspaceName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CassandraTableListResult = armcosmos.CassandraTableListResult{ - // Value: []*armcosmos.CassandraTableGetResults{ - // { - // Name: to.Ptr("tableName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/cassandraTables"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/cassandraKeyspaces/keyspaceName/cassandraTables/tableName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.CassandraTableGetProperties{ - // Resource: &armcosmos.CassandraTableGetPropertiesResource{ - // Schema: &armcosmos.CassandraSchema{ - // ClusterKeys: []*armcosmos.ClusterKey{ - // { - // Name: to.Ptr("columnA"), - // OrderBy: to.Ptr("Asc"), - // }}, - // Columns: []*armcosmos.Column{ - // { - // Name: to.Ptr("columnA"), - // Type: to.Ptr("Ascii"), - // }}, - // PartitionKeys: []*armcosmos.CassandraPartitionKey{ - // { - // Name: to.Ptr("columnA"), - // }}, - // }, - // DefaultTTL: to.Ptr[int32](100), - // ID: to.Ptr("tableName"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCassandraTableGet.json -func ExampleCassandraResourcesClient_GetCassandraTable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCassandraResourcesClient().GetCassandraTable(ctx, "rg1", "ddb1", "keyspaceName", "tableName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CassandraTableGetResults = armcosmos.CassandraTableGetResults{ - // Name: to.Ptr("tableName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/cassandraTables"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/cassandraKeyspaces/keyspaceName/cassandraTables/tableName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.CassandraTableGetProperties{ - // Resource: &armcosmos.CassandraTableGetPropertiesResource{ - // Schema: &armcosmos.CassandraSchema{ - // ClusterKeys: []*armcosmos.ClusterKey{ - // { - // Name: to.Ptr("columnA"), - // OrderBy: to.Ptr("Asc"), - // }}, - // Columns: []*armcosmos.Column{ - // { - // Name: to.Ptr("columnA"), - // Type: to.Ptr("Ascii"), - // }}, - // PartitionKeys: []*armcosmos.CassandraPartitionKey{ - // { - // Name: to.Ptr("columnA"), - // }}, - // }, - // DefaultTTL: to.Ptr[int32](100), - // ID: to.Ptr("tableName"), - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCassandraTableCreateUpdate.json -func ExampleCassandraResourcesClient_BeginCreateUpdateCassandraTable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraResourcesClient().BeginCreateUpdateCassandraTable(ctx, "rg1", "ddb1", "keyspaceName", "tableName", armcosmos.CassandraTableCreateUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.CassandraTableCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.CassandraTableResource{ - Schema: &armcosmos.CassandraSchema{ - ClusterKeys: []*armcosmos.ClusterKey{ - { - Name: to.Ptr("columnA"), - OrderBy: to.Ptr("Asc"), - }}, - Columns: []*armcosmos.Column{ - { - Name: to.Ptr("columnA"), - Type: to.Ptr("Ascii"), - }}, - PartitionKeys: []*armcosmos.CassandraPartitionKey{ - { - Name: to.Ptr("columnA"), - }}, - }, - DefaultTTL: to.Ptr[int32](100), - ID: to.Ptr("tableName"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CassandraTableGetResults = armcosmos.CassandraTableGetResults{ - // Name: to.Ptr("tableName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/cassandraTables"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/cassandraKeyspaces/keyspaceName/cassandraTables/tableName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.CassandraTableGetProperties{ - // Resource: &armcosmos.CassandraTableGetPropertiesResource{ - // Schema: &armcosmos.CassandraSchema{ - // ClusterKeys: []*armcosmos.ClusterKey{ - // { - // Name: to.Ptr("columnA"), - // OrderBy: to.Ptr("Asc"), - // }}, - // Columns: []*armcosmos.Column{ - // { - // Name: to.Ptr("columnA"), - // Type: to.Ptr("Ascii"), - // }}, - // PartitionKeys: []*armcosmos.CassandraPartitionKey{ - // { - // Name: to.Ptr("columnA"), - // }}, - // }, - // DefaultTTL: to.Ptr[int32](100), - // ID: to.Ptr("tableName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCassandraTableDelete.json -func ExampleCassandraResourcesClient_BeginDeleteCassandraTable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraResourcesClient().BeginDeleteCassandraTable(ctx, "rg1", "ddb1", "keyspaceName", "tableName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCassandraTableThroughputGet.json -func ExampleCassandraResourcesClient_GetCassandraTableThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCassandraResourcesClient().GetCassandraTableThroughput(ctx, "rg1", "ddb1", "keyspaceName", "tableName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/cassandraTables/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/cassandraKeyspaces/keyspaceName/cassandraTables/tableName/throughputSettings/default"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // InstantMaximumThroughput: to.Ptr("10000"), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // SoftAllowedMaximumThroughput: to.Ptr("1000000"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCassandraTableThroughputUpdate.json -func ExampleCassandraResourcesClient_BeginUpdateCassandraTableThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraResourcesClient().BeginUpdateCassandraTableThroughput(ctx, "rg1", "ddb1", "keyspaceName", "tableName", armcosmos.ThroughputSettingsUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.ThroughputSettingsUpdateProperties{ - Resource: &armcosmos.ThroughputSettingsResource{ - Throughput: to.Ptr[int32](400), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/cassandraTables/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/cassandraKeyspaces/keyspaceName/cassandraTables/tableName/throughputSettings/default"), - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCassandraTableMigrateToAutoscale.json -func ExampleCassandraResourcesClient_BeginMigrateCassandraTableToAutoscale() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraResourcesClient().BeginMigrateCassandraTableToAutoscale(ctx, "rg1", "ddb1", "keyspaceName", "tableName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // AutoscaleSettings: &armcosmos.AutoscaleSettingsResource{ - // MaxThroughput: to.Ptr[int32](4000), - // }, - // MinimumThroughput: to.Ptr("4000"), - // OfferReplacePending: to.Ptr("false"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCassandraTableMigrateToManualThroughput.json -func ExampleCassandraResourcesClient_BeginMigrateCassandraTableToManualThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCassandraResourcesClient().BeginMigrateCassandraTableToManualThroughput(ctx, "rg1", "ddb1", "keyspaceName", "tableName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("false"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/cassandraresources_live_test.go b/sdk/resourcemanager/cosmos/armcosmos/cassandraresources_live_test.go index 57f99bdb39ca..8cac92102160 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/cassandraresources_live_test.go +++ b/sdk/resourcemanager/cosmos/armcosmos/cassandraresources_live_test.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/cosmos/armcosmos/chaosfault_client.go b/sdk/resourcemanager/cosmos/armcosmos/chaosfault_client.go new file mode 100644 index 000000000000..4177a8e1337c --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/chaosfault_client.go @@ -0,0 +1,263 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcosmos + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ChaosFaultClient contains the methods for the ChaosFault group. +// Don't use this type directly, use NewChaosFaultClient() instead. +type ChaosFaultClient struct { + internal *arm.Client + subscriptionID string +} + +// NewChaosFaultClient creates a new instance of ChaosFaultClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewChaosFaultClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ChaosFaultClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ChaosFaultClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginEnableDisable - Enable, disable Chaos Fault in a CosmosDB account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - chaosFault - The name of the ChaosFault. +// - chaosFaultRequest - A request object to enable/disable the chaos fault. +// - options - ChaosFaultClientBeginEnableDisableOptions contains the optional parameters for the ChaosFaultClient.BeginEnableDisable +// method. +func (client *ChaosFaultClient) BeginEnableDisable(ctx context.Context, resourceGroupName string, accountName string, chaosFault string, chaosFaultRequest ChaosFaultResource, options *ChaosFaultClientBeginEnableDisableOptions) (*runtime.Poller[ChaosFaultClientEnableDisableResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.enableDisable(ctx, resourceGroupName, accountName, chaosFault, chaosFaultRequest, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ChaosFaultClientEnableDisableResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ChaosFaultClientEnableDisableResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// EnableDisable - Enable, disable Chaos Fault in a CosmosDB account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *ChaosFaultClient) enableDisable(ctx context.Context, resourceGroupName string, accountName string, chaosFault string, chaosFaultRequest ChaosFaultResource, options *ChaosFaultClientBeginEnableDisableOptions) (*http.Response, error) { + var err error + const operationName = "ChaosFaultClient.BeginEnableDisable" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.enableDisableCreateRequest(ctx, resourceGroupName, accountName, chaosFault, chaosFaultRequest, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// enableDisableCreateRequest creates the EnableDisable request. +func (client *ChaosFaultClient) enableDisableCreateRequest(ctx context.Context, resourceGroupName string, accountName string, chaosFault string, chaosFaultRequest ChaosFaultResource, options *ChaosFaultClientBeginEnableDisableOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/chaosFaults/{chaosFault}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if chaosFault == "" { + return nil, errors.New("parameter chaosFault cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{chaosFault}", url.PathEscape(chaosFault)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, chaosFaultRequest); err != nil { + return nil, err + } + return req, nil +} + +// Get - Get Chaos Fault for a CosmosdB account for a particular Chaos Fault. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - chaosFault - The name of the ChaosFault. +// - options - ChaosFaultClientGetOptions contains the optional parameters for the ChaosFaultClient.Get method. +func (client *ChaosFaultClient) Get(ctx context.Context, resourceGroupName string, accountName string, chaosFault string, options *ChaosFaultClientGetOptions) (ChaosFaultClientGetResponse, error) { + var err error + const operationName = "ChaosFaultClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, chaosFault, options) + if err != nil { + return ChaosFaultClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ChaosFaultClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ChaosFaultClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ChaosFaultClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, chaosFault string, options *ChaosFaultClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/chaosFaults/{chaosFault}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if chaosFault == "" { + return nil, errors.New("parameter chaosFault cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{chaosFault}", url.PathEscape(chaosFault)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ChaosFaultClient) getHandleResponse(resp *http.Response) (ChaosFaultClientGetResponse, error) { + result := ChaosFaultClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ChaosFaultResource); err != nil { + return ChaosFaultClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List Chaos Faults for CosmosDB account. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - options - ChaosFaultClientListOptions contains the optional parameters for the ChaosFaultClient.NewListPager method. +func (client *ChaosFaultClient) NewListPager(resourceGroupName string, accountName string, options *ChaosFaultClientListOptions) *runtime.Pager[ChaosFaultClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ChaosFaultClientListResponse]{ + More: func(page ChaosFaultClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ChaosFaultClientListResponse) (ChaosFaultClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ChaosFaultClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, nil) + if err != nil { + return ChaosFaultClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ChaosFaultClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *ChaosFaultClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/chaosFaults" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ChaosFaultClient) listHandleResponse(resp *http.Response) (ChaosFaultClientListResponse, error) { + result := ChaosFaultClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ChaosFaultListResponse); err != nil { + return ChaosFaultClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/client_factory.go b/sdk/resourcemanager/cosmos/armcosmos/client_factory.go index c19d829b3da6..90fc4049cd1f 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/client_factory.go +++ b/sdk/resourcemanager/cosmos/armcosmos/client_factory.go @@ -60,6 +60,14 @@ func (c *ClientFactory) NewCassandraResourcesClient() *CassandraResourcesClient } } +// NewChaosFaultClient creates a new instance of ChaosFaultClient. +func (c *ClientFactory) NewChaosFaultClient() *ChaosFaultClient { + return &ChaosFaultClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewCollectionClient creates a new instance of CollectionClient. func (c *ClientFactory) NewCollectionClient() *CollectionClient { return &CollectionClient{ @@ -92,6 +100,14 @@ func (c *ClientFactory) NewCollectionRegionClient() *CollectionRegionClient { } } +// NewDataTransferJobsClient creates a new instance of DataTransferJobsClient. +func (c *ClientFactory) NewDataTransferJobsClient() *DataTransferJobsClient { + return &DataTransferJobsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewDatabaseAccountRegionClient creates a new instance of DatabaseAccountRegionClient. func (c *ClientFactory) NewDatabaseAccountRegionClient() *DatabaseAccountRegionClient { return &DatabaseAccountRegionClient{ @@ -116,6 +132,14 @@ func (c *ClientFactory) NewDatabaseClient() *DatabaseClient { } } +// NewGraphResourcesClient creates a new instance of GraphResourcesClient. +func (c *ClientFactory) NewGraphResourcesClient() *GraphResourcesClient { + return &GraphResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewGremlinResourcesClient creates a new instance of GremlinResourcesClient. func (c *ClientFactory) NewGremlinResourcesClient() *GremlinResourcesClient { return &GremlinResourcesClient{ @@ -140,6 +164,14 @@ func (c *ClientFactory) NewMongoDBResourcesClient() *MongoDBResourcesClient { } } +// NewNetworkSecurityPerimeterConfigurationsClient creates a new instance of NetworkSecurityPerimeterConfigurationsClient. +func (c *ClientFactory) NewNetworkSecurityPerimeterConfigurationsClient() *NetworkSecurityPerimeterConfigurationsClient { + return &NetworkSecurityPerimeterConfigurationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewNotebookWorkspacesClient creates a new instance of NotebookWorkspacesClient. func (c *ClientFactory) NewNotebookWorkspacesClient() *NotebookWorkspacesClient { return &NotebookWorkspacesClient{ @@ -330,3 +362,35 @@ func (c *ClientFactory) NewTableResourcesClient() *TableResourcesClient { internal: c.internal, } } + +// NewThroughputPoolAccountClient creates a new instance of ThroughputPoolAccountClient. +func (c *ClientFactory) NewThroughputPoolAccountClient() *ThroughputPoolAccountClient { + return &ThroughputPoolAccountClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewThroughputPoolAccountsClient creates a new instance of ThroughputPoolAccountsClient. +func (c *ClientFactory) NewThroughputPoolAccountsClient() *ThroughputPoolAccountsClient { + return &ThroughputPoolAccountsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewThroughputPoolClient creates a new instance of ThroughputPoolClient. +func (c *ClientFactory) NewThroughputPoolClient() *ThroughputPoolClient { + return &ThroughputPoolClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewThroughputPoolsClient creates a new instance of ThroughputPoolsClient. +func (c *ClientFactory) NewThroughputPoolsClient() *ThroughputPoolsClient { + return &ThroughputPoolsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/collection_client.go b/sdk/resourcemanager/cosmos/armcosmos/collection_client.go index 982958a6a244..133813b9aa1a 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/collection_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/collection_client.go @@ -45,7 +45,7 @@ func NewCollectionClient(subscriptionID string, credential azcore.TokenCredentia // NewListMetricDefinitionsPager - Retrieves metric definitions for the given collection. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseRid - Cosmos DB database rid. @@ -104,7 +104,7 @@ func (client *CollectionClient) listMetricDefinitionsCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -121,7 +121,7 @@ func (client *CollectionClient) listMetricDefinitionsHandleResponse(resp *http.R // NewListMetricsPager - Retrieves the metrics determined by the given filter for the given database account and collection. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseRid - Cosmos DB database rid. @@ -184,7 +184,7 @@ func (client *CollectionClient) listMetricsCreateRequest(ctx context.Context, re } reqQP := req.Raw().URL.Query() reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -201,7 +201,7 @@ func (client *CollectionClient) listMetricsHandleResponse(resp *http.Response) ( // NewListUsagesPager - Retrieves the usages (most recent storage data) for the given collection. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseRid - Cosmos DB database rid. @@ -263,7 +263,7 @@ func (client *CollectionClient) listUsagesCreateRequest(ctx context.Context, res if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/collection_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/collection_client_example_test.go deleted file mode 100644 index bd7602da12e0..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/collection_client_example_test.go +++ /dev/null @@ -1,170 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCollectionGetMetrics.json -func ExampleCollectionClient_NewListMetricsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCollectionClient().NewListMetricsPager("rg1", "ddb1", "databaseRid", "collectionRid", "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricListResult = armcosmos.MetricListResult{ - // Value: []*armcosmos.Metric{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Total Requests"), - // Value: to.Ptr("Total Requests"), - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:13:55.278Z"); return t}()), - // MetricValues: []*armcosmos.MetricValue{ - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:58:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:03:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:08:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // TimeGrain: to.Ptr("PT5M"), - // Unit: to.Ptr(armcosmos.UnitTypeCount), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCollectionGetUsages.json -func ExampleCollectionClient_NewListUsagesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCollectionClient().NewListUsagesPager("rg1", "ddb1", "databaseRid", "collectionRid", &armcosmos.CollectionClientListUsagesOptions{Filter: to.Ptr("$filter=name.value eq 'Storage'")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.UsagesResult = armcosmos.UsagesResult{ - // Value: []*armcosmos.Usage{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Storage"), - // Value: to.Ptr("Storage"), - // }, - // CurrentValue: to.Ptr[int64](0), - // Limit: to.Ptr[int64](10737418240), - // QuotaPeriod: to.Ptr("P1D"), - // Unit: to.Ptr(armcosmos.UnitTypeBytes), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCollectionGetMetricDefinitions.json -func ExampleCollectionClient_NewListMetricDefinitionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCollectionClient().NewListMetricDefinitionsPager("rg1", "ddb1", "databaseRid", "collectionRid", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricDefinitionsListResult = armcosmos.MetricDefinitionsListResult{ - // Value: []*armcosmos.MetricDefinition{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Total Requests"), - // Value: to.Ptr("Total Requests"), - // }, - // MetricAvailabilities: []*armcosmos.MetricAvailability{ - // { - // Retention: to.Ptr("P2D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P60D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armcosmos.PrimaryAggregationTypeTotal), - // ResourceURI: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1"), - // Unit: to.Ptr(armcosmos.UnitTypeCount), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/collectionpartition_client.go b/sdk/resourcemanager/cosmos/armcosmos/collectionpartition_client.go index f706087ea78a..99bcfc93bf70 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/collectionpartition_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/collectionpartition_client.go @@ -45,7 +45,7 @@ func NewCollectionPartitionClient(subscriptionID string, credential azcore.Token // NewListMetricsPager - Retrieves the metrics determined by the given filter for the given collection, split by partition. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseRid - Cosmos DB database rid. @@ -108,7 +108,7 @@ func (client *CollectionPartitionClient) listMetricsCreateRequest(ctx context.Co } reqQP := req.Raw().URL.Query() reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -125,7 +125,7 @@ func (client *CollectionPartitionClient) listMetricsHandleResponse(resp *http.Re // NewListUsagesPager - Retrieves the usages (most recent storage data) for the given collection, split by partition. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseRid - Cosmos DB database rid. @@ -187,7 +187,7 @@ func (client *CollectionPartitionClient) listUsagesCreateRequest(ctx context.Con if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/collectionpartition_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/collectionpartition_client_example_test.go deleted file mode 100644 index 2a1740acf16b..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/collectionpartition_client_example_test.go +++ /dev/null @@ -1,124 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCollectionPartitionGetMetrics.json -func ExampleCollectionPartitionClient_NewListMetricsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCollectionPartitionClient().NewListMetricsPager("rg1", "ddb1", "databaseRid", "collectionRid", "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PartitionMetricListResult = armcosmos.PartitionMetricListResult{ - // Value: []*armcosmos.PartitionMetric{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Max RUs Per Second"), - // Value: to.Ptr("Max RUs Per Second"), - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T23:58:55.278Z"); return t}()), - // MetricValues: []*armcosmos.MetricValue{ - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:54:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:55:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:56:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:57:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:58:55.278Z"); return t}()), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // TimeGrain: to.Ptr("PT1M"), - // Unit: to.Ptr(armcosmos.UnitTypeCount), - // PartitionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PartitionKeyRangeID: to.Ptr("0"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCollectionPartitionGetUsages.json -func ExampleCollectionPartitionClient_NewListUsagesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCollectionPartitionClient().NewListUsagesPager("rg1", "ddb1", "databaseRid", "collectionRid", &armcosmos.CollectionPartitionClientListUsagesOptions{Filter: to.Ptr("$filter=name.value eq 'Partition Storage'")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PartitionUsagesResult = armcosmos.PartitionUsagesResult{ - // Value: []*armcosmos.PartitionUsage{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Storage"), - // Value: to.Ptr("Storage"), - // }, - // CurrentValue: to.Ptr[int64](0), - // Limit: to.Ptr[int64](10737418240), - // QuotaPeriod: to.Ptr("P1D"), - // Unit: to.Ptr(armcosmos.UnitTypeBytes), - // PartitionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PartitionKeyRangeID: to.Ptr("0"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/collectionpartitionregion_client.go b/sdk/resourcemanager/cosmos/armcosmos/collectionpartitionregion_client.go index a3c2dd4f09bf..34ccc0f183be 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/collectionpartitionregion_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/collectionpartitionregion_client.go @@ -46,7 +46,7 @@ func NewCollectionPartitionRegionClient(subscriptionID string, credential azcore // NewListMetricsPager - Retrieves the metrics determined by the given filter for the given collection and region, split by // partition. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - region - Cosmos DB region, with spaces between words and each word capitalized. @@ -114,7 +114,7 @@ func (client *CollectionPartitionRegionClient) listMetricsCreateRequest(ctx cont } reqQP := req.Raw().URL.Query() reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/collectionpartitionregion_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/collectionpartitionregion_client_example_test.go deleted file mode 100644 index bf4dc5e15632..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/collectionpartitionregion_client_example_test.go +++ /dev/null @@ -1,83 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBCollectionPartitionRegionGetMetrics.json -func ExampleCollectionPartitionRegionClient_NewListMetricsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCollectionPartitionRegionClient().NewListMetricsPager("rg1", "ddb1", "North Europe", "databaseRid", "collectionRid", "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PartitionMetricListResult = armcosmos.PartitionMetricListResult{ - // Value: []*armcosmos.PartitionMetric{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Max RUs Per Second"), - // Value: to.Ptr("Max RUs Per Second"), - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T23:58:55.278Z"); return t}()), - // MetricValues: []*armcosmos.MetricValue{ - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:54:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:55:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:56:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:57:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:58:55.278Z"); return t}()), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // TimeGrain: to.Ptr("PT1M"), - // Unit: to.Ptr(armcosmos.UnitTypeCount), - // PartitionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PartitionKeyRangeID: to.Ptr("0"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/collectionregion_client.go b/sdk/resourcemanager/cosmos/armcosmos/collectionregion_client.go index c9232dc8c761..9c4f350a5fbf 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/collectionregion_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/collectionregion_client.go @@ -46,7 +46,7 @@ func NewCollectionRegionClient(subscriptionID string, credential azcore.TokenCre // NewListMetricsPager - Retrieves the metrics determined by the given filter for the given database account, collection and // region. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - region - Cosmos DB region, with spaces between words and each word capitalized. @@ -114,7 +114,7 @@ func (client *CollectionRegionClient) listMetricsCreateRequest(ctx context.Conte } reqQP := req.Raw().URL.Query() reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/collectionregion_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/collectionregion_client_example_test.go deleted file mode 100644 index ef2b42e2d959..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/collectionregion_client_example_test.go +++ /dev/null @@ -1,81 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBRegionCollectionGetMetrics.json -func ExampleCollectionRegionClient_NewListMetricsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCollectionRegionClient().NewListMetricsPager("rg1", "ddb1", "North Europe", "databaseRid", "collectionRid", "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricListResult = armcosmos.MetricListResult{ - // Value: []*armcosmos.Metric{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Total Requests"), - // Value: to.Ptr("Total Requests"), - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:13:55.278Z"); return t}()), - // MetricValues: []*armcosmos.MetricValue{ - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:58:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:03:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:08:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // TimeGrain: to.Ptr("PT5M"), - // Unit: to.Ptr(armcosmos.UnitTypeCount), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/constants.go b/sdk/resourcemanager/cosmos/armcosmos/constants.go index 5ed36c9bfd60..4f89be13de62 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/constants.go +++ b/sdk/resourcemanager/cosmos/armcosmos/constants.go @@ -10,7 +10,7 @@ package armcosmos const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos" - moduleVersion = "v3.0.0" + moduleVersion = "v4.0.0-beta.1" ) // APIType - Enum to indicate the API type of the restorable database account. @@ -37,6 +37,24 @@ func PossibleAPITypeValues() []APIType { } } +// AccessRuleDirection - Direction of Access Rule +type AccessRuleDirection string + +const ( + // AccessRuleDirectionInbound - Applies to inbound network traffic to the secured resources. + AccessRuleDirectionInbound AccessRuleDirection = "Inbound" + // AccessRuleDirectionOutbound - Applies to outbound network traffic from the secured resources + AccessRuleDirectionOutbound AccessRuleDirection = "Outbound" +) + +// PossibleAccessRuleDirectionValues returns the possible values for the AccessRuleDirection const type. +func PossibleAccessRuleDirectionValues() []AccessRuleDirection { + return []AccessRuleDirection{ + AccessRuleDirectionInbound, + AccessRuleDirectionOutbound, + } +} + // AnalyticalStorageSchemaType - Describes the types of schema for analytical storage. type AnalyticalStorageSchemaType string @@ -73,6 +91,24 @@ func PossibleAuthenticationMethodValues() []AuthenticationMethod { } } +// AutoReplicate - The form of AutoReplicate that is being used by this cluster. +type AutoReplicate string + +const ( + AutoReplicateAllKeyspaces AutoReplicate = "AllKeyspaces" + AutoReplicateNone AutoReplicate = "None" + AutoReplicateSystemKeyspaces AutoReplicate = "SystemKeyspaces" +) + +// PossibleAutoReplicateValues returns the possible values for the AutoReplicate const type. +func PossibleAutoReplicateValues() []AutoReplicate { + return []AutoReplicate{ + AutoReplicateAllKeyspaces, + AutoReplicateNone, + AutoReplicateSystemKeyspaces, + } +} + // AzureConnectionType - How to connect to the azure services needed for running the cluster type AzureConnectionType string @@ -125,6 +161,26 @@ func PossibleBackupPolicyTypeValues() []BackupPolicyType { } } +// BackupState - The current state of the backup. +type BackupState string + +const ( + BackupStateFailed BackupState = "Failed" + BackupStateInProgress BackupState = "InProgress" + BackupStateInitiated BackupState = "Initiated" + BackupStateSucceeded BackupState = "Succeeded" +) + +// PossibleBackupStateValues returns the possible values for the BackupState const type. +func PossibleBackupStateValues() []BackupState { + return []BackupState{ + BackupStateFailed, + BackupStateInProgress, + BackupStateInitiated, + BackupStateSucceeded, + } +} + // BackupStorageRedundancy - Enum to indicate type of backup storage redundancy. type BackupStorageRedundancy string @@ -143,6 +199,86 @@ func PossibleBackupStorageRedundancyValues() []BackupStorageRedundancy { } } +// CapacityMode - Indicates the capacity mode of the account. +type CapacityMode string + +const ( + CapacityModeNone CapacityMode = "None" + CapacityModeProvisioned CapacityMode = "Provisioned" + CapacityModeServerless CapacityMode = "Serverless" +) + +// PossibleCapacityModeValues returns the possible values for the CapacityMode const type. +func PossibleCapacityModeValues() []CapacityMode { + return []CapacityMode{ + CapacityModeNone, + CapacityModeProvisioned, + CapacityModeServerless, + } +} + +// CapacityModeTransitionStatus - The transition status of capacity mode. +type CapacityModeTransitionStatus string + +const ( + CapacityModeTransitionStatusCompleted CapacityModeTransitionStatus = "Completed" + CapacityModeTransitionStatusFailed CapacityModeTransitionStatus = "Failed" + CapacityModeTransitionStatusInProgress CapacityModeTransitionStatus = "InProgress" + CapacityModeTransitionStatusInitialized CapacityModeTransitionStatus = "Initialized" + CapacityModeTransitionStatusInvalid CapacityModeTransitionStatus = "Invalid" +) + +// PossibleCapacityModeTransitionStatusValues returns the possible values for the CapacityModeTransitionStatus const type. +func PossibleCapacityModeTransitionStatusValues() []CapacityModeTransitionStatus { + return []CapacityModeTransitionStatus{ + CapacityModeTransitionStatusCompleted, + CapacityModeTransitionStatusFailed, + CapacityModeTransitionStatusInProgress, + CapacityModeTransitionStatusInitialized, + CapacityModeTransitionStatusInvalid, + } +} + +// ClusterType - Type of the cluster. If set to Production, some operations might not be permitted on cluster. +type ClusterType string + +const ( + ClusterTypeNonProduction ClusterType = "NonProduction" + ClusterTypeProduction ClusterType = "Production" +) + +// PossibleClusterTypeValues returns the possible values for the ClusterType const type. +func PossibleClusterTypeValues() []ClusterType { + return []ClusterType{ + ClusterTypeNonProduction, + ClusterTypeProduction, + } +} + +// CommandStatus - Status of the command. +type CommandStatus string + +const ( + CommandStatusDone CommandStatus = "Done" + CommandStatusEnqueue CommandStatus = "Enqueue" + CommandStatusFailed CommandStatus = "Failed" + CommandStatusFinished CommandStatus = "Finished" + CommandStatusProcessing CommandStatus = "Processing" + CommandStatusRunning CommandStatus = "Running" +) + +// PossibleCommandStatusValues returns the possible values for the CommandStatus const type. +func PossibleCommandStatusValues() []CommandStatus { + return []CommandStatus{ + CommandStatusDone, + CommandStatusEnqueue, + CommandStatusFailed, + CommandStatusFinished, + CommandStatusProcessing, + CommandStatusRunning, + } +} + // CompositePathSortOrder - Sort order for composite paths. type CompositePathSortOrder string @@ -265,6 +401,43 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +type DataTransferComponent string + +const ( + DataTransferComponentAzureBlobStorage DataTransferComponent = "AzureBlobStorage" + DataTransferComponentCosmosDBCassandra DataTransferComponent = "CosmosDBCassandra" + DataTransferComponentCosmosDBMongo DataTransferComponent = "CosmosDBMongo" + DataTransferComponentCosmosDBMongoVCore DataTransferComponent = "CosmosDBMongoVCore" + DataTransferComponentCosmosDBSQL DataTransferComponent = "CosmosDBSql" +) + +// PossibleDataTransferComponentValues returns the possible values for the DataTransferComponent const type. +func PossibleDataTransferComponentValues() []DataTransferComponent { + return []DataTransferComponent{ + DataTransferComponentAzureBlobStorage, + DataTransferComponentCosmosDBCassandra, + DataTransferComponentCosmosDBMongo, + DataTransferComponentCosmosDBMongoVCore, + DataTransferComponentCosmosDBSQL, + } +} + +// DataTransferJobMode - Mode of job execution +type DataTransferJobMode string + +const ( + DataTransferJobModeOffline DataTransferJobMode = "Offline" + DataTransferJobModeOnline DataTransferJobMode = "Online" +) + +// PossibleDataTransferJobModeValues returns the possible values for the DataTransferJobMode const type. +func PossibleDataTransferJobModeValues() []DataTransferJobMode { + return []DataTransferJobMode{ + DataTransferJobModeOffline, + DataTransferJobModeOnline, + } +} + // DataType - The datatype for which the indexing behavior is applied to. type DataType string @@ -345,6 +518,40 @@ func PossibleDefaultConsistencyLevelValues() []DefaultConsistencyLevel { } } +// DefaultPriorityLevel - Enum to indicate default priorityLevel of requests +type DefaultPriorityLevel string + +const ( + DefaultPriorityLevelHigh DefaultPriorityLevel = "High" + DefaultPriorityLevelLow DefaultPriorityLevel = "Low" +) + +// PossibleDefaultPriorityLevelValues returns the possible values for the DefaultPriorityLevel const type. +func PossibleDefaultPriorityLevelValues() []DefaultPriorityLevel { + return []DefaultPriorityLevel{ + DefaultPriorityLevelHigh, + DefaultPriorityLevelLow, + } +} + +// EnableFullTextQuery - Describe the level of detail with which queries are to be logged. +type EnableFullTextQuery string + +const ( + EnableFullTextQueryFalse EnableFullTextQuery = "False" + EnableFullTextQueryNone EnableFullTextQuery = "None" + EnableFullTextQueryTrue EnableFullTextQuery = "True" +) + +// PossibleEnableFullTextQueryValues returns the possible values for the EnableFullTextQuery const type. +func PossibleEnableFullTextQueryValues() []EnableFullTextQuery { + return []EnableFullTextQuery{ + EnableFullTextQueryFalse, + EnableFullTextQueryNone, + EnableFullTextQueryTrue, + } +} + // IndexKind - Indicates the type of index. type IndexKind string @@ -381,6 +588,33 @@ func PossibleIndexingModeValues() []IndexingMode { } } +// IssueType - Type of issue +type IssueType string + +const ( + // IssueTypeConfigurationPropagationFailure - An error occurred while applying the network security perimeter (NSP) configuration. + IssueTypeConfigurationPropagationFailure IssueType = "ConfigurationPropagationFailure" + // IssueTypeMissingIdentityConfiguration - An managed identity hasn't been associated with the resource. The resource will + // still be able to validate inbound traffic from the network security perimeter (NSP) or matching inbound access rules, but + // it won't be able to perform outbound access as a member of the NSP. + IssueTypeMissingIdentityConfiguration IssueType = "MissingIdentityConfiguration" + // IssueTypeMissingPerimeterConfiguration - A network connectivity issue is happening on the resource which could be addressed + // either by adding new resources to the network security perimeter (NSP) or by modifying access rules. + IssueTypeMissingPerimeterConfiguration IssueType = "MissingPerimeterConfiguration" + // IssueTypeUnknown - Unknown issue type + IssueTypeUnknown IssueType = "Unknown" +) + +// PossibleIssueTypeValues returns the possible values for the IssueType const type. +func PossibleIssueTypeValues() []IssueType { + return []IssueType{ + IssueTypeConfigurationPropagationFailure, + IssueTypeMissingIdentityConfiguration, + IssueTypeMissingPerimeterConfiguration, + IssueTypeUnknown, + } +} + // KeyKind - The access key to regenerate. type KeyKind string @@ -461,8 +695,8 @@ func PossibleManagedCassandraResourceIdentityTypeValues() []ManagedCassandraReso } } -// MinimalTLSVersion - Indicates the minimum allowed Tls version. The default value is Tls 1.2. Cassandra and Mongo APIs only -// work with Tls 1.2. +// MinimalTLSVersion - Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, +// which only work with Tls 1.2. type MinimalTLSVersion string const ( @@ -512,6 +746,33 @@ func PossibleNetworkACLBypassValues() []NetworkACLBypass { } } +// NetworkSecurityPerimeterConfigurationProvisioningState - Provisioning state of a network security perimeter configuration +// that is being created or updated. +type NetworkSecurityPerimeterConfigurationProvisioningState string + +const ( + NetworkSecurityPerimeterConfigurationProvisioningStateAccepted NetworkSecurityPerimeterConfigurationProvisioningState = "Accepted" + NetworkSecurityPerimeterConfigurationProvisioningStateCanceled NetworkSecurityPerimeterConfigurationProvisioningState = "Canceled" + NetworkSecurityPerimeterConfigurationProvisioningStateCreating NetworkSecurityPerimeterConfigurationProvisioningState = "Creating" + NetworkSecurityPerimeterConfigurationProvisioningStateDeleting NetworkSecurityPerimeterConfigurationProvisioningState = "Deleting" + NetworkSecurityPerimeterConfigurationProvisioningStateFailed NetworkSecurityPerimeterConfigurationProvisioningState = "Failed" + NetworkSecurityPerimeterConfigurationProvisioningStateSucceeded NetworkSecurityPerimeterConfigurationProvisioningState = "Succeeded" + NetworkSecurityPerimeterConfigurationProvisioningStateUpdating NetworkSecurityPerimeterConfigurationProvisioningState = "Updating" +) + +// PossibleNetworkSecurityPerimeterConfigurationProvisioningStateValues returns the possible values for the NetworkSecurityPerimeterConfigurationProvisioningState const type. +func PossibleNetworkSecurityPerimeterConfigurationProvisioningStateValues() []NetworkSecurityPerimeterConfigurationProvisioningState { + return []NetworkSecurityPerimeterConfigurationProvisioningState{ + NetworkSecurityPerimeterConfigurationProvisioningStateAccepted, + NetworkSecurityPerimeterConfigurationProvisioningStateCanceled, + NetworkSecurityPerimeterConfigurationProvisioningStateCreating, + NetworkSecurityPerimeterConfigurationProvisioningStateDeleting, + NetworkSecurityPerimeterConfigurationProvisioningStateFailed, + NetworkSecurityPerimeterConfigurationProvisioningStateSucceeded, + NetworkSecurityPerimeterConfigurationProvisioningStateUpdating, + } +} + // NodeState - The state of the node in Cassandra ring. type NodeState string @@ -646,6 +907,29 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { } } +// ResourceAssociationAccessMode - Access mode of the resource association +type ResourceAssociationAccessMode string + +const ( + // ResourceAssociationAccessModeAudit - Audit access mode - traffic to the resource that fails access checks is logged but + // not blocked + ResourceAssociationAccessModeAudit ResourceAssociationAccessMode = "Audit" + // ResourceAssociationAccessModeEnforced - Enforced access mode - traffic to the resource that failed access checks is blocked + ResourceAssociationAccessModeEnforced ResourceAssociationAccessMode = "Enforced" + // ResourceAssociationAccessModeLearning - Learning access mode - traffic to the resource is enabled for analysis but not + // blocked + ResourceAssociationAccessModeLearning ResourceAssociationAccessMode = "Learning" +) + +// PossibleResourceAssociationAccessModeValues returns the possible values for the ResourceAssociationAccessMode const type. +func PossibleResourceAssociationAccessModeValues() []ResourceAssociationAccessMode { + return []ResourceAssociationAccessMode{ + ResourceAssociationAccessModeAudit, + ResourceAssociationAccessModeEnforced, + ResourceAssociationAccessModeLearning, + } +} + // ResourceIdentityType - 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. @@ -698,13 +982,32 @@ func PossibleRoleDefinitionTypeValues() []RoleDefinitionType { } } -// ServerVersion - Describes the ServerVersion of an a MongoDB account. +// ScheduledEventStrategy - How the nodes in the cluster react to scheduled events +type ScheduledEventStrategy string + +const ( + ScheduledEventStrategyIgnore ScheduledEventStrategy = "Ignore" + ScheduledEventStrategyStopAny ScheduledEventStrategy = "StopAny" + ScheduledEventStrategyStopByRack ScheduledEventStrategy = "StopByRack" +) + +// PossibleScheduledEventStrategyValues returns the possible values for the ScheduledEventStrategy const type. +func PossibleScheduledEventStrategyValues() []ScheduledEventStrategy { + return []ScheduledEventStrategy{ + ScheduledEventStrategyIgnore, + ScheduledEventStrategyStopAny, + ScheduledEventStrategyStopByRack, + } +} + +// ServerVersion - Describes the version of the MongoDB account. type ServerVersion string const ( ServerVersionFive0 ServerVersion = "5.0" ServerVersionFour0 ServerVersion = "4.0" ServerVersionFour2 ServerVersion = "4.2" + ServerVersionSeven0 ServerVersion = "7.0" ServerVersionSix0 ServerVersion = "6.0" ServerVersionThree2 ServerVersion = "3.2" ServerVersionThree6 ServerVersion = "3.6" @@ -716,6 +1019,7 @@ func PossibleServerVersionValues() []ServerVersion { ServerVersionFive0, ServerVersionFour0, ServerVersionFour2, + ServerVersionSeven0, ServerVersionSix0, ServerVersionThree2, ServerVersionThree6, @@ -784,6 +1088,22 @@ func PossibleServiceTypeValues() []ServiceType { } } +// Severity - Severity of the issue. +type Severity string + +const ( + SeverityError Severity = "Error" + SeverityWarning Severity = "Warning" +) + +// PossibleSeverityValues returns the possible values for the Severity const type. +func PossibleSeverityValues() []Severity { + return []Severity{ + SeverityError, + SeverityWarning, + } +} + // SpatialType - Indicates the spatial type of index. type SpatialType string @@ -808,21 +1128,63 @@ func PossibleSpatialTypeValues() []SpatialType { type Status string const ( + StatusCanceled Status = "Canceled" StatusDeleting Status = "Deleting" + StatusFailed Status = "Failed" StatusInitializing Status = "Initializing" StatusInternallyReady Status = "InternallyReady" StatusOnline Status = "Online" + StatusSucceeded Status = "Succeeded" StatusUninitialized Status = "Uninitialized" + StatusUpdating Status = "Updating" ) // PossibleStatusValues returns the possible values for the Status const type. func PossibleStatusValues() []Status { return []Status{ + StatusCanceled, StatusDeleting, + StatusFailed, StatusInitializing, StatusInternallyReady, StatusOnline, + StatusSucceeded, StatusUninitialized, + StatusUpdating, + } +} + +// SupportedActions - Indicates whether what action to take for the Chaos Fault. +type SupportedActions string + +const ( + SupportedActionsDisable SupportedActions = "Disable" + SupportedActionsEnable SupportedActions = "Enable" +) + +// PossibleSupportedActionsValues returns the possible values for the SupportedActions const type. +func PossibleSupportedActionsValues() []SupportedActions { + return []SupportedActions{ + SupportedActionsDisable, + SupportedActionsEnable, + } +} + +// ThroughputPolicyType - ThroughputPolicy to apply for throughput redistribution +type ThroughputPolicyType string + +const ( + ThroughputPolicyTypeCustom ThroughputPolicyType = "custom" + ThroughputPolicyTypeEqual ThroughputPolicyType = "equal" + ThroughputPolicyTypeNone ThroughputPolicyType = "none" +) + +// PossibleThroughputPolicyTypeValues returns the possible values for the ThroughputPolicyType const type. +func PossibleThroughputPolicyTypeValues() []ThroughputPolicyType { + return []ThroughputPolicyType{ + ThroughputPolicyTypeCustom, + ThroughputPolicyTypeEqual, + ThroughputPolicyTypeNone, } } diff --git a/sdk/resourcemanager/cosmos/armcosmos/database_client.go b/sdk/resourcemanager/cosmos/armcosmos/database_client.go index 8778af96d42f..63777ff5f380 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/database_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/database_client.go @@ -45,7 +45,7 @@ func NewDatabaseClient(subscriptionID string, credential azcore.TokenCredential, // NewListMetricDefinitionsPager - Retrieves metric definitions for the given database. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseRid - Cosmos DB database rid. @@ -99,7 +99,7 @@ func (client *DatabaseClient) listMetricDefinitionsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -116,7 +116,7 @@ func (client *DatabaseClient) listMetricDefinitionsHandleResponse(resp *http.Res // NewListMetricsPager - Retrieves the metrics determined by the given filter for the given database account and database. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseRid - Cosmos DB database rid. @@ -174,7 +174,7 @@ func (client *DatabaseClient) listMetricsCreateRequest(ctx context.Context, reso } reqQP := req.Raw().URL.Query() reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -191,7 +191,7 @@ func (client *DatabaseClient) listMetricsHandleResponse(resp *http.Response) (Da // NewListUsagesPager - Retrieves the usages (most recent data) for the given database. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseRid - Cosmos DB database rid. @@ -247,7 +247,7 @@ func (client *DatabaseClient) listUsagesCreateRequest(ctx context.Context, resou if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/database_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/database_client_example_test.go deleted file mode 100644 index 6708fc6c754c..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/database_client_example_test.go +++ /dev/null @@ -1,170 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseGetMetrics.json -func ExampleDatabaseClient_NewListMetricsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseClient().NewListMetricsPager("rg1", "ddb1", "rid", "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricListResult = armcosmos.MetricListResult{ - // Value: []*armcosmos.Metric{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Total Requests"), - // Value: to.Ptr("Total Requests"), - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:13:55.278Z"); return t}()), - // MetricValues: []*armcosmos.MetricValue{ - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:58:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:03:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:08:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // TimeGrain: to.Ptr("PT5M"), - // Unit: to.Ptr(armcosmos.UnitTypeCount), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseGetUsages.json -func ExampleDatabaseClient_NewListUsagesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseClient().NewListUsagesPager("rg1", "ddb1", "databaseRid", &armcosmos.DatabaseClientListUsagesOptions{Filter: to.Ptr("$filter=name.value eq 'Storage'")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.UsagesResult = armcosmos.UsagesResult{ - // Value: []*armcosmos.Usage{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Storage"), - // Value: to.Ptr("Storage"), - // }, - // CurrentValue: to.Ptr[int64](0), - // Limit: to.Ptr[int64](10737418240), - // QuotaPeriod: to.Ptr("P1D"), - // Unit: to.Ptr(armcosmos.UnitTypeBytes), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseGetMetricDefinitions.json -func ExampleDatabaseClient_NewListMetricDefinitionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseClient().NewListMetricDefinitionsPager("rg1", "ddb1", "databaseRid", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricDefinitionsListResult = armcosmos.MetricDefinitionsListResult{ - // Value: []*armcosmos.MetricDefinition{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Total Requests"), - // Value: to.Ptr("Total Requests"), - // }, - // MetricAvailabilities: []*armcosmos.MetricAvailability{ - // { - // Retention: to.Ptr("P2D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P60D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armcosmos.PrimaryAggregationTypeTotal), - // ResourceURI: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1"), - // Unit: to.Ptr(armcosmos.UnitTypeCount), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/databaseaccountregion_client.go b/sdk/resourcemanager/cosmos/armcosmos/databaseaccountregion_client.go index 05fa685a5398..4a0a03018814 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/databaseaccountregion_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/databaseaccountregion_client.go @@ -45,7 +45,7 @@ func NewDatabaseAccountRegionClient(subscriptionID string, credential azcore.Tok // NewListMetricsPager - Retrieves the metrics determined by the given filter for the given database account and region. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - region - Cosmos DB region, with spaces between words and each word capitalized. @@ -103,7 +103,7 @@ func (client *DatabaseAccountRegionClient) listMetricsCreateRequest(ctx context. } reqQP := req.Raw().URL.Query() reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/databaseaccountregion_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/databaseaccountregion_client_example_test.go deleted file mode 100644 index 86d82651231b..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/databaseaccountregion_client_example_test.go +++ /dev/null @@ -1,81 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountRegionGetMetrics.json -func ExampleDatabaseAccountRegionClient_NewListMetricsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseAccountRegionClient().NewListMetricsPager("rg1", "ddb1", "North Europe", "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricListResult = armcosmos.MetricListResult{ - // Value: []*armcosmos.Metric{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Total Requests"), - // Value: to.Ptr("Total Requests"), - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:13:55.278Z"); return t}()), - // MetricValues: []*armcosmos.MetricValue{ - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:58:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:03:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:08:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // TimeGrain: to.Ptr("PT5M"), - // Unit: to.Ptr(armcosmos.UnitTypeCount), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/databaseaccounts_client.go b/sdk/resourcemanager/cosmos/armcosmos/databaseaccounts_client.go index 02d295dce52a..f4360763176d 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/databaseaccounts_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/databaseaccounts_client.go @@ -46,7 +46,7 @@ func NewDatabaseAccountsClient(subscriptionID string, credential azcore.TokenCre // CheckNameExists - Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase // letters, numbers, and the '-' character, and must be between 3 and 50 characters. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - accountName - Cosmos DB database account name. // - options - DatabaseAccountsClientCheckNameExistsOptions contains the optional parameters for the DatabaseAccountsClient.CheckNameExists // method. @@ -83,7 +83,7 @@ func (client *DatabaseAccountsClient) checkNameExistsCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -92,7 +92,7 @@ func (client *DatabaseAccountsClient) checkNameExistsCreateRequest(ctx context.C // updates on an account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - createUpdateParameters - The parameters to provide for the current database account. @@ -119,7 +119,7 @@ func (client *DatabaseAccountsClient) BeginCreateOrUpdate(ctx context.Context, r // updates on an account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *DatabaseAccountsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters, options *DatabaseAccountsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "DatabaseAccountsClient.BeginCreateOrUpdate" @@ -161,7 +161,7 @@ func (client *DatabaseAccountsClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateParameters); err != nil { @@ -173,7 +173,7 @@ func (client *DatabaseAccountsClient) createOrUpdateCreateRequest(ctx context.Co // BeginDelete - Deletes an existing Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - DatabaseAccountsClientBeginDeleteOptions contains the optional parameters for the DatabaseAccountsClient.BeginDelete @@ -198,7 +198,7 @@ func (client *DatabaseAccountsClient) BeginDelete(ctx context.Context, resourceG // Delete - Deletes an existing Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *DatabaseAccountsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, options *DatabaseAccountsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "DatabaseAccountsClient.BeginDelete" @@ -240,7 +240,7 @@ func (client *DatabaseAccountsClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -250,7 +250,7 @@ func (client *DatabaseAccountsClient) deleteCreateRequest(ctx context.Context, r // Failover priority values must be unique for each of the regions in which the database account exists. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - failoverParameters - The new failover policies for the database account. @@ -278,7 +278,7 @@ func (client *DatabaseAccountsClient) BeginFailoverPriorityChange(ctx context.Co // Failover priority values must be unique for each of the regions in which the database account exists. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *DatabaseAccountsClient) failoverPriorityChange(ctx context.Context, resourceGroupName string, accountName string, failoverParameters FailoverPolicies, options *DatabaseAccountsClientBeginFailoverPriorityChangeOptions) (*http.Response, error) { var err error const operationName = "DatabaseAccountsClient.BeginFailoverPriorityChange" @@ -320,7 +320,7 @@ func (client *DatabaseAccountsClient) failoverPriorityChangeCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if err := runtime.MarshalAsJSON(req, failoverParameters); err != nil { return nil, err @@ -331,7 +331,7 @@ func (client *DatabaseAccountsClient) failoverPriorityChangeCreateRequest(ctx co // Get - Retrieves the properties of an existing Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - DatabaseAccountsClientGetOptions contains the optional parameters for the DatabaseAccountsClient.Get method. @@ -377,7 +377,7 @@ func (client *DatabaseAccountsClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -395,7 +395,7 @@ func (client *DatabaseAccountsClient) getHandleResponse(resp *http.Response) (Da // GetReadOnlyKeys - Lists the read-only access keys for the specified Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - DatabaseAccountsClientGetReadOnlyKeysOptions contains the optional parameters for the DatabaseAccountsClient.GetReadOnlyKeys @@ -442,7 +442,7 @@ func (client *DatabaseAccountsClient) getReadOnlyKeysCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -459,7 +459,7 @@ func (client *DatabaseAccountsClient) getReadOnlyKeysHandleResponse(resp *http.R // NewListPager - Lists all the Azure Cosmos DB database accounts available under the subscription. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - options - DatabaseAccountsClientListOptions contains the optional parameters for the DatabaseAccountsClient.NewListPager // method. func (client *DatabaseAccountsClient) NewListPager(options *DatabaseAccountsClientListOptions) *runtime.Pager[DatabaseAccountsClientListResponse] { @@ -498,7 +498,7 @@ func (client *DatabaseAccountsClient) listCreateRequest(ctx context.Context, opt return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -515,7 +515,7 @@ func (client *DatabaseAccountsClient) listHandleResponse(resp *http.Response) (D // NewListByResourceGroupPager - Lists all the Azure Cosmos DB database accounts available under the given resource group. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - DatabaseAccountsClientListByResourceGroupOptions contains the optional parameters for the DatabaseAccountsClient.NewListByResourceGroupPager // method. @@ -559,7 +559,7 @@ func (client *DatabaseAccountsClient) listByResourceGroupCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -577,7 +577,7 @@ func (client *DatabaseAccountsClient) listByResourceGroupHandleResponse(resp *ht // ListConnectionStrings - Lists the connection strings for the specified Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - DatabaseAccountsClientListConnectionStringsOptions contains the optional parameters for the DatabaseAccountsClient.ListConnectionStrings @@ -624,7 +624,7 @@ func (client *DatabaseAccountsClient) listConnectionStringsCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -642,7 +642,7 @@ func (client *DatabaseAccountsClient) listConnectionStringsHandleResponse(resp * // ListKeys - Lists the access keys for the specified Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - DatabaseAccountsClientListKeysOptions contains the optional parameters for the DatabaseAccountsClient.ListKeys @@ -689,7 +689,7 @@ func (client *DatabaseAccountsClient) listKeysCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -706,7 +706,7 @@ func (client *DatabaseAccountsClient) listKeysHandleResponse(resp *http.Response // NewListMetricDefinitionsPager - Retrieves metric definitions for the given database account. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - DatabaseAccountsClientListMetricDefinitionsOptions contains the optional parameters for the DatabaseAccountsClient.NewListMetricDefinitionsPager @@ -755,7 +755,7 @@ func (client *DatabaseAccountsClient) listMetricDefinitionsCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -772,7 +772,7 @@ func (client *DatabaseAccountsClient) listMetricDefinitionsHandleResponse(resp * // NewListMetricsPager - Retrieves the metrics determined by the given filter for the given database account. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - filter - An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are @@ -825,7 +825,7 @@ func (client *DatabaseAccountsClient) listMetricsCreateRequest(ctx context.Conte } reqQP := req.Raw().URL.Query() reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -843,7 +843,7 @@ func (client *DatabaseAccountsClient) listMetricsHandleResponse(resp *http.Respo // ListReadOnlyKeys - Lists the read-only access keys for the specified Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - DatabaseAccountsClientListReadOnlyKeysOptions contains the optional parameters for the DatabaseAccountsClient.ListReadOnlyKeys @@ -890,7 +890,7 @@ func (client *DatabaseAccountsClient) listReadOnlyKeysCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -907,7 +907,7 @@ func (client *DatabaseAccountsClient) listReadOnlyKeysHandleResponse(resp *http. // NewListUsagesPager - Retrieves the usages (most recent data) for the given database account. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - DatabaseAccountsClientListUsagesOptions contains the optional parameters for the DatabaseAccountsClient.NewListUsagesPager @@ -959,7 +959,7 @@ func (client *DatabaseAccountsClient) listUsagesCreateRequest(ctx context.Contex if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -977,7 +977,7 @@ func (client *DatabaseAccountsClient) listUsagesHandleResponse(resp *http.Respon // BeginOfflineRegion - Offline the specified region for the specified Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - regionParameterForOffline - Cosmos DB region to offline for the database account. @@ -1003,7 +1003,7 @@ func (client *DatabaseAccountsClient) BeginOfflineRegion(ctx context.Context, re // OfflineRegion - Offline the specified region for the specified Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *DatabaseAccountsClient) offlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline, options *DatabaseAccountsClientBeginOfflineRegionOptions) (*http.Response, error) { var err error const operationName = "DatabaseAccountsClient.BeginOfflineRegion" @@ -1045,7 +1045,7 @@ func (client *DatabaseAccountsClient) offlineRegionCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, regionParameterForOffline); err != nil { @@ -1057,7 +1057,7 @@ func (client *DatabaseAccountsClient) offlineRegionCreateRequest(ctx context.Con // BeginOnlineRegion - Online the specified region for the specified Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - regionParameterForOnline - Cosmos DB region to online for the database account. @@ -1083,7 +1083,7 @@ func (client *DatabaseAccountsClient) BeginOnlineRegion(ctx context.Context, res // OnlineRegion - Online the specified region for the specified Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *DatabaseAccountsClient) onlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline, options *DatabaseAccountsClientBeginOnlineRegionOptions) (*http.Response, error) { var err error const operationName = "DatabaseAccountsClient.BeginOnlineRegion" @@ -1125,7 +1125,7 @@ func (client *DatabaseAccountsClient) onlineRegionCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, regionParameterForOnline); err != nil { @@ -1137,7 +1137,7 @@ func (client *DatabaseAccountsClient) onlineRegionCreateRequest(ctx context.Cont // BeginRegenerateKey - Regenerates an access key for the specified Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyToRegenerate - The name of the key to regenerate. @@ -1163,7 +1163,7 @@ func (client *DatabaseAccountsClient) BeginRegenerateKey(ctx context.Context, re // RegenerateKey - Regenerates an access key for the specified Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *DatabaseAccountsClient) regenerateKey(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters, options *DatabaseAccountsClientBeginRegenerateKeyOptions) (*http.Response, error) { var err error const operationName = "DatabaseAccountsClient.BeginRegenerateKey" @@ -1205,7 +1205,7 @@ func (client *DatabaseAccountsClient) regenerateKeyCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if err := runtime.MarshalAsJSON(req, keyToRegenerate); err != nil { return nil, err @@ -1216,7 +1216,7 @@ func (client *DatabaseAccountsClient) regenerateKeyCreateRequest(ctx context.Con // BeginUpdate - Updates the properties of an existing Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - updateParameters - The parameters to provide for the current database account. @@ -1242,7 +1242,7 @@ func (client *DatabaseAccountsClient) BeginUpdate(ctx context.Context, resourceG // Update - Updates the properties of an existing Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *DatabaseAccountsClient) update(ctx context.Context, resourceGroupName string, accountName string, updateParameters DatabaseAccountUpdateParameters, options *DatabaseAccountsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "DatabaseAccountsClient.BeginUpdate" @@ -1284,7 +1284,7 @@ func (client *DatabaseAccountsClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, updateParameters); err != nil { diff --git a/sdk/resourcemanager/cosmos/armcosmos/databaseaccounts_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/databaseaccounts_client_example_test.go deleted file mode 100644 index 74df26a2e458..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/databaseaccounts_client_example_test.go +++ /dev/null @@ -1,1541 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountGet.json -func ExampleDatabaseAccountsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseAccountsClient().Get(ctx, "rg1", "ddb1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseAccountGetResults = armcosmos.DatabaseAccountGetResults{ - // Name: to.Ptr("ddb1"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Identity: &armcosmos.ManagedServiceIdentity{ - // Type: to.Ptr(armcosmos.ResourceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("52f4fef3-3c3f-4ff3-b52e-b5c9eeb68656"), - // TenantID: to.Ptr("33e01921-4d64-4f8c-a055-5bdaffd5e33d"), - // UserAssignedIdentities: map[string]*armcosmos.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // "/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": &armcosmos.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // ClientID: to.Ptr("fbe75b66-01c5-4f87-a220-233af3270436"), - // PrincipalID: to.Ptr("33e01921-4d64-4f8c-a055-5bdaffd5e33d"), - // }, - // }, - // }, - // Kind: to.Ptr(armcosmos.DatabaseAccountKindGlobalDocumentDB), - // Properties: &armcosmos.DatabaseAccountGetProperties{ - // AnalyticalStorageConfiguration: &armcosmos.AnalyticalStorageConfiguration{ - // SchemaType: to.Ptr(armcosmos.AnalyticalStorageSchemaTypeWellDefined), - // }, - // APIProperties: &armcosmos.APIProperties{ - // }, - // BackupPolicy: &armcosmos.PeriodicModeBackupPolicy{ - // Type: to.Ptr(armcosmos.BackupPolicyTypePeriodic), - // MigrationState: &armcosmos.BackupPolicyMigrationState{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T21:07:16.000Z"); return t}()), - // Status: to.Ptr(armcosmos.BackupPolicyMigrationStatusInProgress), - // TargetType: to.Ptr(armcosmos.BackupPolicyTypeContinuous), - // }, - // PeriodicModeProperties: &armcosmos.PeriodicModeProperties{ - // BackupIntervalInMinutes: to.Ptr[int32](240), - // BackupRetentionIntervalInHours: to.Ptr[int32](8), - // BackupStorageRedundancy: to.Ptr(armcosmos.BackupStorageRedundancyGeo), - // }, - // }, - // ConsistencyPolicy: &armcosmos.ConsistencyPolicy{ - // DefaultConsistencyLevel: to.Ptr(armcosmos.DefaultConsistencyLevelSession), - // MaxIntervalInSeconds: to.Ptr[int32](5), - // MaxStalenessPrefix: to.Ptr[int64](100), - // }, - // Cors: []*armcosmos.CorsPolicy{ - // }, - // CreateMode: to.Ptr(armcosmos.CreateModeDefault), - // DatabaseAccountOfferType: to.Ptr("Standard"), - // DefaultIdentity: to.Ptr("FirstPartyIdentity"), - // DisableKeyBasedMetadataWriteAccess: to.Ptr(false), - // DocumentEndpoint: to.Ptr("https://ddb1.documents.azure.com:443/"), - // EnableAnalyticalStorage: to.Ptr(true), - // EnableBurstCapacity: to.Ptr(true), - // EnableFreeTier: to.Ptr(false), - // EnablePartitionMerge: to.Ptr(true), - // FailoverPolicies: []*armcosmos.FailoverPolicy{ - // { - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-eastus"), - // LocationName: to.Ptr("East US"), - // }}, - // InstanceID: to.Ptr("d9b26648-2f53-4541-b3d8-3044f4f9810d"), - // IPRules: []*armcosmos.IPAddressOrRange{ - // }, - // IsVirtualNetworkFilterEnabled: to.Ptr(false), - // KeysMetadata: &armcosmos.DatabaseAccountKeysMetadata{ - // PrimaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // PrimaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // SecondaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // SecondaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // }, - // Locations: []*armcosmos.Location{ - // { - // DocumentEndpoint: to.Ptr("https://ddb1-eastus.documents.azure.com:443/"), - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-eastus"), - // LocationName: to.Ptr("East US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // MinimalTLSVersion: to.Ptr(armcosmos.MinimalTLSVersionTLS), - // NetworkACLBypass: to.Ptr(armcosmos.NetworkACLBypassNone), - // NetworkACLBypassResourceIDs: []*string{ - // }, - // PrivateEndpointConnections: []*armcosmos.PrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.DocumentDB/databaseAccounts/account1/privateEndpointConnections/pe1"), - // Properties: &armcosmos.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcosmos.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/privateEndpoints/pe1"), - // }, - // PrivateLinkServiceConnectionState: &armcosmos.PrivateLinkServiceConnectionStateProperty{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // ReadLocations: []*armcosmos.Location{ - // { - // DocumentEndpoint: to.Ptr("https://ddb1-eastus.documents.azure.com:443/"), - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-eastus"), - // LocationName: to.Ptr("East US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // VirtualNetworkRules: []*armcosmos.VirtualNetworkRule{ - // }, - // WriteLocations: []*armcosmos.Location{ - // { - // DocumentEndpoint: to.Ptr("https://ddb1-eastus.documents.azure.com:443/"), - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-eastus"), - // LocationName: to.Ptr("East US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountPatch.json -func ExampleDatabaseAccountsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabaseAccountsClient().BeginUpdate(ctx, "rg1", "ddb1", armcosmos.DatabaseAccountUpdateParameters{ - Identity: &armcosmos.ManagedServiceIdentity{ - Type: to.Ptr(armcosmos.ResourceIdentityTypeSystemAssignedUserAssigned), - UserAssignedIdentities: map[string]*armcosmos.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - "/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}, - }, - }, - Location: to.Ptr("westus"), - Properties: &armcosmos.DatabaseAccountUpdateProperties{ - AnalyticalStorageConfiguration: &armcosmos.AnalyticalStorageConfiguration{ - SchemaType: to.Ptr(armcosmos.AnalyticalStorageSchemaTypeWellDefined), - }, - BackupPolicy: &armcosmos.PeriodicModeBackupPolicy{ - Type: to.Ptr(armcosmos.BackupPolicyTypePeriodic), - PeriodicModeProperties: &armcosmos.PeriodicModeProperties{ - BackupIntervalInMinutes: to.Ptr[int32](240), - BackupRetentionIntervalInHours: to.Ptr[int32](720), - BackupStorageRedundancy: to.Ptr(armcosmos.BackupStorageRedundancyLocal), - }, - }, - Capacity: &armcosmos.Capacity{ - TotalThroughputLimit: to.Ptr[int32](2000), - }, - ConsistencyPolicy: &armcosmos.ConsistencyPolicy{ - DefaultConsistencyLevel: to.Ptr(armcosmos.DefaultConsistencyLevelBoundedStaleness), - MaxIntervalInSeconds: to.Ptr[int32](10), - MaxStalenessPrefix: to.Ptr[int64](200), - }, - DefaultIdentity: to.Ptr("FirstPartyIdentity"), - EnableAnalyticalStorage: to.Ptr(true), - EnableBurstCapacity: to.Ptr(true), - EnableFreeTier: to.Ptr(false), - EnablePartitionMerge: to.Ptr(true), - IPRules: []*armcosmos.IPAddressOrRange{ - { - IPAddressOrRange: to.Ptr("23.43.230.120"), - }, - { - IPAddressOrRange: to.Ptr("110.12.240.0/12"), - }}, - IsVirtualNetworkFilterEnabled: to.Ptr(true), - MinimalTLSVersion: to.Ptr(armcosmos.MinimalTLSVersionTLS), - NetworkACLBypass: to.Ptr(armcosmos.NetworkACLBypassAzureServices), - NetworkACLBypassResourceIDs: []*string{ - to.Ptr("/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName")}, - VirtualNetworkRules: []*armcosmos.VirtualNetworkRule{ - { - ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - IgnoreMissingVNetServiceEndpoint: to.Ptr(false), - }}, - }, - Tags: map[string]*string{ - "dept": to.Ptr("finance"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseAccountGetResults = armcosmos.DatabaseAccountGetResults{ - // Name: to.Ptr("ddb1"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "dept": to.Ptr("finance"), - // }, - // Identity: &armcosmos.ManagedServiceIdentity{ - // Type: to.Ptr(armcosmos.ResourceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("52f4fef3-3c3f-4ff3-b52e-b5c9eeb68656"), - // TenantID: to.Ptr("33e01921-4d64-4f8c-a055-5bdaffd5e33d"), - // UserAssignedIdentities: map[string]*armcosmos.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // "/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": &armcosmos.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // ClientID: to.Ptr("fbe75b66-01c5-4f87-a220-233af3270436"), - // PrincipalID: to.Ptr("33e01921-4d64-4f8c-a055-5bdaffd5e33d"), - // }, - // }, - // }, - // Kind: to.Ptr(armcosmos.DatabaseAccountKindGlobalDocumentDB), - // Properties: &armcosmos.DatabaseAccountGetProperties{ - // AnalyticalStorageConfiguration: &armcosmos.AnalyticalStorageConfiguration{ - // SchemaType: to.Ptr(armcosmos.AnalyticalStorageSchemaTypeWellDefined), - // }, - // APIProperties: &armcosmos.APIProperties{ - // }, - // BackupPolicy: &armcosmos.PeriodicModeBackupPolicy{ - // Type: to.Ptr(armcosmos.BackupPolicyTypePeriodic), - // PeriodicModeProperties: &armcosmos.PeriodicModeProperties{ - // BackupIntervalInMinutes: to.Ptr[int32](240), - // BackupRetentionIntervalInHours: to.Ptr[int32](720), - // BackupStorageRedundancy: to.Ptr(armcosmos.BackupStorageRedundancyLocal), - // }, - // }, - // Capacity: &armcosmos.Capacity{ - // TotalThroughputLimit: to.Ptr[int32](2000), - // }, - // ConsistencyPolicy: &armcosmos.ConsistencyPolicy{ - // DefaultConsistencyLevel: to.Ptr(armcosmos.DefaultConsistencyLevelBoundedStaleness), - // MaxIntervalInSeconds: to.Ptr[int32](10), - // MaxStalenessPrefix: to.Ptr[int64](200), - // }, - // Cors: []*armcosmos.CorsPolicy{ - // }, - // DatabaseAccountOfferType: to.Ptr("Standard"), - // DefaultIdentity: to.Ptr("FirstPartyIdentity"), - // DisableKeyBasedMetadataWriteAccess: to.Ptr(false), - // DocumentEndpoint: to.Ptr("https://ddb1.documents.azure.com:443/"), - // EnableAnalyticalStorage: to.Ptr(true), - // EnableBurstCapacity: to.Ptr(true), - // EnableFreeTier: to.Ptr(false), - // EnablePartitionMerge: to.Ptr(true), - // FailoverPolicies: []*armcosmos.FailoverPolicy{ - // { - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-eastus"), - // LocationName: to.Ptr("East US"), - // }}, - // IPRules: []*armcosmos.IPAddressOrRange{ - // { - // IPAddressOrRange: to.Ptr("23.43.230.120"), - // }, - // { - // IPAddressOrRange: to.Ptr("110.12.240.0/12"), - // }}, - // IsVirtualNetworkFilterEnabled: to.Ptr(true), - // KeysMetadata: &armcosmos.DatabaseAccountKeysMetadata{ - // PrimaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // PrimaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // SecondaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // SecondaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // }, - // Locations: []*armcosmos.Location{ - // { - // DocumentEndpoint: to.Ptr("https://ddb1-eastus.documents.azure.com:443/"), - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-eastus"), - // LocationName: to.Ptr("East US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // MinimalTLSVersion: to.Ptr(armcosmos.MinimalTLSVersionTLS), - // NetworkACLBypass: to.Ptr(armcosmos.NetworkACLBypassAzureServices), - // NetworkACLBypassResourceIDs: []*string{ - // to.Ptr("/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName")}, - // PrivateEndpointConnections: []*armcosmos.PrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.DocumentDB/databaseAccounts/account1/privateEndpointConnections/pe1"), - // Properties: &armcosmos.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcosmos.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/privateEndpoints/pe1"), - // }, - // PrivateLinkServiceConnectionState: &armcosmos.PrivateLinkServiceConnectionStateProperty{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // ReadLocations: []*armcosmos.Location{ - // { - // DocumentEndpoint: to.Ptr("https://ddb1-eastus.documents.azure.com:443/"), - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-eastus"), - // LocationName: to.Ptr("East US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // VirtualNetworkRules: []*armcosmos.VirtualNetworkRule{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // IgnoreMissingVNetServiceEndpoint: to.Ptr(false), - // }}, - // WriteLocations: []*armcosmos.Location{ - // { - // DocumentEndpoint: to.Ptr("https://ddb1-eastus.documents.azure.com:443/"), - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-eastus"), - // LocationName: to.Ptr("East US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountCreateMax.json -func ExampleDatabaseAccountsClient_BeginCreateOrUpdate_cosmosDbDatabaseAccountCreateMax() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabaseAccountsClient().BeginCreateOrUpdate(ctx, "rg1", "ddb1", armcosmos.DatabaseAccountCreateUpdateParameters{ - Location: to.Ptr("westus"), - Tags: map[string]*string{}, - Identity: &armcosmos.ManagedServiceIdentity{ - Type: to.Ptr(armcosmos.ResourceIdentityTypeSystemAssignedUserAssigned), - UserAssignedIdentities: map[string]*armcosmos.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - "/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}, - }, - }, - Kind: to.Ptr(armcosmos.DatabaseAccountKindMongoDB), - Properties: &armcosmos.DatabaseAccountCreateUpdateProperties{ - AnalyticalStorageConfiguration: &armcosmos.AnalyticalStorageConfiguration{ - SchemaType: to.Ptr(armcosmos.AnalyticalStorageSchemaTypeWellDefined), - }, - APIProperties: &armcosmos.APIProperties{ - ServerVersion: to.Ptr(armcosmos.ServerVersionThree2), - }, - BackupPolicy: &armcosmos.PeriodicModeBackupPolicy{ - Type: to.Ptr(armcosmos.BackupPolicyTypePeriodic), - PeriodicModeProperties: &armcosmos.PeriodicModeProperties{ - BackupIntervalInMinutes: to.Ptr[int32](240), - BackupRetentionIntervalInHours: to.Ptr[int32](8), - BackupStorageRedundancy: to.Ptr(armcosmos.BackupStorageRedundancyGeo), - }, - }, - Capacity: &armcosmos.Capacity{ - TotalThroughputLimit: to.Ptr[int32](2000), - }, - ConsistencyPolicy: &armcosmos.ConsistencyPolicy{ - DefaultConsistencyLevel: to.Ptr(armcosmos.DefaultConsistencyLevelBoundedStaleness), - MaxIntervalInSeconds: to.Ptr[int32](10), - MaxStalenessPrefix: to.Ptr[int64](200), - }, - Cors: []*armcosmos.CorsPolicy{ - { - AllowedOrigins: to.Ptr("https://test"), - }}, - CreateMode: to.Ptr(armcosmos.CreateModeDefault), - DatabaseAccountOfferType: to.Ptr("Standard"), - DefaultIdentity: to.Ptr("FirstPartyIdentity"), - EnableAnalyticalStorage: to.Ptr(true), - EnableBurstCapacity: to.Ptr(true), - EnableFreeTier: to.Ptr(false), - IPRules: []*armcosmos.IPAddressOrRange{ - { - IPAddressOrRange: to.Ptr("23.43.230.120"), - }, - { - IPAddressOrRange: to.Ptr("110.12.240.0/12"), - }}, - IsVirtualNetworkFilterEnabled: to.Ptr(true), - KeyVaultKeyURI: to.Ptr("https://myKeyVault.vault.azure.net"), - Locations: []*armcosmos.Location{ - { - FailoverPriority: to.Ptr[int32](0), - IsZoneRedundant: to.Ptr(false), - LocationName: to.Ptr("southcentralus"), - }, - { - FailoverPriority: to.Ptr[int32](1), - IsZoneRedundant: to.Ptr(false), - LocationName: to.Ptr("eastus"), - }}, - MinimalTLSVersion: to.Ptr(armcosmos.MinimalTLSVersionTls12), - NetworkACLBypass: to.Ptr(armcosmos.NetworkACLBypassAzureServices), - NetworkACLBypassResourceIDs: []*string{ - to.Ptr("/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName")}, - PublicNetworkAccess: to.Ptr(armcosmos.PublicNetworkAccessEnabled), - VirtualNetworkRules: []*armcosmos.VirtualNetworkRule{ - { - ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - IgnoreMissingVNetServiceEndpoint: to.Ptr(false), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseAccountGetResults = armcosmos.DatabaseAccountGetResults{ - // Name: to.Ptr("ddb1"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Identity: &armcosmos.ManagedServiceIdentity{ - // Type: to.Ptr(armcosmos.ResourceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("52f4fef3-3c3f-4ff3-b52e-b5c9eeb68656"), - // TenantID: to.Ptr("33e01921-4d64-4f8c-a055-5bdaffd5e33d"), - // UserAssignedIdentities: map[string]*armcosmos.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // "/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": &armcosmos.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // ClientID: to.Ptr("fbe75b66-01c5-4f87-a220-233af3270436"), - // PrincipalID: to.Ptr("33e01921-4d64-4f8c-a055-5bdaffd5e33d"), - // }, - // }, - // }, - // Kind: to.Ptr(armcosmos.DatabaseAccountKindMongoDB), - // Properties: &armcosmos.DatabaseAccountGetProperties{ - // AnalyticalStorageConfiguration: &armcosmos.AnalyticalStorageConfiguration{ - // SchemaType: to.Ptr(armcosmos.AnalyticalStorageSchemaTypeWellDefined), - // }, - // APIProperties: &armcosmos.APIProperties{ - // ServerVersion: to.Ptr(armcosmos.ServerVersionThree2), - // }, - // BackupPolicy: &armcosmos.PeriodicModeBackupPolicy{ - // Type: to.Ptr(armcosmos.BackupPolicyTypePeriodic), - // PeriodicModeProperties: &armcosmos.PeriodicModeProperties{ - // BackupIntervalInMinutes: to.Ptr[int32](240), - // BackupRetentionIntervalInHours: to.Ptr[int32](8), - // BackupStorageRedundancy: to.Ptr(armcosmos.BackupStorageRedundancyGeo), - // }, - // }, - // Capacity: &armcosmos.Capacity{ - // TotalThroughputLimit: to.Ptr[int32](2000), - // }, - // ConsistencyPolicy: &armcosmos.ConsistencyPolicy{ - // DefaultConsistencyLevel: to.Ptr(armcosmos.DefaultConsistencyLevelBoundedStaleness), - // MaxIntervalInSeconds: to.Ptr[int32](10), - // MaxStalenessPrefix: to.Ptr[int64](200), - // }, - // Cors: []*armcosmos.CorsPolicy{ - // { - // AllowedOrigins: to.Ptr("https://test"), - // }}, - // CreateMode: to.Ptr(armcosmos.CreateModeDefault), - // DatabaseAccountOfferType: to.Ptr("Standard"), - // DefaultIdentity: to.Ptr("FirstPartyIdentity"), - // DisableKeyBasedMetadataWriteAccess: to.Ptr(false), - // EnableAnalyticalStorage: to.Ptr(true), - // EnableBurstCapacity: to.Ptr(true), - // EnableFreeTier: to.Ptr(false), - // FailoverPolicies: []*armcosmos.FailoverPolicy{ - // { - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-southcentralus"), - // LocationName: to.Ptr("South Central US"), - // }, - // { - // FailoverPriority: to.Ptr[int32](1), - // ID: to.Ptr("ddb1-eastus"), - // LocationName: to.Ptr("East US"), - // }}, - // InstanceID: to.Ptr("d9b26648-2f53-4541-b3d8-3044f4f9810d"), - // IPRules: []*armcosmos.IPAddressOrRange{ - // { - // IPAddressOrRange: to.Ptr("23.43.230.120"), - // }, - // { - // IPAddressOrRange: to.Ptr("110.12.240.0/12"), - // }}, - // IsVirtualNetworkFilterEnabled: to.Ptr(true), - // KeyVaultKeyURI: to.Ptr("https://myKeyVault.vault.azure.net"), - // KeysMetadata: &armcosmos.DatabaseAccountKeysMetadata{ - // PrimaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09.000Z"); return t}()), - // }, - // PrimaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09.000Z"); return t}()), - // }, - // SecondaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09.000Z"); return t}()), - // }, - // SecondaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09.000Z"); return t}()), - // }, - // }, - // Locations: []*armcosmos.Location{ - // { - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-southcentralus"), - // IsZoneRedundant: to.Ptr(false), - // LocationName: to.Ptr("South Central US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // { - // FailoverPriority: to.Ptr[int32](1), - // ID: to.Ptr("ddb1-eastus"), - // IsZoneRedundant: to.Ptr(false), - // LocationName: to.Ptr("East US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // MinimalTLSVersion: to.Ptr(armcosmos.MinimalTLSVersionTls12), - // NetworkACLBypass: to.Ptr(armcosmos.NetworkACLBypassAzureServices), - // NetworkACLBypassResourceIDs: []*string{ - // to.Ptr("/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName")}, - // ProvisioningState: to.Ptr("Succeeded"), - // PublicNetworkAccess: to.Ptr(armcosmos.PublicNetworkAccessEnabled), - // ReadLocations: []*armcosmos.Location{ - // { - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-southcentralus"), - // IsZoneRedundant: to.Ptr(false), - // LocationName: to.Ptr("South Central US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // { - // FailoverPriority: to.Ptr[int32](1), - // ID: to.Ptr("ddb1-eastus"), - // IsZoneRedundant: to.Ptr(false), - // LocationName: to.Ptr("East US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // VirtualNetworkRules: []*armcosmos.VirtualNetworkRule{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // }}, - // WriteLocations: []*armcosmos.Location{ - // { - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-southcentralus"), - // IsZoneRedundant: to.Ptr(false), - // LocationName: to.Ptr("South Central US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // }, - // SystemData: &armcosmos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09.000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountCreateMin.json -func ExampleDatabaseAccountsClient_BeginCreateOrUpdate_cosmosDbDatabaseAccountCreateMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabaseAccountsClient().BeginCreateOrUpdate(ctx, "rg1", "ddb1", armcosmos.DatabaseAccountCreateUpdateParameters{ - Location: to.Ptr("westus"), - Properties: &armcosmos.DatabaseAccountCreateUpdateProperties{ - CreateMode: to.Ptr(armcosmos.CreateModeDefault), - DatabaseAccountOfferType: to.Ptr("Standard"), - Locations: []*armcosmos.Location{ - { - FailoverPriority: to.Ptr[int32](0), - IsZoneRedundant: to.Ptr(false), - LocationName: to.Ptr("southcentralus"), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseAccountGetResults = armcosmos.DatabaseAccountGetResults{ - // Name: to.Ptr("ddb1"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Kind: to.Ptr(armcosmos.DatabaseAccountKindGlobalDocumentDB), - // Properties: &armcosmos.DatabaseAccountGetProperties{ - // APIProperties: &armcosmos.APIProperties{ - // }, - // BackupPolicy: &armcosmos.PeriodicModeBackupPolicy{ - // Type: to.Ptr(armcosmos.BackupPolicyTypePeriodic), - // PeriodicModeProperties: &armcosmos.PeriodicModeProperties{ - // BackupIntervalInMinutes: to.Ptr[int32](240), - // BackupRetentionIntervalInHours: to.Ptr[int32](720), - // BackupStorageRedundancy: to.Ptr(armcosmos.BackupStorageRedundancyGeo), - // }, - // }, - // ConsistencyPolicy: &armcosmos.ConsistencyPolicy{ - // DefaultConsistencyLevel: to.Ptr(armcosmos.DefaultConsistencyLevelSession), - // MaxIntervalInSeconds: to.Ptr[int32](5), - // MaxStalenessPrefix: to.Ptr[int64](100), - // }, - // Cors: []*armcosmos.CorsPolicy{ - // }, - // CreateMode: to.Ptr(armcosmos.CreateModeDefault), - // DatabaseAccountOfferType: to.Ptr("Standard"), - // DisableKeyBasedMetadataWriteAccess: to.Ptr(false), - // EnableAnalyticalStorage: to.Ptr(false), - // EnableFreeTier: to.Ptr(false), - // FailoverPolicies: []*armcosmos.FailoverPolicy{ - // { - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-southcentralus"), - // LocationName: to.Ptr("South Central US"), - // }}, - // InstanceID: to.Ptr("d9b26648-2f53-4541-b3d8-3044f4f9810d"), - // IPRules: []*armcosmos.IPAddressOrRange{ - // }, - // KeysMetadata: &armcosmos.DatabaseAccountKeysMetadata{ - // PrimaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09.000Z"); return t}()), - // }, - // PrimaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09.000Z"); return t}()), - // }, - // SecondaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09.000Z"); return t}()), - // }, - // SecondaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09.000Z"); return t}()), - // }, - // }, - // Locations: []*armcosmos.Location{ - // { - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-southcentralus"), - // IsZoneRedundant: to.Ptr(false), - // LocationName: to.Ptr("South Central US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // MinimalTLSVersion: to.Ptr(armcosmos.MinimalTLSVersionTLS), - // NetworkACLBypass: to.Ptr(armcosmos.NetworkACLBypassNone), - // NetworkACLBypassResourceIDs: []*string{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // ReadLocations: []*armcosmos.Location{ - // { - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-southcentralus"), - // IsZoneRedundant: to.Ptr(false), - // LocationName: to.Ptr("South Central US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // WriteLocations: []*armcosmos.Location{ - // { - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-southcentralus"), - // IsZoneRedundant: to.Ptr(false), - // LocationName: to.Ptr("South Central US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // }, - // SystemData: &armcosmos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09.000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBRestoreDatabaseAccountCreateUpdate.json -func ExampleDatabaseAccountsClient_BeginCreateOrUpdate_cosmosDbRestoreDatabaseAccountCreateUpdateJson() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabaseAccountsClient().BeginCreateOrUpdate(ctx, "rg1", "ddb1", armcosmos.DatabaseAccountCreateUpdateParameters{ - Location: to.Ptr("westus"), - Tags: map[string]*string{}, - Kind: to.Ptr(armcosmos.DatabaseAccountKindGlobalDocumentDB), - Properties: &armcosmos.DatabaseAccountCreateUpdateProperties{ - APIProperties: &armcosmos.APIProperties{ - ServerVersion: to.Ptr(armcosmos.ServerVersionThree2), - }, - BackupPolicy: &armcosmos.ContinuousModeBackupPolicy{ - Type: to.Ptr(armcosmos.BackupPolicyTypeContinuous), - ContinuousModeProperties: &armcosmos.ContinuousModeProperties{ - Tier: to.Ptr(armcosmos.ContinuousTierContinuous30Days), - }, - }, - ConsistencyPolicy: &armcosmos.ConsistencyPolicy{ - DefaultConsistencyLevel: to.Ptr(armcosmos.DefaultConsistencyLevelBoundedStaleness), - MaxIntervalInSeconds: to.Ptr[int32](10), - MaxStalenessPrefix: to.Ptr[int64](200), - }, - CreateMode: to.Ptr(armcosmos.CreateModeRestore), - DatabaseAccountOfferType: to.Ptr("Standard"), - EnableAnalyticalStorage: to.Ptr(true), - EnableFreeTier: to.Ptr(false), - KeyVaultKeyURI: to.Ptr("https://myKeyVault.vault.azure.net"), - Locations: []*armcosmos.Location{ - { - FailoverPriority: to.Ptr[int32](0), - IsZoneRedundant: to.Ptr(false), - LocationName: to.Ptr("southcentralus"), - }}, - MinimalTLSVersion: to.Ptr(armcosmos.MinimalTLSVersionTLS), - RestoreParameters: &armcosmos.RestoreParameters{ - RestoreSource: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/1a97b4bb-f6a0-430e-ade1-638d781830cc"), - RestoreTimestampInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-11T22:05:09.000Z"); return t }()), - DatabasesToRestore: []*armcosmos.DatabaseRestoreResource{ - { - CollectionNames: []*string{ - to.Ptr("collection1"), - to.Ptr("collection2")}, - DatabaseName: to.Ptr("db1"), - }, - { - CollectionNames: []*string{ - to.Ptr("collection3"), - to.Ptr("collection4")}, - DatabaseName: to.Ptr("db2"), - }}, - RestoreMode: to.Ptr(armcosmos.RestoreModePointInTime), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseAccountGetResults = armcosmos.DatabaseAccountGetResults{ - // Name: to.Ptr("ddb1"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Kind: to.Ptr(armcosmos.DatabaseAccountKindGlobalDocumentDB), - // Properties: &armcosmos.DatabaseAccountGetProperties{ - // APIProperties: &armcosmos.APIProperties{ - // }, - // BackupPolicy: &armcosmos.ContinuousModeBackupPolicy{ - // Type: to.Ptr(armcosmos.BackupPolicyTypeContinuous), - // ContinuousModeProperties: &armcosmos.ContinuousModeProperties{ - // Tier: to.Ptr(armcosmos.ContinuousTierContinuous30Days), - // }, - // }, - // ConsistencyPolicy: &armcosmos.ConsistencyPolicy{ - // DefaultConsistencyLevel: to.Ptr(armcosmos.DefaultConsistencyLevelSession), - // MaxIntervalInSeconds: to.Ptr[int32](5), - // MaxStalenessPrefix: to.Ptr[int64](100), - // }, - // CreateMode: to.Ptr(armcosmos.CreateModeRestore), - // DatabaseAccountOfferType: to.Ptr("Standard"), - // DisableKeyBasedMetadataWriteAccess: to.Ptr(false), - // EnableAnalyticalStorage: to.Ptr(false), - // EnableFreeTier: to.Ptr(false), - // FailoverPolicies: []*armcosmos.FailoverPolicy{ - // { - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-southcentralus"), - // LocationName: to.Ptr("South Central US"), - // }}, - // InstanceID: to.Ptr("d9b26648-2f53-4541-b3d8-3044f4f9810d"), - // IPRules: []*armcosmos.IPAddressOrRange{ - // }, - // KeysMetadata: &armcosmos.DatabaseAccountKeysMetadata{ - // PrimaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // PrimaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // SecondaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // SecondaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // }, - // Locations: []*armcosmos.Location{ - // { - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-southcentralus"), - // IsZoneRedundant: to.Ptr(false), - // LocationName: to.Ptr("South Central US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // MinimalTLSVersion: to.Ptr(armcosmos.MinimalTLSVersionTLS), - // ProvisioningState: to.Ptr("Succeeded"), - // ReadLocations: []*armcosmos.Location{ - // { - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-southcentralus"), - // IsZoneRedundant: to.Ptr(false), - // LocationName: to.Ptr("South Central US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // WriteLocations: []*armcosmos.Location{ - // { - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-southcentralus"), - // IsZoneRedundant: to.Ptr(false), - // LocationName: to.Ptr("South Central US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // }, - // SystemData: &armcosmos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09.000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountDelete.json -func ExampleDatabaseAccountsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabaseAccountsClient().BeginDelete(ctx, "rg1", "ddb1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountFailoverPriorityChange.json -func ExampleDatabaseAccountsClient_BeginFailoverPriorityChange() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabaseAccountsClient().BeginFailoverPriorityChange(ctx, "rg1", "ddb1-failover", armcosmos.FailoverPolicies{ - FailoverPolicies: []*armcosmos.FailoverPolicy{ - { - FailoverPriority: to.Ptr[int32](0), - LocationName: to.Ptr("eastus"), - }, - { - FailoverPriority: to.Ptr[int32](1), - LocationName: to.Ptr("westus"), - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountList.json -func ExampleDatabaseAccountsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseAccountsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseAccountsListResult = armcosmos.DatabaseAccountsListResult{ - // Value: []*armcosmos.DatabaseAccountGetResults{ - // { - // Name: to.Ptr("ddb1"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Identity: &armcosmos.ManagedServiceIdentity{ - // Type: to.Ptr(armcosmos.ResourceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("52f4fef3-3c3f-4ff3-b52e-b5c9eeb68656"), - // TenantID: to.Ptr("33e01921-4d64-4f8c-a055-5bdaffd5e33d"), - // UserAssignedIdentities: map[string]*armcosmos.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // "/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": &armcosmos.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // ClientID: to.Ptr("fbe75b66-01c5-4f87-a220-233af3270436"), - // PrincipalID: to.Ptr("33e01921-4d64-4f8c-a055-5bdaffd5e33d"), - // }, - // }, - // }, - // Kind: to.Ptr(armcosmos.DatabaseAccountKindGlobalDocumentDB), - // Properties: &armcosmos.DatabaseAccountGetProperties{ - // AnalyticalStorageConfiguration: &armcosmos.AnalyticalStorageConfiguration{ - // SchemaType: to.Ptr(armcosmos.AnalyticalStorageSchemaTypeWellDefined), - // }, - // APIProperties: &armcosmos.APIProperties{ - // }, - // BackupPolicy: &armcosmos.PeriodicModeBackupPolicy{ - // Type: to.Ptr(armcosmos.BackupPolicyTypePeriodic), - // PeriodicModeProperties: &armcosmos.PeriodicModeProperties{ - // BackupIntervalInMinutes: to.Ptr[int32](240), - // BackupRetentionIntervalInHours: to.Ptr[int32](720), - // BackupStorageRedundancy: to.Ptr(armcosmos.BackupStorageRedundancyGeo), - // }, - // }, - // ConsistencyPolicy: &armcosmos.ConsistencyPolicy{ - // DefaultConsistencyLevel: to.Ptr(armcosmos.DefaultConsistencyLevelSession), - // MaxIntervalInSeconds: to.Ptr[int32](5), - // MaxStalenessPrefix: to.Ptr[int64](100), - // }, - // Cors: []*armcosmos.CorsPolicy{ - // }, - // CreateMode: to.Ptr(armcosmos.CreateModeDefault), - // DatabaseAccountOfferType: to.Ptr("Standard"), - // DefaultIdentity: to.Ptr("FirstPartyIdentity"), - // DisableKeyBasedMetadataWriteAccess: to.Ptr(false), - // DocumentEndpoint: to.Ptr("https://ddb1.documents.azure.com:443/"), - // EnableAnalyticalStorage: to.Ptr(true), - // EnableBurstCapacity: to.Ptr(true), - // EnableFreeTier: to.Ptr(false), - // EnablePartitionMerge: to.Ptr(true), - // FailoverPolicies: []*armcosmos.FailoverPolicy{ - // { - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-eastus"), - // LocationName: to.Ptr("East US"), - // }}, - // InstanceID: to.Ptr("d9b26648-2f53-4541-b3d8-3044f4f9810d"), - // IPRules: []*armcosmos.IPAddressOrRange{ - // }, - // KeysMetadata: &armcosmos.DatabaseAccountKeysMetadata{ - // PrimaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // PrimaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // SecondaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // SecondaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // }, - // Locations: []*armcosmos.Location{ - // { - // DocumentEndpoint: to.Ptr("https://ddb1-eastus.documents.azure.com:443/"), - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-eastus"), - // LocationName: to.Ptr("East US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // MinimalTLSVersion: to.Ptr(armcosmos.MinimalTLSVersionTLS), - // NetworkACLBypass: to.Ptr(armcosmos.NetworkACLBypassNone), - // NetworkACLBypassResourceIDs: []*string{ - // }, - // PrivateEndpointConnections: []*armcosmos.PrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.DocumentDB/databaseAccounts/account1/privateEndpointConnections/pe1"), - // Properties: &armcosmos.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armcosmos.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/privateEndpoints/pe1"), - // }, - // PrivateLinkServiceConnectionState: &armcosmos.PrivateLinkServiceConnectionStateProperty{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // ReadLocations: []*armcosmos.Location{ - // { - // DocumentEndpoint: to.Ptr("https://ddb1-eastus.documents.azure.com:443/"), - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-eastus"), - // LocationName: to.Ptr("East US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // WriteLocations: []*armcosmos.Location{ - // { - // DocumentEndpoint: to.Ptr("https://ddb1-eastus.documents.azure.com:443/"), - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-eastus"), - // LocationName: to.Ptr("East US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // }, - // SystemData: &armcosmos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09.000Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountListByResourceGroup.json -func ExampleDatabaseAccountsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseAccountsClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseAccountsListResult = armcosmos.DatabaseAccountsListResult{ - // Value: []*armcosmos.DatabaseAccountGetResults{ - // { - // Name: to.Ptr("ddb1"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Identity: &armcosmos.ManagedServiceIdentity{ - // Type: to.Ptr(armcosmos.ResourceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("52f4fef3-3c3f-4ff3-b52e-b5c9eeb68656"), - // TenantID: to.Ptr("33e01921-4d64-4f8c-a055-5bdaffd5e33d"), - // UserAssignedIdentities: map[string]*armcosmos.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // "/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": &armcosmos.Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties{ - // ClientID: to.Ptr("fbe75b66-01c5-4f87-a220-233af3270436"), - // PrincipalID: to.Ptr("33e01921-4d64-4f8c-a055-5bdaffd5e33d"), - // }, - // }, - // }, - // Kind: to.Ptr(armcosmos.DatabaseAccountKindGlobalDocumentDB), - // Properties: &armcosmos.DatabaseAccountGetProperties{ - // ConsistencyPolicy: &armcosmos.ConsistencyPolicy{ - // DefaultConsistencyLevel: to.Ptr(armcosmos.DefaultConsistencyLevelSession), - // MaxIntervalInSeconds: to.Ptr[int32](5), - // MaxStalenessPrefix: to.Ptr[int64](100), - // }, - // Cors: []*armcosmos.CorsPolicy{ - // }, - // DatabaseAccountOfferType: to.Ptr("Standard"), - // DefaultIdentity: to.Ptr("FirstPartyIdentity"), - // DisableKeyBasedMetadataWriteAccess: to.Ptr(false), - // DocumentEndpoint: to.Ptr("https://ddb1.documents.azure.com:443/"), - // EnableFreeTier: to.Ptr(false), - // FailoverPolicies: []*armcosmos.FailoverPolicy{ - // { - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-eastus"), - // LocationName: to.Ptr("East US"), - // }}, - // IPRules: []*armcosmos.IPAddressOrRange{ - // }, - // KeysMetadata: &armcosmos.DatabaseAccountKeysMetadata{ - // PrimaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // PrimaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // SecondaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // SecondaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11.000Z"); return t}()), - // }, - // }, - // Locations: []*armcosmos.Location{ - // { - // DocumentEndpoint: to.Ptr("https://ddb1-eastus.documents.azure.com:443/"), - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-eastus"), - // LocationName: to.Ptr("East US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // MinimalTLSVersion: to.Ptr(armcosmos.MinimalTLSVersionTLS), - // NetworkACLBypass: to.Ptr(armcosmos.NetworkACLBypassNone), - // NetworkACLBypassResourceIDs: []*string{ - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // ReadLocations: []*armcosmos.Location{ - // { - // DocumentEndpoint: to.Ptr("https://ddb1-eastus.documents.azure.com:443/"), - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-eastus"), - // LocationName: to.Ptr("East US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // WriteLocations: []*armcosmos.Location{ - // { - // DocumentEndpoint: to.Ptr("https://ddb1-eastus.documents.azure.com:443/"), - // FailoverPriority: to.Ptr[int32](0), - // ID: to.Ptr("ddb1-eastus"), - // LocationName: to.Ptr("East US"), - // ProvisioningState: to.Ptr("Succeeded"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountListKeys.json -func ExampleDatabaseAccountsClient_ListKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseAccountsClient().ListKeys(ctx, "rg1", "ddb1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseAccountListKeysResult = armcosmos.DatabaseAccountListKeysResult{ - // PrimaryReadonlyMasterKey: to.Ptr("primaryReadonlyMasterKey"), - // SecondaryReadonlyMasterKey: to.Ptr("secondaryReadonlyMasterKey"), - // PrimaryMasterKey: to.Ptr("primaryMasterKey"), - // SecondaryMasterKey: to.Ptr("secondaryMasterKey"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountListConnectionStrings.json -func ExampleDatabaseAccountsClient_ListConnectionStrings_cosmosDbDatabaseAccountListConnectionStrings() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseAccountsClient().ListConnectionStrings(ctx, "rg1", "ddb1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseAccountListConnectionStringsResult = armcosmos.DatabaseAccountListConnectionStringsResult{ - // ConnectionStrings: []*armcosmos.DatabaseAccountConnectionString{ - // { - // Type: to.Ptr(armcosmos.TypeSQL), - // Description: to.Ptr("Primary SQL Connection String"), - // ConnectionString: to.Ptr("connection-string"), - // KeyKind: to.Ptr(armcosmos.KindPrimary), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountListConnectionStringsMongo.json -func ExampleDatabaseAccountsClient_ListConnectionStrings_cosmosDbDatabaseAccountListConnectionStringsMongo() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseAccountsClient().ListConnectionStrings(ctx, "rg1", "mongo-ddb1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseAccountListConnectionStringsResult = armcosmos.DatabaseAccountListConnectionStringsResult{ - // ConnectionStrings: []*armcosmos.DatabaseAccountConnectionString{ - // { - // Description: to.Ptr("Name of the connection string"), - // ConnectionString: to.Ptr("connection-string"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountOfflineRegion.json -func ExampleDatabaseAccountsClient_BeginOfflineRegion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabaseAccountsClient().BeginOfflineRegion(ctx, "rg1", "ddb1", armcosmos.RegionForOnlineOffline{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountOnlineRegion.json -func ExampleDatabaseAccountsClient_BeginOnlineRegion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabaseAccountsClient().BeginOnlineRegion(ctx, "rg1", "ddb1", armcosmos.RegionForOnlineOffline{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountListReadOnlyKeys.json -func ExampleDatabaseAccountsClient_GetReadOnlyKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseAccountsClient().GetReadOnlyKeys(ctx, "rg1", "ddb1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseAccountListReadOnlyKeysResult = armcosmos.DatabaseAccountListReadOnlyKeysResult{ - // PrimaryReadonlyMasterKey: to.Ptr("primaryReadonlyMasterKey"), - // SecondaryReadonlyMasterKey: to.Ptr("secondaryReadonlyMasterKey"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountRegenerateKey.json -func ExampleDatabaseAccountsClient_BeginRegenerateKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabaseAccountsClient().BeginRegenerateKey(ctx, "rg1", "ddb1", armcosmos.DatabaseAccountRegenerateKeyParameters{ - KeyKind: to.Ptr(armcosmos.KeyKindPrimary), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountCheckNameExists.json -func ExampleDatabaseAccountsClient_CheckNameExists() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDatabaseAccountsClient().CheckNameExists(ctx, "ddb1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountGetMetrics.json -func ExampleDatabaseAccountsClient_NewListMetricsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseAccountsClient().NewListMetricsPager("rg1", "ddb1", "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricListResult = armcosmos.MetricListResult{ - // Value: []*armcosmos.Metric{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Total Requests"), - // Value: to.Ptr("Total Requests"), - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:13:55.278Z"); return t}()), - // MetricValues: []*armcosmos.MetricValue{ - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:58:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:03:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }, - // { - // Count: to.Ptr[int32](0), - // Average: to.Ptr[float64](0), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:08:55.278Z"); return t}()), - // Total: to.Ptr[float64](0), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // TimeGrain: to.Ptr("PT5M"), - // Unit: to.Ptr(armcosmos.UnitTypeCount), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountGetUsages.json -func ExampleDatabaseAccountsClient_NewListUsagesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseAccountsClient().NewListUsagesPager("rg1", "ddb1", &armcosmos.DatabaseAccountsClientListUsagesOptions{Filter: to.Ptr("$filter=name.value eq 'Storage'")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.UsagesResult = armcosmos.UsagesResult{ - // Value: []*armcosmos.Usage{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Storage"), - // Value: to.Ptr("Storage"), - // }, - // CurrentValue: to.Ptr[int64](0), - // Limit: to.Ptr[int64](10737418240), - // QuotaPeriod: to.Ptr("P1D"), - // Unit: to.Ptr(armcosmos.UnitTypeBytes), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDatabaseAccountGetMetricDefinitions.json -func ExampleDatabaseAccountsClient_NewListMetricDefinitionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabaseAccountsClient().NewListMetricDefinitionsPager("rg1", "ddb1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MetricDefinitionsListResult = armcosmos.MetricDefinitionsListResult{ - // Value: []*armcosmos.MetricDefinition{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Total Requests"), - // Value: to.Ptr("Total Requests"), - // }, - // MetricAvailabilities: []*armcosmos.MetricAvailability{ - // { - // Retention: to.Ptr("P2D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P14D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P60D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // PrimaryAggregationType: to.Ptr(armcosmos.PrimaryAggregationTypeTotal), - // ResourceURI: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1"), - // Unit: to.Ptr(armcosmos.UnitTypeCount), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/databaseaccounts_live_test.go b/sdk/resourcemanager/cosmos/armcosmos/databaseaccounts_live_test.go index 26ef4556f217..b30e7e7ca643 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/databaseaccounts_live_test.go +++ b/sdk/resourcemanager/cosmos/armcosmos/databaseaccounts_live_test.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/cosmos/armcosmos/datatransferjobs_client.go b/sdk/resourcemanager/cosmos/armcosmos/datatransferjobs_client.go new file mode 100644 index 000000000000..3f097927650c --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/datatransferjobs_client.go @@ -0,0 +1,527 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcosmos + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DataTransferJobsClient contains the methods for the DataTransferJobs group. +// Don't use this type directly, use NewDataTransferJobsClient() instead. +type DataTransferJobsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDataTransferJobsClient creates a new instance of DataTransferJobsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDataTransferJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataTransferJobsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DataTransferJobsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Cancel - Cancels a Data Transfer Job. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - jobName - Name of the Data Transfer Job +// - options - DataTransferJobsClientCancelOptions contains the optional parameters for the DataTransferJobsClient.Cancel method. +func (client *DataTransferJobsClient) Cancel(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *DataTransferJobsClientCancelOptions) (DataTransferJobsClientCancelResponse, error) { + var err error + const operationName = "DataTransferJobsClient.Cancel" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.cancelCreateRequest(ctx, resourceGroupName, accountName, jobName, options) + if err != nil { + return DataTransferJobsClientCancelResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DataTransferJobsClientCancelResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DataTransferJobsClientCancelResponse{}, err + } + resp, err := client.cancelHandleResponse(httpResp) + return resp, err +} + +// cancelCreateRequest creates the Cancel request. +func (client *DataTransferJobsClient) cancelCreateRequest(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *DataTransferJobsClientCancelOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/cancel" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// cancelHandleResponse handles the Cancel response. +func (client *DataTransferJobsClient) cancelHandleResponse(resp *http.Response) (DataTransferJobsClientCancelResponse, error) { + result := DataTransferJobsClientCancelResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataTransferJobGetResults); err != nil { + return DataTransferJobsClientCancelResponse{}, err + } + return result, nil +} + +// Complete - Completes a Data Transfer Online Job. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - jobName - Name of the Data Transfer Job +// - options - DataTransferJobsClientCompleteOptions contains the optional parameters for the DataTransferJobsClient.Complete +// method. +func (client *DataTransferJobsClient) Complete(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *DataTransferJobsClientCompleteOptions) (DataTransferJobsClientCompleteResponse, error) { + var err error + const operationName = "DataTransferJobsClient.Complete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.completeCreateRequest(ctx, resourceGroupName, accountName, jobName, options) + if err != nil { + return DataTransferJobsClientCompleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DataTransferJobsClientCompleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DataTransferJobsClientCompleteResponse{}, err + } + resp, err := client.completeHandleResponse(httpResp) + return resp, err +} + +// completeCreateRequest creates the Complete request. +func (client *DataTransferJobsClient) completeCreateRequest(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *DataTransferJobsClientCompleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/complete" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// completeHandleResponse handles the Complete response. +func (client *DataTransferJobsClient) completeHandleResponse(resp *http.Response) (DataTransferJobsClientCompleteResponse, error) { + result := DataTransferJobsClientCompleteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataTransferJobGetResults); err != nil { + return DataTransferJobsClientCompleteResponse{}, err + } + return result, nil +} + +// Create - Creates a Data Transfer Job. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - jobName - Name of the Data Transfer Job +// - options - DataTransferJobsClientCreateOptions contains the optional parameters for the DataTransferJobsClient.Create method. +func (client *DataTransferJobsClient) Create(ctx context.Context, resourceGroupName string, accountName string, jobName string, jobCreateParameters CreateJobRequest, options *DataTransferJobsClientCreateOptions) (DataTransferJobsClientCreateResponse, error) { + var err error + const operationName = "DataTransferJobsClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, jobName, jobCreateParameters, options) + if err != nil { + return DataTransferJobsClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DataTransferJobsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DataTransferJobsClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *DataTransferJobsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, jobName string, jobCreateParameters CreateJobRequest, options *DataTransferJobsClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, jobCreateParameters); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *DataTransferJobsClient) createHandleResponse(resp *http.Response) (DataTransferJobsClientCreateResponse, error) { + result := DataTransferJobsClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataTransferJobGetResults); err != nil { + return DataTransferJobsClientCreateResponse{}, err + } + return result, nil +} + +// Get - Get a Data Transfer Job. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - jobName - Name of the Data Transfer Job +// - options - DataTransferJobsClientGetOptions contains the optional parameters for the DataTransferJobsClient.Get method. +func (client *DataTransferJobsClient) Get(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *DataTransferJobsClientGetOptions) (DataTransferJobsClientGetResponse, error) { + var err error + const operationName = "DataTransferJobsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, jobName, options) + if err != nil { + return DataTransferJobsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DataTransferJobsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DataTransferJobsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DataTransferJobsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *DataTransferJobsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DataTransferJobsClient) getHandleResponse(resp *http.Response) (DataTransferJobsClientGetResponse, error) { + result := DataTransferJobsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataTransferJobGetResults); err != nil { + return DataTransferJobsClientGetResponse{}, err + } + return result, nil +} + +// NewListByDatabaseAccountPager - Get a list of Data Transfer jobs. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - options - DataTransferJobsClientListByDatabaseAccountOptions contains the optional parameters for the DataTransferJobsClient.NewListByDatabaseAccountPager +// method. +func (client *DataTransferJobsClient) NewListByDatabaseAccountPager(resourceGroupName string, accountName string, options *DataTransferJobsClientListByDatabaseAccountOptions) *runtime.Pager[DataTransferJobsClientListByDatabaseAccountResponse] { + return runtime.NewPager(runtime.PagingHandler[DataTransferJobsClientListByDatabaseAccountResponse]{ + More: func(page DataTransferJobsClientListByDatabaseAccountResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DataTransferJobsClientListByDatabaseAccountResponse) (DataTransferJobsClientListByDatabaseAccountResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataTransferJobsClient.NewListByDatabaseAccountPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByDatabaseAccountCreateRequest(ctx, resourceGroupName, accountName, options) + }, nil) + if err != nil { + return DataTransferJobsClientListByDatabaseAccountResponse{}, err + } + return client.listByDatabaseAccountHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByDatabaseAccountCreateRequest creates the ListByDatabaseAccount request. +func (client *DataTransferJobsClient) listByDatabaseAccountCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *DataTransferJobsClientListByDatabaseAccountOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByDatabaseAccountHandleResponse handles the ListByDatabaseAccount response. +func (client *DataTransferJobsClient) listByDatabaseAccountHandleResponse(resp *http.Response) (DataTransferJobsClientListByDatabaseAccountResponse, error) { + result := DataTransferJobsClientListByDatabaseAccountResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataTransferJobFeedResults); err != nil { + return DataTransferJobsClientListByDatabaseAccountResponse{}, err + } + return result, nil +} + +// Pause - Pause a Data Transfer Job. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - jobName - Name of the Data Transfer Job +// - options - DataTransferJobsClientPauseOptions contains the optional parameters for the DataTransferJobsClient.Pause method. +func (client *DataTransferJobsClient) Pause(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *DataTransferJobsClientPauseOptions) (DataTransferJobsClientPauseResponse, error) { + var err error + const operationName = "DataTransferJobsClient.Pause" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.pauseCreateRequest(ctx, resourceGroupName, accountName, jobName, options) + if err != nil { + return DataTransferJobsClientPauseResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DataTransferJobsClientPauseResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DataTransferJobsClientPauseResponse{}, err + } + resp, err := client.pauseHandleResponse(httpResp) + return resp, err +} + +// pauseCreateRequest creates the Pause request. +func (client *DataTransferJobsClient) pauseCreateRequest(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *DataTransferJobsClientPauseOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/pause" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// pauseHandleResponse handles the Pause response. +func (client *DataTransferJobsClient) pauseHandleResponse(resp *http.Response) (DataTransferJobsClientPauseResponse, error) { + result := DataTransferJobsClientPauseResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataTransferJobGetResults); err != nil { + return DataTransferJobsClientPauseResponse{}, err + } + return result, nil +} + +// Resume - Resumes a Data Transfer Job. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - jobName - Name of the Data Transfer Job +// - options - DataTransferJobsClientResumeOptions contains the optional parameters for the DataTransferJobsClient.Resume method. +func (client *DataTransferJobsClient) Resume(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *DataTransferJobsClientResumeOptions) (DataTransferJobsClientResumeResponse, error) { + var err error + const operationName = "DataTransferJobsClient.Resume" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.resumeCreateRequest(ctx, resourceGroupName, accountName, jobName, options) + if err != nil { + return DataTransferJobsClientResumeResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DataTransferJobsClientResumeResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DataTransferJobsClientResumeResponse{}, err + } + resp, err := client.resumeHandleResponse(httpResp) + return resp, err +} + +// resumeCreateRequest creates the Resume request. +func (client *DataTransferJobsClient) resumeCreateRequest(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *DataTransferJobsClientResumeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/resume" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// resumeHandleResponse handles the Resume response. +func (client *DataTransferJobsClient) resumeHandleResponse(resp *http.Response) (DataTransferJobsClientResumeResponse, error) { + result := DataTransferJobsClientResumeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataTransferJobGetResults); err != nil { + return DataTransferJobsClientResumeResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/cassandraclusters_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/cassandraclusters_server.go index df83f25b3dc1..0cc6859aa033 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/cassandraclusters_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/cassandraclusters_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" @@ -39,10 +39,26 @@ type CassandraClustersServer struct { // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, clusterName string, options *armcosmos.CassandraClustersClientGetOptions) (resp azfake.Responder[armcosmos.CassandraClustersClientGetResponse], errResp azfake.ErrorResponder) + // GetBackup is the fake for method CassandraClustersClient.GetBackup + // HTTP status codes to indicate success: http.StatusOK + GetBackup func(ctx context.Context, resourceGroupName string, clusterName string, backupID string, options *armcosmos.CassandraClustersClientGetBackupOptions) (resp azfake.Responder[armcosmos.CassandraClustersClientGetBackupResponse], errResp azfake.ErrorResponder) + + // GetCommandAsync is the fake for method CassandraClustersClient.GetCommandAsync + // HTTP status codes to indicate success: http.StatusOK + GetCommandAsync func(ctx context.Context, resourceGroupName string, clusterName string, commandID string, options *armcosmos.CassandraClustersClientGetCommandAsyncOptions) (resp azfake.Responder[armcosmos.CassandraClustersClientGetCommandAsyncResponse], errResp azfake.ErrorResponder) + // BeginInvokeCommand is the fake for method CassandraClustersClient.BeginInvokeCommand // HTTP status codes to indicate success: http.StatusAccepted BeginInvokeCommand func(ctx context.Context, resourceGroupName string, clusterName string, body armcosmos.CommandPostBody, options *armcosmos.CassandraClustersClientBeginInvokeCommandOptions) (resp azfake.PollerResponder[armcosmos.CassandraClustersClientInvokeCommandResponse], errResp azfake.ErrorResponder) + // BeginInvokeCommandAsync is the fake for method CassandraClustersClient.BeginInvokeCommandAsync + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginInvokeCommandAsync func(ctx context.Context, resourceGroupName string, clusterName string, body armcosmos.CommandPostBody, options *armcosmos.CassandraClustersClientBeginInvokeCommandAsyncOptions) (resp azfake.PollerResponder[armcosmos.CassandraClustersClientInvokeCommandAsyncResponse], errResp azfake.ErrorResponder) + + // NewListBackupsPager is the fake for method CassandraClustersClient.NewListBackupsPager + // HTTP status codes to indicate success: http.StatusOK + NewListBackupsPager func(resourceGroupName string, clusterName string, options *armcosmos.CassandraClustersClientListBackupsOptions) (resp azfake.PagerResponder[armcosmos.CassandraClustersClientListBackupsResponse]) + // NewListByResourceGroupPager is the fake for method CassandraClustersClient.NewListByResourceGroupPager // HTTP status codes to indicate success: http.StatusOK NewListByResourceGroupPager func(resourceGroupName string, options *armcosmos.CassandraClustersClientListByResourceGroupOptions) (resp azfake.PagerResponder[armcosmos.CassandraClustersClientListByResourceGroupResponse]) @@ -51,6 +67,10 @@ type CassandraClustersServer struct { // HTTP status codes to indicate success: http.StatusOK NewListBySubscriptionPager func(options *armcosmos.CassandraClustersClientListBySubscriptionOptions) (resp azfake.PagerResponder[armcosmos.CassandraClustersClientListBySubscriptionResponse]) + // NewListCommandPager is the fake for method CassandraClustersClient.NewListCommandPager + // HTTP status codes to indicate success: http.StatusOK + NewListCommandPager func(resourceGroupName string, clusterName string, options *armcosmos.CassandraClustersClientListCommandOptions) (resp azfake.PagerResponder[armcosmos.CassandraClustersClientListCommandResponse]) + // BeginStart is the fake for method CassandraClustersClient.BeginStart // HTTP status codes to indicate success: http.StatusAccepted BeginStart func(ctx context.Context, resourceGroupName string, clusterName string, options *armcosmos.CassandraClustersClientBeginStartOptions) (resp azfake.PollerResponder[armcosmos.CassandraClustersClientStartResponse], errResp azfake.ErrorResponder) @@ -74,8 +94,11 @@ func NewCassandraClustersServerTransport(srv *CassandraClustersServer) *Cassandr beginDeallocate: newTracker[azfake.PollerResponder[armcosmos.CassandraClustersClientDeallocateResponse]](), beginDelete: newTracker[azfake.PollerResponder[armcosmos.CassandraClustersClientDeleteResponse]](), beginInvokeCommand: newTracker[azfake.PollerResponder[armcosmos.CassandraClustersClientInvokeCommandResponse]](), + beginInvokeCommandAsync: newTracker[azfake.PollerResponder[armcosmos.CassandraClustersClientInvokeCommandAsyncResponse]](), + newListBackupsPager: newTracker[azfake.PagerResponder[armcosmos.CassandraClustersClientListBackupsResponse]](), newListByResourceGroupPager: newTracker[azfake.PagerResponder[armcosmos.CassandraClustersClientListByResourceGroupResponse]](), newListBySubscriptionPager: newTracker[azfake.PagerResponder[armcosmos.CassandraClustersClientListBySubscriptionResponse]](), + newListCommandPager: newTracker[azfake.PagerResponder[armcosmos.CassandraClustersClientListCommandResponse]](), beginStart: newTracker[azfake.PollerResponder[armcosmos.CassandraClustersClientStartResponse]](), beginUpdate: newTracker[azfake.PollerResponder[armcosmos.CassandraClustersClientUpdateResponse]](), } @@ -89,8 +112,11 @@ type CassandraClustersServerTransport struct { beginDeallocate *tracker[azfake.PollerResponder[armcosmos.CassandraClustersClientDeallocateResponse]] beginDelete *tracker[azfake.PollerResponder[armcosmos.CassandraClustersClientDeleteResponse]] beginInvokeCommand *tracker[azfake.PollerResponder[armcosmos.CassandraClustersClientInvokeCommandResponse]] + beginInvokeCommandAsync *tracker[azfake.PollerResponder[armcosmos.CassandraClustersClientInvokeCommandAsyncResponse]] + newListBackupsPager *tracker[azfake.PagerResponder[armcosmos.CassandraClustersClientListBackupsResponse]] newListByResourceGroupPager *tracker[azfake.PagerResponder[armcosmos.CassandraClustersClientListByResourceGroupResponse]] newListBySubscriptionPager *tracker[azfake.PagerResponder[armcosmos.CassandraClustersClientListBySubscriptionResponse]] + newListCommandPager *tracker[azfake.PagerResponder[armcosmos.CassandraClustersClientListCommandResponse]] beginStart *tracker[azfake.PollerResponder[armcosmos.CassandraClustersClientStartResponse]] beginUpdate *tracker[azfake.PollerResponder[armcosmos.CassandraClustersClientUpdateResponse]] } @@ -115,12 +141,22 @@ func (c *CassandraClustersServerTransport) Do(req *http.Request) (*http.Response resp, err = c.dispatchBeginDelete(req) case "CassandraClustersClient.Get": resp, err = c.dispatchGet(req) + case "CassandraClustersClient.GetBackup": + resp, err = c.dispatchGetBackup(req) + case "CassandraClustersClient.GetCommandAsync": + resp, err = c.dispatchGetCommandAsync(req) case "CassandraClustersClient.BeginInvokeCommand": resp, err = c.dispatchBeginInvokeCommand(req) + case "CassandraClustersClient.BeginInvokeCommandAsync": + resp, err = c.dispatchBeginInvokeCommandAsync(req) + case "CassandraClustersClient.NewListBackupsPager": + resp, err = c.dispatchNewListBackupsPager(req) case "CassandraClustersClient.NewListByResourceGroupPager": resp, err = c.dispatchNewListByResourceGroupPager(req) case "CassandraClustersClient.NewListBySubscriptionPager": resp, err = c.dispatchNewListBySubscriptionPager(req) + case "CassandraClustersClient.NewListCommandPager": + resp, err = c.dispatchNewListCommandPager(req) case "CassandraClustersClient.BeginStart": resp, err = c.dispatchBeginStart(req) case "CassandraClustersClient.Status": @@ -206,7 +242,14 @@ func (c *CassandraClustersServerTransport) dispatchBeginDeallocate(req *http.Req if err != nil { return nil, err } - respr, errRespr := c.srv.BeginDeallocate(req.Context(), resourceGroupNameParam, clusterNameParam, nil) + xMSForceDeallocateParam := getOptional(getHeaderValue(req.Header, "x-ms-force-deallocate")) + var options *armcosmos.CassandraClustersClientBeginDeallocateOptions + if xMSForceDeallocateParam != nil { + options = &armcosmos.CassandraClustersClientBeginDeallocateOptions{ + XMSForceDeallocate: xMSForceDeallocateParam, + } + } + respr, errRespr := c.srv.BeginDeallocate(req.Context(), resourceGroupNameParam, clusterNameParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -307,6 +350,80 @@ func (c *CassandraClustersServerTransport) dispatchGet(req *http.Request) (*http return resp, nil } +func (c *CassandraClustersServerTransport) dispatchGetBackup(req *http.Request) (*http.Response, error) { + if c.srv.GetBackup == nil { + return nil, &nonRetriableError{errors.New("fake for method GetBackup not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/cassandraClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + backupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupId")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.GetBackup(req.Context(), resourceGroupNameParam, clusterNameParam, backupIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BackupResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CassandraClustersServerTransport) dispatchGetCommandAsync(req *http.Request) (*http.Response, error) { + if c.srv.GetCommandAsync == nil { + return nil, &nonRetriableError{errors.New("fake for method GetCommandAsync not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/cassandraClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/commands/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + commandIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("commandId")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.GetCommandAsync(req.Context(), resourceGroupNameParam, clusterNameParam, commandIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ListCommands, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (c *CassandraClustersServerTransport) dispatchBeginInvokeCommand(req *http.Request) (*http.Response, error) { if c.srv.BeginInvokeCommand == nil { return nil, &nonRetriableError{errors.New("fake for method BeginInvokeCommand not implemented")} @@ -355,6 +472,92 @@ func (c *CassandraClustersServerTransport) dispatchBeginInvokeCommand(req *http. return resp, nil } +func (c *CassandraClustersServerTransport) dispatchBeginInvokeCommandAsync(req *http.Request) (*http.Response, error) { + if c.srv.BeginInvokeCommandAsync == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginInvokeCommandAsync not implemented")} + } + beginInvokeCommandAsync := c.beginInvokeCommandAsync.get(req) + if beginInvokeCommandAsync == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/cassandraClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/invokeCommandAsync` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.CommandPostBody](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginInvokeCommandAsync(req.Context(), resourceGroupNameParam, clusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginInvokeCommandAsync = &respr + c.beginInvokeCommandAsync.add(req, beginInvokeCommandAsync) + } + + resp, err := server.PollerResponderNext(beginInvokeCommandAsync, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginInvokeCommandAsync.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginInvokeCommandAsync) { + c.beginInvokeCommandAsync.remove(req) + } + + return resp, nil +} + +func (c *CassandraClustersServerTransport) dispatchNewListBackupsPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListBackupsPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBackupsPager not implemented")} + } + newListBackupsPager := c.newListBackupsPager.get(req) + if newListBackupsPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/cassandraClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backups` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + resp := c.srv.NewListBackupsPager(resourceGroupNameParam, clusterNameParam, nil) + newListBackupsPager = &resp + c.newListBackupsPager.add(req, newListBackupsPager) + } + resp, err := server.PagerResponderNext(newListBackupsPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListBackupsPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBackupsPager) { + c.newListBackupsPager.remove(req) + } + return resp, nil +} + func (c *CassandraClustersServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { if c.srv.NewListByResourceGroupPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} @@ -419,6 +622,44 @@ func (c *CassandraClustersServerTransport) dispatchNewListBySubscriptionPager(re return resp, nil } +func (c *CassandraClustersServerTransport) dispatchNewListCommandPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListCommandPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListCommandPager not implemented")} + } + newListCommandPager := c.newListCommandPager.get(req) + if newListCommandPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/cassandraClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/commands` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + clusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("clusterName")]) + if err != nil { + return nil, err + } + resp := c.srv.NewListCommandPager(resourceGroupNameParam, clusterNameParam, nil) + newListCommandPager = &resp + c.newListCommandPager.add(req, newListCommandPager) + } + resp, err := server.PagerResponderNext(newListCommandPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListCommandPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListCommandPager) { + c.newListCommandPager.remove(req) + } + return resp, nil +} + func (c *CassandraClustersServerTransport) dispatchBeginStart(req *http.Request) (*http.Response, error) { if c.srv.BeginStart == nil { return nil, &nonRetriableError{errors.New("fake for method BeginStart not implemented")} diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/cassandradatacenters_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/cassandradatacenters_server.go index da54815b1101..4b806dce3112 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/cassandradatacenters_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/cassandradatacenters_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/cassandraresources_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/cassandraresources_server.go index b68f6c1bff8e..0af87eca1070 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/cassandraresources_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/cassandraresources_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" @@ -31,6 +31,10 @@ type CassandraResourcesServer struct { // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginCreateUpdateCassandraTable func(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, createUpdateCassandraTableParameters armcosmos.CassandraTableCreateUpdateParameters, options *armcosmos.CassandraResourcesClientBeginCreateUpdateCassandraTableOptions) (resp azfake.PollerResponder[armcosmos.CassandraResourcesClientCreateUpdateCassandraTableResponse], errResp azfake.ErrorResponder) + // BeginCreateUpdateCassandraView is the fake for method CassandraResourcesClient.BeginCreateUpdateCassandraView + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginCreateUpdateCassandraView func(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, createUpdateCassandraViewParameters armcosmos.CassandraViewCreateUpdateParameters, options *armcosmos.CassandraResourcesClientBeginCreateUpdateCassandraViewOptions) (resp azfake.PollerResponder[armcosmos.CassandraResourcesClientCreateUpdateCassandraViewResponse], errResp azfake.ErrorResponder) + // BeginDeleteCassandraKeyspace is the fake for method CassandraResourcesClient.BeginDeleteCassandraKeyspace // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent BeginDeleteCassandraKeyspace func(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, options *armcosmos.CassandraResourcesClientBeginDeleteCassandraKeyspaceOptions) (resp azfake.PollerResponder[armcosmos.CassandraResourcesClientDeleteCassandraKeyspaceResponse], errResp azfake.ErrorResponder) @@ -39,6 +43,10 @@ type CassandraResourcesServer struct { // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent BeginDeleteCassandraTable func(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, options *armcosmos.CassandraResourcesClientBeginDeleteCassandraTableOptions) (resp azfake.PollerResponder[armcosmos.CassandraResourcesClientDeleteCassandraTableResponse], errResp azfake.ErrorResponder) + // BeginDeleteCassandraView is the fake for method CassandraResourcesClient.BeginDeleteCassandraView + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDeleteCassandraView func(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *armcosmos.CassandraResourcesClientBeginDeleteCassandraViewOptions) (resp azfake.PollerResponder[armcosmos.CassandraResourcesClientDeleteCassandraViewResponse], errResp azfake.ErrorResponder) + // GetCassandraKeyspace is the fake for method CassandraResourcesClient.GetCassandraKeyspace // HTTP status codes to indicate success: http.StatusOK GetCassandraKeyspace func(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, options *armcosmos.CassandraResourcesClientGetCassandraKeyspaceOptions) (resp azfake.Responder[armcosmos.CassandraResourcesClientGetCassandraKeyspaceResponse], errResp azfake.ErrorResponder) @@ -55,6 +63,14 @@ type CassandraResourcesServer struct { // HTTP status codes to indicate success: http.StatusOK GetCassandraTableThroughput func(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, options *armcosmos.CassandraResourcesClientGetCassandraTableThroughputOptions) (resp azfake.Responder[armcosmos.CassandraResourcesClientGetCassandraTableThroughputResponse], errResp azfake.ErrorResponder) + // GetCassandraView is the fake for method CassandraResourcesClient.GetCassandraView + // HTTP status codes to indicate success: http.StatusOK + GetCassandraView func(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *armcosmos.CassandraResourcesClientGetCassandraViewOptions) (resp azfake.Responder[armcosmos.CassandraResourcesClientGetCassandraViewResponse], errResp azfake.ErrorResponder) + + // GetCassandraViewThroughput is the fake for method CassandraResourcesClient.GetCassandraViewThroughput + // HTTP status codes to indicate success: http.StatusOK + GetCassandraViewThroughput func(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *armcosmos.CassandraResourcesClientGetCassandraViewThroughputOptions) (resp azfake.Responder[armcosmos.CassandraResourcesClientGetCassandraViewThroughputResponse], errResp azfake.ErrorResponder) + // NewListCassandraKeyspacesPager is the fake for method CassandraResourcesClient.NewListCassandraKeyspacesPager // HTTP status codes to indicate success: http.StatusOK NewListCassandraKeyspacesPager func(resourceGroupName string, accountName string, options *armcosmos.CassandraResourcesClientListCassandraKeyspacesOptions) (resp azfake.PagerResponder[armcosmos.CassandraResourcesClientListCassandraKeyspacesResponse]) @@ -63,6 +79,10 @@ type CassandraResourcesServer struct { // HTTP status codes to indicate success: http.StatusOK NewListCassandraTablesPager func(resourceGroupName string, accountName string, keyspaceName string, options *armcosmos.CassandraResourcesClientListCassandraTablesOptions) (resp azfake.PagerResponder[armcosmos.CassandraResourcesClientListCassandraTablesResponse]) + // NewListCassandraViewsPager is the fake for method CassandraResourcesClient.NewListCassandraViewsPager + // HTTP status codes to indicate success: http.StatusOK + NewListCassandraViewsPager func(resourceGroupName string, accountName string, keyspaceName string, options *armcosmos.CassandraResourcesClientListCassandraViewsOptions) (resp azfake.PagerResponder[armcosmos.CassandraResourcesClientListCassandraViewsResponse]) + // BeginMigrateCassandraKeyspaceToAutoscale is the fake for method CassandraResourcesClient.BeginMigrateCassandraKeyspaceToAutoscale // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginMigrateCassandraKeyspaceToAutoscale func(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, options *armcosmos.CassandraResourcesClientBeginMigrateCassandraKeyspaceToAutoscaleOptions) (resp azfake.PollerResponder[armcosmos.CassandraResourcesClientMigrateCassandraKeyspaceToAutoscaleResponse], errResp azfake.ErrorResponder) @@ -79,6 +99,14 @@ type CassandraResourcesServer struct { // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginMigrateCassandraTableToManualThroughput func(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, options *armcosmos.CassandraResourcesClientBeginMigrateCassandraTableToManualThroughputOptions) (resp azfake.PollerResponder[armcosmos.CassandraResourcesClientMigrateCassandraTableToManualThroughputResponse], errResp azfake.ErrorResponder) + // BeginMigrateCassandraViewToAutoscale is the fake for method CassandraResourcesClient.BeginMigrateCassandraViewToAutoscale + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginMigrateCassandraViewToAutoscale func(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *armcosmos.CassandraResourcesClientBeginMigrateCassandraViewToAutoscaleOptions) (resp azfake.PollerResponder[armcosmos.CassandraResourcesClientMigrateCassandraViewToAutoscaleResponse], errResp azfake.ErrorResponder) + + // BeginMigrateCassandraViewToManualThroughput is the fake for method CassandraResourcesClient.BeginMigrateCassandraViewToManualThroughput + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginMigrateCassandraViewToManualThroughput func(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *armcosmos.CassandraResourcesClientBeginMigrateCassandraViewToManualThroughputOptions) (resp azfake.PollerResponder[armcosmos.CassandraResourcesClientMigrateCassandraViewToManualThroughputResponse], errResp azfake.ErrorResponder) + // BeginUpdateCassandraKeyspaceThroughput is the fake for method CassandraResourcesClient.BeginUpdateCassandraKeyspaceThroughput // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginUpdateCassandraKeyspaceThroughput func(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters armcosmos.ThroughputSettingsUpdateParameters, options *armcosmos.CassandraResourcesClientBeginUpdateCassandraKeyspaceThroughputOptions) (resp azfake.PollerResponder[armcosmos.CassandraResourcesClientUpdateCassandraKeyspaceThroughputResponse], errResp azfake.ErrorResponder) @@ -86,6 +114,10 @@ type CassandraResourcesServer struct { // BeginUpdateCassandraTableThroughput is the fake for method CassandraResourcesClient.BeginUpdateCassandraTableThroughput // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginUpdateCassandraTableThroughput func(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, updateThroughputParameters armcosmos.ThroughputSettingsUpdateParameters, options *armcosmos.CassandraResourcesClientBeginUpdateCassandraTableThroughputOptions) (resp azfake.PollerResponder[armcosmos.CassandraResourcesClientUpdateCassandraTableThroughputResponse], errResp azfake.ErrorResponder) + + // BeginUpdateCassandraViewThroughput is the fake for method CassandraResourcesClient.BeginUpdateCassandraViewThroughput + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdateCassandraViewThroughput func(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, updateThroughputParameters armcosmos.ThroughputSettingsUpdateParameters, options *armcosmos.CassandraResourcesClientBeginUpdateCassandraViewThroughputOptions) (resp azfake.PollerResponder[armcosmos.CassandraResourcesClientUpdateCassandraViewThroughputResponse], errResp azfake.ErrorResponder) } // NewCassandraResourcesServerTransport creates a new instance of CassandraResourcesServerTransport with the provided implementation. @@ -96,16 +128,22 @@ func NewCassandraResourcesServerTransport(srv *CassandraResourcesServer) *Cassan srv: srv, beginCreateUpdateCassandraKeyspace: newTracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientCreateUpdateCassandraKeyspaceResponse]](), beginCreateUpdateCassandraTable: newTracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientCreateUpdateCassandraTableResponse]](), + beginCreateUpdateCassandraView: newTracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientCreateUpdateCassandraViewResponse]](), beginDeleteCassandraKeyspace: newTracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientDeleteCassandraKeyspaceResponse]](), beginDeleteCassandraTable: newTracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientDeleteCassandraTableResponse]](), + beginDeleteCassandraView: newTracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientDeleteCassandraViewResponse]](), newListCassandraKeyspacesPager: newTracker[azfake.PagerResponder[armcosmos.CassandraResourcesClientListCassandraKeyspacesResponse]](), newListCassandraTablesPager: newTracker[azfake.PagerResponder[armcosmos.CassandraResourcesClientListCassandraTablesResponse]](), + newListCassandraViewsPager: newTracker[azfake.PagerResponder[armcosmos.CassandraResourcesClientListCassandraViewsResponse]](), beginMigrateCassandraKeyspaceToAutoscale: newTracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientMigrateCassandraKeyspaceToAutoscaleResponse]](), beginMigrateCassandraKeyspaceToManualThroughput: newTracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientMigrateCassandraKeyspaceToManualThroughputResponse]](), beginMigrateCassandraTableToAutoscale: newTracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientMigrateCassandraTableToAutoscaleResponse]](), beginMigrateCassandraTableToManualThroughput: newTracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientMigrateCassandraTableToManualThroughputResponse]](), + beginMigrateCassandraViewToAutoscale: newTracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientMigrateCassandraViewToAutoscaleResponse]](), + beginMigrateCassandraViewToManualThroughput: newTracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientMigrateCassandraViewToManualThroughputResponse]](), beginUpdateCassandraKeyspaceThroughput: newTracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientUpdateCassandraKeyspaceThroughputResponse]](), beginUpdateCassandraTableThroughput: newTracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientUpdateCassandraTableThroughputResponse]](), + beginUpdateCassandraViewThroughput: newTracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientUpdateCassandraViewThroughputResponse]](), } } @@ -115,16 +153,22 @@ type CassandraResourcesServerTransport struct { srv *CassandraResourcesServer beginCreateUpdateCassandraKeyspace *tracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientCreateUpdateCassandraKeyspaceResponse]] beginCreateUpdateCassandraTable *tracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientCreateUpdateCassandraTableResponse]] + beginCreateUpdateCassandraView *tracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientCreateUpdateCassandraViewResponse]] beginDeleteCassandraKeyspace *tracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientDeleteCassandraKeyspaceResponse]] beginDeleteCassandraTable *tracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientDeleteCassandraTableResponse]] + beginDeleteCassandraView *tracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientDeleteCassandraViewResponse]] newListCassandraKeyspacesPager *tracker[azfake.PagerResponder[armcosmos.CassandraResourcesClientListCassandraKeyspacesResponse]] newListCassandraTablesPager *tracker[azfake.PagerResponder[armcosmos.CassandraResourcesClientListCassandraTablesResponse]] + newListCassandraViewsPager *tracker[azfake.PagerResponder[armcosmos.CassandraResourcesClientListCassandraViewsResponse]] beginMigrateCassandraKeyspaceToAutoscale *tracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientMigrateCassandraKeyspaceToAutoscaleResponse]] beginMigrateCassandraKeyspaceToManualThroughput *tracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientMigrateCassandraKeyspaceToManualThroughputResponse]] beginMigrateCassandraTableToAutoscale *tracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientMigrateCassandraTableToAutoscaleResponse]] beginMigrateCassandraTableToManualThroughput *tracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientMigrateCassandraTableToManualThroughputResponse]] + beginMigrateCassandraViewToAutoscale *tracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientMigrateCassandraViewToAutoscaleResponse]] + beginMigrateCassandraViewToManualThroughput *tracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientMigrateCassandraViewToManualThroughputResponse]] beginUpdateCassandraKeyspaceThroughput *tracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientUpdateCassandraKeyspaceThroughputResponse]] beginUpdateCassandraTableThroughput *tracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientUpdateCassandraTableThroughputResponse]] + beginUpdateCassandraViewThroughput *tracker[azfake.PollerResponder[armcosmos.CassandraResourcesClientUpdateCassandraViewThroughputResponse]] } // Do implements the policy.Transporter interface for CassandraResourcesServerTransport. @@ -143,10 +187,14 @@ func (c *CassandraResourcesServerTransport) Do(req *http.Request) (*http.Respons resp, err = c.dispatchBeginCreateUpdateCassandraKeyspace(req) case "CassandraResourcesClient.BeginCreateUpdateCassandraTable": resp, err = c.dispatchBeginCreateUpdateCassandraTable(req) + case "CassandraResourcesClient.BeginCreateUpdateCassandraView": + resp, err = c.dispatchBeginCreateUpdateCassandraView(req) case "CassandraResourcesClient.BeginDeleteCassandraKeyspace": resp, err = c.dispatchBeginDeleteCassandraKeyspace(req) case "CassandraResourcesClient.BeginDeleteCassandraTable": resp, err = c.dispatchBeginDeleteCassandraTable(req) + case "CassandraResourcesClient.BeginDeleteCassandraView": + resp, err = c.dispatchBeginDeleteCassandraView(req) case "CassandraResourcesClient.GetCassandraKeyspace": resp, err = c.dispatchGetCassandraKeyspace(req) case "CassandraResourcesClient.GetCassandraKeyspaceThroughput": @@ -155,10 +203,16 @@ func (c *CassandraResourcesServerTransport) Do(req *http.Request) (*http.Respons resp, err = c.dispatchGetCassandraTable(req) case "CassandraResourcesClient.GetCassandraTableThroughput": resp, err = c.dispatchGetCassandraTableThroughput(req) + case "CassandraResourcesClient.GetCassandraView": + resp, err = c.dispatchGetCassandraView(req) + case "CassandraResourcesClient.GetCassandraViewThroughput": + resp, err = c.dispatchGetCassandraViewThroughput(req) case "CassandraResourcesClient.NewListCassandraKeyspacesPager": resp, err = c.dispatchNewListCassandraKeyspacesPager(req) case "CassandraResourcesClient.NewListCassandraTablesPager": resp, err = c.dispatchNewListCassandraTablesPager(req) + case "CassandraResourcesClient.NewListCassandraViewsPager": + resp, err = c.dispatchNewListCassandraViewsPager(req) case "CassandraResourcesClient.BeginMigrateCassandraKeyspaceToAutoscale": resp, err = c.dispatchBeginMigrateCassandraKeyspaceToAutoscale(req) case "CassandraResourcesClient.BeginMigrateCassandraKeyspaceToManualThroughput": @@ -167,10 +221,16 @@ func (c *CassandraResourcesServerTransport) Do(req *http.Request) (*http.Respons resp, err = c.dispatchBeginMigrateCassandraTableToAutoscale(req) case "CassandraResourcesClient.BeginMigrateCassandraTableToManualThroughput": resp, err = c.dispatchBeginMigrateCassandraTableToManualThroughput(req) + case "CassandraResourcesClient.BeginMigrateCassandraViewToAutoscale": + resp, err = c.dispatchBeginMigrateCassandraViewToAutoscale(req) + case "CassandraResourcesClient.BeginMigrateCassandraViewToManualThroughput": + resp, err = c.dispatchBeginMigrateCassandraViewToManualThroughput(req) case "CassandraResourcesClient.BeginUpdateCassandraKeyspaceThroughput": resp, err = c.dispatchBeginUpdateCassandraKeyspaceThroughput(req) case "CassandraResourcesClient.BeginUpdateCassandraTableThroughput": resp, err = c.dispatchBeginUpdateCassandraTableThroughput(req) + case "CassandraResourcesClient.BeginUpdateCassandraViewThroughput": + resp, err = c.dispatchBeginUpdateCassandraViewThroughput(req) default: err = fmt.Errorf("unhandled API %s", method) } @@ -290,6 +350,62 @@ func (c *CassandraResourcesServerTransport) dispatchBeginCreateUpdateCassandraTa return resp, nil } +func (c *CassandraResourcesServerTransport) dispatchBeginCreateUpdateCassandraView(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreateUpdateCassandraView == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateUpdateCassandraView not implemented")} + } + beginCreateUpdateCassandraView := c.beginCreateUpdateCassandraView.get(req) + if beginCreateUpdateCassandraView == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cassandraKeyspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/views/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.CassandraViewCreateUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + keyspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("keyspaceName")]) + if err != nil { + return nil, err + } + viewNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("viewName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreateUpdateCassandraView(req.Context(), resourceGroupNameParam, accountNameParam, keyspaceNameParam, viewNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateUpdateCassandraView = &respr + c.beginCreateUpdateCassandraView.add(req, beginCreateUpdateCassandraView) + } + + resp, err := server.PollerResponderNext(beginCreateUpdateCassandraView, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginCreateUpdateCassandraView.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateUpdateCassandraView) { + c.beginCreateUpdateCassandraView.remove(req) + } + + return resp, nil +} + func (c *CassandraResourcesServerTransport) dispatchBeginDeleteCassandraKeyspace(req *http.Request) (*http.Response, error) { if c.srv.BeginDeleteCassandraKeyspace == nil { return nil, &nonRetriableError{errors.New("fake for method BeginDeleteCassandraKeyspace not implemented")} @@ -390,6 +506,58 @@ func (c *CassandraResourcesServerTransport) dispatchBeginDeleteCassandraTable(re return resp, nil } +func (c *CassandraResourcesServerTransport) dispatchBeginDeleteCassandraView(req *http.Request) (*http.Response, error) { + if c.srv.BeginDeleteCassandraView == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDeleteCassandraView not implemented")} + } + beginDeleteCassandraView := c.beginDeleteCassandraView.get(req) + if beginDeleteCassandraView == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cassandraKeyspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/views/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + keyspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("keyspaceName")]) + if err != nil { + return nil, err + } + viewNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("viewName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDeleteCassandraView(req.Context(), resourceGroupNameParam, accountNameParam, keyspaceNameParam, viewNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDeleteCassandraView = &respr + c.beginDeleteCassandraView.add(req, beginDeleteCassandraView) + } + + resp, err := server.PollerResponderNext(beginDeleteCassandraView, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.beginDeleteCassandraView.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDeleteCassandraView) { + c.beginDeleteCassandraView.remove(req) + } + + return resp, nil +} + func (c *CassandraResourcesServerTransport) dispatchGetCassandraKeyspace(req *http.Request) (*http.Response, error) { if c.srv.GetCassandraKeyspace == nil { return nil, &nonRetriableError{errors.New("fake for method GetCassandraKeyspace not implemented")} @@ -546,6 +714,88 @@ func (c *CassandraResourcesServerTransport) dispatchGetCassandraTableThroughput( return resp, nil } +func (c *CassandraResourcesServerTransport) dispatchGetCassandraView(req *http.Request) (*http.Response, error) { + if c.srv.GetCassandraView == nil { + return nil, &nonRetriableError{errors.New("fake for method GetCassandraView not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cassandraKeyspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/views/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + keyspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("keyspaceName")]) + if err != nil { + return nil, err + } + viewNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("viewName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.GetCassandraView(req.Context(), resourceGroupNameParam, accountNameParam, keyspaceNameParam, viewNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CassandraViewGetResults, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CassandraResourcesServerTransport) dispatchGetCassandraViewThroughput(req *http.Request) (*http.Response, error) { + if c.srv.GetCassandraViewThroughput == nil { + return nil, &nonRetriableError{errors.New("fake for method GetCassandraViewThroughput not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cassandraKeyspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/views/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/throughputSettings/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + keyspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("keyspaceName")]) + if err != nil { + return nil, err + } + viewNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("viewName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.GetCassandraViewThroughput(req.Context(), resourceGroupNameParam, accountNameParam, keyspaceNameParam, viewNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ThroughputSettingsGetResults, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (c *CassandraResourcesServerTransport) dispatchNewListCassandraKeyspacesPager(req *http.Request) (*http.Response, error) { if c.srv.NewListCassandraKeyspacesPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListCassandraKeyspacesPager not implemented")} @@ -626,6 +876,48 @@ func (c *CassandraResourcesServerTransport) dispatchNewListCassandraTablesPager( return resp, nil } +func (c *CassandraResourcesServerTransport) dispatchNewListCassandraViewsPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListCassandraViewsPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListCassandraViewsPager not implemented")} + } + newListCassandraViewsPager := c.newListCassandraViewsPager.get(req) + if newListCassandraViewsPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cassandraKeyspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/views` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + keyspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("keyspaceName")]) + if err != nil { + return nil, err + } + resp := c.srv.NewListCassandraViewsPager(resourceGroupNameParam, accountNameParam, keyspaceNameParam, nil) + newListCassandraViewsPager = &resp + c.newListCassandraViewsPager.add(req, newListCassandraViewsPager) + } + resp, err := server.PagerResponderNext(newListCassandraViewsPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListCassandraViewsPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListCassandraViewsPager) { + c.newListCassandraViewsPager.remove(req) + } + return resp, nil +} + func (c *CassandraResourcesServerTransport) dispatchBeginMigrateCassandraKeyspaceToAutoscale(req *http.Request) (*http.Response, error) { if c.srv.BeginMigrateCassandraKeyspaceToAutoscale == nil { return nil, &nonRetriableError{errors.New("fake for method BeginMigrateCassandraKeyspaceToAutoscale not implemented")} @@ -826,6 +1118,110 @@ func (c *CassandraResourcesServerTransport) dispatchBeginMigrateCassandraTableTo return resp, nil } +func (c *CassandraResourcesServerTransport) dispatchBeginMigrateCassandraViewToAutoscale(req *http.Request) (*http.Response, error) { + if c.srv.BeginMigrateCassandraViewToAutoscale == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginMigrateCassandraViewToAutoscale not implemented")} + } + beginMigrateCassandraViewToAutoscale := c.beginMigrateCassandraViewToAutoscale.get(req) + if beginMigrateCassandraViewToAutoscale == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cassandraKeyspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/views/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/throughputSettings/default/migrateToAutoscale` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + keyspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("keyspaceName")]) + if err != nil { + return nil, err + } + viewNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("viewName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginMigrateCassandraViewToAutoscale(req.Context(), resourceGroupNameParam, accountNameParam, keyspaceNameParam, viewNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginMigrateCassandraViewToAutoscale = &respr + c.beginMigrateCassandraViewToAutoscale.add(req, beginMigrateCassandraViewToAutoscale) + } + + resp, err := server.PollerResponderNext(beginMigrateCassandraViewToAutoscale, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginMigrateCassandraViewToAutoscale.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginMigrateCassandraViewToAutoscale) { + c.beginMigrateCassandraViewToAutoscale.remove(req) + } + + return resp, nil +} + +func (c *CassandraResourcesServerTransport) dispatchBeginMigrateCassandraViewToManualThroughput(req *http.Request) (*http.Response, error) { + if c.srv.BeginMigrateCassandraViewToManualThroughput == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginMigrateCassandraViewToManualThroughput not implemented")} + } + beginMigrateCassandraViewToManualThroughput := c.beginMigrateCassandraViewToManualThroughput.get(req) + if beginMigrateCassandraViewToManualThroughput == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cassandraKeyspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/views/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/throughputSettings/default/migrateToManualThroughput` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + keyspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("keyspaceName")]) + if err != nil { + return nil, err + } + viewNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("viewName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginMigrateCassandraViewToManualThroughput(req.Context(), resourceGroupNameParam, accountNameParam, keyspaceNameParam, viewNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginMigrateCassandraViewToManualThroughput = &respr + c.beginMigrateCassandraViewToManualThroughput.add(req, beginMigrateCassandraViewToManualThroughput) + } + + resp, err := server.PollerResponderNext(beginMigrateCassandraViewToManualThroughput, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginMigrateCassandraViewToManualThroughput.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginMigrateCassandraViewToManualThroughput) { + c.beginMigrateCassandraViewToManualThroughput.remove(req) + } + + return resp, nil +} + func (c *CassandraResourcesServerTransport) dispatchBeginUpdateCassandraKeyspaceThroughput(req *http.Request) (*http.Response, error) { if c.srv.BeginUpdateCassandraKeyspaceThroughput == nil { return nil, &nonRetriableError{errors.New("fake for method BeginUpdateCassandraKeyspaceThroughput not implemented")} @@ -933,3 +1329,59 @@ func (c *CassandraResourcesServerTransport) dispatchBeginUpdateCassandraTableThr return resp, nil } + +func (c *CassandraResourcesServerTransport) dispatchBeginUpdateCassandraViewThroughput(req *http.Request) (*http.Response, error) { + if c.srv.BeginUpdateCassandraViewThroughput == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdateCassandraViewThroughput not implemented")} + } + beginUpdateCassandraViewThroughput := c.beginUpdateCassandraViewThroughput.get(req) + if beginUpdateCassandraViewThroughput == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cassandraKeyspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/views/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/throughputSettings/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.ThroughputSettingsUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + keyspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("keyspaceName")]) + if err != nil { + return nil, err + } + viewNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("viewName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginUpdateCassandraViewThroughput(req.Context(), resourceGroupNameParam, accountNameParam, keyspaceNameParam, viewNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdateCassandraViewThroughput = &respr + c.beginUpdateCassandraViewThroughput.add(req, beginUpdateCassandraViewThroughput) + } + + resp, err := server.PollerResponderNext(beginUpdateCassandraViewThroughput, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginUpdateCassandraViewThroughput.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdateCassandraViewThroughput) { + c.beginUpdateCassandraViewThroughput.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/chaosfault_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/chaosfault_server.go new file mode 100644 index 000000000000..a184341490e2 --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/chaosfault_server.go @@ -0,0 +1,216 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" + "net/http" + "net/url" + "regexp" +) + +// ChaosFaultServer is a fake server for instances of the armcosmos.ChaosFaultClient type. +type ChaosFaultServer struct { + // BeginEnableDisable is the fake for method ChaosFaultClient.BeginEnableDisable + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginEnableDisable func(ctx context.Context, resourceGroupName string, accountName string, chaosFault string, chaosFaultRequest armcosmos.ChaosFaultResource, options *armcosmos.ChaosFaultClientBeginEnableDisableOptions) (resp azfake.PollerResponder[armcosmos.ChaosFaultClientEnableDisableResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ChaosFaultClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, chaosFault string, options *armcosmos.ChaosFaultClientGetOptions) (resp azfake.Responder[armcosmos.ChaosFaultClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ChaosFaultClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, accountName string, options *armcosmos.ChaosFaultClientListOptions) (resp azfake.PagerResponder[armcosmos.ChaosFaultClientListResponse]) +} + +// NewChaosFaultServerTransport creates a new instance of ChaosFaultServerTransport with the provided implementation. +// The returned ChaosFaultServerTransport instance is connected to an instance of armcosmos.ChaosFaultClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewChaosFaultServerTransport(srv *ChaosFaultServer) *ChaosFaultServerTransport { + return &ChaosFaultServerTransport{ + srv: srv, + beginEnableDisable: newTracker[azfake.PollerResponder[armcosmos.ChaosFaultClientEnableDisableResponse]](), + newListPager: newTracker[azfake.PagerResponder[armcosmos.ChaosFaultClientListResponse]](), + } +} + +// ChaosFaultServerTransport connects instances of armcosmos.ChaosFaultClient to instances of ChaosFaultServer. +// Don't use this type directly, use NewChaosFaultServerTransport instead. +type ChaosFaultServerTransport struct { + srv *ChaosFaultServer + beginEnableDisable *tracker[azfake.PollerResponder[armcosmos.ChaosFaultClientEnableDisableResponse]] + newListPager *tracker[azfake.PagerResponder[armcosmos.ChaosFaultClientListResponse]] +} + +// Do implements the policy.Transporter interface for ChaosFaultServerTransport. +func (c *ChaosFaultServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ChaosFaultClient.BeginEnableDisable": + resp, err = c.dispatchBeginEnableDisable(req) + case "ChaosFaultClient.Get": + resp, err = c.dispatchGet(req) + case "ChaosFaultClient.NewListPager": + resp, err = c.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *ChaosFaultServerTransport) dispatchBeginEnableDisable(req *http.Request) (*http.Response, error) { + if c.srv.BeginEnableDisable == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginEnableDisable not implemented")} + } + beginEnableDisable := c.beginEnableDisable.get(req) + if beginEnableDisable == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/chaosFaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.ChaosFaultResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + chaosFaultParam, err := url.PathUnescape(matches[regex.SubexpIndex("chaosFault")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginEnableDisable(req.Context(), resourceGroupNameParam, accountNameParam, chaosFaultParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginEnableDisable = &respr + c.beginEnableDisable.add(req, beginEnableDisable) + } + + resp, err := server.PollerResponderNext(beginEnableDisable, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + c.beginEnableDisable.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginEnableDisable) { + c.beginEnableDisable.remove(req) + } + + return resp, nil +} + +func (c *ChaosFaultServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/chaosFaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + chaosFaultParam, err := url.PathUnescape(matches[regex.SubexpIndex("chaosFault")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, chaosFaultParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ChaosFaultResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ChaosFaultServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := c.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/chaosFaults` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + resp := c.srv.NewListPager(resourceGroupNameParam, accountNameParam, nil) + newListPager = &resp + c.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcosmos.ChaosFaultClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + c.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/collection_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/collection_server.go index 408c6e30a054..2511e501f532 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/collection_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/collection_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/collectionpartition_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/collectionpartition_server.go index 77b1fb3a35ae..c6a036310817 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/collectionpartition_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/collectionpartition_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/collectionpartitionregion_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/collectionpartitionregion_server.go index efdc1323b128..04f0c785ca12 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/collectionpartitionregion_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/collectionpartitionregion_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/collectionregion_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/collectionregion_server.go index e71b4f3c07ae..7da9dfd58fdb 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/collectionregion_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/collectionregion_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/database_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/database_server.go index e9530d3b0624..19676f7eafdb 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/database_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/database_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/databaseaccountregion_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/databaseaccountregion_server.go index a14f671dc0fc..989b794ff1cf 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/databaseaccountregion_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/databaseaccountregion_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/databaseaccounts_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/databaseaccounts_server.go index ae22897705c1..ef560385925e 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/databaseaccounts_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/databaseaccounts_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/datatransferjobs_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/datatransferjobs_server.go new file mode 100644 index 000000000000..a28d31cd9ad7 --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/datatransferjobs_server.go @@ -0,0 +1,375 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" + "net/http" + "net/url" + "regexp" +) + +// DataTransferJobsServer is a fake server for instances of the armcosmos.DataTransferJobsClient type. +type DataTransferJobsServer struct { + // Cancel is the fake for method DataTransferJobsClient.Cancel + // HTTP status codes to indicate success: http.StatusOK + Cancel func(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *armcosmos.DataTransferJobsClientCancelOptions) (resp azfake.Responder[armcosmos.DataTransferJobsClientCancelResponse], errResp azfake.ErrorResponder) + + // Complete is the fake for method DataTransferJobsClient.Complete + // HTTP status codes to indicate success: http.StatusOK + Complete func(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *armcosmos.DataTransferJobsClientCompleteOptions) (resp azfake.Responder[armcosmos.DataTransferJobsClientCompleteResponse], errResp azfake.ErrorResponder) + + // Create is the fake for method DataTransferJobsClient.Create + // HTTP status codes to indicate success: http.StatusOK + Create func(ctx context.Context, resourceGroupName string, accountName string, jobName string, jobCreateParameters armcosmos.CreateJobRequest, options *armcosmos.DataTransferJobsClientCreateOptions) (resp azfake.Responder[armcosmos.DataTransferJobsClientCreateResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method DataTransferJobsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *armcosmos.DataTransferJobsClientGetOptions) (resp azfake.Responder[armcosmos.DataTransferJobsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByDatabaseAccountPager is the fake for method DataTransferJobsClient.NewListByDatabaseAccountPager + // HTTP status codes to indicate success: http.StatusOK + NewListByDatabaseAccountPager func(resourceGroupName string, accountName string, options *armcosmos.DataTransferJobsClientListByDatabaseAccountOptions) (resp azfake.PagerResponder[armcosmos.DataTransferJobsClientListByDatabaseAccountResponse]) + + // Pause is the fake for method DataTransferJobsClient.Pause + // HTTP status codes to indicate success: http.StatusOK + Pause func(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *armcosmos.DataTransferJobsClientPauseOptions) (resp azfake.Responder[armcosmos.DataTransferJobsClientPauseResponse], errResp azfake.ErrorResponder) + + // Resume is the fake for method DataTransferJobsClient.Resume + // HTTP status codes to indicate success: http.StatusOK + Resume func(ctx context.Context, resourceGroupName string, accountName string, jobName string, options *armcosmos.DataTransferJobsClientResumeOptions) (resp azfake.Responder[armcosmos.DataTransferJobsClientResumeResponse], errResp azfake.ErrorResponder) +} + +// NewDataTransferJobsServerTransport creates a new instance of DataTransferJobsServerTransport with the provided implementation. +// The returned DataTransferJobsServerTransport instance is connected to an instance of armcosmos.DataTransferJobsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDataTransferJobsServerTransport(srv *DataTransferJobsServer) *DataTransferJobsServerTransport { + return &DataTransferJobsServerTransport{ + srv: srv, + newListByDatabaseAccountPager: newTracker[azfake.PagerResponder[armcosmos.DataTransferJobsClientListByDatabaseAccountResponse]](), + } +} + +// DataTransferJobsServerTransport connects instances of armcosmos.DataTransferJobsClient to instances of DataTransferJobsServer. +// Don't use this type directly, use NewDataTransferJobsServerTransport instead. +type DataTransferJobsServerTransport struct { + srv *DataTransferJobsServer + newListByDatabaseAccountPager *tracker[azfake.PagerResponder[armcosmos.DataTransferJobsClientListByDatabaseAccountResponse]] +} + +// Do implements the policy.Transporter interface for DataTransferJobsServerTransport. +func (d *DataTransferJobsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "DataTransferJobsClient.Cancel": + resp, err = d.dispatchCancel(req) + case "DataTransferJobsClient.Complete": + resp, err = d.dispatchComplete(req) + case "DataTransferJobsClient.Create": + resp, err = d.dispatchCreate(req) + case "DataTransferJobsClient.Get": + resp, err = d.dispatchGet(req) + case "DataTransferJobsClient.NewListByDatabaseAccountPager": + resp, err = d.dispatchNewListByDatabaseAccountPager(req) + case "DataTransferJobsClient.Pause": + resp, err = d.dispatchPause(req) + case "DataTransferJobsClient.Resume": + resp, err = d.dispatchResume(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (d *DataTransferJobsServerTransport) dispatchCancel(req *http.Request) (*http.Response, error) { + if d.srv.Cancel == nil { + return nil, &nonRetriableError{errors.New("fake for method Cancel not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataTransferJobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cancel` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Cancel(req.Context(), resourceGroupNameParam, accountNameParam, jobNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataTransferJobGetResults, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DataTransferJobsServerTransport) dispatchComplete(req *http.Request) (*http.Response, error) { + if d.srv.Complete == nil { + return nil, &nonRetriableError{errors.New("fake for method Complete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataTransferJobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/complete` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Complete(req.Context(), resourceGroupNameParam, accountNameParam, jobNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataTransferJobGetResults, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DataTransferJobsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if d.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataTransferJobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.CreateJobRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Create(req.Context(), resourceGroupNameParam, accountNameParam, jobNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataTransferJobGetResults, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DataTransferJobsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if d.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataTransferJobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, jobNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataTransferJobGetResults, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DataTransferJobsServerTransport) dispatchNewListByDatabaseAccountPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListByDatabaseAccountPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByDatabaseAccountPager not implemented")} + } + newListByDatabaseAccountPager := d.newListByDatabaseAccountPager.get(req) + if newListByDatabaseAccountPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataTransferJobs` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + resp := d.srv.NewListByDatabaseAccountPager(resourceGroupNameParam, accountNameParam, nil) + newListByDatabaseAccountPager = &resp + d.newListByDatabaseAccountPager.add(req, newListByDatabaseAccountPager) + server.PagerResponderInjectNextLinks(newListByDatabaseAccountPager, req, func(page *armcosmos.DataTransferJobsClientListByDatabaseAccountResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByDatabaseAccountPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + d.newListByDatabaseAccountPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByDatabaseAccountPager) { + d.newListByDatabaseAccountPager.remove(req) + } + return resp, nil +} + +func (d *DataTransferJobsServerTransport) dispatchPause(req *http.Request) (*http.Response, error) { + if d.srv.Pause == nil { + return nil, &nonRetriableError{errors.New("fake for method Pause not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataTransferJobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/pause` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Pause(req.Context(), resourceGroupNameParam, accountNameParam, jobNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataTransferJobGetResults, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DataTransferJobsServerTransport) dispatchResume(req *http.Request) (*http.Response, error) { + if d.srv.Resume == nil { + return nil, &nonRetriableError{errors.New("fake for method Resume not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataTransferJobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resume` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.Resume(req.Context(), resourceGroupNameParam, accountNameParam, jobNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataTransferJobGetResults, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/graphresources_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/graphresources_server.go new file mode 100644 index 000000000000..8afe518a3f47 --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/graphresources_server.go @@ -0,0 +1,268 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" + "net/http" + "net/url" + "regexp" +) + +// GraphResourcesServer is a fake server for instances of the armcosmos.GraphResourcesClient type. +type GraphResourcesServer struct { + // BeginCreateUpdateGraph is the fake for method GraphResourcesClient.BeginCreateUpdateGraph + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginCreateUpdateGraph func(ctx context.Context, resourceGroupName string, accountName string, graphName string, createUpdateGraphParameters armcosmos.GraphResourceCreateUpdateParameters, options *armcosmos.GraphResourcesClientBeginCreateUpdateGraphOptions) (resp azfake.PollerResponder[armcosmos.GraphResourcesClientCreateUpdateGraphResponse], errResp azfake.ErrorResponder) + + // BeginDeleteGraphResource is the fake for method GraphResourcesClient.BeginDeleteGraphResource + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDeleteGraphResource func(ctx context.Context, resourceGroupName string, accountName string, graphName string, options *armcosmos.GraphResourcesClientBeginDeleteGraphResourceOptions) (resp azfake.PollerResponder[armcosmos.GraphResourcesClientDeleteGraphResourceResponse], errResp azfake.ErrorResponder) + + // GetGraph is the fake for method GraphResourcesClient.GetGraph + // HTTP status codes to indicate success: http.StatusOK + GetGraph func(ctx context.Context, resourceGroupName string, accountName string, graphName string, options *armcosmos.GraphResourcesClientGetGraphOptions) (resp azfake.Responder[armcosmos.GraphResourcesClientGetGraphResponse], errResp azfake.ErrorResponder) + + // NewListGraphsPager is the fake for method GraphResourcesClient.NewListGraphsPager + // HTTP status codes to indicate success: http.StatusOK + NewListGraphsPager func(resourceGroupName string, accountName string, options *armcosmos.GraphResourcesClientListGraphsOptions) (resp azfake.PagerResponder[armcosmos.GraphResourcesClientListGraphsResponse]) +} + +// NewGraphResourcesServerTransport creates a new instance of GraphResourcesServerTransport with the provided implementation. +// The returned GraphResourcesServerTransport instance is connected to an instance of armcosmos.GraphResourcesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewGraphResourcesServerTransport(srv *GraphResourcesServer) *GraphResourcesServerTransport { + return &GraphResourcesServerTransport{ + srv: srv, + beginCreateUpdateGraph: newTracker[azfake.PollerResponder[armcosmos.GraphResourcesClientCreateUpdateGraphResponse]](), + beginDeleteGraphResource: newTracker[azfake.PollerResponder[armcosmos.GraphResourcesClientDeleteGraphResourceResponse]](), + newListGraphsPager: newTracker[azfake.PagerResponder[armcosmos.GraphResourcesClientListGraphsResponse]](), + } +} + +// GraphResourcesServerTransport connects instances of armcosmos.GraphResourcesClient to instances of GraphResourcesServer. +// Don't use this type directly, use NewGraphResourcesServerTransport instead. +type GraphResourcesServerTransport struct { + srv *GraphResourcesServer + beginCreateUpdateGraph *tracker[azfake.PollerResponder[armcosmos.GraphResourcesClientCreateUpdateGraphResponse]] + beginDeleteGraphResource *tracker[azfake.PollerResponder[armcosmos.GraphResourcesClientDeleteGraphResourceResponse]] + newListGraphsPager *tracker[azfake.PagerResponder[armcosmos.GraphResourcesClientListGraphsResponse]] +} + +// Do implements the policy.Transporter interface for GraphResourcesServerTransport. +func (g *GraphResourcesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "GraphResourcesClient.BeginCreateUpdateGraph": + resp, err = g.dispatchBeginCreateUpdateGraph(req) + case "GraphResourcesClient.BeginDeleteGraphResource": + resp, err = g.dispatchBeginDeleteGraphResource(req) + case "GraphResourcesClient.GetGraph": + resp, err = g.dispatchGetGraph(req) + case "GraphResourcesClient.NewListGraphsPager": + resp, err = g.dispatchNewListGraphsPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (g *GraphResourcesServerTransport) dispatchBeginCreateUpdateGraph(req *http.Request) (*http.Response, error) { + if g.srv.BeginCreateUpdateGraph == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateUpdateGraph not implemented")} + } + beginCreateUpdateGraph := g.beginCreateUpdateGraph.get(req) + if beginCreateUpdateGraph == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/graphs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.GraphResourceCreateUpdateParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + graphNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("graphName")]) + if err != nil { + return nil, err + } + respr, errRespr := g.srv.BeginCreateUpdateGraph(req.Context(), resourceGroupNameParam, accountNameParam, graphNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateUpdateGraph = &respr + g.beginCreateUpdateGraph.add(req, beginCreateUpdateGraph) + } + + resp, err := server.PollerResponderNext(beginCreateUpdateGraph, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + g.beginCreateUpdateGraph.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateUpdateGraph) { + g.beginCreateUpdateGraph.remove(req) + } + + return resp, nil +} + +func (g *GraphResourcesServerTransport) dispatchBeginDeleteGraphResource(req *http.Request) (*http.Response, error) { + if g.srv.BeginDeleteGraphResource == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDeleteGraphResource not implemented")} + } + beginDeleteGraphResource := g.beginDeleteGraphResource.get(req) + if beginDeleteGraphResource == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/graphs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + graphNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("graphName")]) + if err != nil { + return nil, err + } + respr, errRespr := g.srv.BeginDeleteGraphResource(req.Context(), resourceGroupNameParam, accountNameParam, graphNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDeleteGraphResource = &respr + g.beginDeleteGraphResource.add(req, beginDeleteGraphResource) + } + + resp, err := server.PollerResponderNext(beginDeleteGraphResource, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + g.beginDeleteGraphResource.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDeleteGraphResource) { + g.beginDeleteGraphResource.remove(req) + } + + return resp, nil +} + +func (g *GraphResourcesServerTransport) dispatchGetGraph(req *http.Request) (*http.Response, error) { + if g.srv.GetGraph == nil { + return nil, &nonRetriableError{errors.New("fake for method GetGraph not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/graphs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + graphNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("graphName")]) + if err != nil { + return nil, err + } + respr, errRespr := g.srv.GetGraph(req.Context(), resourceGroupNameParam, accountNameParam, graphNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GraphResourceGetResults, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (g *GraphResourcesServerTransport) dispatchNewListGraphsPager(req *http.Request) (*http.Response, error) { + if g.srv.NewListGraphsPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListGraphsPager not implemented")} + } + newListGraphsPager := g.newListGraphsPager.get(req) + if newListGraphsPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/graphs` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + resp := g.srv.NewListGraphsPager(resourceGroupNameParam, accountNameParam, nil) + newListGraphsPager = &resp + g.newListGraphsPager.add(req, newListGraphsPager) + } + resp, err := server.PagerResponderNext(newListGraphsPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + g.newListGraphsPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListGraphsPager) { + g.newListGraphsPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/gremlinresources_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/gremlinresources_server.go index 94ac206e38b9..1e219c9ef701 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/gremlinresources_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/gremlinresources_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/internal.go b/sdk/resourcemanager/cosmos/armcosmos/fake/internal.go index 55ac7c4dc64f..5a066550a12e 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/internal.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/internal.go @@ -32,6 +32,14 @@ func contains[T comparable](s []T, v T) bool { return false } +func getHeaderValue(h http.Header, k string) string { + v := h[k] + if len(v) == 0 { + return "" + } + return v[0] +} + func getOptional[T any](v T) *T { if reflect.ValueOf(v).IsZero() { return nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/locations_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/locations_server.go index d367d80d02ef..5fe5d8703c07 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/locations_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/locations_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/mongodbresources_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/mongodbresources_server.go index 43c14652a385..99f93cb39994 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/mongodbresources_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/mongodbresources_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" @@ -79,6 +79,10 @@ type MongoDBResourcesServer struct { // HTTP status codes to indicate success: http.StatusOK GetMongoUserDefinition func(ctx context.Context, mongoUserDefinitionID string, resourceGroupName string, accountName string, options *armcosmos.MongoDBResourcesClientGetMongoUserDefinitionOptions) (resp azfake.Responder[armcosmos.MongoDBResourcesClientGetMongoUserDefinitionResponse], errResp azfake.ErrorResponder) + // BeginListMongoDBCollectionPartitionMerge is the fake for method MongoDBResourcesClient.BeginListMongoDBCollectionPartitionMerge + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginListMongoDBCollectionPartitionMerge func(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, mergeParameters armcosmos.MergeParameters, options *armcosmos.MongoDBResourcesClientBeginListMongoDBCollectionPartitionMergeOptions) (resp azfake.PollerResponder[armcosmos.MongoDBResourcesClientListMongoDBCollectionPartitionMergeResponse], errResp azfake.ErrorResponder) + // NewListMongoDBCollectionsPager is the fake for method MongoDBResourcesClient.NewListMongoDBCollectionsPager // HTTP status codes to indicate success: http.StatusOK NewListMongoDBCollectionsPager func(resourceGroupName string, accountName string, databaseName string, options *armcosmos.MongoDBResourcesClientListMongoDBCollectionsOptions) (resp azfake.PagerResponder[armcosmos.MongoDBResourcesClientListMongoDBCollectionsResponse]) @@ -111,6 +115,26 @@ type MongoDBResourcesServer struct { // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginMigrateMongoDBDatabaseToManualThroughput func(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *armcosmos.MongoDBResourcesClientBeginMigrateMongoDBDatabaseToManualThroughputOptions) (resp azfake.PollerResponder[armcosmos.MongoDBResourcesClientMigrateMongoDBDatabaseToManualThroughputResponse], errResp azfake.ErrorResponder) + // BeginMongoDBContainerRedistributeThroughput is the fake for method MongoDBResourcesClient.BeginMongoDBContainerRedistributeThroughput + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginMongoDBContainerRedistributeThroughput func(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, redistributeThroughputParameters armcosmos.RedistributeThroughputParameters, options *armcosmos.MongoDBResourcesClientBeginMongoDBContainerRedistributeThroughputOptions) (resp azfake.PollerResponder[armcosmos.MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse], errResp azfake.ErrorResponder) + + // BeginMongoDBContainerRetrieveThroughputDistribution is the fake for method MongoDBResourcesClient.BeginMongoDBContainerRetrieveThroughputDistribution + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginMongoDBContainerRetrieveThroughputDistribution func(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, retrieveThroughputParameters armcosmos.RetrieveThroughputParameters, options *armcosmos.MongoDBResourcesClientBeginMongoDBContainerRetrieveThroughputDistributionOptions) (resp azfake.PollerResponder[armcosmos.MongoDBResourcesClientMongoDBContainerRetrieveThroughputDistributionResponse], errResp azfake.ErrorResponder) + + // BeginMongoDBDatabasePartitionMerge is the fake for method MongoDBResourcesClient.BeginMongoDBDatabasePartitionMerge + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginMongoDBDatabasePartitionMerge func(ctx context.Context, resourceGroupName string, accountName string, databaseName string, mergeParameters armcosmos.MergeParameters, options *armcosmos.MongoDBResourcesClientBeginMongoDBDatabasePartitionMergeOptions) (resp azfake.PollerResponder[armcosmos.MongoDBResourcesClientMongoDBDatabasePartitionMergeResponse], errResp azfake.ErrorResponder) + + // BeginMongoDBDatabaseRedistributeThroughput is the fake for method MongoDBResourcesClient.BeginMongoDBDatabaseRedistributeThroughput + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginMongoDBDatabaseRedistributeThroughput func(ctx context.Context, resourceGroupName string, accountName string, databaseName string, redistributeThroughputParameters armcosmos.RedistributeThroughputParameters, options *armcosmos.MongoDBResourcesClientBeginMongoDBDatabaseRedistributeThroughputOptions) (resp azfake.PollerResponder[armcosmos.MongoDBResourcesClientMongoDBDatabaseRedistributeThroughputResponse], errResp azfake.ErrorResponder) + + // BeginMongoDBDatabaseRetrieveThroughputDistribution is the fake for method MongoDBResourcesClient.BeginMongoDBDatabaseRetrieveThroughputDistribution + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginMongoDBDatabaseRetrieveThroughputDistribution func(ctx context.Context, resourceGroupName string, accountName string, databaseName string, retrieveThroughputParameters armcosmos.RetrieveThroughputParameters, options *armcosmos.MongoDBResourcesClientBeginMongoDBDatabaseRetrieveThroughputDistributionOptions) (resp azfake.PollerResponder[armcosmos.MongoDBResourcesClientMongoDBDatabaseRetrieveThroughputDistributionResponse], errResp azfake.ErrorResponder) + // BeginRetrieveContinuousBackupInformation is the fake for method MongoDBResourcesClient.BeginRetrieveContinuousBackupInformation // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginRetrieveContinuousBackupInformation func(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, location armcosmos.ContinuousBackupRestoreLocation, options *armcosmos.MongoDBResourcesClientBeginRetrieveContinuousBackupInformationOptions) (resp azfake.PollerResponder[armcosmos.MongoDBResourcesClientRetrieveContinuousBackupInformationResponse], errResp azfake.ErrorResponder) @@ -129,52 +153,64 @@ type MongoDBResourcesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewMongoDBResourcesServerTransport(srv *MongoDBResourcesServer) *MongoDBResourcesServerTransport { return &MongoDBResourcesServerTransport{ - srv: srv, - beginCreateUpdateMongoDBCollection: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientCreateUpdateMongoDBCollectionResponse]](), - beginCreateUpdateMongoDBDatabase: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientCreateUpdateMongoDBDatabaseResponse]](), - beginCreateUpdateMongoRoleDefinition: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientCreateUpdateMongoRoleDefinitionResponse]](), - beginCreateUpdateMongoUserDefinition: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientCreateUpdateMongoUserDefinitionResponse]](), - beginDeleteMongoDBCollection: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientDeleteMongoDBCollectionResponse]](), - beginDeleteMongoDBDatabase: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientDeleteMongoDBDatabaseResponse]](), - beginDeleteMongoRoleDefinition: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientDeleteMongoRoleDefinitionResponse]](), - beginDeleteMongoUserDefinition: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientDeleteMongoUserDefinitionResponse]](), - newListMongoDBCollectionsPager: newTracker[azfake.PagerResponder[armcosmos.MongoDBResourcesClientListMongoDBCollectionsResponse]](), - newListMongoDBDatabasesPager: newTracker[azfake.PagerResponder[armcosmos.MongoDBResourcesClientListMongoDBDatabasesResponse]](), - newListMongoRoleDefinitionsPager: newTracker[azfake.PagerResponder[armcosmos.MongoDBResourcesClientListMongoRoleDefinitionsResponse]](), - newListMongoUserDefinitionsPager: newTracker[azfake.PagerResponder[armcosmos.MongoDBResourcesClientListMongoUserDefinitionsResponse]](), - beginMigrateMongoDBCollectionToAutoscale: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMigrateMongoDBCollectionToAutoscaleResponse]](), - beginMigrateMongoDBCollectionToManualThroughput: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMigrateMongoDBCollectionToManualThroughputResponse]](), - beginMigrateMongoDBDatabaseToAutoscale: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMigrateMongoDBDatabaseToAutoscaleResponse]](), - beginMigrateMongoDBDatabaseToManualThroughput: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMigrateMongoDBDatabaseToManualThroughputResponse]](), - beginRetrieveContinuousBackupInformation: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientRetrieveContinuousBackupInformationResponse]](), - beginUpdateMongoDBCollectionThroughput: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientUpdateMongoDBCollectionThroughputResponse]](), - beginUpdateMongoDBDatabaseThroughput: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientUpdateMongoDBDatabaseThroughputResponse]](), + srv: srv, + beginCreateUpdateMongoDBCollection: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientCreateUpdateMongoDBCollectionResponse]](), + beginCreateUpdateMongoDBDatabase: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientCreateUpdateMongoDBDatabaseResponse]](), + beginCreateUpdateMongoRoleDefinition: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientCreateUpdateMongoRoleDefinitionResponse]](), + beginCreateUpdateMongoUserDefinition: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientCreateUpdateMongoUserDefinitionResponse]](), + beginDeleteMongoDBCollection: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientDeleteMongoDBCollectionResponse]](), + beginDeleteMongoDBDatabase: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientDeleteMongoDBDatabaseResponse]](), + beginDeleteMongoRoleDefinition: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientDeleteMongoRoleDefinitionResponse]](), + beginDeleteMongoUserDefinition: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientDeleteMongoUserDefinitionResponse]](), + beginListMongoDBCollectionPartitionMerge: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientListMongoDBCollectionPartitionMergeResponse]](), + newListMongoDBCollectionsPager: newTracker[azfake.PagerResponder[armcosmos.MongoDBResourcesClientListMongoDBCollectionsResponse]](), + newListMongoDBDatabasesPager: newTracker[azfake.PagerResponder[armcosmos.MongoDBResourcesClientListMongoDBDatabasesResponse]](), + newListMongoRoleDefinitionsPager: newTracker[azfake.PagerResponder[armcosmos.MongoDBResourcesClientListMongoRoleDefinitionsResponse]](), + newListMongoUserDefinitionsPager: newTracker[azfake.PagerResponder[armcosmos.MongoDBResourcesClientListMongoUserDefinitionsResponse]](), + beginMigrateMongoDBCollectionToAutoscale: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMigrateMongoDBCollectionToAutoscaleResponse]](), + beginMigrateMongoDBCollectionToManualThroughput: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMigrateMongoDBCollectionToManualThroughputResponse]](), + beginMigrateMongoDBDatabaseToAutoscale: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMigrateMongoDBDatabaseToAutoscaleResponse]](), + beginMigrateMongoDBDatabaseToManualThroughput: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMigrateMongoDBDatabaseToManualThroughputResponse]](), + beginMongoDBContainerRedistributeThroughput: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse]](), + beginMongoDBContainerRetrieveThroughputDistribution: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMongoDBContainerRetrieveThroughputDistributionResponse]](), + beginMongoDBDatabasePartitionMerge: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMongoDBDatabasePartitionMergeResponse]](), + beginMongoDBDatabaseRedistributeThroughput: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMongoDBDatabaseRedistributeThroughputResponse]](), + beginMongoDBDatabaseRetrieveThroughputDistribution: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMongoDBDatabaseRetrieveThroughputDistributionResponse]](), + beginRetrieveContinuousBackupInformation: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientRetrieveContinuousBackupInformationResponse]](), + beginUpdateMongoDBCollectionThroughput: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientUpdateMongoDBCollectionThroughputResponse]](), + beginUpdateMongoDBDatabaseThroughput: newTracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientUpdateMongoDBDatabaseThroughputResponse]](), } } // MongoDBResourcesServerTransport connects instances of armcosmos.MongoDBResourcesClient to instances of MongoDBResourcesServer. // Don't use this type directly, use NewMongoDBResourcesServerTransport instead. type MongoDBResourcesServerTransport struct { - srv *MongoDBResourcesServer - beginCreateUpdateMongoDBCollection *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientCreateUpdateMongoDBCollectionResponse]] - beginCreateUpdateMongoDBDatabase *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientCreateUpdateMongoDBDatabaseResponse]] - beginCreateUpdateMongoRoleDefinition *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientCreateUpdateMongoRoleDefinitionResponse]] - beginCreateUpdateMongoUserDefinition *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientCreateUpdateMongoUserDefinitionResponse]] - beginDeleteMongoDBCollection *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientDeleteMongoDBCollectionResponse]] - beginDeleteMongoDBDatabase *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientDeleteMongoDBDatabaseResponse]] - beginDeleteMongoRoleDefinition *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientDeleteMongoRoleDefinitionResponse]] - beginDeleteMongoUserDefinition *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientDeleteMongoUserDefinitionResponse]] - newListMongoDBCollectionsPager *tracker[azfake.PagerResponder[armcosmos.MongoDBResourcesClientListMongoDBCollectionsResponse]] - newListMongoDBDatabasesPager *tracker[azfake.PagerResponder[armcosmos.MongoDBResourcesClientListMongoDBDatabasesResponse]] - newListMongoRoleDefinitionsPager *tracker[azfake.PagerResponder[armcosmos.MongoDBResourcesClientListMongoRoleDefinitionsResponse]] - newListMongoUserDefinitionsPager *tracker[azfake.PagerResponder[armcosmos.MongoDBResourcesClientListMongoUserDefinitionsResponse]] - beginMigrateMongoDBCollectionToAutoscale *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMigrateMongoDBCollectionToAutoscaleResponse]] - beginMigrateMongoDBCollectionToManualThroughput *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMigrateMongoDBCollectionToManualThroughputResponse]] - beginMigrateMongoDBDatabaseToAutoscale *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMigrateMongoDBDatabaseToAutoscaleResponse]] - beginMigrateMongoDBDatabaseToManualThroughput *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMigrateMongoDBDatabaseToManualThroughputResponse]] - beginRetrieveContinuousBackupInformation *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientRetrieveContinuousBackupInformationResponse]] - beginUpdateMongoDBCollectionThroughput *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientUpdateMongoDBCollectionThroughputResponse]] - beginUpdateMongoDBDatabaseThroughput *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientUpdateMongoDBDatabaseThroughputResponse]] + srv *MongoDBResourcesServer + beginCreateUpdateMongoDBCollection *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientCreateUpdateMongoDBCollectionResponse]] + beginCreateUpdateMongoDBDatabase *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientCreateUpdateMongoDBDatabaseResponse]] + beginCreateUpdateMongoRoleDefinition *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientCreateUpdateMongoRoleDefinitionResponse]] + beginCreateUpdateMongoUserDefinition *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientCreateUpdateMongoUserDefinitionResponse]] + beginDeleteMongoDBCollection *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientDeleteMongoDBCollectionResponse]] + beginDeleteMongoDBDatabase *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientDeleteMongoDBDatabaseResponse]] + beginDeleteMongoRoleDefinition *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientDeleteMongoRoleDefinitionResponse]] + beginDeleteMongoUserDefinition *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientDeleteMongoUserDefinitionResponse]] + beginListMongoDBCollectionPartitionMerge *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientListMongoDBCollectionPartitionMergeResponse]] + newListMongoDBCollectionsPager *tracker[azfake.PagerResponder[armcosmos.MongoDBResourcesClientListMongoDBCollectionsResponse]] + newListMongoDBDatabasesPager *tracker[azfake.PagerResponder[armcosmos.MongoDBResourcesClientListMongoDBDatabasesResponse]] + newListMongoRoleDefinitionsPager *tracker[azfake.PagerResponder[armcosmos.MongoDBResourcesClientListMongoRoleDefinitionsResponse]] + newListMongoUserDefinitionsPager *tracker[azfake.PagerResponder[armcosmos.MongoDBResourcesClientListMongoUserDefinitionsResponse]] + beginMigrateMongoDBCollectionToAutoscale *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMigrateMongoDBCollectionToAutoscaleResponse]] + beginMigrateMongoDBCollectionToManualThroughput *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMigrateMongoDBCollectionToManualThroughputResponse]] + beginMigrateMongoDBDatabaseToAutoscale *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMigrateMongoDBDatabaseToAutoscaleResponse]] + beginMigrateMongoDBDatabaseToManualThroughput *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMigrateMongoDBDatabaseToManualThroughputResponse]] + beginMongoDBContainerRedistributeThroughput *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse]] + beginMongoDBContainerRetrieveThroughputDistribution *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMongoDBContainerRetrieveThroughputDistributionResponse]] + beginMongoDBDatabasePartitionMerge *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMongoDBDatabasePartitionMergeResponse]] + beginMongoDBDatabaseRedistributeThroughput *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMongoDBDatabaseRedistributeThroughputResponse]] + beginMongoDBDatabaseRetrieveThroughputDistribution *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientMongoDBDatabaseRetrieveThroughputDistributionResponse]] + beginRetrieveContinuousBackupInformation *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientRetrieveContinuousBackupInformationResponse]] + beginUpdateMongoDBCollectionThroughput *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientUpdateMongoDBCollectionThroughputResponse]] + beginUpdateMongoDBDatabaseThroughput *tracker[azfake.PollerResponder[armcosmos.MongoDBResourcesClientUpdateMongoDBDatabaseThroughputResponse]] } // Do implements the policy.Transporter interface for MongoDBResourcesServerTransport. @@ -217,6 +253,8 @@ func (m *MongoDBResourcesServerTransport) Do(req *http.Request) (*http.Response, resp, err = m.dispatchGetMongoRoleDefinition(req) case "MongoDBResourcesClient.GetMongoUserDefinition": resp, err = m.dispatchGetMongoUserDefinition(req) + case "MongoDBResourcesClient.BeginListMongoDBCollectionPartitionMerge": + resp, err = m.dispatchBeginListMongoDBCollectionPartitionMerge(req) case "MongoDBResourcesClient.NewListMongoDBCollectionsPager": resp, err = m.dispatchNewListMongoDBCollectionsPager(req) case "MongoDBResourcesClient.NewListMongoDBDatabasesPager": @@ -233,6 +271,16 @@ func (m *MongoDBResourcesServerTransport) Do(req *http.Request) (*http.Response, resp, err = m.dispatchBeginMigrateMongoDBDatabaseToAutoscale(req) case "MongoDBResourcesClient.BeginMigrateMongoDBDatabaseToManualThroughput": resp, err = m.dispatchBeginMigrateMongoDBDatabaseToManualThroughput(req) + case "MongoDBResourcesClient.BeginMongoDBContainerRedistributeThroughput": + resp, err = m.dispatchBeginMongoDBContainerRedistributeThroughput(req) + case "MongoDBResourcesClient.BeginMongoDBContainerRetrieveThroughputDistribution": + resp, err = m.dispatchBeginMongoDBContainerRetrieveThroughputDistribution(req) + case "MongoDBResourcesClient.BeginMongoDBDatabasePartitionMerge": + resp, err = m.dispatchBeginMongoDBDatabasePartitionMerge(req) + case "MongoDBResourcesClient.BeginMongoDBDatabaseRedistributeThroughput": + resp, err = m.dispatchBeginMongoDBDatabaseRedistributeThroughput(req) + case "MongoDBResourcesClient.BeginMongoDBDatabaseRetrieveThroughputDistribution": + resp, err = m.dispatchBeginMongoDBDatabaseRetrieveThroughputDistribution(req) case "MongoDBResourcesClient.BeginRetrieveContinuousBackupInformation": resp, err = m.dispatchBeginRetrieveContinuousBackupInformation(req) case "MongoDBResourcesClient.BeginUpdateMongoDBCollectionThroughput": @@ -888,6 +936,62 @@ func (m *MongoDBResourcesServerTransport) dispatchGetMongoUserDefinition(req *ht return resp, nil } +func (m *MongoDBResourcesServerTransport) dispatchBeginListMongoDBCollectionPartitionMerge(req *http.Request) (*http.Response, error) { + if m.srv.BeginListMongoDBCollectionPartitionMerge == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginListMongoDBCollectionPartitionMerge not implemented")} + } + beginListMongoDBCollectionPartitionMerge := m.beginListMongoDBCollectionPartitionMerge.get(req) + if beginListMongoDBCollectionPartitionMerge == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/mongodbDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/collections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/partitionMerge` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.MergeParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + collectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("collectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginListMongoDBCollectionPartitionMerge(req.Context(), resourceGroupNameParam, accountNameParam, databaseNameParam, collectionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginListMongoDBCollectionPartitionMerge = &respr + m.beginListMongoDBCollectionPartitionMerge.add(req, beginListMongoDBCollectionPartitionMerge) + } + + resp, err := server.PollerResponderNext(beginListMongoDBCollectionPartitionMerge, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.beginListMongoDBCollectionPartitionMerge.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginListMongoDBCollectionPartitionMerge) { + m.beginListMongoDBCollectionPartitionMerge.remove(req) + } + + return resp, nil +} + func (m *MongoDBResourcesServerTransport) dispatchNewListMongoDBCollectionsPager(req *http.Request) (*http.Response, error) { if m.srv.NewListMongoDBCollectionsPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListMongoDBCollectionsPager not implemented")} @@ -1244,6 +1348,274 @@ func (m *MongoDBResourcesServerTransport) dispatchBeginMigrateMongoDBDatabaseToM return resp, nil } +func (m *MongoDBResourcesServerTransport) dispatchBeginMongoDBContainerRedistributeThroughput(req *http.Request) (*http.Response, error) { + if m.srv.BeginMongoDBContainerRedistributeThroughput == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginMongoDBContainerRedistributeThroughput not implemented")} + } + beginMongoDBContainerRedistributeThroughput := m.beginMongoDBContainerRedistributeThroughput.get(req) + if beginMongoDBContainerRedistributeThroughput == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/mongodbDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/collections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/throughputSettings/default/redistributeThroughput` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.RedistributeThroughputParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + collectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("collectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginMongoDBContainerRedistributeThroughput(req.Context(), resourceGroupNameParam, accountNameParam, databaseNameParam, collectionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginMongoDBContainerRedistributeThroughput = &respr + m.beginMongoDBContainerRedistributeThroughput.add(req, beginMongoDBContainerRedistributeThroughput) + } + + resp, err := server.PollerResponderNext(beginMongoDBContainerRedistributeThroughput, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.beginMongoDBContainerRedistributeThroughput.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginMongoDBContainerRedistributeThroughput) { + m.beginMongoDBContainerRedistributeThroughput.remove(req) + } + + return resp, nil +} + +func (m *MongoDBResourcesServerTransport) dispatchBeginMongoDBContainerRetrieveThroughputDistribution(req *http.Request) (*http.Response, error) { + if m.srv.BeginMongoDBContainerRetrieveThroughputDistribution == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginMongoDBContainerRetrieveThroughputDistribution not implemented")} + } + beginMongoDBContainerRetrieveThroughputDistribution := m.beginMongoDBContainerRetrieveThroughputDistribution.get(req) + if beginMongoDBContainerRetrieveThroughputDistribution == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/mongodbDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/collections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/throughputSettings/default/retrieveThroughputDistribution` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.RetrieveThroughputParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + collectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("collectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginMongoDBContainerRetrieveThroughputDistribution(req.Context(), resourceGroupNameParam, accountNameParam, databaseNameParam, collectionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginMongoDBContainerRetrieveThroughputDistribution = &respr + m.beginMongoDBContainerRetrieveThroughputDistribution.add(req, beginMongoDBContainerRetrieveThroughputDistribution) + } + + resp, err := server.PollerResponderNext(beginMongoDBContainerRetrieveThroughputDistribution, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.beginMongoDBContainerRetrieveThroughputDistribution.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginMongoDBContainerRetrieveThroughputDistribution) { + m.beginMongoDBContainerRetrieveThroughputDistribution.remove(req) + } + + return resp, nil +} + +func (m *MongoDBResourcesServerTransport) dispatchBeginMongoDBDatabasePartitionMerge(req *http.Request) (*http.Response, error) { + if m.srv.BeginMongoDBDatabasePartitionMerge == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginMongoDBDatabasePartitionMerge not implemented")} + } + beginMongoDBDatabasePartitionMerge := m.beginMongoDBDatabasePartitionMerge.get(req) + if beginMongoDBDatabasePartitionMerge == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/mongodbDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/partitionMerge` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.MergeParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginMongoDBDatabasePartitionMerge(req.Context(), resourceGroupNameParam, accountNameParam, databaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginMongoDBDatabasePartitionMerge = &respr + m.beginMongoDBDatabasePartitionMerge.add(req, beginMongoDBDatabasePartitionMerge) + } + + resp, err := server.PollerResponderNext(beginMongoDBDatabasePartitionMerge, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.beginMongoDBDatabasePartitionMerge.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginMongoDBDatabasePartitionMerge) { + m.beginMongoDBDatabasePartitionMerge.remove(req) + } + + return resp, nil +} + +func (m *MongoDBResourcesServerTransport) dispatchBeginMongoDBDatabaseRedistributeThroughput(req *http.Request) (*http.Response, error) { + if m.srv.BeginMongoDBDatabaseRedistributeThroughput == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginMongoDBDatabaseRedistributeThroughput not implemented")} + } + beginMongoDBDatabaseRedistributeThroughput := m.beginMongoDBDatabaseRedistributeThroughput.get(req) + if beginMongoDBDatabaseRedistributeThroughput == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/mongodbDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/throughputSettings/default/redistributeThroughput` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.RedistributeThroughputParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginMongoDBDatabaseRedistributeThroughput(req.Context(), resourceGroupNameParam, accountNameParam, databaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginMongoDBDatabaseRedistributeThroughput = &respr + m.beginMongoDBDatabaseRedistributeThroughput.add(req, beginMongoDBDatabaseRedistributeThroughput) + } + + resp, err := server.PollerResponderNext(beginMongoDBDatabaseRedistributeThroughput, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.beginMongoDBDatabaseRedistributeThroughput.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginMongoDBDatabaseRedistributeThroughput) { + m.beginMongoDBDatabaseRedistributeThroughput.remove(req) + } + + return resp, nil +} + +func (m *MongoDBResourcesServerTransport) dispatchBeginMongoDBDatabaseRetrieveThroughputDistribution(req *http.Request) (*http.Response, error) { + if m.srv.BeginMongoDBDatabaseRetrieveThroughputDistribution == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginMongoDBDatabaseRetrieveThroughputDistribution not implemented")} + } + beginMongoDBDatabaseRetrieveThroughputDistribution := m.beginMongoDBDatabaseRetrieveThroughputDistribution.get(req) + if beginMongoDBDatabaseRetrieveThroughputDistribution == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/mongodbDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/throughputSettings/default/retrieveThroughputDistribution` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.RetrieveThroughputParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginMongoDBDatabaseRetrieveThroughputDistribution(req.Context(), resourceGroupNameParam, accountNameParam, databaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginMongoDBDatabaseRetrieveThroughputDistribution = &respr + m.beginMongoDBDatabaseRetrieveThroughputDistribution.add(req, beginMongoDBDatabaseRetrieveThroughputDistribution) + } + + resp, err := server.PollerResponderNext(beginMongoDBDatabaseRetrieveThroughputDistribution, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.beginMongoDBDatabaseRetrieveThroughputDistribution.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginMongoDBDatabaseRetrieveThroughputDistribution) { + m.beginMongoDBDatabaseRetrieveThroughputDistribution.remove(req) + } + + return resp, nil +} + func (m *MongoDBResourcesServerTransport) dispatchBeginRetrieveContinuousBackupInformation(req *http.Request) (*http.Response, error) { if m.srv.BeginRetrieveContinuousBackupInformation == nil { return nil, &nonRetriableError{errors.New("fake for method BeginRetrieveContinuousBackupInformation not implemented")} diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/networksecurityperimeterconfigurations_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/networksecurityperimeterconfigurations_server.go new file mode 100644 index 000000000000..0484b38b56b3 --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/networksecurityperimeterconfigurations_server.go @@ -0,0 +1,212 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" + "net/http" + "net/url" + "regexp" +) + +// NetworkSecurityPerimeterConfigurationsServer is a fake server for instances of the armcosmos.NetworkSecurityPerimeterConfigurationsClient type. +type NetworkSecurityPerimeterConfigurationsServer struct { + // Get is the fake for method NetworkSecurityPerimeterConfigurationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, networkSecurityPerimeterConfigurationName string, options *armcosmos.NetworkSecurityPerimeterConfigurationsClientGetOptions) (resp azfake.Responder[armcosmos.NetworkSecurityPerimeterConfigurationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method NetworkSecurityPerimeterConfigurationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, accountName string, options *armcosmos.NetworkSecurityPerimeterConfigurationsClientListOptions) (resp azfake.PagerResponder[armcosmos.NetworkSecurityPerimeterConfigurationsClientListResponse]) + + // BeginReconcile is the fake for method NetworkSecurityPerimeterConfigurationsClient.BeginReconcile + // HTTP status codes to indicate success: http.StatusAccepted + BeginReconcile func(ctx context.Context, resourceGroupName string, accountName string, networkSecurityPerimeterConfigurationName string, options *armcosmos.NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions) (resp azfake.PollerResponder[armcosmos.NetworkSecurityPerimeterConfigurationsClientReconcileResponse], errResp azfake.ErrorResponder) +} + +// NewNetworkSecurityPerimeterConfigurationsServerTransport creates a new instance of NetworkSecurityPerimeterConfigurationsServerTransport with the provided implementation. +// The returned NetworkSecurityPerimeterConfigurationsServerTransport instance is connected to an instance of armcosmos.NetworkSecurityPerimeterConfigurationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewNetworkSecurityPerimeterConfigurationsServerTransport(srv *NetworkSecurityPerimeterConfigurationsServer) *NetworkSecurityPerimeterConfigurationsServerTransport { + return &NetworkSecurityPerimeterConfigurationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armcosmos.NetworkSecurityPerimeterConfigurationsClientListResponse]](), + beginReconcile: newTracker[azfake.PollerResponder[armcosmos.NetworkSecurityPerimeterConfigurationsClientReconcileResponse]](), + } +} + +// NetworkSecurityPerimeterConfigurationsServerTransport connects instances of armcosmos.NetworkSecurityPerimeterConfigurationsClient to instances of NetworkSecurityPerimeterConfigurationsServer. +// Don't use this type directly, use NewNetworkSecurityPerimeterConfigurationsServerTransport instead. +type NetworkSecurityPerimeterConfigurationsServerTransport struct { + srv *NetworkSecurityPerimeterConfigurationsServer + newListPager *tracker[azfake.PagerResponder[armcosmos.NetworkSecurityPerimeterConfigurationsClientListResponse]] + beginReconcile *tracker[azfake.PollerResponder[armcosmos.NetworkSecurityPerimeterConfigurationsClientReconcileResponse]] +} + +// Do implements the policy.Transporter interface for NetworkSecurityPerimeterConfigurationsServerTransport. +func (n *NetworkSecurityPerimeterConfigurationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "NetworkSecurityPerimeterConfigurationsClient.Get": + resp, err = n.dispatchGet(req) + case "NetworkSecurityPerimeterConfigurationsClient.NewListPager": + resp, err = n.dispatchNewListPager(req) + case "NetworkSecurityPerimeterConfigurationsClient.BeginReconcile": + resp, err = n.dispatchBeginReconcile(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (n *NetworkSecurityPerimeterConfigurationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if n.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + networkSecurityPerimeterConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkSecurityPerimeterConfigurationName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, networkSecurityPerimeterConfigurationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).NetworkSecurityPerimeterConfiguration, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (n *NetworkSecurityPerimeterConfigurationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if n.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := n.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + resp := n.srv.NewListPager(resourceGroupNameParam, accountNameParam, nil) + newListPager = &resp + n.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcosmos.NetworkSecurityPerimeterConfigurationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + n.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + n.newListPager.remove(req) + } + return resp, nil +} + +func (n *NetworkSecurityPerimeterConfigurationsServerTransport) dispatchBeginReconcile(req *http.Request) (*http.Response, error) { + if n.srv.BeginReconcile == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginReconcile not implemented")} + } + beginReconcile := n.beginReconcile.get(req) + if beginReconcile == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/networkSecurityPerimeterConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/reconcile` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + networkSecurityPerimeterConfigurationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("networkSecurityPerimeterConfigurationName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.BeginReconcile(req.Context(), resourceGroupNameParam, accountNameParam, networkSecurityPerimeterConfigurationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginReconcile = &respr + n.beginReconcile.add(req, beginReconcile) + } + + resp, err := server.PollerResponderNext(beginReconcile, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + n.beginReconcile.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginReconcile) { + n.beginReconcile.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/notebookworkspaces_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/notebookworkspaces_server.go index 405f6ac23dec..1c551969792e 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/notebookworkspaces_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/notebookworkspaces_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/operations_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/operations_server.go index e7e38f1fbb5c..3db880fe8c5f 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/operations_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/operations_server.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" ) diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/partitionkeyrangeid_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/partitionkeyrangeid_server.go index 005ba6dcfb14..07239c76f5c2 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/partitionkeyrangeid_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/partitionkeyrangeid_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/partitionkeyrangeidregion_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/partitionkeyrangeidregion_server.go index a7c45d02233b..cd2df73e5f86 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/partitionkeyrangeidregion_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/partitionkeyrangeidregion_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/percentile_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/percentile_server.go index a642522f4601..d3650362fbfb 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/percentile_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/percentile_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/percentilesourcetarget_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/percentilesourcetarget_server.go index 85f2ea4b7d96..525428926993 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/percentilesourcetarget_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/percentilesourcetarget_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/percentiletarget_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/percentiletarget_server.go index 621f732f2840..4a9966677a85 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/percentiletarget_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/percentiletarget_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/privateendpointconnections_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/privateendpointconnections_server.go index bbc492810b9f..46c29fb89cb0 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/privateendpointconnections_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/privateendpointconnections_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/privatelinkresources_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/privatelinkresources_server.go index 4d0eafdf6a5a..0d337f4d7c7e 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/privatelinkresources_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/privatelinkresources_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/restorabledatabaseaccounts_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/restorabledatabaseaccounts_server.go index 8e49bd42b11b..6bc61f516319 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/restorabledatabaseaccounts_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/restorabledatabaseaccounts_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/restorablegremlindatabases_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/restorablegremlindatabases_server.go index 192929f3fcdc..5c7eb6bf299d 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/restorablegremlindatabases_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/restorablegremlindatabases_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/restorablegremlingraphs_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/restorablegremlingraphs_server.go index e5cbecbe9458..d005784a2fc4 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/restorablegremlingraphs_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/restorablegremlingraphs_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/restorablegremlinresources_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/restorablegremlinresources_server.go index e3517c29f22b..241af53aa799 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/restorablegremlinresources_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/restorablegremlinresources_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/restorablemongodbcollections_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/restorablemongodbcollections_server.go index 96429f917ef2..0d906c13389d 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/restorablemongodbcollections_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/restorablemongodbcollections_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/restorablemongodbdatabases_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/restorablemongodbdatabases_server.go index fd2f5faa7054..e53405770c59 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/restorablemongodbdatabases_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/restorablemongodbdatabases_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/restorablemongodbresources_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/restorablemongodbresources_server.go index 359a9fe7f00c..649daa308748 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/restorablemongodbresources_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/restorablemongodbresources_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/restorablesqlcontainers_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/restorablesqlcontainers_server.go index e737f292b929..410f8db8ac27 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/restorablesqlcontainers_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/restorablesqlcontainers_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/restorablesqldatabases_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/restorablesqldatabases_server.go index c51cd023f82b..f6f3f05394f4 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/restorablesqldatabases_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/restorablesqldatabases_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/restorablesqlresources_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/restorablesqlresources_server.go index 9d9d0f4c826f..245e7a2ae140 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/restorablesqlresources_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/restorablesqlresources_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/restorabletableresources_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/restorabletableresources_server.go index a63c544e9c3e..06e86aacf69c 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/restorabletableresources_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/restorabletableresources_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/restorabletables_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/restorabletables_server.go index 048154e1a37c..7f9b40ceb8c8 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/restorabletables_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/restorabletables_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/server_factory.go b/sdk/resourcemanager/cosmos/armcosmos/fake/server_factory.go index b1a3bda52810..1228c878fdd4 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/server_factory.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/server_factory.go @@ -19,43 +19,51 @@ import ( // ServerFactory is a fake server for instances of the armcosmos.ClientFactory type. type ServerFactory struct { - CassandraClustersServer CassandraClustersServer - CassandraDataCentersServer CassandraDataCentersServer - CassandraResourcesServer CassandraResourcesServer - CollectionServer CollectionServer - CollectionPartitionServer CollectionPartitionServer - CollectionPartitionRegionServer CollectionPartitionRegionServer - CollectionRegionServer CollectionRegionServer - DatabaseAccountRegionServer DatabaseAccountRegionServer - DatabaseAccountsServer DatabaseAccountsServer - DatabaseServer DatabaseServer - GremlinResourcesServer GremlinResourcesServer - LocationsServer LocationsServer - MongoDBResourcesServer MongoDBResourcesServer - NotebookWorkspacesServer NotebookWorkspacesServer - OperationsServer OperationsServer - PartitionKeyRangeIDServer PartitionKeyRangeIDServer - PartitionKeyRangeIDRegionServer PartitionKeyRangeIDRegionServer - PercentileServer PercentileServer - PercentileSourceTargetServer PercentileSourceTargetServer - PercentileTargetServer PercentileTargetServer - PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer - PrivateLinkResourcesServer PrivateLinkResourcesServer - RestorableDatabaseAccountsServer RestorableDatabaseAccountsServer - RestorableGremlinDatabasesServer RestorableGremlinDatabasesServer - RestorableGremlinGraphsServer RestorableGremlinGraphsServer - RestorableGremlinResourcesServer RestorableGremlinResourcesServer - RestorableMongodbCollectionsServer RestorableMongodbCollectionsServer - RestorableMongodbDatabasesServer RestorableMongodbDatabasesServer - RestorableMongodbResourcesServer RestorableMongodbResourcesServer - RestorableSQLContainersServer RestorableSQLContainersServer - RestorableSQLDatabasesServer RestorableSQLDatabasesServer - RestorableSQLResourcesServer RestorableSQLResourcesServer - RestorableTableResourcesServer RestorableTableResourcesServer - RestorableTablesServer RestorableTablesServer - SQLResourcesServer SQLResourcesServer - ServiceServer ServiceServer - TableResourcesServer TableResourcesServer + CassandraClustersServer CassandraClustersServer + CassandraDataCentersServer CassandraDataCentersServer + CassandraResourcesServer CassandraResourcesServer + ChaosFaultServer ChaosFaultServer + CollectionServer CollectionServer + CollectionPartitionServer CollectionPartitionServer + CollectionPartitionRegionServer CollectionPartitionRegionServer + CollectionRegionServer CollectionRegionServer + DataTransferJobsServer DataTransferJobsServer + DatabaseAccountRegionServer DatabaseAccountRegionServer + DatabaseAccountsServer DatabaseAccountsServer + DatabaseServer DatabaseServer + GraphResourcesServer GraphResourcesServer + GremlinResourcesServer GremlinResourcesServer + LocationsServer LocationsServer + MongoDBResourcesServer MongoDBResourcesServer + NetworkSecurityPerimeterConfigurationsServer NetworkSecurityPerimeterConfigurationsServer + NotebookWorkspacesServer NotebookWorkspacesServer + OperationsServer OperationsServer + PartitionKeyRangeIDServer PartitionKeyRangeIDServer + PartitionKeyRangeIDRegionServer PartitionKeyRangeIDRegionServer + PercentileServer PercentileServer + PercentileSourceTargetServer PercentileSourceTargetServer + PercentileTargetServer PercentileTargetServer + PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer + PrivateLinkResourcesServer PrivateLinkResourcesServer + RestorableDatabaseAccountsServer RestorableDatabaseAccountsServer + RestorableGremlinDatabasesServer RestorableGremlinDatabasesServer + RestorableGremlinGraphsServer RestorableGremlinGraphsServer + RestorableGremlinResourcesServer RestorableGremlinResourcesServer + RestorableMongodbCollectionsServer RestorableMongodbCollectionsServer + RestorableMongodbDatabasesServer RestorableMongodbDatabasesServer + RestorableMongodbResourcesServer RestorableMongodbResourcesServer + RestorableSQLContainersServer RestorableSQLContainersServer + RestorableSQLDatabasesServer RestorableSQLDatabasesServer + RestorableSQLResourcesServer RestorableSQLResourcesServer + RestorableTableResourcesServer RestorableTableResourcesServer + RestorableTablesServer RestorableTablesServer + SQLResourcesServer SQLResourcesServer + ServiceServer ServiceServer + TableResourcesServer TableResourcesServer + ThroughputPoolAccountServer ThroughputPoolAccountServer + ThroughputPoolAccountsServer ThroughputPoolAccountsServer + ThroughputPoolServer ThroughputPoolServer + ThroughputPoolsServer ThroughputPoolsServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -70,45 +78,53 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armcosmos.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trCassandraClustersServer *CassandraClustersServerTransport - trCassandraDataCentersServer *CassandraDataCentersServerTransport - trCassandraResourcesServer *CassandraResourcesServerTransport - trCollectionServer *CollectionServerTransport - trCollectionPartitionServer *CollectionPartitionServerTransport - trCollectionPartitionRegionServer *CollectionPartitionRegionServerTransport - trCollectionRegionServer *CollectionRegionServerTransport - trDatabaseAccountRegionServer *DatabaseAccountRegionServerTransport - trDatabaseAccountsServer *DatabaseAccountsServerTransport - trDatabaseServer *DatabaseServerTransport - trGremlinResourcesServer *GremlinResourcesServerTransport - trLocationsServer *LocationsServerTransport - trMongoDBResourcesServer *MongoDBResourcesServerTransport - trNotebookWorkspacesServer *NotebookWorkspacesServerTransport - trOperationsServer *OperationsServerTransport - trPartitionKeyRangeIDServer *PartitionKeyRangeIDServerTransport - trPartitionKeyRangeIDRegionServer *PartitionKeyRangeIDRegionServerTransport - trPercentileServer *PercentileServerTransport - trPercentileSourceTargetServer *PercentileSourceTargetServerTransport - trPercentileTargetServer *PercentileTargetServerTransport - trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport - trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport - trRestorableDatabaseAccountsServer *RestorableDatabaseAccountsServerTransport - trRestorableGremlinDatabasesServer *RestorableGremlinDatabasesServerTransport - trRestorableGremlinGraphsServer *RestorableGremlinGraphsServerTransport - trRestorableGremlinResourcesServer *RestorableGremlinResourcesServerTransport - trRestorableMongodbCollectionsServer *RestorableMongodbCollectionsServerTransport - trRestorableMongodbDatabasesServer *RestorableMongodbDatabasesServerTransport - trRestorableMongodbResourcesServer *RestorableMongodbResourcesServerTransport - trRestorableSQLContainersServer *RestorableSQLContainersServerTransport - trRestorableSQLDatabasesServer *RestorableSQLDatabasesServerTransport - trRestorableSQLResourcesServer *RestorableSQLResourcesServerTransport - trRestorableTableResourcesServer *RestorableTableResourcesServerTransport - trRestorableTablesServer *RestorableTablesServerTransport - trSQLResourcesServer *SQLResourcesServerTransport - trServiceServer *ServiceServerTransport - trTableResourcesServer *TableResourcesServerTransport + srv *ServerFactory + trMu sync.Mutex + trCassandraClustersServer *CassandraClustersServerTransport + trCassandraDataCentersServer *CassandraDataCentersServerTransport + trCassandraResourcesServer *CassandraResourcesServerTransport + trChaosFaultServer *ChaosFaultServerTransport + trCollectionServer *CollectionServerTransport + trCollectionPartitionServer *CollectionPartitionServerTransport + trCollectionPartitionRegionServer *CollectionPartitionRegionServerTransport + trCollectionRegionServer *CollectionRegionServerTransport + trDataTransferJobsServer *DataTransferJobsServerTransport + trDatabaseAccountRegionServer *DatabaseAccountRegionServerTransport + trDatabaseAccountsServer *DatabaseAccountsServerTransport + trDatabaseServer *DatabaseServerTransport + trGraphResourcesServer *GraphResourcesServerTransport + trGremlinResourcesServer *GremlinResourcesServerTransport + trLocationsServer *LocationsServerTransport + trMongoDBResourcesServer *MongoDBResourcesServerTransport + trNetworkSecurityPerimeterConfigurationsServer *NetworkSecurityPerimeterConfigurationsServerTransport + trNotebookWorkspacesServer *NotebookWorkspacesServerTransport + trOperationsServer *OperationsServerTransport + trPartitionKeyRangeIDServer *PartitionKeyRangeIDServerTransport + trPartitionKeyRangeIDRegionServer *PartitionKeyRangeIDRegionServerTransport + trPercentileServer *PercentileServerTransport + trPercentileSourceTargetServer *PercentileSourceTargetServerTransport + trPercentileTargetServer *PercentileTargetServerTransport + trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport + trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport + trRestorableDatabaseAccountsServer *RestorableDatabaseAccountsServerTransport + trRestorableGremlinDatabasesServer *RestorableGremlinDatabasesServerTransport + trRestorableGremlinGraphsServer *RestorableGremlinGraphsServerTransport + trRestorableGremlinResourcesServer *RestorableGremlinResourcesServerTransport + trRestorableMongodbCollectionsServer *RestorableMongodbCollectionsServerTransport + trRestorableMongodbDatabasesServer *RestorableMongodbDatabasesServerTransport + trRestorableMongodbResourcesServer *RestorableMongodbResourcesServerTransport + trRestorableSQLContainersServer *RestorableSQLContainersServerTransport + trRestorableSQLDatabasesServer *RestorableSQLDatabasesServerTransport + trRestorableSQLResourcesServer *RestorableSQLResourcesServerTransport + trRestorableTableResourcesServer *RestorableTableResourcesServerTransport + trRestorableTablesServer *RestorableTablesServerTransport + trSQLResourcesServer *SQLResourcesServerTransport + trServiceServer *ServiceServerTransport + trTableResourcesServer *TableResourcesServerTransport + trThroughputPoolAccountServer *ThroughputPoolAccountServerTransport + trThroughputPoolAccountsServer *ThroughputPoolAccountsServerTransport + trThroughputPoolServer *ThroughputPoolServerTransport + trThroughputPoolsServer *ThroughputPoolsServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -139,6 +155,9 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewCassandraResourcesServerTransport(&s.srv.CassandraResourcesServer) }) resp, err = s.trCassandraResourcesServer.Do(req) + case "ChaosFaultClient": + initServer(s, &s.trChaosFaultServer, func() *ChaosFaultServerTransport { return NewChaosFaultServerTransport(&s.srv.ChaosFaultServer) }) + resp, err = s.trChaosFaultServer.Do(req) case "CollectionClient": initServer(s, &s.trCollectionServer, func() *CollectionServerTransport { return NewCollectionServerTransport(&s.srv.CollectionServer) }) resp, err = s.trCollectionServer.Do(req) @@ -157,6 +176,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewCollectionRegionServerTransport(&s.srv.CollectionRegionServer) }) resp, err = s.trCollectionRegionServer.Do(req) + case "DataTransferJobsClient": + initServer(s, &s.trDataTransferJobsServer, func() *DataTransferJobsServerTransport { + return NewDataTransferJobsServerTransport(&s.srv.DataTransferJobsServer) + }) + resp, err = s.trDataTransferJobsServer.Do(req) case "DatabaseAccountRegionClient": initServer(s, &s.trDatabaseAccountRegionServer, func() *DatabaseAccountRegionServerTransport { return NewDatabaseAccountRegionServerTransport(&s.srv.DatabaseAccountRegionServer) @@ -170,6 +194,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "DatabaseClient": initServer(s, &s.trDatabaseServer, func() *DatabaseServerTransport { return NewDatabaseServerTransport(&s.srv.DatabaseServer) }) resp, err = s.trDatabaseServer.Do(req) + case "GraphResourcesClient": + initServer(s, &s.trGraphResourcesServer, func() *GraphResourcesServerTransport { + return NewGraphResourcesServerTransport(&s.srv.GraphResourcesServer) + }) + resp, err = s.trGraphResourcesServer.Do(req) case "GremlinResourcesClient": initServer(s, &s.trGremlinResourcesServer, func() *GremlinResourcesServerTransport { return NewGremlinResourcesServerTransport(&s.srv.GremlinResourcesServer) @@ -183,6 +212,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewMongoDBResourcesServerTransport(&s.srv.MongoDBResourcesServer) }) resp, err = s.trMongoDBResourcesServer.Do(req) + case "NetworkSecurityPerimeterConfigurationsClient": + initServer(s, &s.trNetworkSecurityPerimeterConfigurationsServer, func() *NetworkSecurityPerimeterConfigurationsServerTransport { + return NewNetworkSecurityPerimeterConfigurationsServerTransport(&s.srv.NetworkSecurityPerimeterConfigurationsServer) + }) + resp, err = s.trNetworkSecurityPerimeterConfigurationsServer.Do(req) case "NotebookWorkspacesClient": initServer(s, &s.trNotebookWorkspacesServer, func() *NotebookWorkspacesServerTransport { return NewNotebookWorkspacesServerTransport(&s.srv.NotebookWorkspacesServer) @@ -295,6 +329,26 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewTableResourcesServerTransport(&s.srv.TableResourcesServer) }) resp, err = s.trTableResourcesServer.Do(req) + case "ThroughputPoolAccountClient": + initServer(s, &s.trThroughputPoolAccountServer, func() *ThroughputPoolAccountServerTransport { + return NewThroughputPoolAccountServerTransport(&s.srv.ThroughputPoolAccountServer) + }) + resp, err = s.trThroughputPoolAccountServer.Do(req) + case "ThroughputPoolAccountsClient": + initServer(s, &s.trThroughputPoolAccountsServer, func() *ThroughputPoolAccountsServerTransport { + return NewThroughputPoolAccountsServerTransport(&s.srv.ThroughputPoolAccountsServer) + }) + resp, err = s.trThroughputPoolAccountsServer.Do(req) + case "ThroughputPoolClient": + initServer(s, &s.trThroughputPoolServer, func() *ThroughputPoolServerTransport { + return NewThroughputPoolServerTransport(&s.srv.ThroughputPoolServer) + }) + resp, err = s.trThroughputPoolServer.Do(req) + case "ThroughputPoolsClient": + initServer(s, &s.trThroughputPoolsServer, func() *ThroughputPoolsServerTransport { + return NewThroughputPoolsServerTransport(&s.srv.ThroughputPoolsServer) + }) + resp, err = s.trThroughputPoolsServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/service_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/service_server.go index 24f955a38121..19ecb7757846 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/service_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/service_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/sqlresources_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/sqlresources_server.go index aefd6a39ef5c..32cb97af8e53 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/sqlresources_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/sqlresources_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" @@ -127,6 +127,10 @@ type SQLResourcesServer struct { // HTTP status codes to indicate success: http.StatusOK NewListClientEncryptionKeysPager func(resourceGroupName string, accountName string, databaseName string, options *armcosmos.SQLResourcesClientListClientEncryptionKeysOptions) (resp azfake.PagerResponder[armcosmos.SQLResourcesClientListClientEncryptionKeysResponse]) + // BeginListSQLContainerPartitionMerge is the fake for method SQLResourcesClient.BeginListSQLContainerPartitionMerge + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginListSQLContainerPartitionMerge func(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, mergeParameters armcosmos.MergeParameters, options *armcosmos.SQLResourcesClientBeginListSQLContainerPartitionMergeOptions) (resp azfake.PollerResponder[armcosmos.SQLResourcesClientListSQLContainerPartitionMergeResponse], errResp azfake.ErrorResponder) + // NewListSQLContainersPager is the fake for method SQLResourcesClient.NewListSQLContainersPager // HTTP status codes to indicate success: http.StatusOK NewListSQLContainersPager func(resourceGroupName string, accountName string, databaseName string, options *armcosmos.SQLResourcesClientListSQLContainersOptions) (resp azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLContainersResponse]) @@ -175,6 +179,26 @@ type SQLResourcesServer struct { // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginRetrieveContinuousBackupInformation func(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, location armcosmos.ContinuousBackupRestoreLocation, options *armcosmos.SQLResourcesClientBeginRetrieveContinuousBackupInformationOptions) (resp azfake.PollerResponder[armcosmos.SQLResourcesClientRetrieveContinuousBackupInformationResponse], errResp azfake.ErrorResponder) + // BeginSQLContainerRedistributeThroughput is the fake for method SQLResourcesClient.BeginSQLContainerRedistributeThroughput + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginSQLContainerRedistributeThroughput func(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, redistributeThroughputParameters armcosmos.RedistributeThroughputParameters, options *armcosmos.SQLResourcesClientBeginSQLContainerRedistributeThroughputOptions) (resp azfake.PollerResponder[armcosmos.SQLResourcesClientSQLContainerRedistributeThroughputResponse], errResp azfake.ErrorResponder) + + // BeginSQLContainerRetrieveThroughputDistribution is the fake for method SQLResourcesClient.BeginSQLContainerRetrieveThroughputDistribution + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginSQLContainerRetrieveThroughputDistribution func(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, retrieveThroughputParameters armcosmos.RetrieveThroughputParameters, options *armcosmos.SQLResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions) (resp azfake.PollerResponder[armcosmos.SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse], errResp azfake.ErrorResponder) + + // BeginSQLDatabasePartitionMerge is the fake for method SQLResourcesClient.BeginSQLDatabasePartitionMerge + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginSQLDatabasePartitionMerge func(ctx context.Context, resourceGroupName string, accountName string, databaseName string, mergeParameters armcosmos.MergeParameters, options *armcosmos.SQLResourcesClientBeginSQLDatabasePartitionMergeOptions) (resp azfake.PollerResponder[armcosmos.SQLResourcesClientSQLDatabasePartitionMergeResponse], errResp azfake.ErrorResponder) + + // BeginSQLDatabaseRedistributeThroughput is the fake for method SQLResourcesClient.BeginSQLDatabaseRedistributeThroughput + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginSQLDatabaseRedistributeThroughput func(ctx context.Context, resourceGroupName string, accountName string, databaseName string, redistributeThroughputParameters armcosmos.RedistributeThroughputParameters, options *armcosmos.SQLResourcesClientBeginSQLDatabaseRedistributeThroughputOptions) (resp azfake.PollerResponder[armcosmos.SQLResourcesClientSQLDatabaseRedistributeThroughputResponse], errResp azfake.ErrorResponder) + + // BeginSQLDatabaseRetrieveThroughputDistribution is the fake for method SQLResourcesClient.BeginSQLDatabaseRetrieveThroughputDistribution + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginSQLDatabaseRetrieveThroughputDistribution func(ctx context.Context, resourceGroupName string, accountName string, databaseName string, retrieveThroughputParameters armcosmos.RetrieveThroughputParameters, options *armcosmos.SQLResourcesClientBeginSQLDatabaseRetrieveThroughputDistributionOptions) (resp azfake.PollerResponder[armcosmos.SQLResourcesClientSQLDatabaseRetrieveThroughputDistributionResponse], errResp azfake.ErrorResponder) + // BeginUpdateSQLContainerThroughput is the fake for method SQLResourcesClient.BeginUpdateSQLContainerThroughput // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginUpdateSQLContainerThroughput func(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters armcosmos.ThroughputSettingsUpdateParameters, options *armcosmos.SQLResourcesClientBeginUpdateSQLContainerThroughputOptions) (resp azfake.PollerResponder[armcosmos.SQLResourcesClientUpdateSQLContainerThroughputResponse], errResp azfake.ErrorResponder) @@ -189,74 +213,86 @@ type SQLResourcesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewSQLResourcesServerTransport(srv *SQLResourcesServer) *SQLResourcesServerTransport { return &SQLResourcesServerTransport{ - srv: srv, - beginCreateUpdateClientEncryptionKey: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateClientEncryptionKeyResponse]](), - beginCreateUpdateSQLContainer: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLContainerResponse]](), - beginCreateUpdateSQLDatabase: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLDatabaseResponse]](), - beginCreateUpdateSQLRoleAssignment: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLRoleAssignmentResponse]](), - beginCreateUpdateSQLRoleDefinition: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLRoleDefinitionResponse]](), - beginCreateUpdateSQLStoredProcedure: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLStoredProcedureResponse]](), - beginCreateUpdateSQLTrigger: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLTriggerResponse]](), - beginCreateUpdateSQLUserDefinedFunction: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLUserDefinedFunctionResponse]](), - beginDeleteSQLContainer: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLContainerResponse]](), - beginDeleteSQLDatabase: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLDatabaseResponse]](), - beginDeleteSQLRoleAssignment: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLRoleAssignmentResponse]](), - beginDeleteSQLRoleDefinition: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLRoleDefinitionResponse]](), - beginDeleteSQLStoredProcedure: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLStoredProcedureResponse]](), - beginDeleteSQLTrigger: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLTriggerResponse]](), - beginDeleteSQLUserDefinedFunction: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLUserDefinedFunctionResponse]](), - newListClientEncryptionKeysPager: newTracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListClientEncryptionKeysResponse]](), - newListSQLContainersPager: newTracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLContainersResponse]](), - newListSQLDatabasesPager: newTracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLDatabasesResponse]](), - newListSQLRoleAssignmentsPager: newTracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLRoleAssignmentsResponse]](), - newListSQLRoleDefinitionsPager: newTracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLRoleDefinitionsResponse]](), - newListSQLStoredProceduresPager: newTracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLStoredProceduresResponse]](), - newListSQLTriggersPager: newTracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLTriggersResponse]](), - newListSQLUserDefinedFunctionsPager: newTracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLUserDefinedFunctionsResponse]](), - beginMigrateSQLContainerToAutoscale: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientMigrateSQLContainerToAutoscaleResponse]](), - beginMigrateSQLContainerToManualThroughput: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientMigrateSQLContainerToManualThroughputResponse]](), - beginMigrateSQLDatabaseToAutoscale: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientMigrateSQLDatabaseToAutoscaleResponse]](), - beginMigrateSQLDatabaseToManualThroughput: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientMigrateSQLDatabaseToManualThroughputResponse]](), - beginRetrieveContinuousBackupInformation: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientRetrieveContinuousBackupInformationResponse]](), - beginUpdateSQLContainerThroughput: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientUpdateSQLContainerThroughputResponse]](), - beginUpdateSQLDatabaseThroughput: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientUpdateSQLDatabaseThroughputResponse]](), + srv: srv, + beginCreateUpdateClientEncryptionKey: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateClientEncryptionKeyResponse]](), + beginCreateUpdateSQLContainer: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLContainerResponse]](), + beginCreateUpdateSQLDatabase: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLDatabaseResponse]](), + beginCreateUpdateSQLRoleAssignment: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLRoleAssignmentResponse]](), + beginCreateUpdateSQLRoleDefinition: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLRoleDefinitionResponse]](), + beginCreateUpdateSQLStoredProcedure: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLStoredProcedureResponse]](), + beginCreateUpdateSQLTrigger: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLTriggerResponse]](), + beginCreateUpdateSQLUserDefinedFunction: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLUserDefinedFunctionResponse]](), + beginDeleteSQLContainer: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLContainerResponse]](), + beginDeleteSQLDatabase: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLDatabaseResponse]](), + beginDeleteSQLRoleAssignment: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLRoleAssignmentResponse]](), + beginDeleteSQLRoleDefinition: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLRoleDefinitionResponse]](), + beginDeleteSQLStoredProcedure: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLStoredProcedureResponse]](), + beginDeleteSQLTrigger: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLTriggerResponse]](), + beginDeleteSQLUserDefinedFunction: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLUserDefinedFunctionResponse]](), + newListClientEncryptionKeysPager: newTracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListClientEncryptionKeysResponse]](), + beginListSQLContainerPartitionMerge: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientListSQLContainerPartitionMergeResponse]](), + newListSQLContainersPager: newTracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLContainersResponse]](), + newListSQLDatabasesPager: newTracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLDatabasesResponse]](), + newListSQLRoleAssignmentsPager: newTracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLRoleAssignmentsResponse]](), + newListSQLRoleDefinitionsPager: newTracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLRoleDefinitionsResponse]](), + newListSQLStoredProceduresPager: newTracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLStoredProceduresResponse]](), + newListSQLTriggersPager: newTracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLTriggersResponse]](), + newListSQLUserDefinedFunctionsPager: newTracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLUserDefinedFunctionsResponse]](), + beginMigrateSQLContainerToAutoscale: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientMigrateSQLContainerToAutoscaleResponse]](), + beginMigrateSQLContainerToManualThroughput: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientMigrateSQLContainerToManualThroughputResponse]](), + beginMigrateSQLDatabaseToAutoscale: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientMigrateSQLDatabaseToAutoscaleResponse]](), + beginMigrateSQLDatabaseToManualThroughput: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientMigrateSQLDatabaseToManualThroughputResponse]](), + beginRetrieveContinuousBackupInformation: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientRetrieveContinuousBackupInformationResponse]](), + beginSQLContainerRedistributeThroughput: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientSQLContainerRedistributeThroughputResponse]](), + beginSQLContainerRetrieveThroughputDistribution: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse]](), + beginSQLDatabasePartitionMerge: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientSQLDatabasePartitionMergeResponse]](), + beginSQLDatabaseRedistributeThroughput: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientSQLDatabaseRedistributeThroughputResponse]](), + beginSQLDatabaseRetrieveThroughputDistribution: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientSQLDatabaseRetrieveThroughputDistributionResponse]](), + beginUpdateSQLContainerThroughput: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientUpdateSQLContainerThroughputResponse]](), + beginUpdateSQLDatabaseThroughput: newTracker[azfake.PollerResponder[armcosmos.SQLResourcesClientUpdateSQLDatabaseThroughputResponse]](), } } // SQLResourcesServerTransport connects instances of armcosmos.SQLResourcesClient to instances of SQLResourcesServer. // Don't use this type directly, use NewSQLResourcesServerTransport instead. type SQLResourcesServerTransport struct { - srv *SQLResourcesServer - beginCreateUpdateClientEncryptionKey *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateClientEncryptionKeyResponse]] - beginCreateUpdateSQLContainer *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLContainerResponse]] - beginCreateUpdateSQLDatabase *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLDatabaseResponse]] - beginCreateUpdateSQLRoleAssignment *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLRoleAssignmentResponse]] - beginCreateUpdateSQLRoleDefinition *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLRoleDefinitionResponse]] - beginCreateUpdateSQLStoredProcedure *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLStoredProcedureResponse]] - beginCreateUpdateSQLTrigger *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLTriggerResponse]] - beginCreateUpdateSQLUserDefinedFunction *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLUserDefinedFunctionResponse]] - beginDeleteSQLContainer *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLContainerResponse]] - beginDeleteSQLDatabase *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLDatabaseResponse]] - beginDeleteSQLRoleAssignment *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLRoleAssignmentResponse]] - beginDeleteSQLRoleDefinition *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLRoleDefinitionResponse]] - beginDeleteSQLStoredProcedure *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLStoredProcedureResponse]] - beginDeleteSQLTrigger *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLTriggerResponse]] - beginDeleteSQLUserDefinedFunction *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLUserDefinedFunctionResponse]] - newListClientEncryptionKeysPager *tracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListClientEncryptionKeysResponse]] - newListSQLContainersPager *tracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLContainersResponse]] - newListSQLDatabasesPager *tracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLDatabasesResponse]] - newListSQLRoleAssignmentsPager *tracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLRoleAssignmentsResponse]] - newListSQLRoleDefinitionsPager *tracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLRoleDefinitionsResponse]] - newListSQLStoredProceduresPager *tracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLStoredProceduresResponse]] - newListSQLTriggersPager *tracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLTriggersResponse]] - newListSQLUserDefinedFunctionsPager *tracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLUserDefinedFunctionsResponse]] - beginMigrateSQLContainerToAutoscale *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientMigrateSQLContainerToAutoscaleResponse]] - beginMigrateSQLContainerToManualThroughput *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientMigrateSQLContainerToManualThroughputResponse]] - beginMigrateSQLDatabaseToAutoscale *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientMigrateSQLDatabaseToAutoscaleResponse]] - beginMigrateSQLDatabaseToManualThroughput *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientMigrateSQLDatabaseToManualThroughputResponse]] - beginRetrieveContinuousBackupInformation *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientRetrieveContinuousBackupInformationResponse]] - beginUpdateSQLContainerThroughput *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientUpdateSQLContainerThroughputResponse]] - beginUpdateSQLDatabaseThroughput *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientUpdateSQLDatabaseThroughputResponse]] + srv *SQLResourcesServer + beginCreateUpdateClientEncryptionKey *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateClientEncryptionKeyResponse]] + beginCreateUpdateSQLContainer *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLContainerResponse]] + beginCreateUpdateSQLDatabase *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLDatabaseResponse]] + beginCreateUpdateSQLRoleAssignment *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLRoleAssignmentResponse]] + beginCreateUpdateSQLRoleDefinition *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLRoleDefinitionResponse]] + beginCreateUpdateSQLStoredProcedure *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLStoredProcedureResponse]] + beginCreateUpdateSQLTrigger *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLTriggerResponse]] + beginCreateUpdateSQLUserDefinedFunction *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientCreateUpdateSQLUserDefinedFunctionResponse]] + beginDeleteSQLContainer *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLContainerResponse]] + beginDeleteSQLDatabase *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLDatabaseResponse]] + beginDeleteSQLRoleAssignment *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLRoleAssignmentResponse]] + beginDeleteSQLRoleDefinition *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLRoleDefinitionResponse]] + beginDeleteSQLStoredProcedure *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLStoredProcedureResponse]] + beginDeleteSQLTrigger *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLTriggerResponse]] + beginDeleteSQLUserDefinedFunction *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientDeleteSQLUserDefinedFunctionResponse]] + newListClientEncryptionKeysPager *tracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListClientEncryptionKeysResponse]] + beginListSQLContainerPartitionMerge *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientListSQLContainerPartitionMergeResponse]] + newListSQLContainersPager *tracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLContainersResponse]] + newListSQLDatabasesPager *tracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLDatabasesResponse]] + newListSQLRoleAssignmentsPager *tracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLRoleAssignmentsResponse]] + newListSQLRoleDefinitionsPager *tracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLRoleDefinitionsResponse]] + newListSQLStoredProceduresPager *tracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLStoredProceduresResponse]] + newListSQLTriggersPager *tracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLTriggersResponse]] + newListSQLUserDefinedFunctionsPager *tracker[azfake.PagerResponder[armcosmos.SQLResourcesClientListSQLUserDefinedFunctionsResponse]] + beginMigrateSQLContainerToAutoscale *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientMigrateSQLContainerToAutoscaleResponse]] + beginMigrateSQLContainerToManualThroughput *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientMigrateSQLContainerToManualThroughputResponse]] + beginMigrateSQLDatabaseToAutoscale *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientMigrateSQLDatabaseToAutoscaleResponse]] + beginMigrateSQLDatabaseToManualThroughput *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientMigrateSQLDatabaseToManualThroughputResponse]] + beginRetrieveContinuousBackupInformation *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientRetrieveContinuousBackupInformationResponse]] + beginSQLContainerRedistributeThroughput *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientSQLContainerRedistributeThroughputResponse]] + beginSQLContainerRetrieveThroughputDistribution *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse]] + beginSQLDatabasePartitionMerge *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientSQLDatabasePartitionMergeResponse]] + beginSQLDatabaseRedistributeThroughput *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientSQLDatabaseRedistributeThroughputResponse]] + beginSQLDatabaseRetrieveThroughputDistribution *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientSQLDatabaseRetrieveThroughputDistributionResponse]] + beginUpdateSQLContainerThroughput *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientUpdateSQLContainerThroughputResponse]] + beginUpdateSQLDatabaseThroughput *tracker[azfake.PollerResponder[armcosmos.SQLResourcesClientUpdateSQLDatabaseThroughputResponse]] } // Do implements the policy.Transporter interface for SQLResourcesServerTransport. @@ -323,6 +359,8 @@ func (s *SQLResourcesServerTransport) Do(req *http.Request) (*http.Response, err resp, err = s.dispatchGetSQLUserDefinedFunction(req) case "SQLResourcesClient.NewListClientEncryptionKeysPager": resp, err = s.dispatchNewListClientEncryptionKeysPager(req) + case "SQLResourcesClient.BeginListSQLContainerPartitionMerge": + resp, err = s.dispatchBeginListSQLContainerPartitionMerge(req) case "SQLResourcesClient.NewListSQLContainersPager": resp, err = s.dispatchNewListSQLContainersPager(req) case "SQLResourcesClient.NewListSQLDatabasesPager": @@ -347,6 +385,16 @@ func (s *SQLResourcesServerTransport) Do(req *http.Request) (*http.Response, err resp, err = s.dispatchBeginMigrateSQLDatabaseToManualThroughput(req) case "SQLResourcesClient.BeginRetrieveContinuousBackupInformation": resp, err = s.dispatchBeginRetrieveContinuousBackupInformation(req) + case "SQLResourcesClient.BeginSQLContainerRedistributeThroughput": + resp, err = s.dispatchBeginSQLContainerRedistributeThroughput(req) + case "SQLResourcesClient.BeginSQLContainerRetrieveThroughputDistribution": + resp, err = s.dispatchBeginSQLContainerRetrieveThroughputDistribution(req) + case "SQLResourcesClient.BeginSQLDatabasePartitionMerge": + resp, err = s.dispatchBeginSQLDatabasePartitionMerge(req) + case "SQLResourcesClient.BeginSQLDatabaseRedistributeThroughput": + resp, err = s.dispatchBeginSQLDatabaseRedistributeThroughput(req) + case "SQLResourcesClient.BeginSQLDatabaseRetrieveThroughputDistribution": + resp, err = s.dispatchBeginSQLDatabaseRetrieveThroughputDistribution(req) case "SQLResourcesClient.BeginUpdateSQLContainerThroughput": resp, err = s.dispatchBeginUpdateSQLContainerThroughput(req) case "SQLResourcesClient.BeginUpdateSQLDatabaseThroughput": @@ -1622,6 +1670,62 @@ func (s *SQLResourcesServerTransport) dispatchNewListClientEncryptionKeysPager(r return resp, nil } +func (s *SQLResourcesServerTransport) dispatchBeginListSQLContainerPartitionMerge(req *http.Request) (*http.Response, error) { + if s.srv.BeginListSQLContainerPartitionMerge == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginListSQLContainerPartitionMerge not implemented")} + } + beginListSQLContainerPartitionMerge := s.beginListSQLContainerPartitionMerge.get(req) + if beginListSQLContainerPartitionMerge == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/partitionMerge` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.MergeParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginListSQLContainerPartitionMerge(req.Context(), resourceGroupNameParam, accountNameParam, databaseNameParam, containerNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginListSQLContainerPartitionMerge = &respr + s.beginListSQLContainerPartitionMerge.add(req, beginListSQLContainerPartitionMerge) + } + + resp, err := server.PollerResponderNext(beginListSQLContainerPartitionMerge, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginListSQLContainerPartitionMerge.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginListSQLContainerPartitionMerge) { + s.beginListSQLContainerPartitionMerge.remove(req) + } + + return resp, nil +} + func (s *SQLResourcesServerTransport) dispatchNewListSQLContainersPager(req *http.Request) (*http.Response, error) { if s.srv.NewListSQLContainersPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListSQLContainersPager not implemented")} @@ -2172,6 +2276,274 @@ func (s *SQLResourcesServerTransport) dispatchBeginRetrieveContinuousBackupInfor return resp, nil } +func (s *SQLResourcesServerTransport) dispatchBeginSQLContainerRedistributeThroughput(req *http.Request) (*http.Response, error) { + if s.srv.BeginSQLContainerRedistributeThroughput == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginSQLContainerRedistributeThroughput not implemented")} + } + beginSQLContainerRedistributeThroughput := s.beginSQLContainerRedistributeThroughput.get(req) + if beginSQLContainerRedistributeThroughput == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/throughputSettings/default/redistributeThroughput` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.RedistributeThroughputParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginSQLContainerRedistributeThroughput(req.Context(), resourceGroupNameParam, accountNameParam, databaseNameParam, containerNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginSQLContainerRedistributeThroughput = &respr + s.beginSQLContainerRedistributeThroughput.add(req, beginSQLContainerRedistributeThroughput) + } + + resp, err := server.PollerResponderNext(beginSQLContainerRedistributeThroughput, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginSQLContainerRedistributeThroughput.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginSQLContainerRedistributeThroughput) { + s.beginSQLContainerRedistributeThroughput.remove(req) + } + + return resp, nil +} + +func (s *SQLResourcesServerTransport) dispatchBeginSQLContainerRetrieveThroughputDistribution(req *http.Request) (*http.Response, error) { + if s.srv.BeginSQLContainerRetrieveThroughputDistribution == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginSQLContainerRetrieveThroughputDistribution not implemented")} + } + beginSQLContainerRetrieveThroughputDistribution := s.beginSQLContainerRetrieveThroughputDistribution.get(req) + if beginSQLContainerRetrieveThroughputDistribution == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/throughputSettings/default/retrieveThroughputDistribution` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.RetrieveThroughputParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginSQLContainerRetrieveThroughputDistribution(req.Context(), resourceGroupNameParam, accountNameParam, databaseNameParam, containerNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginSQLContainerRetrieveThroughputDistribution = &respr + s.beginSQLContainerRetrieveThroughputDistribution.add(req, beginSQLContainerRetrieveThroughputDistribution) + } + + resp, err := server.PollerResponderNext(beginSQLContainerRetrieveThroughputDistribution, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginSQLContainerRetrieveThroughputDistribution.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginSQLContainerRetrieveThroughputDistribution) { + s.beginSQLContainerRetrieveThroughputDistribution.remove(req) + } + + return resp, nil +} + +func (s *SQLResourcesServerTransport) dispatchBeginSQLDatabasePartitionMerge(req *http.Request) (*http.Response, error) { + if s.srv.BeginSQLDatabasePartitionMerge == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginSQLDatabasePartitionMerge not implemented")} + } + beginSQLDatabasePartitionMerge := s.beginSQLDatabasePartitionMerge.get(req) + if beginSQLDatabasePartitionMerge == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/partitionMerge` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.MergeParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginSQLDatabasePartitionMerge(req.Context(), resourceGroupNameParam, accountNameParam, databaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginSQLDatabasePartitionMerge = &respr + s.beginSQLDatabasePartitionMerge.add(req, beginSQLDatabasePartitionMerge) + } + + resp, err := server.PollerResponderNext(beginSQLDatabasePartitionMerge, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginSQLDatabasePartitionMerge.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginSQLDatabasePartitionMerge) { + s.beginSQLDatabasePartitionMerge.remove(req) + } + + return resp, nil +} + +func (s *SQLResourcesServerTransport) dispatchBeginSQLDatabaseRedistributeThroughput(req *http.Request) (*http.Response, error) { + if s.srv.BeginSQLDatabaseRedistributeThroughput == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginSQLDatabaseRedistributeThroughput not implemented")} + } + beginSQLDatabaseRedistributeThroughput := s.beginSQLDatabaseRedistributeThroughput.get(req) + if beginSQLDatabaseRedistributeThroughput == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/throughputSettings/default/redistributeThroughput` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.RedistributeThroughputParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginSQLDatabaseRedistributeThroughput(req.Context(), resourceGroupNameParam, accountNameParam, databaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginSQLDatabaseRedistributeThroughput = &respr + s.beginSQLDatabaseRedistributeThroughput.add(req, beginSQLDatabaseRedistributeThroughput) + } + + resp, err := server.PollerResponderNext(beginSQLDatabaseRedistributeThroughput, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginSQLDatabaseRedistributeThroughput.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginSQLDatabaseRedistributeThroughput) { + s.beginSQLDatabaseRedistributeThroughput.remove(req) + } + + return resp, nil +} + +func (s *SQLResourcesServerTransport) dispatchBeginSQLDatabaseRetrieveThroughputDistribution(req *http.Request) (*http.Response, error) { + if s.srv.BeginSQLDatabaseRetrieveThroughputDistribution == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginSQLDatabaseRetrieveThroughputDistribution not implemented")} + } + beginSQLDatabaseRetrieveThroughputDistribution := s.beginSQLDatabaseRetrieveThroughputDistribution.get(req) + if beginSQLDatabaseRetrieveThroughputDistribution == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/databaseAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sqlDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/throughputSettings/default/retrieveThroughputDistribution` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.RetrieveThroughputParameters](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginSQLDatabaseRetrieveThroughputDistribution(req.Context(), resourceGroupNameParam, accountNameParam, databaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginSQLDatabaseRetrieveThroughputDistribution = &respr + s.beginSQLDatabaseRetrieveThroughputDistribution.add(req, beginSQLDatabaseRetrieveThroughputDistribution) + } + + resp, err := server.PollerResponderNext(beginSQLDatabaseRetrieveThroughputDistribution, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginSQLDatabaseRetrieveThroughputDistribution.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginSQLDatabaseRetrieveThroughputDistribution) { + s.beginSQLDatabaseRetrieveThroughputDistribution.remove(req) + } + + return resp, nil +} + func (s *SQLResourcesServerTransport) dispatchBeginUpdateSQLContainerThroughput(req *http.Request) (*http.Response, error) { if s.srv.BeginUpdateSQLContainerThroughput == nil { return nil, &nonRetriableError{errors.New("fake for method BeginUpdateSQLContainerThroughput not implemented")} diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/tableresources_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/tableresources_server.go index 58c9dbbef480..a96b138dd774 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/fake/tableresources_server.go +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/tableresources_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/throughputpool_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/throughputpool_server.go new file mode 100644 index 000000000000..8a12ac1e4ede --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/throughputpool_server.go @@ -0,0 +1,273 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" + "net/http" + "net/url" + "reflect" + "regexp" +) + +// ThroughputPoolServer is a fake server for instances of the armcosmos.ThroughputPoolClient type. +type ThroughputPoolServer struct { + // BeginCreateOrUpdate is the fake for method ThroughputPoolClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, throughputPoolName string, body armcosmos.ThroughputPoolResource, options *armcosmos.ThroughputPoolClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcosmos.ThroughputPoolClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ThroughputPoolClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, throughputPoolName string, options *armcosmos.ThroughputPoolClientBeginDeleteOptions) (resp azfake.PollerResponder[armcosmos.ThroughputPoolClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ThroughputPoolClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, throughputPoolName string, options *armcosmos.ThroughputPoolClientGetOptions) (resp azfake.Responder[armcosmos.ThroughputPoolClientGetResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method ThroughputPoolClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, throughputPoolName string, options *armcosmos.ThroughputPoolClientBeginUpdateOptions) (resp azfake.PollerResponder[armcosmos.ThroughputPoolClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewThroughputPoolServerTransport creates a new instance of ThroughputPoolServerTransport with the provided implementation. +// The returned ThroughputPoolServerTransport instance is connected to an instance of armcosmos.ThroughputPoolClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewThroughputPoolServerTransport(srv *ThroughputPoolServer) *ThroughputPoolServerTransport { + return &ThroughputPoolServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcosmos.ThroughputPoolClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcosmos.ThroughputPoolClientDeleteResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armcosmos.ThroughputPoolClientUpdateResponse]](), + } +} + +// ThroughputPoolServerTransport connects instances of armcosmos.ThroughputPoolClient to instances of ThroughputPoolServer. +// Don't use this type directly, use NewThroughputPoolServerTransport instead. +type ThroughputPoolServerTransport struct { + srv *ThroughputPoolServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armcosmos.ThroughputPoolClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcosmos.ThroughputPoolClientDeleteResponse]] + beginUpdate *tracker[azfake.PollerResponder[armcosmos.ThroughputPoolClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for ThroughputPoolServerTransport. +func (t *ThroughputPoolServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ThroughputPoolClient.BeginCreateOrUpdate": + resp, err = t.dispatchBeginCreateOrUpdate(req) + case "ThroughputPoolClient.BeginDelete": + resp, err = t.dispatchBeginDelete(req) + case "ThroughputPoolClient.Get": + resp, err = t.dispatchGet(req) + case "ThroughputPoolClient.BeginUpdate": + resp, err = t.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (t *ThroughputPoolServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if t.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := t.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/throughputPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.ThroughputPoolResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + throughputPoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("throughputPoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, throughputPoolNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + t.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + t.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + t.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (t *ThroughputPoolServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if t.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := t.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/throughputPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + throughputPoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("throughputPoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginDelete(req.Context(), resourceGroupNameParam, throughputPoolNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + t.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + t.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + t.beginDelete.remove(req) + } + + return resp, nil +} + +func (t *ThroughputPoolServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if t.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/throughputPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + throughputPoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("throughputPoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.Get(req.Context(), resourceGroupNameParam, throughputPoolNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ThroughputPoolResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (t *ThroughputPoolServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if t.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := t.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/throughputPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.ThroughputPoolUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + throughputPoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("throughputPoolName")]) + if err != nil { + return nil, err + } + var options *armcosmos.ThroughputPoolClientBeginUpdateOptions + if !reflect.ValueOf(body).IsZero() { + options = &armcosmos.ThroughputPoolClientBeginUpdateOptions{ + Body: &body, + } + } + respr, errRespr := t.srv.BeginUpdate(req.Context(), resourceGroupNameParam, throughputPoolNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + t.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + t.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + t.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/throughputpoolaccount_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/throughputpoolaccount_server.go new file mode 100644 index 000000000000..6d5883881c5a --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/throughputpoolaccount_server.go @@ -0,0 +1,222 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" + "net/http" + "net/url" + "regexp" +) + +// ThroughputPoolAccountServer is a fake server for instances of the armcosmos.ThroughputPoolAccountClient type. +type ThroughputPoolAccountServer struct { + // BeginCreate is the fake for method ThroughputPoolAccountClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, throughputPoolName string, throughputPoolAccountName string, body armcosmos.ThroughputPoolAccountResource, options *armcosmos.ThroughputPoolAccountClientBeginCreateOptions) (resp azfake.PollerResponder[armcosmos.ThroughputPoolAccountClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ThroughputPoolAccountClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, throughputPoolName string, throughputPoolAccountName string, options *armcosmos.ThroughputPoolAccountClientBeginDeleteOptions) (resp azfake.PollerResponder[armcosmos.ThroughputPoolAccountClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ThroughputPoolAccountClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, throughputPoolName string, throughputPoolAccountName string, options *armcosmos.ThroughputPoolAccountClientGetOptions) (resp azfake.Responder[armcosmos.ThroughputPoolAccountClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewThroughputPoolAccountServerTransport creates a new instance of ThroughputPoolAccountServerTransport with the provided implementation. +// The returned ThroughputPoolAccountServerTransport instance is connected to an instance of armcosmos.ThroughputPoolAccountClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewThroughputPoolAccountServerTransport(srv *ThroughputPoolAccountServer) *ThroughputPoolAccountServerTransport { + return &ThroughputPoolAccountServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armcosmos.ThroughputPoolAccountClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcosmos.ThroughputPoolAccountClientDeleteResponse]](), + } +} + +// ThroughputPoolAccountServerTransport connects instances of armcosmos.ThroughputPoolAccountClient to instances of ThroughputPoolAccountServer. +// Don't use this type directly, use NewThroughputPoolAccountServerTransport instead. +type ThroughputPoolAccountServerTransport struct { + srv *ThroughputPoolAccountServer + beginCreate *tracker[azfake.PollerResponder[armcosmos.ThroughputPoolAccountClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcosmos.ThroughputPoolAccountClientDeleteResponse]] +} + +// Do implements the policy.Transporter interface for ThroughputPoolAccountServerTransport. +func (t *ThroughputPoolAccountServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ThroughputPoolAccountClient.BeginCreate": + resp, err = t.dispatchBeginCreate(req) + case "ThroughputPoolAccountClient.BeginDelete": + resp, err = t.dispatchBeginDelete(req) + case "ThroughputPoolAccountClient.Get": + resp, err = t.dispatchGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (t *ThroughputPoolAccountServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if t.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := t.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/throughputPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/throughputPoolAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcosmos.ThroughputPoolAccountResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + throughputPoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("throughputPoolName")]) + if err != nil { + return nil, err + } + throughputPoolAccountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("throughputPoolAccountName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginCreate(req.Context(), resourceGroupNameParam, throughputPoolNameParam, throughputPoolAccountNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + t.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + t.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + t.beginCreate.remove(req) + } + + return resp, nil +} + +func (t *ThroughputPoolAccountServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if t.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := t.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/throughputPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/throughputPoolAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + throughputPoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("throughputPoolName")]) + if err != nil { + return nil, err + } + throughputPoolAccountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("throughputPoolAccountName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.BeginDelete(req.Context(), resourceGroupNameParam, throughputPoolNameParam, throughputPoolAccountNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + t.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + t.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + t.beginDelete.remove(req) + } + + return resp, nil +} + +func (t *ThroughputPoolAccountServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if t.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/throughputPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/throughputPoolAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + throughputPoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("throughputPoolName")]) + if err != nil { + return nil, err + } + throughputPoolAccountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("throughputPoolAccountName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.Get(req.Context(), resourceGroupNameParam, throughputPoolNameParam, throughputPoolAccountNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ThroughputPoolAccountResource, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/throughputpoolaccounts_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/throughputpoolaccounts_server.go new file mode 100644 index 000000000000..ccbb9b3fe000 --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/throughputpoolaccounts_server.go @@ -0,0 +1,112 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" + "net/http" + "net/url" + "regexp" +) + +// ThroughputPoolAccountsServer is a fake server for instances of the armcosmos.ThroughputPoolAccountsClient type. +type ThroughputPoolAccountsServer struct { + // NewListPager is the fake for method ThroughputPoolAccountsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, throughputPoolName string, options *armcosmos.ThroughputPoolAccountsClientListOptions) (resp azfake.PagerResponder[armcosmos.ThroughputPoolAccountsClientListResponse]) +} + +// NewThroughputPoolAccountsServerTransport creates a new instance of ThroughputPoolAccountsServerTransport with the provided implementation. +// The returned ThroughputPoolAccountsServerTransport instance is connected to an instance of armcosmos.ThroughputPoolAccountsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewThroughputPoolAccountsServerTransport(srv *ThroughputPoolAccountsServer) *ThroughputPoolAccountsServerTransport { + return &ThroughputPoolAccountsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armcosmos.ThroughputPoolAccountsClientListResponse]](), + } +} + +// ThroughputPoolAccountsServerTransport connects instances of armcosmos.ThroughputPoolAccountsClient to instances of ThroughputPoolAccountsServer. +// Don't use this type directly, use NewThroughputPoolAccountsServerTransport instead. +type ThroughputPoolAccountsServerTransport struct { + srv *ThroughputPoolAccountsServer + newListPager *tracker[azfake.PagerResponder[armcosmos.ThroughputPoolAccountsClientListResponse]] +} + +// Do implements the policy.Transporter interface for ThroughputPoolAccountsServerTransport. +func (t *ThroughputPoolAccountsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ThroughputPoolAccountsClient.NewListPager": + resp, err = t.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (t *ThroughputPoolAccountsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if t.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := t.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/throughputPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/throughputPoolAccounts` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + throughputPoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("throughputPoolName")]) + if err != nil { + return nil, err + } + resp := t.srv.NewListPager(resourceGroupNameParam, throughputPoolNameParam, nil) + newListPager = &resp + t.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcosmos.ThroughputPoolAccountsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + t.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + t.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/fake/throughputpools_server.go b/sdk/resourcemanager/cosmos/armcosmos/fake/throughputpools_server.go new file mode 100644 index 000000000000..284c726f0557 --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/fake/throughputpools_server.go @@ -0,0 +1,149 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" + "net/http" + "net/url" + "regexp" +) + +// ThroughputPoolsServer is a fake server for instances of the armcosmos.ThroughputPoolsClient type. +type ThroughputPoolsServer struct { + // NewListPager is the fake for method ThroughputPoolsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armcosmos.ThroughputPoolsClientListOptions) (resp azfake.PagerResponder[armcosmos.ThroughputPoolsClientListResponse]) + + // NewListByResourceGroupPager is the fake for method ThroughputPoolsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armcosmos.ThroughputPoolsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armcosmos.ThroughputPoolsClientListByResourceGroupResponse]) +} + +// NewThroughputPoolsServerTransport creates a new instance of ThroughputPoolsServerTransport with the provided implementation. +// The returned ThroughputPoolsServerTransport instance is connected to an instance of armcosmos.ThroughputPoolsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewThroughputPoolsServerTransport(srv *ThroughputPoolsServer) *ThroughputPoolsServerTransport { + return &ThroughputPoolsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armcosmos.ThroughputPoolsClientListResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armcosmos.ThroughputPoolsClientListByResourceGroupResponse]](), + } +} + +// ThroughputPoolsServerTransport connects instances of armcosmos.ThroughputPoolsClient to instances of ThroughputPoolsServer. +// Don't use this type directly, use NewThroughputPoolsServerTransport instead. +type ThroughputPoolsServerTransport struct { + srv *ThroughputPoolsServer + newListPager *tracker[azfake.PagerResponder[armcosmos.ThroughputPoolsClientListResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armcosmos.ThroughputPoolsClientListByResourceGroupResponse]] +} + +// Do implements the policy.Transporter interface for ThroughputPoolsServerTransport. +func (t *ThroughputPoolsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ThroughputPoolsClient.NewListPager": + resp, err = t.dispatchNewListPager(req) + case "ThroughputPoolsClient.NewListByResourceGroupPager": + resp, err = t.dispatchNewListByResourceGroupPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (t *ThroughputPoolsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if t.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := t.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/throughputPools` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := t.srv.NewListPager(nil) + newListPager = &resp + t.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcosmos.ThroughputPoolsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + t.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + t.newListPager.remove(req) + } + return resp, nil +} + +func (t *ThroughputPoolsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if t.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := t.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/throughputPools` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := t.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + t.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armcosmos.ThroughputPoolsClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + t.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + t.newListByResourceGroupPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/go.mod b/sdk/resourcemanager/cosmos/armcosmos/go.mod index 1d04bed5e7ca..243a9781af20 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/go.mod +++ b/sdk/resourcemanager/cosmos/armcosmos/go.mod @@ -1,10 +1,9 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3 +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4 go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 @@ -12,6 +11,7 @@ require ( ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/golang-jwt/jwt/v5 v5.2.1 // indirect diff --git a/sdk/resourcemanager/cosmos/armcosmos/graphresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/graphresources_client.go new file mode 100644 index 000000000000..1cf2f384add2 --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/graphresources_client.go @@ -0,0 +1,344 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcosmos + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// GraphResourcesClient contains the methods for the GraphResources group. +// Don't use this type directly, use NewGraphResourcesClient() instead. +type GraphResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewGraphResourcesClient creates a new instance of GraphResourcesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewGraphResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GraphResourcesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GraphResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateUpdateGraph - Create or update an Azure Cosmos DB Graph. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - graphName - Cosmos DB graph resource name. +// - createUpdateGraphParameters - The parameters to provide for the current graph. +// - options - GraphResourcesClientBeginCreateUpdateGraphOptions contains the optional parameters for the GraphResourcesClient.BeginCreateUpdateGraph +// method. +func (client *GraphResourcesClient) BeginCreateUpdateGraph(ctx context.Context, resourceGroupName string, accountName string, graphName string, createUpdateGraphParameters GraphResourceCreateUpdateParameters, options *GraphResourcesClientBeginCreateUpdateGraphOptions) (*runtime.Poller[GraphResourcesClientCreateUpdateGraphResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createUpdateGraph(ctx, resourceGroupName, accountName, graphName, createUpdateGraphParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GraphResourcesClientCreateUpdateGraphResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GraphResourcesClientCreateUpdateGraphResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateUpdateGraph - Create or update an Azure Cosmos DB Graph. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *GraphResourcesClient) createUpdateGraph(ctx context.Context, resourceGroupName string, accountName string, graphName string, createUpdateGraphParameters GraphResourceCreateUpdateParameters, options *GraphResourcesClientBeginCreateUpdateGraphOptions) (*http.Response, error) { + var err error + const operationName = "GraphResourcesClient.BeginCreateUpdateGraph" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createUpdateGraphCreateRequest(ctx, resourceGroupName, accountName, graphName, createUpdateGraphParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createUpdateGraphCreateRequest creates the CreateUpdateGraph request. +func (client *GraphResourcesClient) createUpdateGraphCreateRequest(ctx context.Context, resourceGroupName string, accountName string, graphName string, createUpdateGraphParameters GraphResourceCreateUpdateParameters, options *GraphResourcesClientBeginCreateUpdateGraphOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if graphName == "" { + return nil, errors.New("parameter graphName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{graphName}", url.PathEscape(graphName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, createUpdateGraphParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDeleteGraphResource - Deletes an existing Azure Cosmos DB Graph Resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - graphName - Cosmos DB graph resource name. +// - options - GraphResourcesClientBeginDeleteGraphResourceOptions contains the optional parameters for the GraphResourcesClient.BeginDeleteGraphResource +// method. +func (client *GraphResourcesClient) BeginDeleteGraphResource(ctx context.Context, resourceGroupName string, accountName string, graphName string, options *GraphResourcesClientBeginDeleteGraphResourceOptions) (*runtime.Poller[GraphResourcesClientDeleteGraphResourceResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteGraphResource(ctx, resourceGroupName, accountName, graphName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GraphResourcesClientDeleteGraphResourceResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GraphResourcesClientDeleteGraphResourceResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// DeleteGraphResource - Deletes an existing Azure Cosmos DB Graph Resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *GraphResourcesClient) deleteGraphResource(ctx context.Context, resourceGroupName string, accountName string, graphName string, options *GraphResourcesClientBeginDeleteGraphResourceOptions) (*http.Response, error) { + var err error + const operationName = "GraphResourcesClient.BeginDeleteGraphResource" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteGraphResourceCreateRequest(ctx, resourceGroupName, accountName, graphName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteGraphResourceCreateRequest creates the DeleteGraphResource request. +func (client *GraphResourcesClient) deleteGraphResourceCreateRequest(ctx context.Context, resourceGroupName string, accountName string, graphName string, options *GraphResourcesClientBeginDeleteGraphResourceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if graphName == "" { + return nil, errors.New("parameter graphName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{graphName}", url.PathEscape(graphName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// GetGraph - Gets the Graph resource under an existing Azure Cosmos DB database account with the provided name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - graphName - Cosmos DB graph resource name. +// - options - GraphResourcesClientGetGraphOptions contains the optional parameters for the GraphResourcesClient.GetGraph method. +func (client *GraphResourcesClient) GetGraph(ctx context.Context, resourceGroupName string, accountName string, graphName string, options *GraphResourcesClientGetGraphOptions) (GraphResourcesClientGetGraphResponse, error) { + var err error + const operationName = "GraphResourcesClient.GetGraph" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getGraphCreateRequest(ctx, resourceGroupName, accountName, graphName, options) + if err != nil { + return GraphResourcesClientGetGraphResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GraphResourcesClientGetGraphResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GraphResourcesClientGetGraphResponse{}, err + } + resp, err := client.getGraphHandleResponse(httpResp) + return resp, err +} + +// getGraphCreateRequest creates the GetGraph request. +func (client *GraphResourcesClient) getGraphCreateRequest(ctx context.Context, resourceGroupName string, accountName string, graphName string, options *GraphResourcesClientGetGraphOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if graphName == "" { + return nil, errors.New("parameter graphName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{graphName}", url.PathEscape(graphName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getGraphHandleResponse handles the GetGraph response. +func (client *GraphResourcesClient) getGraphHandleResponse(resp *http.Response) (GraphResourcesClientGetGraphResponse, error) { + result := GraphResourcesClientGetGraphResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GraphResourceGetResults); err != nil { + return GraphResourcesClientGetGraphResponse{}, err + } + return result, nil +} + +// NewListGraphsPager - Lists the graphs under an existing Azure Cosmos DB database account. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - options - GraphResourcesClientListGraphsOptions contains the optional parameters for the GraphResourcesClient.NewListGraphsPager +// method. +func (client *GraphResourcesClient) NewListGraphsPager(resourceGroupName string, accountName string, options *GraphResourcesClientListGraphsOptions) *runtime.Pager[GraphResourcesClientListGraphsResponse] { + return runtime.NewPager(runtime.PagingHandler[GraphResourcesClientListGraphsResponse]{ + More: func(page GraphResourcesClientListGraphsResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *GraphResourcesClientListGraphsResponse) (GraphResourcesClientListGraphsResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GraphResourcesClient.NewListGraphsPager") + req, err := client.listGraphsCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return GraphResourcesClientListGraphsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GraphResourcesClientListGraphsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GraphResourcesClientListGraphsResponse{}, runtime.NewResponseError(resp) + } + return client.listGraphsHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listGraphsCreateRequest creates the ListGraphs request. +func (client *GraphResourcesClient) listGraphsCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *GraphResourcesClientListGraphsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listGraphsHandleResponse handles the ListGraphs response. +func (client *GraphResourcesClient) listGraphsHandleResponse(resp *http.Response) (GraphResourcesClientListGraphsResponse, error) { + result := GraphResourcesClientListGraphsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GraphResourcesListResult); err != nil { + return GraphResourcesClientListGraphsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/gremlinresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/gremlinresources_client.go index d4112dc68c44..a1c7d46d31e7 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/gremlinresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/gremlinresources_client.go @@ -46,7 +46,7 @@ func NewGremlinResourcesClient(subscriptionID string, credential azcore.TokenCre // BeginCreateUpdateGremlinDatabase - Create or update an Azure Cosmos DB Gremlin database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -73,7 +73,7 @@ func (client *GremlinResourcesClient) BeginCreateUpdateGremlinDatabase(ctx conte // CreateUpdateGremlinDatabase - Create or update an Azure Cosmos DB Gremlin database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *GremlinResourcesClient) createUpdateGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters, options *GremlinResourcesClientBeginCreateUpdateGremlinDatabaseOptions) (*http.Response, error) { var err error const operationName = "GremlinResourcesClient.BeginCreateUpdateGremlinDatabase" @@ -119,7 +119,7 @@ func (client *GremlinResourcesClient) createUpdateGremlinDatabaseCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateGremlinDatabaseParameters); err != nil { @@ -131,7 +131,7 @@ func (client *GremlinResourcesClient) createUpdateGremlinDatabaseCreateRequest(c // BeginCreateUpdateGremlinGraph - Create or update an Azure Cosmos DB Gremlin graph // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -159,7 +159,7 @@ func (client *GremlinResourcesClient) BeginCreateUpdateGremlinGraph(ctx context. // CreateUpdateGremlinGraph - Create or update an Azure Cosmos DB Gremlin graph // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *GremlinResourcesClient) createUpdateGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, createUpdateGremlinGraphParameters GremlinGraphCreateUpdateParameters, options *GremlinResourcesClientBeginCreateUpdateGremlinGraphOptions) (*http.Response, error) { var err error const operationName = "GremlinResourcesClient.BeginCreateUpdateGremlinGraph" @@ -209,7 +209,7 @@ func (client *GremlinResourcesClient) createUpdateGremlinGraphCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateGremlinGraphParameters); err != nil { @@ -221,7 +221,7 @@ func (client *GremlinResourcesClient) createUpdateGremlinGraphCreateRequest(ctx // BeginDeleteGremlinDatabase - Deletes an existing Azure Cosmos DB Gremlin database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -247,7 +247,7 @@ func (client *GremlinResourcesClient) BeginDeleteGremlinDatabase(ctx context.Con // DeleteGremlinDatabase - Deletes an existing Azure Cosmos DB Gremlin database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *GremlinResourcesClient) deleteGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *GremlinResourcesClientBeginDeleteGremlinDatabaseOptions) (*http.Response, error) { var err error const operationName = "GremlinResourcesClient.BeginDeleteGremlinDatabase" @@ -293,7 +293,7 @@ func (client *GremlinResourcesClient) deleteGremlinDatabaseCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -301,7 +301,7 @@ func (client *GremlinResourcesClient) deleteGremlinDatabaseCreateRequest(ctx con // BeginDeleteGremlinGraph - Deletes an existing Azure Cosmos DB Gremlin graph. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -328,7 +328,7 @@ func (client *GremlinResourcesClient) BeginDeleteGremlinGraph(ctx context.Contex // DeleteGremlinGraph - Deletes an existing Azure Cosmos DB Gremlin graph. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *GremlinResourcesClient) deleteGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, options *GremlinResourcesClientBeginDeleteGremlinGraphOptions) (*http.Response, error) { var err error const operationName = "GremlinResourcesClient.BeginDeleteGremlinGraph" @@ -378,7 +378,7 @@ func (client *GremlinResourcesClient) deleteGremlinGraphCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -386,7 +386,7 @@ func (client *GremlinResourcesClient) deleteGremlinGraphCreateRequest(ctx contex // GetGremlinDatabase - Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -438,7 +438,7 @@ func (client *GremlinResourcesClient) getGremlinDatabaseCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -457,7 +457,7 @@ func (client *GremlinResourcesClient) getGremlinDatabaseHandleResponse(resp *htt // account with the provided name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -509,7 +509,7 @@ func (client *GremlinResourcesClient) getGremlinDatabaseThroughputCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -527,7 +527,7 @@ func (client *GremlinResourcesClient) getGremlinDatabaseThroughputHandleResponse // GetGremlinGraph - Gets the Gremlin graph under an existing Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -584,7 +584,7 @@ func (client *GremlinResourcesClient) getGremlinGraphCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -603,7 +603,7 @@ func (client *GremlinResourcesClient) getGremlinGraphHandleResponse(resp *http.R // provided name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -660,7 +660,7 @@ func (client *GremlinResourcesClient) getGremlinGraphThroughputCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -677,7 +677,7 @@ func (client *GremlinResourcesClient) getGremlinGraphThroughputHandleResponse(re // NewListGremlinDatabasesPager - Lists the Gremlin databases under an existing Azure Cosmos DB database account. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - GremlinResourcesClientListGremlinDatabasesOptions contains the optional parameters for the GremlinResourcesClient.NewListGremlinDatabasesPager @@ -726,7 +726,7 @@ func (client *GremlinResourcesClient) listGremlinDatabasesCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -743,7 +743,7 @@ func (client *GremlinResourcesClient) listGremlinDatabasesHandleResponse(resp *h // NewListGremlinGraphsPager - Lists the Gremlin graph under an existing Azure Cosmos DB database account. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -797,7 +797,7 @@ func (client *GremlinResourcesClient) listGremlinGraphsCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -815,7 +815,7 @@ func (client *GremlinResourcesClient) listGremlinGraphsHandleResponse(resp *http // BeginMigrateGremlinDatabaseToAutoscale - Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -841,7 +841,7 @@ func (client *GremlinResourcesClient) BeginMigrateGremlinDatabaseToAutoscale(ctx // MigrateGremlinDatabaseToAutoscale - Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *GremlinResourcesClient) migrateGremlinDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *GremlinResourcesClientBeginMigrateGremlinDatabaseToAutoscaleOptions) (*http.Response, error) { var err error const operationName = "GremlinResourcesClient.BeginMigrateGremlinDatabaseToAutoscale" @@ -887,7 +887,7 @@ func (client *GremlinResourcesClient) migrateGremlinDatabaseToAutoscaleCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -896,7 +896,7 @@ func (client *GremlinResourcesClient) migrateGremlinDatabaseToAutoscaleCreateReq // BeginMigrateGremlinDatabaseToManualThroughput - Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -922,7 +922,7 @@ func (client *GremlinResourcesClient) BeginMigrateGremlinDatabaseToManualThrough // MigrateGremlinDatabaseToManualThroughput - Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *GremlinResourcesClient) migrateGremlinDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *GremlinResourcesClientBeginMigrateGremlinDatabaseToManualThroughputOptions) (*http.Response, error) { var err error const operationName = "GremlinResourcesClient.BeginMigrateGremlinDatabaseToManualThroughput" @@ -968,7 +968,7 @@ func (client *GremlinResourcesClient) migrateGremlinDatabaseToManualThroughputCr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -977,7 +977,7 @@ func (client *GremlinResourcesClient) migrateGremlinDatabaseToManualThroughputCr // BeginMigrateGremlinGraphToAutoscale - Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1004,7 +1004,7 @@ func (client *GremlinResourcesClient) BeginMigrateGremlinGraphToAutoscale(ctx co // MigrateGremlinGraphToAutoscale - Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *GremlinResourcesClient) migrateGremlinGraphToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, options *GremlinResourcesClientBeginMigrateGremlinGraphToAutoscaleOptions) (*http.Response, error) { var err error const operationName = "GremlinResourcesClient.BeginMigrateGremlinGraphToAutoscale" @@ -1054,7 +1054,7 @@ func (client *GremlinResourcesClient) migrateGremlinGraphToAutoscaleCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1063,7 +1063,7 @@ func (client *GremlinResourcesClient) migrateGremlinGraphToAutoscaleCreateReques // BeginMigrateGremlinGraphToManualThroughput - Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1090,7 +1090,7 @@ func (client *GremlinResourcesClient) BeginMigrateGremlinGraphToManualThroughput // MigrateGremlinGraphToManualThroughput - Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *GremlinResourcesClient) migrateGremlinGraphToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, options *GremlinResourcesClientBeginMigrateGremlinGraphToManualThroughputOptions) (*http.Response, error) { var err error const operationName = "GremlinResourcesClient.BeginMigrateGremlinGraphToManualThroughput" @@ -1140,7 +1140,7 @@ func (client *GremlinResourcesClient) migrateGremlinGraphToManualThroughputCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1149,7 +1149,7 @@ func (client *GremlinResourcesClient) migrateGremlinGraphToManualThroughputCreat // BeginRetrieveContinuousBackupInformation - Retrieves continuous backup information for a gremlin graph. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1178,7 +1178,7 @@ func (client *GremlinResourcesClient) BeginRetrieveContinuousBackupInformation(c // RetrieveContinuousBackupInformation - Retrieves continuous backup information for a gremlin graph. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *GremlinResourcesClient) retrieveContinuousBackupInformation(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, location ContinuousBackupRestoreLocation, options *GremlinResourcesClientBeginRetrieveContinuousBackupInformationOptions) (*http.Response, error) { var err error const operationName = "GremlinResourcesClient.BeginRetrieveContinuousBackupInformation" @@ -1228,7 +1228,7 @@ func (client *GremlinResourcesClient) retrieveContinuousBackupInformationCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, location); err != nil { @@ -1240,7 +1240,7 @@ func (client *GremlinResourcesClient) retrieveContinuousBackupInformationCreateR // BeginUpdateGremlinDatabaseThroughput - Update RUs per second of an Azure Cosmos DB Gremlin database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1267,7 +1267,7 @@ func (client *GremlinResourcesClient) BeginUpdateGremlinDatabaseThroughput(ctx c // UpdateGremlinDatabaseThroughput - Update RUs per second of an Azure Cosmos DB Gremlin database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *GremlinResourcesClient) updateGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *GremlinResourcesClientBeginUpdateGremlinDatabaseThroughputOptions) (*http.Response, error) { var err error const operationName = "GremlinResourcesClient.BeginUpdateGremlinDatabaseThroughput" @@ -1313,7 +1313,7 @@ func (client *GremlinResourcesClient) updateGremlinDatabaseThroughputCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { @@ -1325,7 +1325,7 @@ func (client *GremlinResourcesClient) updateGremlinDatabaseThroughputCreateReque // BeginUpdateGremlinGraphThroughput - Update RUs per second of an Azure Cosmos DB Gremlin graph // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1353,7 +1353,7 @@ func (client *GremlinResourcesClient) BeginUpdateGremlinGraphThroughput(ctx cont // UpdateGremlinGraphThroughput - Update RUs per second of an Azure Cosmos DB Gremlin graph // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *GremlinResourcesClient) updateGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *GremlinResourcesClientBeginUpdateGremlinGraphThroughputOptions) (*http.Response, error) { var err error const operationName = "GremlinResourcesClient.BeginUpdateGremlinGraphThroughput" @@ -1403,7 +1403,7 @@ func (client *GremlinResourcesClient) updateGremlinGraphThroughputCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { diff --git a/sdk/resourcemanager/cosmos/armcosmos/gremlinresources_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/gremlinresources_client_example_test.go deleted file mode 100644 index 76b0b8d163f4..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/gremlinresources_client_example_test.go +++ /dev/null @@ -1,825 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGremlinDatabaseList.json -func ExampleGremlinResourcesClient_NewListGremlinDatabasesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGremlinResourcesClient().NewListGremlinDatabasesPager("rgName", "ddb1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GremlinDatabaseListResult = armcosmos.GremlinDatabaseListResult{ - // Value: []*armcosmos.GremlinDatabaseGetResults{ - // { - // Name: to.Ptr("databaseName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/gremlinDatabases"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/gremlinDatabases/databaseName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.GremlinDatabaseGetProperties{ - // Resource: &armcosmos.GremlinDatabaseGetPropertiesResource{ - // Etag: to.Ptr("\"00000a00-0000-0000-0000-56672f920000\""), - // Rid: to.Ptr("CqNBAA=="), - // Ts: to.Ptr[float32](1449602962), - // ID: to.Ptr("databaseName"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGremlinDatabaseGet.json -func ExampleGremlinResourcesClient_GetGremlinDatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGremlinResourcesClient().GetGremlinDatabase(ctx, "rg1", "ddb1", "databaseName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GremlinDatabaseGetResults = armcosmos.GremlinDatabaseGetResults{ - // Name: to.Ptr("databaseName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/gremlinDatabases"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/gremlinDatabases/databaseName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.GremlinDatabaseGetProperties{ - // Resource: &armcosmos.GremlinDatabaseGetPropertiesResource{ - // Etag: to.Ptr("\"00000a00-0000-0000-0000-56672f920000\""), - // Rid: to.Ptr("CqNBAA=="), - // Ts: to.Ptr[float32](1449602962), - // ID: to.Ptr("databaseName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGremlinDatabaseCreateUpdate.json -func ExampleGremlinResourcesClient_BeginCreateUpdateGremlinDatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGremlinResourcesClient().BeginCreateUpdateGremlinDatabase(ctx, "rg1", "ddb1", "databaseName", armcosmos.GremlinDatabaseCreateUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.GremlinDatabaseCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.GremlinDatabaseResource{ - ID: to.Ptr("databaseName"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GremlinDatabaseGetResults = armcosmos.GremlinDatabaseGetResults{ - // Name: to.Ptr("databaseName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/gremlinDatabases"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/gremlinDatabases/databaseName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.GremlinDatabaseGetProperties{ - // Resource: &armcosmos.GremlinDatabaseGetPropertiesResource{ - // Etag: to.Ptr("\"00000a00-0000-0000-0000-56672f920000\""), - // Rid: to.Ptr("CqNBAA=="), - // Ts: to.Ptr[float32](1449602962), - // ID: to.Ptr("databaseName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGremlinDatabaseDelete.json -func ExampleGremlinResourcesClient_BeginDeleteGremlinDatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGremlinResourcesClient().BeginDeleteGremlinDatabase(ctx, "rg1", "ddb1", "databaseName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGremlinDatabaseThroughputGet.json -func ExampleGremlinResourcesClient_GetGremlinDatabaseThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGremlinResourcesClient().GetGremlinDatabaseThroughput(ctx, "rg1", "ddb1", "databaseName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/gremlinDatabases/databaseName/throughputSettings/default"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // InstantMaximumThroughput: to.Ptr("10000"), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // SoftAllowedMaximumThroughput: to.Ptr("1000000"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGremlinDatabaseThroughputUpdate.json -func ExampleGremlinResourcesClient_BeginUpdateGremlinDatabaseThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGremlinResourcesClient().BeginUpdateGremlinDatabaseThroughput(ctx, "rg1", "ddb1", "databaseName", armcosmos.ThroughputSettingsUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.ThroughputSettingsUpdateProperties{ - Resource: &armcosmos.ThroughputSettingsResource{ - Throughput: to.Ptr[int32](400), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/gremlinDatabases/databaseName/throughputSettings/default"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGremlinDatabaseMigrateToAutoscale.json -func ExampleGremlinResourcesClient_BeginMigrateGremlinDatabaseToAutoscale() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGremlinResourcesClient().BeginMigrateGremlinDatabaseToAutoscale(ctx, "rg1", "ddb1", "databaseName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // AutoscaleSettings: &armcosmos.AutoscaleSettingsResource{ - // MaxThroughput: to.Ptr[int32](4000), - // }, - // MinimumThroughput: to.Ptr("4000"), - // OfferReplacePending: to.Ptr("false"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGremlinDatabaseMigrateToManualThroughput.json -func ExampleGremlinResourcesClient_BeginMigrateGremlinDatabaseToManualThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGremlinResourcesClient().BeginMigrateGremlinDatabaseToManualThroughput(ctx, "rg1", "ddb1", "databaseName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGremlinGraphList.json -func ExampleGremlinResourcesClient_NewListGremlinGraphsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGremlinResourcesClient().NewListGremlinGraphsPager("rgName", "ddb1", "databaseName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GremlinGraphListResult = armcosmos.GremlinGraphListResult{ - // Value: []*armcosmos.GremlinGraphGetResults{ - // { - // Name: to.Ptr("testgrf"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/apis/databases/graphs"), - // ID: to.Ptr("testgrf"), - // Properties: &armcosmos.GremlinGraphGetProperties{ - // Resource: &armcosmos.GremlinGraphGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // ConflictResolutionPolicy: &armcosmos.ConflictResolutionPolicy{ - // ConflictResolutionPath: to.Ptr("/path"), - // Mode: to.Ptr(armcosmos.ConflictResolutionModeLastWriterWins), - // }, - // DefaultTTL: to.Ptr[int32](100), - // ID: to.Ptr("testgrf"), - // IndexingPolicy: &armcosmos.IndexingPolicy{ - // Automatic: to.Ptr(true), - // ExcludedPaths: []*armcosmos.ExcludedPath{ - // }, - // IncludedPaths: []*armcosmos.IncludedPath{ - // { - // Path: to.Ptr("/*"), - // Indexes: []*armcosmos.Indexes{ - // { - // DataType: to.Ptr(armcosmos.DataTypeString), - // Kind: to.Ptr(armcosmos.IndexKindRange), - // Precision: to.Ptr[int32](-1), - // }, - // { - // DataType: to.Ptr(armcosmos.DataTypeNumber), - // Kind: to.Ptr(armcosmos.IndexKindRange), - // Precision: to.Ptr[int32](-1), - // }}, - // }}, - // IndexingMode: to.Ptr(armcosmos.IndexingModeConsistent), - // }, - // PartitionKey: &armcosmos.ContainerPartitionKey{ - // Kind: to.Ptr(armcosmos.PartitionKindHash), - // Paths: []*string{ - // to.Ptr("/AccountNumber")}, - // }, - // UniqueKeyPolicy: &armcosmos.UniqueKeyPolicy{ - // UniqueKeys: []*armcosmos.UniqueKey{ - // { - // Paths: []*string{ - // to.Ptr("/testPath")}, - // }}, - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGremlinGraphGet.json -func ExampleGremlinResourcesClient_GetGremlinGraph() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGremlinResourcesClient().GetGremlinGraph(ctx, "rgName", "ddb1", "databaseName", "graphName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GremlinGraphGetResults = armcosmos.GremlinGraphGetResults{ - // Name: to.Ptr("graphName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/apis/databases/graphs"), - // ID: to.Ptr("graphName"), - // Properties: &armcosmos.GremlinGraphGetProperties{ - // Resource: &armcosmos.GremlinGraphGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // ConflictResolutionPolicy: &armcosmos.ConflictResolutionPolicy{ - // ConflictResolutionPath: to.Ptr("/path"), - // Mode: to.Ptr(armcosmos.ConflictResolutionModeLastWriterWins), - // }, - // DefaultTTL: to.Ptr[int32](100), - // ID: to.Ptr("graphName"), - // IndexingPolicy: &armcosmos.IndexingPolicy{ - // Automatic: to.Ptr(true), - // ExcludedPaths: []*armcosmos.ExcludedPath{ - // }, - // IncludedPaths: []*armcosmos.IncludedPath{ - // { - // Path: to.Ptr("/*"), - // Indexes: []*armcosmos.Indexes{ - // { - // DataType: to.Ptr(armcosmos.DataTypeString), - // Kind: to.Ptr(armcosmos.IndexKindRange), - // Precision: to.Ptr[int32](-1), - // }, - // { - // DataType: to.Ptr(armcosmos.DataTypeNumber), - // Kind: to.Ptr(armcosmos.IndexKindRange), - // Precision: to.Ptr[int32](-1), - // }}, - // }}, - // IndexingMode: to.Ptr(armcosmos.IndexingModeConsistent), - // }, - // PartitionKey: &armcosmos.ContainerPartitionKey{ - // Kind: to.Ptr(armcosmos.PartitionKindHash), - // Paths: []*string{ - // to.Ptr("/AccountNumber")}, - // }, - // UniqueKeyPolicy: &armcosmos.UniqueKeyPolicy{ - // UniqueKeys: []*armcosmos.UniqueKey{ - // { - // Paths: []*string{ - // to.Ptr("/testPath")}, - // }}, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGremlinGraphCreateUpdate.json -func ExampleGremlinResourcesClient_BeginCreateUpdateGremlinGraph() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGremlinResourcesClient().BeginCreateUpdateGremlinGraph(ctx, "rg1", "ddb1", "databaseName", "graphName", armcosmos.GremlinGraphCreateUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.GremlinGraphCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.GremlinGraphResource{ - ConflictResolutionPolicy: &armcosmos.ConflictResolutionPolicy{ - ConflictResolutionPath: to.Ptr("/path"), - Mode: to.Ptr(armcosmos.ConflictResolutionModeLastWriterWins), - }, - DefaultTTL: to.Ptr[int32](100), - ID: to.Ptr("graphName"), - IndexingPolicy: &armcosmos.IndexingPolicy{ - Automatic: to.Ptr(true), - ExcludedPaths: []*armcosmos.ExcludedPath{}, - IncludedPaths: []*armcosmos.IncludedPath{ - { - Path: to.Ptr("/*"), - Indexes: []*armcosmos.Indexes{ - { - DataType: to.Ptr(armcosmos.DataTypeString), - Kind: to.Ptr(armcosmos.IndexKindRange), - Precision: to.Ptr[int32](-1), - }, - { - DataType: to.Ptr(armcosmos.DataTypeNumber), - Kind: to.Ptr(armcosmos.IndexKindRange), - Precision: to.Ptr[int32](-1), - }}, - }}, - IndexingMode: to.Ptr(armcosmos.IndexingModeConsistent), - }, - PartitionKey: &armcosmos.ContainerPartitionKey{ - Kind: to.Ptr(armcosmos.PartitionKindHash), - Paths: []*string{ - to.Ptr("/AccountNumber")}, - }, - UniqueKeyPolicy: &armcosmos.UniqueKeyPolicy{ - UniqueKeys: []*armcosmos.UniqueKey{ - { - Paths: []*string{ - to.Ptr("/testPath")}, - }}, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GremlinGraphGetResults = armcosmos.GremlinGraphGetResults{ - // Name: to.Ptr("graphName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/gremlinGraphs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/gremlinDatabases/databaseName/gremlinGraphs/graphName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.GremlinGraphGetProperties{ - // Resource: &armcosmos.GremlinGraphGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // ConflictResolutionPolicy: &armcosmos.ConflictResolutionPolicy{ - // ConflictResolutionPath: to.Ptr("/path"), - // Mode: to.Ptr(armcosmos.ConflictResolutionModeLastWriterWins), - // }, - // DefaultTTL: to.Ptr[int32](100), - // ID: to.Ptr("graphName"), - // IndexingPolicy: &armcosmos.IndexingPolicy{ - // Automatic: to.Ptr(true), - // ExcludedPaths: []*armcosmos.ExcludedPath{ - // }, - // IncludedPaths: []*armcosmos.IncludedPath{ - // { - // Path: to.Ptr("/*"), - // Indexes: []*armcosmos.Indexes{ - // { - // DataType: to.Ptr(armcosmos.DataTypeString), - // Kind: to.Ptr(armcosmos.IndexKindRange), - // Precision: to.Ptr[int32](-1), - // }, - // { - // DataType: to.Ptr(armcosmos.DataTypeNumber), - // Kind: to.Ptr(armcosmos.IndexKindRange), - // Precision: to.Ptr[int32](-1), - // }}, - // }}, - // IndexingMode: to.Ptr(armcosmos.IndexingModeConsistent), - // }, - // PartitionKey: &armcosmos.ContainerPartitionKey{ - // Kind: to.Ptr(armcosmos.PartitionKindHash), - // Paths: []*string{ - // to.Ptr("/AccountNumber")}, - // }, - // UniqueKeyPolicy: &armcosmos.UniqueKeyPolicy{ - // UniqueKeys: []*armcosmos.UniqueKey{ - // { - // Paths: []*string{ - // to.Ptr("/testPath")}, - // }}, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGremlinGraphDelete.json -func ExampleGremlinResourcesClient_BeginDeleteGremlinGraph() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGremlinResourcesClient().BeginDeleteGremlinGraph(ctx, "rg1", "ddb1", "databaseName", "graphName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGremlinGraphThroughputGet.json -func ExampleGremlinResourcesClient_GetGremlinGraphThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGremlinResourcesClient().GetGremlinGraphThroughput(ctx, "rg1", "ddb1", "databaseName", "graphName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/gremlinDatabases/databaseName/gremlinGraphs/graphName/throughputSettings/default"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // InstantMaximumThroughput: to.Ptr("10000"), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // SoftAllowedMaximumThroughput: to.Ptr("1000000"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGremlinGraphThroughputUpdate.json -func ExampleGremlinResourcesClient_BeginUpdateGremlinGraphThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGremlinResourcesClient().BeginUpdateGremlinGraphThroughput(ctx, "rg1", "ddb1", "databaseName", "graphName", armcosmos.ThroughputSettingsUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.ThroughputSettingsUpdateProperties{ - Resource: &armcosmos.ThroughputSettingsResource{ - Throughput: to.Ptr[int32](400), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/gremlinDatabases/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/gremlinDatabases/databaseName/gremlinGraphs/graphName/throughputSettings/default"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGremlinGraphMigrateToAutoscale.json -func ExampleGremlinResourcesClient_BeginMigrateGremlinGraphToAutoscale() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGremlinResourcesClient().BeginMigrateGremlinGraphToAutoscale(ctx, "rg1", "ddb1", "databaseName", "graphName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // AutoscaleSettings: &armcosmos.AutoscaleSettingsResource{ - // MaxThroughput: to.Ptr[int32](4000), - // }, - // MinimumThroughput: to.Ptr("4000"), - // OfferReplacePending: to.Ptr("false"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGremlinGraphMigrateToManualThroughput.json -func ExampleGremlinResourcesClient_BeginMigrateGremlinGraphToManualThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGremlinResourcesClient().BeginMigrateGremlinGraphToManualThroughput(ctx, "rg1", "ddb1", "databaseName", "graphName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGremlinGraphBackupInformation.json -func ExampleGremlinResourcesClient_BeginRetrieveContinuousBackupInformation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGremlinResourcesClient().BeginRetrieveContinuousBackupInformation(ctx, "rgName", "ddb1", "databaseName", "graphName", armcosmos.ContinuousBackupRestoreLocation{ - Location: to.Ptr("North Europe"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupInformation = armcosmos.BackupInformation{ - // ContinuousBackupInformation: &armcosmos.ContinuousBackupInformation{ - // LatestRestorableTimestamp: to.Ptr("2021-02-05T02:40:50Z"), - // }, - // } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/gremlinresources_live_test.go b/sdk/resourcemanager/cosmos/armcosmos/gremlinresources_live_test.go index b20f500eb283..723d0b73f8a9 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/gremlinresources_live_test.go +++ b/sdk/resourcemanager/cosmos/armcosmos/gremlinresources_live_test.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/cosmos/armcosmos/interfaces.go b/sdk/resourcemanager/cosmos/armcosmos/interfaces.go index 8f8e99f5e10e..e00384a97e2a 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/interfaces.go +++ b/sdk/resourcemanager/cosmos/armcosmos/interfaces.go @@ -17,6 +17,26 @@ type BackupPolicyClassification interface { GetBackupPolicy() *BackupPolicy } +// BaseCosmosDataTransferDataSourceSinkClassification provides polymorphic access to related types. +// Call the interface's GetBaseCosmosDataTransferDataSourceSink() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *BaseCosmosDataTransferDataSourceSink, *CassandraDataTransferDataSourceSink, *MongoDataTransferDataSourceSink, *SQLDataTransferDataSourceSink +type BaseCosmosDataTransferDataSourceSinkClassification interface { + DataTransferDataSourceSinkClassification + // GetBaseCosmosDataTransferDataSourceSink returns the BaseCosmosDataTransferDataSourceSink content of the underlying type. + GetBaseCosmosDataTransferDataSourceSink() *BaseCosmosDataTransferDataSourceSink +} + +// DataTransferDataSourceSinkClassification provides polymorphic access to related types. +// Call the interface's GetDataTransferDataSourceSink() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AzureBlobDataTransferDataSourceSink, *BaseCosmosDataTransferDataSourceSink, *CassandraDataTransferDataSourceSink, *DataTransferDataSourceSink, +// - *MongoDataTransferDataSourceSink, *MongoVCoreDataTransferDataSourceSink, *SQLDataTransferDataSourceSink +type DataTransferDataSourceSinkClassification interface { + // GetDataTransferDataSourceSink returns the DataTransferDataSourceSink content of the underlying type. + GetDataTransferDataSourceSink() *DataTransferDataSourceSink +} + // ServiceResourceCreateUpdatePropertiesClassification provides polymorphic access to related types. // Call the interface's GetServiceResourceCreateUpdateProperties() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: diff --git a/sdk/resourcemanager/cosmos/armcosmos/locations_client.go b/sdk/resourcemanager/cosmos/armcosmos/locations_client.go index 5e613db8f891..69fcf34b3016 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/locations_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/locations_client.go @@ -46,7 +46,7 @@ func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential // Get - Get the properties of an existing Cosmos DB location // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - location - Cosmos DB region, with spaces between words and each word capitalized. // - options - LocationsClientGetOptions contains the optional parameters for the LocationsClient.Get method. func (client *LocationsClient) Get(ctx context.Context, location string, options *LocationsClientGetOptions) (LocationsClientGetResponse, error) { @@ -87,7 +87,7 @@ func (client *LocationsClient) getCreateRequest(ctx context.Context, location st return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -104,7 +104,7 @@ func (client *LocationsClient) getHandleResponse(resp *http.Response) (Locations // NewListPager - List Cosmos DB locations and their properties // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - options - LocationsClientListOptions contains the optional parameters for the LocationsClient.NewListPager method. func (client *LocationsClient) NewListPager(options *LocationsClientListOptions) *runtime.Pager[LocationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[LocationsClientListResponse]{ @@ -142,7 +142,7 @@ func (client *LocationsClient) listCreateRequest(ctx context.Context, options *L return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/locations_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/locations_client_example_test.go deleted file mode 100644 index 7fc844b987f1..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/locations_client_example_test.go +++ /dev/null @@ -1,111 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBLocationList.json -func ExampleLocationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLocationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LocationListResult = armcosmos.LocationListResult{ - // Value: []*armcosmos.LocationGetResult{ - // { - // Name: to.Ptr("westus"), - // Type: to.Ptr("Microsoft.DocumentDB/locations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DocumentDB/locations/westus"), - // Properties: &armcosmos.LocationProperties{ - // BackupStorageRedundancies: []*armcosmos.BackupStorageRedundancy{ - // to.Ptr(armcosmos.BackupStorageRedundancyLocal), - // to.Ptr(armcosmos.BackupStorageRedundancyGeo)}, - // IsResidencyRestricted: to.Ptr(false), - // IsSubscriptionRegionAccessAllowedForAz: to.Ptr(false), - // IsSubscriptionRegionAccessAllowedForRegular: to.Ptr(true), - // Status: to.Ptr(armcosmos.StatusOnline), - // SupportsAvailabilityZone: to.Ptr(false), - // }, - // }, - // { - // Name: to.Ptr("centralus"), - // Type: to.Ptr("Microsoft.DocumentDB/locations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DocumentDB/locations/centralus"), - // Properties: &armcosmos.LocationProperties{ - // BackupStorageRedundancies: []*armcosmos.BackupStorageRedundancy{ - // to.Ptr(armcosmos.BackupStorageRedundancyZone), - // to.Ptr(armcosmos.BackupStorageRedundancyGeo)}, - // IsResidencyRestricted: to.Ptr(false), - // IsSubscriptionRegionAccessAllowedForAz: to.Ptr(true), - // IsSubscriptionRegionAccessAllowedForRegular: to.Ptr(false), - // Status: to.Ptr(armcosmos.StatusOnline), - // SupportsAvailabilityZone: to.Ptr(true), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBLocationGet.json -func ExampleLocationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLocationsClient().Get(ctx, "westus", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LocationGetResult = armcosmos.LocationGetResult{ - // Name: to.Ptr("westus"), - // Type: to.Ptr("Microsoft.DocumentDB/locations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DocumentDB/locations/westus"), - // Properties: &armcosmos.LocationProperties{ - // BackupStorageRedundancies: []*armcosmos.BackupStorageRedundancy{ - // to.Ptr(armcosmos.BackupStorageRedundancyLocal), - // to.Ptr(armcosmos.BackupStorageRedundancyGeo)}, - // IsResidencyRestricted: to.Ptr(true), - // IsSubscriptionRegionAccessAllowedForAz: to.Ptr(true), - // IsSubscriptionRegionAccessAllowedForRegular: to.Ptr(true), - // Status: to.Ptr(armcosmos.StatusOnline), - // SupportsAvailabilityZone: to.Ptr(true), - // }, - // } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/models.go b/sdk/resourcemanager/cosmos/armcosmos/models.go index cc1eaec42676..1eb44dedf4a6 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/models.go +++ b/sdk/resourcemanager/cosmos/armcosmos/models.go @@ -11,7 +11,7 @@ package armcosmos import "time" type APIProperties struct { - // Describes the ServerVersion of an a MongoDB account. + // Describes the version of the MongoDB account. ServerVersion *ServerVersion } @@ -30,6 +30,9 @@ type ARMProxyResource struct { // ARMResourceProperties - The core properties of ARM resources. type ARMResourceProperties struct { + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -50,6 +53,45 @@ type ARMResourceProperties struct { Type *string } +// AccessRule - Access rule in a network security perimeter configuration profile +type AccessRule struct { + // Name of the access rule + Name *string + + // Properties of Access Rule + Properties *AccessRuleProperties +} + +// AccessRuleProperties - Properties of Access Rule +type AccessRuleProperties struct { + // Address prefixes in the CIDR format for inbound rules + AddressPrefixes []*string + + // Direction of Access Rule + Direction *AccessRuleDirection + + // Email addresses for outbound rules + EmailAddresses []*string + + // Fully qualified domain names (FQDN) for outbound rules + FullyQualifiedDomainNames []*string + + // Network security perimeters for inbound rules + NetworkSecurityPerimeters []*NetworkSecurityPerimeter + + // Phone numbers for outbound rules + PhoneNumbers []*string + + // Subscriptions for inbound rules + Subscriptions []*AccessRulePropertiesSubscriptionsItem +} + +// AccessRulePropertiesSubscriptionsItem - Subscription identifiers +type AccessRulePropertiesSubscriptionsItem struct { + // The fully qualified Azure resource ID of the subscription e.g. ('/subscriptions/00000000-0000-0000-0000-000000000000') + ID *string +} + // AccountKeyMetadata - The metadata related to an access key for a given database account. type AccountKeyMetadata struct { // READ-ONLY; Generation time in UTC of the key in ISO-8601 format. If the value is missing from the object, it means that @@ -111,6 +153,23 @@ type AutoscaleSettingsResource struct { TargetMaxThroughput *int32 } +// AzureBlobDataTransferDataSourceSink - An Azure Blob Storage data source/sink +type AzureBlobDataTransferDataSourceSink struct { + // REQUIRED + Component *DataTransferComponent + + // REQUIRED + ContainerName *string + EndpointURL *string +} + +// GetDataTransferDataSourceSink implements the DataTransferDataSourceSinkClassification interface for type AzureBlobDataTransferDataSourceSink. +func (a *AzureBlobDataTransferDataSourceSink) GetDataTransferDataSourceSink() *DataTransferDataSourceSink { + return &DataTransferDataSourceSink{ + Component: a.Component, + } +} + // BackupInformation - Backup information of a resource. type BackupInformation struct { // READ-ONLY; Information about the status of continuous backups. @@ -141,6 +200,55 @@ type BackupPolicyMigrationState struct { TargetType *BackupPolicyType } +// BackupResource - A restorable backup of a Cassandra cluster. +type BackupResource struct { + // The time at which the backup will expire. + BackupExpiryTimestamp *time.Time + + // The unique identifier of backup. + BackupID *string + + // The time at which the backup process begins. + BackupStartTimestamp *time.Time + + // The current state of the backup. + BackupState *BackupState + + // The time at which the backup process ends. + BackupStopTimestamp *time.Time +} + +type BackupSchedule struct { + // The cron expression that defines when you want to back up your data. + CronExpression *string + + // The retention period (hours) of the backups. If you want to retain data forever, set retention to 0. + RetentionInHours *int32 + + // The unique identifier of backup schedule. + ScheduleName *string +} + +// BaseCosmosDataTransferDataSourceSink - A base CosmosDB data source/sink +type BaseCosmosDataTransferDataSourceSink struct { + // REQUIRED + Component *DataTransferComponent + RemoteAccountName *string +} + +// GetBaseCosmosDataTransferDataSourceSink implements the BaseCosmosDataTransferDataSourceSinkClassification interface for +// type BaseCosmosDataTransferDataSourceSink. +func (b *BaseCosmosDataTransferDataSourceSink) GetBaseCosmosDataTransferDataSourceSink() *BaseCosmosDataTransferDataSourceSink { + return b +} + +// GetDataTransferDataSourceSink implements the DataTransferDataSourceSinkClassification interface for type BaseCosmosDataTransferDataSourceSink. +func (b *BaseCosmosDataTransferDataSourceSink) GetDataTransferDataSourceSink() *DataTransferDataSourceSink { + return &DataTransferDataSourceSink{ + Component: b.Component, + } +} + // Capability - Cosmos DB capability object type Capability struct { // Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and @@ -156,6 +264,27 @@ type Capacity struct { TotalThroughputLimit *int32 } +// CapacityModeChangeTransitionState - The transition state information related capacity mode change with update request. +type CapacityModeChangeTransitionState struct { + // The transition status of capacity mode. + CapacityModeTransitionStatus *CapacityModeTransitionStatus + + // Indicates the current capacity mode of the account. + CurrentCapacityMode *CapacityMode + + // Indicates the previous capacity mode of the account before successful transition. + PreviousCapacityMode *CapacityMode + + // READ-ONLY; End time in UTC of the last successful capacity mode change. + CapacityModeLastSuccessfulTransitionEndTimestamp *time.Time + + // READ-ONLY; Begin time in UTC of the capacity mode change. + CapacityModeTransitionBeginTimestamp *time.Time + + // READ-ONLY; End time in UTC of the capacity mode change. + CapacityModeTransitionEndTimestamp *time.Time +} + // CassandraClusterPublicStatus - Properties of a managed Cassandra cluster public status. type CassandraClusterPublicStatus struct { // List relevant information about any connection errors to the Datacenters. @@ -179,6 +308,35 @@ type CassandraClusterPublicStatusDataCentersItem struct { SeedNodes []*string } +// CassandraDataTransferDataSourceSink - A CosmosDB Cassandra API data source/sink +type CassandraDataTransferDataSourceSink struct { + // REQUIRED + Component *DataTransferComponent + + // REQUIRED + KeyspaceName *string + + // REQUIRED + TableName *string + RemoteAccountName *string +} + +// GetBaseCosmosDataTransferDataSourceSink implements the BaseCosmosDataTransferDataSourceSinkClassification interface for +// type CassandraDataTransferDataSourceSink. +func (c *CassandraDataTransferDataSourceSink) GetBaseCosmosDataTransferDataSourceSink() *BaseCosmosDataTransferDataSourceSink { + return &BaseCosmosDataTransferDataSourceSink{ + Component: c.Component, + RemoteAccountName: c.RemoteAccountName, + } +} + +// GetDataTransferDataSourceSink implements the DataTransferDataSourceSinkClassification interface for type CassandraDataTransferDataSourceSink. +func (c *CassandraDataTransferDataSourceSink) GetDataTransferDataSourceSink() *DataTransferDataSourceSink { + return &DataTransferDataSourceSink{ + Component: c.Component, + } +} + type CassandraError struct { // Additional information about the error. AdditionalErrorInfo *string @@ -198,6 +356,9 @@ type CassandraKeyspaceCreateUpdateParameters struct { // REQUIRED; Properties to create and update Azure Cosmos DB Cassandra keyspace. Properties *CassandraKeyspaceCreateUpdateProperties + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -258,6 +419,9 @@ type CassandraKeyspaceGetPropertiesResource struct { // CassandraKeyspaceGetResults - An Azure Cosmos DB Cassandra keyspace. type CassandraKeyspaceGetResults struct { + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -316,6 +480,9 @@ type CassandraTableCreateUpdateParameters struct { // REQUIRED; Properties to create and update Azure Cosmos DB Cassandra table. Properties *CassandraTableCreateUpdateProperties + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -385,6 +552,9 @@ type CassandraTableGetPropertiesResource struct { // CassandraTableGetResults - An Azure Cosmos DB Cassandra table. type CassandraTableGetResults struct { + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -429,11 +599,168 @@ type CassandraTableResource struct { Schema *CassandraSchema } +// CassandraViewCreateUpdateParameters - Parameters to create and update Cosmos DB Cassandra view. +type CassandraViewCreateUpdateParameters struct { + // REQUIRED; Properties to create and update Azure Cosmos DB Cassandra view. + Properties *CassandraViewCreateUpdateProperties + + // Identity for the resource. + Identity *ManagedServiceIdentity + + // The location of the resource group to which the resource belongs. + Location *string + + // Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource + // (across resource groups). A maximum of 15 tags can be provided for a + // resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, + // the default experience for a template type is set with "defaultExperience": + // "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + Tags map[string]*string + + // READ-ONLY; The unique resource identifier of the ARM resource. + ID *string + + // READ-ONLY; The name of the ARM resource. + Name *string + + // READ-ONLY; The type of Azure resource. + Type *string +} + +// CassandraViewCreateUpdateProperties - Properties to create and update Azure Cosmos DB Cassandra view. +type CassandraViewCreateUpdateProperties struct { + // REQUIRED; The standard JSON format of a Cassandra view + Resource *CassandraViewResource + + // A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + Options *CreateUpdateOptions +} + +// CassandraViewGetProperties - The properties of an Azure Cosmos DB Cassandra view +type CassandraViewGetProperties struct { + Options *CassandraViewGetPropertiesOptions + Resource *CassandraViewGetPropertiesResource +} + +type CassandraViewGetPropertiesOptions struct { + // Specifies the Autoscale settings. + AutoscaleSettings *AutoscaleSettings + + // Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer + // details. + Throughput *int32 +} + +type CassandraViewGetPropertiesResource struct { + // REQUIRED; Name of the Cosmos DB Cassandra view + ID *string + + // REQUIRED; View Definition of the Cosmos DB Cassandra view + ViewDefinition *string + + // READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. + Etag *string + + // READ-ONLY; A system generated property. A unique identifier. + Rid *string + + // READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. + Ts *float32 +} + +// CassandraViewGetResults - An Azure Cosmos DB Cassandra view. +type CassandraViewGetResults struct { + // Identity for the resource. + Identity *ManagedServiceIdentity + + // The location of the resource group to which the resource belongs. + Location *string + + // The properties of an Azure Cosmos DB Cassandra view + Properties *CassandraViewGetProperties + + // Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource + // (across resource groups). A maximum of 15 tags can be provided for a + // resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, + // the default experience for a template type is set with "defaultExperience": + // "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + Tags map[string]*string + + // READ-ONLY; The unique resource identifier of the ARM resource. + ID *string + + // READ-ONLY; The name of the ARM resource. + Name *string + + // READ-ONLY; The type of Azure resource. + Type *string +} + +// CassandraViewListResult - The List operation response, that contains the Cassandra views and their properties. +type CassandraViewListResult struct { + // READ-ONLY; List of Cassandra views and their properties. + Value []*CassandraViewGetResults +} + +// CassandraViewResource - Cosmos DB Cassandra view resource object +type CassandraViewResource struct { + // REQUIRED; Name of the Cosmos DB Cassandra view + ID *string + + // REQUIRED; View Definition of the Cosmos DB Cassandra view + ViewDefinition *string +} + type Certificate struct { // PEM formatted public key. Pem *string } +// ChaosFaultListResponse - Chaos Fault List Response. +type ChaosFaultListResponse struct { + // READ-ONLY; The link used to get the next page of results. + NextLink *string + + // READ-ONLY; List of Chaos Faults. + Value []*ChaosFaultResource +} + +// ChaosFaultProperties - A request object to enable/disable the chaos fault. +type ChaosFaultProperties struct { + // Indicates whether what action to take for the Chaos Fault. + Action *SupportedActions + + // Container name. + ContainerName *string + + // Database name. + DatabaseName *string + + // Region of the account where the Chaos Fault is to be enabled/disabled. + Region *string + + // READ-ONLY; A provisioning state of the Chaos Fault. + ProvisioningState *string +} + +// ChaosFaultResource - A request object to enable/disable the chaos fault +type ChaosFaultResource struct { + // A request object to enable/disable the chaos fault. + Properties *ChaosFaultProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + // ClientEncryptionIncludedPath - . type ClientEncryptionIncludedPath struct { // REQUIRED; The identifier of the Client Encryption Key to be used to encrypt the path. @@ -579,9 +906,15 @@ type ClusterResourceProperties struct { // authentication. The default is 'Cassandra'. AuthenticationMethod *AuthenticationMethod + // The form of AutoReplicate that is being used by this cluster. + AutoReplicate *AutoReplicate + // How to connect to the azure services needed for running the cluster AzureConnectionMethod *AzureConnectionType + // List of backup schedules that define when you want to back up your data. + BackupSchedules []*BackupSchedule + // Whether Cassandra audit logging is enabled CassandraAuditLoggingEnabled *bool @@ -599,6 +932,9 @@ type ClusterResourceProperties struct { // the value to use on this property. ClusterNameOverride *string + // Type of the cluster. If set to Production, some operations might not be permitted on cluster. + ClusterType *ClusterType + // Whether the cluster and associated data centers has been deallocated. Deallocated *bool @@ -607,6 +943,12 @@ type ClusterResourceProperties struct { // resource id must be of the form '/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/' DelegatedManagementSubnetID *string + // Extensions to be added or updated on cluster. + Extensions []*string + + // List of the data center names for unmanaged data centers in this cluster to be included in auto-replication. + ExternalDataCenters []*string + // List of TLS certificates used to authorize gossip from unmanaged data centers. The TLS certificates of all nodes in unmanaged // data centers must be verifiable using one of the certificates provided in // this property. @@ -641,12 +983,15 @@ type ClusterResourceProperties struct { // the resource id of the backup. RestoreFromBackupID *string + // How the nodes in the cluster react to scheduled events + ScheduledEventStrategy *ScheduledEventStrategy + // READ-ONLY; List of TLS certificates that unmanaged nodes must trust for gossip with managed nodes. All managed nodes will // present TLS client certificates that are verifiable using one of the certificates // provided in this property. GossipCertificates []*Certificate - // READ-ONLY; If the Connection Method is VPN, this is the Id of the private link resource that the datacenters need to connect + // READ-ONLY; If the Connection Method is Vpn, this is the Id of the private link resource that the datacenters need to connect // to. PrivateLinkResourceID *string @@ -679,13 +1024,46 @@ type CommandPostBody struct { Host *string // The arguments for the command to be run - Arguments map[string]*string + Arguments any + + // If true, stops cassandra before executing the command and then start it again + CassandraStopStart *bool + + // If true, allows the command to write to the cassandra directory, otherwise read-only. + ReadWrite *bool +} + +// CommandPublicResource - resource representing a command +type CommandPublicResource struct { + // The arguments for the command to be run + Arguments any // If true, stops cassandra before executing the command and then start it again CassandraStopStart *bool + // The command which should be run + Command *string + + // The unique id of command + CommandID *string + + // IP address of the cassandra host to run the command on + Host *string + + // Whether command has admin privileges + IsAdmin *bool + + // The name of the file where the result is written. + OutputFile *string + // If true, allows the command to write to the cassandra directory, otherwise read-only. - Readwrite *bool + ReadWrite *bool + + // Result output of the command. + Result *string + + // Status of the command. + Status *CommandStatus } type Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties struct { @@ -715,6 +1093,9 @@ type ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersIte // The network ID of the node. HostID *string + // If node has been updated to latest model + IsLatestModel *bool + // The amount of file system data in the data directory (e.g., 47.66 kB), excluding all content in the snapshots subdirectories. // Because all SSTable data files are included, any data that is not cleaned // up (such as TTL-expired cells or tombstones) is counted. @@ -860,7 +1241,7 @@ func (c *ContinuousModeBackupPolicy) GetBackupPolicy() *BackupPolicy { // ContinuousModeProperties - Configuration values for periodic mode backup type ContinuousModeProperties struct { - // Enum to indicate type of Continuous backup mode + // Enum to indicate type of Continuos backup mode Tier *ContinuousTier } @@ -882,6 +1263,21 @@ type CorsPolicy struct { MaxAgeInSeconds *int64 } +// CreateJobRequest - Parameters to create Data Transfer Job +type CreateJobRequest struct { + // REQUIRED; Data Transfer Create Job Properties + Properties *DataTransferJobProperties + + // READ-ONLY; The unique resource identifier of the database account. + ID *string + + // READ-ONLY; The name of the database account. + Name *string + + // READ-ONLY; The type of Azure resource. + Type *string +} + // 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 { @@ -969,6 +1365,77 @@ type DataCenterResourceProperties struct { SeedNodes []*SeedNode } +// DataTransferDataSourceSink - Base class for all DataTransfer source/sink +type DataTransferDataSourceSink struct { + // REQUIRED + Component *DataTransferComponent +} + +// GetDataTransferDataSourceSink implements the DataTransferDataSourceSinkClassification interface for type DataTransferDataSourceSink. +func (d *DataTransferDataSourceSink) GetDataTransferDataSourceSink() *DataTransferDataSourceSink { + return d +} + +// DataTransferJobFeedResults - The List operation response, that contains the Data Transfer jobs and their properties. +type DataTransferJobFeedResults struct { + // READ-ONLY; URL to get the next set of Data Transfer job list results if there are any. + NextLink *string + + // READ-ONLY; List of Data Transfer jobs and their properties. + Value []*DataTransferJobGetResults +} + +// DataTransferJobGetResults - A Cosmos DB Data Transfer Job +type DataTransferJobGetResults struct { + // The properties of a DataTransfer Job + Properties *DataTransferJobProperties + + // READ-ONLY; The unique resource identifier of the database account. + ID *string + + // READ-ONLY; The name of the database account. + Name *string + + // READ-ONLY; The type of Azure resource. + Type *string +} + +// DataTransferJobProperties - The properties of a DataTransfer Job +type DataTransferJobProperties struct { + // REQUIRED; Destination DataStore details + Destination DataTransferDataSourceSinkClassification + + // REQUIRED; Source DataStore details + Source DataTransferDataSourceSinkClassification + + // Mode of job execution + Mode *DataTransferJobMode + + // Worker count + WorkerCount *int32 + + // READ-ONLY; Total Duration of Job + Duration *string + + // READ-ONLY; Error response for Faulted job + Error *ErrorResponse + + // READ-ONLY; Job Name + JobName *string + + // READ-ONLY; Last Updated Time (ISO-8601 format). + LastUpdatedUTCTime *time.Time + + // READ-ONLY; Processed Count. + ProcessedCount *int64 + + // READ-ONLY; Job Status + Status *string + + // READ-ONLY; Total Count. + TotalCount *int64 +} + // DataTransferRegionalServiceResource - Resource for a regional service location. type DataTransferRegionalServiceResource struct { // READ-ONLY; The location name. @@ -1115,6 +1582,9 @@ type DatabaseAccountCreateUpdateProperties struct { // The object that represents all properties related to capacity enforcement on an account. Capacity *Capacity + // Indicates the capacityMode of the Cosmos DB account. + CapacityMode *CapacityMode + // The cassandra connector offer type for the Cosmos DB database C* account. ConnectorOffer *ConnectorOffer @@ -1136,6 +1606,12 @@ type DatabaseAccountCreateUpdateProperties struct { // "SystemAssignedIdentity" and more. DefaultIdentity *string + // Enum to indicate default Priority Level of request for Priority Based Execution. + DefaultPriorityLevel *DefaultPriorityLevel + + // The Object representing the different Diagnostic log settings for the Cosmos DB Account. + DiagnosticLogSettings *DiagnosticLogSettings + // Disable write operations on metadata resources (databases, containers, throughput) via account keys DisableKeyBasedMetadataWriteAccess *bool @@ -1159,12 +1635,21 @@ type DatabaseAccountCreateUpdateProperties struct { // Flag to indicate whether Free Tier is enabled. EnableFreeTier *bool + // Flag to indicate whether to enable MaterializedViews on the Cosmos DB account + EnableMaterializedViews *bool + // Enables the account to write in multiple locations EnableMultipleWriteLocations *bool // Flag to indicate enabling/disabling of Partition Merge feature on the account EnablePartitionMerge *bool + // Flag to indicate enabling/disabling of Per-Region Per-partition autoscale Preview feature on the account + EnablePerRegionPerPartitionAutoscale *bool + + // Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account + EnablePriorityBasedExecution *bool + // List of IpRules. IPRules []*IPAddressOrRange @@ -1174,7 +1659,8 @@ type DatabaseAccountCreateUpdateProperties struct { // The URI of the key vault KeyVaultKeyURI *string - // Indicates the minimum allowed Tls version. The default value is Tls 1.2. Cassandra and Mongo APIs only work with Tls 1.2. + // Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work + // with Tls 1.2. MinimalTLSVersion *MinimalTLSVersion // Indicates what services are allowed to bypass firewall checks. @@ -1214,6 +1700,12 @@ type DatabaseAccountGetProperties struct { // The object that represents all properties related to capacity enforcement on an account. Capacity *Capacity + // Indicates the capacityMode of the Cosmos DB account. + CapacityMode *CapacityMode + + // The object that represents the migration state for the CapacityMode of the Cosmos DB account. + CapacityModeChangeTransitionState *CapacityModeChangeTransitionState + // The cassandra connector offer type for the Cosmos DB database C* account. ConnectorOffer *ConnectorOffer @@ -1235,6 +1727,12 @@ type DatabaseAccountGetProperties struct { // "SystemAssignedIdentity" and more. DefaultIdentity *string + // Enum to indicate default Priority Level of request for Priority Based Execution. + DefaultPriorityLevel *DefaultPriorityLevel + + // The Object representing the different Diagnostic log settings for the Cosmos DB Account. + DiagnosticLogSettings *DiagnosticLogSettings + // Disable write operations on metadata resources (databases, containers, throughput) via account keys DisableKeyBasedMetadataWriteAccess *bool @@ -1258,12 +1756,21 @@ type DatabaseAccountGetProperties struct { // Flag to indicate whether Free Tier is enabled. EnableFreeTier *bool + // Flag to indicate whether to enable MaterializedViews on the Cosmos DB account + EnableMaterializedViews *bool + // Enables the account to write in multiple locations EnableMultipleWriteLocations *bool // Flag to indicate enabling/disabling of Partition Merge feature on the account EnablePartitionMerge *bool + // Flag to indicate enabling/disabling of Per-Region Per-partition autoscale Preview feature on the account + EnablePerRegionPerPartitionAutoscale *bool + + // Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account + EnablePriorityBasedExecution *bool + // List of IpRules. IPRules []*IPAddressOrRange @@ -1273,7 +1780,8 @@ type DatabaseAccountGetProperties struct { // The URI of the key vault KeyVaultKeyURI *string - // Indicates the minimum allowed Tls version. The default value is Tls 1.2. Cassandra and Mongo APIs only work with Tls 1.2. + // Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work + // with Tls 1.2. MinimalTLSVersion *MinimalTLSVersion // Indicates what services are allowed to bypass firewall checks. @@ -1448,6 +1956,9 @@ type DatabaseAccountUpdateProperties struct { // The object that represents all properties related to capacity enforcement on an account. Capacity *Capacity + // Indicates the capacityMode of the Cosmos DB account. + CapacityMode *CapacityMode + // The cassandra connector offer type for the Cosmos DB database C* account. ConnectorOffer *ConnectorOffer @@ -1466,6 +1977,12 @@ type DatabaseAccountUpdateProperties struct { // "SystemAssignedIdentity" and more. DefaultIdentity *string + // Enum to indicate default Priority Level of request for Priority Based Execution. + DefaultPriorityLevel *DefaultPriorityLevel + + // The Object representing the different Diagnostic log settings for the Cosmos DB Account. + DiagnosticLogSettings *DiagnosticLogSettings + // Disable write operations on metadata resources (databases, containers, throughput) via account keys DisableKeyBasedMetadataWriteAccess *bool @@ -1489,12 +2006,21 @@ type DatabaseAccountUpdateProperties struct { // Flag to indicate whether Free Tier is enabled. EnableFreeTier *bool + // Flag to indicate whether to enable MaterializedViews on the Cosmos DB account + EnableMaterializedViews *bool + // Enables the account to write in multiple locations EnableMultipleWriteLocations *bool // Flag to indicate enabling/disabling of Partition Merge feature on the account EnablePartitionMerge *bool + // Flag to indicate enabling/disabling of Per-Region Per-partition autoscale Preview feature on the account + EnablePerRegionPerPartitionAutoscale *bool + + // Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account + EnablePriorityBasedExecution *bool + // List of IpRules. IPRules []*IPAddressOrRange @@ -1507,7 +2033,8 @@ type DatabaseAccountUpdateProperties struct { // An array that contains the georeplication locations enabled for the Cosmos DB account. Locations []*Location - // Indicates the minimum allowed Tls version. The default value is Tls 1.2. Cassandra and Mongo APIs only work with Tls 1.2. + // Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and Mongo API's, which only work + // with Tls 1.2. MinimalTLSVersion *MinimalTLSVersion // Indicates what services are allowed to bypass firewall checks. @@ -1542,6 +2069,39 @@ type DatabaseRestoreResource struct { DatabaseName *string } +// DiagnosticLogSettings - Indicates what diagnostic log settings are to be enabled. +type DiagnosticLogSettings struct { + // Describe the level of detail with which queries are to be logged. + EnableFullTextQuery *EnableFullTextQuery +} + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any + + // READ-ONLY; The additional info type. + Type *string +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo + + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details []*ErrorDetail + + // READ-ONLY; The error message. + Message *string + + // READ-ONLY; The error target. + Target *string +} + // ErrorResponse - Error Response. type ErrorResponse struct { // Error code. @@ -1551,6 +2111,13 @@ type ErrorResponse struct { Message *string } +// ErrorResponseAutoGenerated - Common error response for all Azure Resource Manager APIs to return error details for failed +// operations. (This also follows the OData error response format.). +type ErrorResponseAutoGenerated struct { + // The error object. + Error *ErrorDetail +} + type ExcludedPath struct { // The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) Path *string @@ -1671,11 +2238,111 @@ func (g *GraphAPIComputeServiceResourceProperties) GetServiceResourceProperties( } } +// GraphResource - Cosmos DB Graph resource object +type GraphResource struct { + // REQUIRED; Name of the Cosmos DB Graph + ID *string +} + +// GraphResourceCreateUpdateParameters - Parameters to create and update Cosmos DB Graph resource. +type GraphResourceCreateUpdateParameters struct { + // REQUIRED; Properties to create and update Azure Cosmos DB Graph resource. + Properties *GraphResourceCreateUpdateProperties + + // Identity for the resource. + Identity *ManagedServiceIdentity + + // The location of the resource group to which the resource belongs. + Location *string + + // Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource + // (across resource groups). A maximum of 15 tags can be provided for a + // resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, + // the default experience for a template type is set with "defaultExperience": + // "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + Tags map[string]*string + + // READ-ONLY; The unique resource identifier of the ARM resource. + ID *string + + // READ-ONLY; The name of the ARM resource. + Name *string + + // READ-ONLY; The type of Azure resource. + Type *string +} + +// GraphResourceCreateUpdateProperties - Properties to create and update Azure Cosmos DB Graph resource. +type GraphResourceCreateUpdateProperties struct { + // REQUIRED; The standard JSON format of a Graph resource + Resource *GraphResource + + // A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + Options *CreateUpdateOptions +} + +// GraphResourceGetProperties - The properties of an Azure Cosmos DB SQL database +type GraphResourceGetProperties struct { + Options *GraphResourceGetPropertiesOptions + Resource *GraphResourceGetPropertiesResource +} + +type GraphResourceGetPropertiesOptions struct { + // Specifies the Autoscale settings. + AutoscaleSettings *AutoscaleSettings + + // Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer + // details. + Throughput *int32 +} + +type GraphResourceGetPropertiesResource struct { + // REQUIRED; Name of the Cosmos DB Graph + ID *string +} + +// GraphResourceGetResults - An Azure Cosmos DB Graph resource. +type GraphResourceGetResults struct { + // Identity for the resource. + Identity *ManagedServiceIdentity + + // The location of the resource group to which the resource belongs. + Location *string + + // The properties of an Azure Cosmos DB Graph resource. + Properties *GraphResourceGetProperties + + // Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource + // (across resource groups). A maximum of 15 tags can be provided for a + // resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, + // the default experience for a template type is set with "defaultExperience": + // "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + Tags map[string]*string + + // READ-ONLY; The unique resource identifier of the ARM resource. + ID *string + + // READ-ONLY; The name of the ARM resource. + Name *string + + // READ-ONLY; The type of Azure resource. + Type *string +} + +// GraphResourcesListResult - The List operation response, that contains the Graph resource and their properties. +type GraphResourcesListResult struct { + // READ-ONLY; List of Graph resource and their properties. + Value []*GraphResourceGetResults +} + // GremlinDatabaseCreateUpdateParameters - Parameters to create and update Cosmos DB Gremlin database. type GremlinDatabaseCreateUpdateParameters struct { // REQUIRED; Properties to create and update Azure Cosmos DB Gremlin database. Properties *GremlinDatabaseCreateUpdateProperties + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -1742,6 +2409,9 @@ type GremlinDatabaseGetPropertiesResource struct { // GremlinDatabaseGetResults - An Azure Cosmos DB Gremlin database. type GremlinDatabaseGetResults struct { + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -1797,6 +2467,9 @@ type GremlinGraphCreateUpdateParameters struct { // REQUIRED; Properties to create and update Azure Cosmos DB Gremlin graph. Properties *GremlinGraphCreateUpdateProperties + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -1882,6 +2555,9 @@ type GremlinGraphGetPropertiesResource struct { // GremlinGraphGetResults - An Azure Cosmos DB Gremlin graph. type GremlinGraphGetResults struct { + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -2009,12 +2685,24 @@ type KeyWrapMetadata struct { Value *string } +// ListBackups - List of restorable backups for a Cassandra cluster. +type ListBackups struct { + // READ-ONLY; Container for array of backups. + Value []*BackupResource +} + // ListClusters - List of managed Cassandra clusters. type ListClusters struct { // Container for the array of clusters. Value []*ClusterResource } +// ListCommands - List of commands for cluster. +type ListCommands struct { + // READ-ONLY; Container for array of commands. + Value []*CommandPublicResource +} + // ListDataCenters - List of managed Cassandra data centers and their properties. type ListDataCenters struct { // READ-ONLY; Container for array of data centers. @@ -2158,6 +2846,19 @@ type ManagedServiceIdentity struct { TenantID *string } +// MaterializedViewDefinition - Materialized View definition for the container. +type MaterializedViewDefinition struct { + // REQUIRED; The definition should be an SQL query which would be used to fetch data from the source container to populate + // into the Materialized View container. + Definition *string + + // REQUIRED; The name of the source container on which the Materialized View will be created. + SourceCollectionID *string + + // READ-ONLY; An unique identifier for the source collection. This is a system generated property. + SourceCollectionRid *string +} + // MaterializedViewsBuilderRegionalServiceResource - Resource for a regional service location. type MaterializedViewsBuilderRegionalServiceResource struct { // READ-ONLY; The location name. @@ -2234,6 +2935,12 @@ func (m *MaterializedViewsBuilderServiceResourceProperties) GetServiceResourcePr } } +// MergeParameters - The properties of an Azure Cosmos DB merge operations +type MergeParameters struct { + // Specifies whether the operation is a real merge operation or a simulation. + IsDryRun *bool +} + // Metric data type Metric struct { // READ-ONLY; The end time for the metric (ISO-8601 format). @@ -2329,6 +3036,9 @@ type MongoDBCollectionCreateUpdateParameters struct { // REQUIRED; Properties to create and update Azure Cosmos DB MongoDB collection. Properties *MongoDBCollectionCreateUpdateProperties + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -2404,6 +3114,9 @@ type MongoDBCollectionGetPropertiesResource struct { // MongoDBCollectionGetResults - An Azure Cosmos DB MongoDB collection. type MongoDBCollectionGetResults struct { + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -2459,6 +3172,9 @@ type MongoDBDatabaseCreateUpdateParameters struct { // REQUIRED; Properties to create and update Azure Cosmos DB MongoDB database. Properties *MongoDBDatabaseCreateUpdateProperties + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -2525,6 +3241,9 @@ type MongoDBDatabaseGetPropertiesResource struct { // MongoDBDatabaseGetResults - An Azure Cosmos DB MongoDB database. type MongoDBDatabaseGetResults struct { + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -2566,6 +3285,35 @@ type MongoDBDatabaseResource struct { RestoreParameters *ResourceRestoreParameters } +// MongoDataTransferDataSourceSink - A CosmosDB Mongo API data source/sink +type MongoDataTransferDataSourceSink struct { + // REQUIRED + CollectionName *string + + // REQUIRED + Component *DataTransferComponent + + // REQUIRED + DatabaseName *string + RemoteAccountName *string +} + +// GetBaseCosmosDataTransferDataSourceSink implements the BaseCosmosDataTransferDataSourceSinkClassification interface for +// type MongoDataTransferDataSourceSink. +func (m *MongoDataTransferDataSourceSink) GetBaseCosmosDataTransferDataSourceSink() *BaseCosmosDataTransferDataSourceSink { + return &BaseCosmosDataTransferDataSourceSink{ + Component: m.Component, + RemoteAccountName: m.RemoteAccountName, + } +} + +// GetDataTransferDataSourceSink implements the DataTransferDataSourceSinkClassification interface for type MongoDataTransferDataSourceSink. +func (m *MongoDataTransferDataSourceSink) GetDataTransferDataSourceSink() *DataTransferDataSourceSink { + return &DataTransferDataSourceSink{ + Component: m.Component, + } +} + // MongoIndex - Cosmos DB MongoDB collection index key type MongoIndex struct { // Cosmos DB MongoDB collection index keys @@ -2685,6 +3433,102 @@ type MongoUserDefinitionResource struct { UserName *string } +// MongoVCoreDataTransferDataSourceSink - A CosmosDB Mongo vCore API data source/sink +type MongoVCoreDataTransferDataSourceSink struct { + // REQUIRED + CollectionName *string + + // REQUIRED + Component *DataTransferComponent + + // REQUIRED + DatabaseName *string + ConnectionStringKeyVaultURI *string + HostName *string +} + +// GetDataTransferDataSourceSink implements the DataTransferDataSourceSinkClassification interface for type MongoVCoreDataTransferDataSourceSink. +func (m *MongoVCoreDataTransferDataSourceSink) GetDataTransferDataSourceSink() *DataTransferDataSourceSink { + return &DataTransferDataSourceSink{ + Component: m.Component, + } +} + +// NetworkSecurityPerimeter - Information about a network security perimeter (NSP) +type NetworkSecurityPerimeter struct { + // Fully qualified Azure resource ID of the NSP resource + ID *string + + // Location of the network security perimeter + Location *string + + // Universal unique ID (UUID) of the network security perimeter + PerimeterGUID *string +} + +// NetworkSecurityPerimeterConfiguration - Network security perimeter (NSP) configuration resource +type NetworkSecurityPerimeterConfiguration struct { + // Network security configuration properties. + Properties *NetworkSecurityPerimeterConfigurationProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// NetworkSecurityPerimeterConfigurationListResult - Result of a list NSP (network security perimeter) configurations request. +type NetworkSecurityPerimeterConfigurationListResult struct { + // The link used to get the next page of results. + NextLink *string + + // Array of network security perimeter results. + Value []*NetworkSecurityPerimeterConfiguration +} + +// NetworkSecurityPerimeterConfigurationProperties - Network security configuration properties. +type NetworkSecurityPerimeterConfigurationProperties struct { + // Information about a network security perimeter (NSP) + NetworkSecurityPerimeter *NetworkSecurityPerimeter + + // Network security perimeter configuration profile + Profile *NetworkSecurityProfile + + // Information about resource association + ResourceAssociation *ResourceAssociation + + // READ-ONLY; List of provisioning issues, if any + ProvisioningIssues []*ProvisioningIssue + + // READ-ONLY; Provisioning state of a network security perimeter configuration that is being created or updated. + ProvisioningState *NetworkSecurityPerimeterConfigurationProvisioningState +} + +// NetworkSecurityProfile - Network security perimeter configuration profile +type NetworkSecurityProfile struct { + // List of Access Rules + AccessRules []*AccessRule + + // Current access rules version + AccessRulesVersion *int32 + + // Current diagnostic settings version + DiagnosticSettingsVersion *int32 + + // List of log categories that are enabled + EnabledLogCategories []*string + + // Name of the profile + Name *string +} + // NotebookWorkspace - A notebook workspace resource type NotebookWorkspace struct { // Resource properties. @@ -2917,40 +3761,118 @@ type PeriodicModeBackupPolicy struct { // REQUIRED; Describes the mode of backups. Type *BackupPolicyType - // The object representing the state of the migration between the backup policies. - MigrationState *BackupPolicyMigrationState + // The object representing the state of the migration between the backup policies. + MigrationState *BackupPolicyMigrationState + + // Configuration values for periodic mode backup + PeriodicModeProperties *PeriodicModeProperties +} + +// GetBackupPolicy implements the BackupPolicyClassification interface for type PeriodicModeBackupPolicy. +func (p *PeriodicModeBackupPolicy) GetBackupPolicy() *BackupPolicy { + return &BackupPolicy{ + MigrationState: p.MigrationState, + Type: p.Type, + } +} + +// PeriodicModeProperties - Configuration values for periodic mode backup +type PeriodicModeProperties struct { + // An integer representing the interval in minutes between two backups + BackupIntervalInMinutes *int32 + + // An integer representing the time (in hours) that each backup is retained + BackupRetentionIntervalInHours *int32 + + // Enum to indicate type of backup residency + BackupStorageRedundancy *BackupStorageRedundancy +} + +// Permission - The set of data plane operations permitted through this Role Definition. +type Permission struct { + // An array of data actions that are allowed. + DataActions []*string + + // An array of data actions that are denied. + NotDataActions []*string +} + +// PhysicalPartitionID - PhysicalPartitionId object +type PhysicalPartitionID struct { + // REQUIRED; Id of a physical partition + ID *string +} + +// PhysicalPartitionStorageInfo - The storage of a physical partition +type PhysicalPartitionStorageInfo struct { + // READ-ONLY; The unique identifier of the partition. + ID *string + + // READ-ONLY; The storage in KB for the physical partition. + StorageInKB *float64 +} + +// PhysicalPartitionStorageInfoCollection - List of physical partitions and their properties returned by a merge operation. +type PhysicalPartitionStorageInfoCollection struct { + // READ-ONLY; List of physical partitions and their properties. + PhysicalPartitionStorageInfoCollection []*PhysicalPartitionStorageInfo +} + +// PhysicalPartitionThroughputInfoProperties - The properties of an Azure Cosmos DB PhysicalPartitionThroughputInfoProperties +// object +type PhysicalPartitionThroughputInfoProperties struct { + // Array of physical partition throughput info objects + PhysicalPartitionThroughputInfo []*PhysicalPartitionThroughputInfoResource +} + +// PhysicalPartitionThroughputInfoResource - PhysicalPartitionThroughputInfo object +type PhysicalPartitionThroughputInfoResource struct { + // REQUIRED; Id of a physical partition + ID *string + + // Throughput of a physical partition + Throughput *float64 +} + +// PhysicalPartitionThroughputInfoResult - An Azure Cosmos DB PhysicalPartitionThroughputInfoResult object. +type PhysicalPartitionThroughputInfoResult struct { + // Identity for the resource. + Identity *ManagedServiceIdentity + + // The location of the resource group to which the resource belongs. + Location *string - // Configuration values for periodic mode backup - PeriodicModeProperties *PeriodicModeProperties -} + // The properties of an Azure Cosmos DB PhysicalPartitionThroughputInfoResult object + Properties *PhysicalPartitionThroughputInfoResultProperties -// GetBackupPolicy implements the BackupPolicyClassification interface for type PeriodicModeBackupPolicy. -func (p *PeriodicModeBackupPolicy) GetBackupPolicy() *BackupPolicy { - return &BackupPolicy{ - MigrationState: p.MigrationState, - Type: p.Type, - } -} + // Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource + // (across resource groups). A maximum of 15 tags can be provided for a + // resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, + // the default experience for a template type is set with "defaultExperience": + // "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + Tags map[string]*string -// PeriodicModeProperties - Configuration values for periodic mode backup -type PeriodicModeProperties struct { - // An integer representing the interval in minutes between two backups - BackupIntervalInMinutes *int32 + // READ-ONLY; The unique resource identifier of the ARM resource. + ID *string - // An integer representing the time (in hours) that each backup is retained - BackupRetentionIntervalInHours *int32 + // READ-ONLY; The name of the ARM resource. + Name *string - // Enum to indicate type of backup residency - BackupStorageRedundancy *BackupStorageRedundancy + // READ-ONLY; The type of Azure resource. + Type *string } -// Permission - The set of data plane operations permitted through this Role Definition. -type Permission struct { - // An array of data actions that are allowed. - DataActions []*string +// PhysicalPartitionThroughputInfoResultProperties - The properties of an Azure Cosmos DB PhysicalPartitionThroughputInfoResult +// object +type PhysicalPartitionThroughputInfoResultProperties struct { + // properties of physical partition throughput info + Resource *PhysicalPartitionThroughputInfoResultPropertiesResource +} - // An array of data actions that are denied. - NotDataActions []*string +// PhysicalPartitionThroughputInfoResultPropertiesResource - properties of physical partition throughput info +type PhysicalPartitionThroughputInfoResultPropertiesResource struct { + // Array of physical partition throughput info objects + PhysicalPartitionThroughputInfo []*PhysicalPartitionThroughputInfoResource } // PrivateEndpointConnection - A private endpoint connection @@ -2958,12 +3880,15 @@ type PrivateEndpointConnection struct { // Resource properties. Properties *PrivateEndpointConnectionProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -3058,19 +3983,100 @@ type PrivilegeResource struct { Db *string } +// ProvisioningIssue - Describes a provisioning issue for a network security perimeter configuration +type ProvisioningIssue struct { + // READ-ONLY; Name of the issue + Name *string + + // READ-ONLY; Details of a provisioning issue for a network security perimeter (NSP) configuration. Resource providers should + // generate separate provisioning issue elements for each separate issue detected, and + // include a meaningful and distinctive description, as well as any appropriate suggestedResourceIds and suggestedAccessRules + Properties *ProvisioningIssueProperties +} + +// ProvisioningIssueProperties - Details of a provisioning issue for a network security perimeter (NSP) configuration. Resource +// providers should generate separate provisioning issue elements for each separate issue detected, and +// include a meaningful and distinctive description, as well as any appropriate suggestedResourceIds and suggestedAccessRules +type ProvisioningIssueProperties struct { + // READ-ONLY; Description of the issue + Description *string + + // READ-ONLY; Type of issue + IssueType *IssueType + + // READ-ONLY; Severity of the issue. + Severity *Severity + + // READ-ONLY; Access rules that can be added to the network security profile (NSP) to remediate the issue. + SuggestedAccessRules []*AccessRule + + // READ-ONLY; Fully qualified resource IDs of suggested resources that can be associated to the network security perimeter + // (NSP) to remediate the issue. + SuggestedResourceIDs []*string +} + // ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a // location type ProxyResource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } +// RedistributeThroughputParameters - Cosmos DB redistribute throughput parameters object +type RedistributeThroughputParameters struct { + // REQUIRED; Properties to redistribute throughput parameters object + Properties *RedistributeThroughputProperties + + // Identity for the resource. + Identity *ManagedServiceIdentity + + // The location of the resource group to which the resource belongs. + Location *string + + // Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource + // (across resource groups). A maximum of 15 tags can be provided for a + // resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, + // the default experience for a template type is set with "defaultExperience": + // "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + Tags map[string]*string + + // READ-ONLY; The unique resource identifier of the ARM resource. + ID *string + + // READ-ONLY; The name of the ARM resource. + Name *string + + // READ-ONLY; The type of Azure resource. + Type *string +} + +// RedistributeThroughputProperties - Properties to redistribute throughput for Azure Cosmos DB resource. +type RedistributeThroughputProperties struct { + // REQUIRED; The standard JSON format of a resource throughput + Resource *RedistributeThroughputPropertiesResource +} + +// RedistributeThroughputPropertiesResource - Resource to redistribute throughput for Azure Cosmos DB resource +type RedistributeThroughputPropertiesResource struct { + // REQUIRED; Array of PhysicalPartitionThroughputInfoResource objects. + SourcePhysicalPartitionThroughputInfo []*PhysicalPartitionThroughputInfoResource + + // REQUIRED; Array of PhysicalPartitionThroughputInfoResource objects. + TargetPhysicalPartitionThroughputInfo []*PhysicalPartitionThroughputInfoResource + + // REQUIRED; ThroughputPolicy to apply for throughput redistribution + ThroughputPolicy *ThroughputPolicyType +} + // RegionForOnlineOffline - Cosmos DB region to online or offline. type RegionForOnlineOffline struct { // REQUIRED; Cosmos DB region, with spaces between words and each word capitalized. @@ -3091,16 +4097,28 @@ type RegionalServiceResource struct { // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } +// ResourceAssociation - Information about resource association +type ResourceAssociation struct { + // Access mode of the resource association + AccessMode *ResourceAssociationAccessMode + + // Name of the resource association + Name *string +} + // ResourceRestoreParameters - Parameters to indicate the information about the restore. type ResourceRestoreParameters struct { // The id of the restorable database account from which the restore has to be initiated. For example: @@ -3109,6 +4127,9 @@ type ResourceRestoreParameters struct { // Time to which the account has to be restored (ISO-8601 format). RestoreTimestampInUTC *time.Time + + // Specifies whether the restored account will have Time-To-Live disabled upon the successful restore. + RestoreWithTTLDisabled *bool } // RestorableDatabaseAccountGetResult - A Azure Cosmos DB restorable database account. @@ -3501,6 +4522,9 @@ type RestorableSQLContainerPropertiesResourceContainer struct { // The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container IndexingPolicy *IndexingPolicy + // The configuration for defining Materialized Views. This must be specified only for creating a Materialized View container. + MaterializedViewDefinition *MaterializedViewDefinition + // The configuration of the partition key to be used for partitioning data into multiple partitions PartitionKey *ContainerPartitionKey @@ -3725,6 +4749,12 @@ type RestoreParameters struct { // Time to which the account has to be restored (ISO-8601 format). RestoreTimestampInUTC *time.Time + // Specifies whether the restored account will have Time-To-Live disabled upon the successful restore. + RestoreWithTTLDisabled *bool + + // The source backup location for restore. + SourceBackupLocation *string + // List of specific tables available for restore. TablesToRestore []*string } @@ -3737,6 +4767,49 @@ type RestoreParametersBase struct { // Time to which the account has to be restored (ISO-8601 format). RestoreTimestampInUTC *time.Time + + // Specifies whether the restored account will have Time-To-Live disabled upon the successful restore. + RestoreWithTTLDisabled *bool +} + +// RetrieveThroughputParameters - Cosmos DB retrieve throughput parameters object +type RetrieveThroughputParameters struct { + // REQUIRED; Properties to retrieve throughput parameters object + Properties *RetrieveThroughputProperties + + // Identity for the resource. + Identity *ManagedServiceIdentity + + // The location of the resource group to which the resource belongs. + Location *string + + // Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource + // (across resource groups). A maximum of 15 tags can be provided for a + // resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, + // the default experience for a template type is set with "defaultExperience": + // "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + Tags map[string]*string + + // READ-ONLY; The unique resource identifier of the ARM resource. + ID *string + + // READ-ONLY; The name of the ARM resource. + Name *string + + // READ-ONLY; The type of Azure resource. + Type *string +} + +// RetrieveThroughputProperties - Properties to retrieve throughput for Azure Cosmos DB resource. +type RetrieveThroughputProperties struct { + // REQUIRED; The standard JSON format of a resource throughput + Resource *RetrieveThroughputPropertiesResource +} + +// RetrieveThroughputPropertiesResource - Resource to retrieve throughput information for Cosmos DB resource +type RetrieveThroughputPropertiesResource struct { + // REQUIRED; Array of PhysicalPartitionId objects. + PhysicalPartitionIDs []*PhysicalPartitionID } // Role - The set of roles permitted through this Role Definition. @@ -3753,6 +4826,9 @@ type SQLContainerCreateUpdateParameters struct { // REQUIRED; Properties to create and update Azure Cosmos DB container. Properties *SQLContainerCreateUpdateProperties + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -3822,6 +4898,9 @@ type SQLContainerGetPropertiesResource struct { // The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container IndexingPolicy *IndexingPolicy + // The configuration for defining Materialized Views. This must be specified only for creating a Materialized View container. + MaterializedViewDefinition *MaterializedViewDefinition + // The configuration of the partition key to be used for partitioning data into multiple partitions PartitionKey *ContainerPartitionKey @@ -3844,6 +4923,9 @@ type SQLContainerGetPropertiesResource struct { // SQLContainerGetResults - An Azure Cosmos DB container. type SQLContainerGetResults struct { + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -3899,6 +4981,9 @@ type SQLContainerResource struct { // The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container IndexingPolicy *IndexingPolicy + // The configuration for defining Materialized Views. This must be specified only for creating a Materialized View container. + MaterializedViewDefinition *MaterializedViewDefinition + // The configuration of the partition key to be used for partitioning data into multiple partitions PartitionKey *ContainerPartitionKey @@ -3910,11 +4995,43 @@ type SQLContainerResource struct { UniqueKeyPolicy *UniqueKeyPolicy } +// SQLDataTransferDataSourceSink - A CosmosDB No Sql API data source/sink +type SQLDataTransferDataSourceSink struct { + // REQUIRED + Component *DataTransferComponent + + // REQUIRED + ContainerName *string + + // REQUIRED + DatabaseName *string + RemoteAccountName *string +} + +// GetBaseCosmosDataTransferDataSourceSink implements the BaseCosmosDataTransferDataSourceSinkClassification interface for +// type SQLDataTransferDataSourceSink. +func (s *SQLDataTransferDataSourceSink) GetBaseCosmosDataTransferDataSourceSink() *BaseCosmosDataTransferDataSourceSink { + return &BaseCosmosDataTransferDataSourceSink{ + Component: s.Component, + RemoteAccountName: s.RemoteAccountName, + } +} + +// GetDataTransferDataSourceSink implements the DataTransferDataSourceSinkClassification interface for type SQLDataTransferDataSourceSink. +func (s *SQLDataTransferDataSourceSink) GetDataTransferDataSourceSink() *DataTransferDataSourceSink { + return &DataTransferDataSourceSink{ + Component: s.Component, + } +} + // SQLDatabaseCreateUpdateParameters - Parameters to create and update Cosmos DB SQL database. type SQLDatabaseCreateUpdateParameters struct { // REQUIRED; Properties to create and update Azure Cosmos DB SQL database. Properties *SQLDatabaseCreateUpdateProperties + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -3987,6 +5104,9 @@ type SQLDatabaseGetPropertiesResource struct { // SQLDatabaseGetResults - An Azure Cosmos DB SQL database. type SQLDatabaseGetResults struct { + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -4208,6 +5328,9 @@ type SQLStoredProcedureCreateUpdateParameters struct { // REQUIRED; Properties to create and update Azure Cosmos DB storedProcedure. Properties *SQLStoredProcedureCreateUpdateProperties + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -4261,6 +5384,9 @@ type SQLStoredProcedureGetPropertiesResource struct { // SQLStoredProcedureGetResults - An Azure Cosmos DB storedProcedure. type SQLStoredProcedureGetResults struct { + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -4304,6 +5430,9 @@ type SQLTriggerCreateUpdateParameters struct { // REQUIRED; Properties to create and update Azure Cosmos DB trigger. Properties *SQLTriggerCreateUpdateProperties + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -4363,6 +5492,9 @@ type SQLTriggerGetPropertiesResource struct { // SQLTriggerGetResults - An Azure Cosmos DB trigger. type SQLTriggerGetResults struct { + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -4412,6 +5544,9 @@ type SQLUserDefinedFunctionCreateUpdateParameters struct { // REQUIRED; Properties to create and update Azure Cosmos DB userDefinedFunction. Properties *SQLUserDefinedFunctionCreateUpdateProperties + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -4465,6 +5600,9 @@ type SQLUserDefinedFunctionGetPropertiesResource struct { // SQLUserDefinedFunctionGetResults - An Azure Cosmos DB userDefinedFunction. type SQLUserDefinedFunctionGetResults struct { + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -4613,6 +5751,9 @@ type TableCreateUpdateParameters struct { // REQUIRED; Properties to create and update Azure Cosmos DB Table. Properties *TableCreateUpdateProperties + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -4679,6 +5820,9 @@ type TableGetPropertiesResource struct { // TableGetResults - An Azure Cosmos DB Table. type TableGetResults struct { + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -4729,6 +5873,118 @@ type ThroughputPolicyResource struct { IsEnabled *bool } +// ThroughputPoolAccountCreateParameters - Parameters for creating a Azure Cosmos DB throughput pool account. +type ThroughputPoolAccountCreateParameters struct { + // Properties to update Azure Cosmos DB throughput pool. + Properties *ThroughputPoolAccountCreateProperties + + // Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource + // (across resource groups). A maximum of 15 tags can be provided for a + // resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, + // the default experience for a template type is set with "defaultExperience": + // "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + Tags map[string]*string +} + +// ThroughputPoolAccountCreateProperties - Properties to update Azure Cosmos DB throughput pool. +type ThroughputPoolAccountCreateProperties struct { + // The location of global database account in the throughputPool. + AccountLocation *string + + // The resource identifier of global database account in the throughputPool. + AccountResourceIdentifier *string +} + +// ThroughputPoolAccountProperties - An Azure Cosmos DB Global Database Account which is part of a Throughputpool. +type ThroughputPoolAccountProperties struct { + // The location of global database account in the throughputPool. + AccountLocation *string + + // The resource identifier of global database account in the throughputPool. + AccountResourceIdentifier *string + + // A provisioning state of the ThroughputPool Account. + ProvisioningState *Status + + // READ-ONLY; The instance id of global database account in the throughputPool. + AccountInstanceID *string +} + +// ThroughputPoolAccountResource - An Azure Cosmos DB Throughputpool Account +type ThroughputPoolAccountResource struct { + // An Azure Cosmos DB Global Database Account which is part of a Throughputpool. + Properties *ThroughputPoolAccountProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ThroughputPoolAccountsListResult - The List operation response, that contains the global database accounts and their properties. +type ThroughputPoolAccountsListResult struct { + // READ-ONLY; The link used to get the next page of results. + NextLink *string + + // READ-ONLY; List of global database accounts in a throughput pool and their properties. + Value []*ThroughputPoolAccountResource +} + +// ThroughputPoolProperties - Properties to update Azure Cosmos DB throughput pool. +type ThroughputPoolProperties struct { + // Value for throughput to be shared among CosmosDB resources in the pool. + MaxThroughput *int32 + + // A provisioning state of the ThroughputPool. + ProvisioningState *Status +} + +// ThroughputPoolResource - An Azure Cosmos DB Throughputpool. +type ThroughputPoolResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Properties to update Azure Cosmos DB throughput pool. + Properties *ThroughputPoolProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ThroughputPoolUpdate - Represents a throughput pool resource for updates. +type ThroughputPoolUpdate struct { + // Properties of the throughput pool. + Properties *ThroughputPoolProperties +} + +// ThroughputPoolsListResult - The List operation response, that contains the throughput pools and their properties. +type ThroughputPoolsListResult struct { + // READ-ONLY; The link used to get the next page of results. + NextLink *string + + // READ-ONLY; List of throughput pools and their properties. + Value []*ThroughputPoolResource +} + // ThroughputSettingsGetProperties - The properties of an Azure Cosmos DB resource throughput type ThroughputSettingsGetProperties struct { Resource *ThroughputSettingsGetPropertiesResource @@ -4765,6 +6021,9 @@ type ThroughputSettingsGetPropertiesResource struct { // ThroughputSettingsGetResults - An Azure Cosmos DB resource throughput. type ThroughputSettingsGetResults struct { + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -4815,6 +6074,9 @@ type ThroughputSettingsUpdateParameters struct { // REQUIRED; Properties to update Azure Cosmos DB resource throughput. Properties *ThroughputSettingsUpdateProperties + // Identity for the resource. + Identity *ManagedServiceIdentity + // The location of the resource group to which the resource belongs. Location *string @@ -4841,6 +6103,28 @@ type ThroughputSettingsUpdateProperties struct { Resource *ThroughputSettingsResource } +// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' +// and a 'location' +type TrackedResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + // UniqueKey - The unique key on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB // service. type UniqueKey struct { diff --git a/sdk/resourcemanager/cosmos/armcosmos/models_serde.go b/sdk/resourcemanager/cosmos/armcosmos/models_serde.go index 4c043063b626..2885e3ddb177 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/models_serde.go +++ b/sdk/resourcemanager/cosmos/armcosmos/models_serde.go @@ -82,6 +82,7 @@ func (a *ARMProxyResource) UnmarshalJSON(data []byte) error { func (a ARMResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", a.ID) + populate(objectMap, "identity", a.Identity) populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) populate(objectMap, "tags", a.Tags) @@ -101,6 +102,9 @@ func (a *ARMResourceProperties) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &a.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &a.Location) delete(rawMsg, key) @@ -121,6 +125,115 @@ func (a *ARMResourceProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AccessRule. +func (a AccessRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessRule. +func (a *AccessRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccessRuleProperties. +func (a AccessRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressPrefixes", a.AddressPrefixes) + populate(objectMap, "direction", a.Direction) + populate(objectMap, "emailAddresses", a.EmailAddresses) + populate(objectMap, "fullyQualifiedDomainNames", a.FullyQualifiedDomainNames) + populate(objectMap, "networkSecurityPerimeters", a.NetworkSecurityPerimeters) + populate(objectMap, "phoneNumbers", a.PhoneNumbers) + populate(objectMap, "subscriptions", a.Subscriptions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessRuleProperties. +func (a *AccessRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "addressPrefixes": + err = unpopulate(val, "AddressPrefixes", &a.AddressPrefixes) + delete(rawMsg, key) + case "direction": + err = unpopulate(val, "Direction", &a.Direction) + delete(rawMsg, key) + case "emailAddresses": + err = unpopulate(val, "EmailAddresses", &a.EmailAddresses) + delete(rawMsg, key) + case "fullyQualifiedDomainNames": + err = unpopulate(val, "FullyQualifiedDomainNames", &a.FullyQualifiedDomainNames) + delete(rawMsg, key) + case "networkSecurityPerimeters": + err = unpopulate(val, "NetworkSecurityPerimeters", &a.NetworkSecurityPerimeters) + delete(rawMsg, key) + case "phoneNumbers": + err = unpopulate(val, "PhoneNumbers", &a.PhoneNumbers) + delete(rawMsg, key) + case "subscriptions": + err = unpopulate(val, "Subscriptions", &a.Subscriptions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccessRulePropertiesSubscriptionsItem. +func (a AccessRulePropertiesSubscriptionsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessRulePropertiesSubscriptionsItem. +func (a *AccessRulePropertiesSubscriptionsItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AccountKeyMetadata. func (a AccountKeyMetadata) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -319,6 +432,41 @@ func (a *AutoscaleSettingsResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AzureBlobDataTransferDataSourceSink. +func (a AzureBlobDataTransferDataSourceSink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["component"] = DataTransferComponentAzureBlobStorage + populate(objectMap, "containerName", a.ContainerName) + populate(objectMap, "endpointUrl", a.EndpointURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBlobDataTransferDataSourceSink. +func (a *AzureBlobDataTransferDataSourceSink) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "component": + err = unpopulate(val, "Component", &a.Component) + delete(rawMsg, key) + case "containerName": + err = unpopulate(val, "ContainerName", &a.ContainerName) + delete(rawMsg, key) + case "endpointUrl": + err = unpopulate(val, "EndpointURL", &a.EndpointURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type BackupInformation. func (b BackupInformation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -412,6 +560,115 @@ func (b *BackupPolicyMigrationState) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type BackupResource. +func (b BackupResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "backupExpiryTimestamp", b.BackupExpiryTimestamp) + populate(objectMap, "backupId", b.BackupID) + populateDateTimeRFC3339(objectMap, "backupStartTimestamp", b.BackupStartTimestamp) + populate(objectMap, "backupState", b.BackupState) + populateDateTimeRFC3339(objectMap, "backupStopTimestamp", b.BackupStopTimestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupResource. +func (b *BackupResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupExpiryTimestamp": + err = unpopulateDateTimeRFC3339(val, "BackupExpiryTimestamp", &b.BackupExpiryTimestamp) + delete(rawMsg, key) + case "backupId": + err = unpopulate(val, "BackupID", &b.BackupID) + delete(rawMsg, key) + case "backupStartTimestamp": + err = unpopulateDateTimeRFC3339(val, "BackupStartTimestamp", &b.BackupStartTimestamp) + delete(rawMsg, key) + case "backupState": + err = unpopulate(val, "BackupState", &b.BackupState) + delete(rawMsg, key) + case "backupStopTimestamp": + err = unpopulateDateTimeRFC3339(val, "BackupStopTimestamp", &b.BackupStopTimestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupSchedule. +func (b BackupSchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cronExpression", b.CronExpression) + populate(objectMap, "retentionInHours", b.RetentionInHours) + populate(objectMap, "scheduleName", b.ScheduleName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupSchedule. +func (b *BackupSchedule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cronExpression": + err = unpopulate(val, "CronExpression", &b.CronExpression) + delete(rawMsg, key) + case "retentionInHours": + err = unpopulate(val, "RetentionInHours", &b.RetentionInHours) + delete(rawMsg, key) + case "scheduleName": + err = unpopulate(val, "ScheduleName", &b.ScheduleName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BaseCosmosDataTransferDataSourceSink. +func (b BaseCosmosDataTransferDataSourceSink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["component"] = "BaseCosmosDataTransferDataSourceSink" + populate(objectMap, "remoteAccountName", b.RemoteAccountName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BaseCosmosDataTransferDataSourceSink. +func (b *BaseCosmosDataTransferDataSourceSink) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "component": + err = unpopulate(val, "Component", &b.Component) + delete(rawMsg, key) + case "remoteAccountName": + err = unpopulate(val, "RemoteAccountName", &b.RemoteAccountName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Capability. func (c Capability) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -466,6 +723,53 @@ func (c *Capacity) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CapacityModeChangeTransitionState. +func (c CapacityModeChangeTransitionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "capacityModeLastSuccessfulTransitionEndTimestamp", c.CapacityModeLastSuccessfulTransitionEndTimestamp) + populateDateTimeRFC3339(objectMap, "capacityModeTransitionBeginTimestamp", c.CapacityModeTransitionBeginTimestamp) + populateDateTimeRFC3339(objectMap, "capacityModeTransitionEndTimestamp", c.CapacityModeTransitionEndTimestamp) + populate(objectMap, "capacityModeTransitionStatus", c.CapacityModeTransitionStatus) + populate(objectMap, "currentCapacityMode", c.CurrentCapacityMode) + populate(objectMap, "previousCapacityMode", c.PreviousCapacityMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityModeChangeTransitionState. +func (c *CapacityModeChangeTransitionState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacityModeLastSuccessfulTransitionEndTimestamp": + err = unpopulateDateTimeRFC3339(val, "CapacityModeLastSuccessfulTransitionEndTimestamp", &c.CapacityModeLastSuccessfulTransitionEndTimestamp) + delete(rawMsg, key) + case "capacityModeTransitionBeginTimestamp": + err = unpopulateDateTimeRFC3339(val, "CapacityModeTransitionBeginTimestamp", &c.CapacityModeTransitionBeginTimestamp) + delete(rawMsg, key) + case "capacityModeTransitionEndTimestamp": + err = unpopulateDateTimeRFC3339(val, "CapacityModeTransitionEndTimestamp", &c.CapacityModeTransitionEndTimestamp) + delete(rawMsg, key) + case "capacityModeTransitionStatus": + err = unpopulate(val, "CapacityModeTransitionStatus", &c.CapacityModeTransitionStatus) + delete(rawMsg, key) + case "currentCapacityMode": + err = unpopulate(val, "CurrentCapacityMode", &c.CurrentCapacityMode) + delete(rawMsg, key) + case "previousCapacityMode": + err = unpopulate(val, "PreviousCapacityMode", &c.PreviousCapacityMode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CassandraClusterPublicStatus. func (c CassandraClusterPublicStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -544,6 +848,45 @@ func (c *CassandraClusterPublicStatusDataCentersItem) UnmarshalJSON(data []byte) return nil } +// MarshalJSON implements the json.Marshaller interface for type CassandraDataTransferDataSourceSink. +func (c CassandraDataTransferDataSourceSink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["component"] = DataTransferComponentCosmosDBCassandra + populate(objectMap, "keyspaceName", c.KeyspaceName) + populate(objectMap, "remoteAccountName", c.RemoteAccountName) + populate(objectMap, "tableName", c.TableName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CassandraDataTransferDataSourceSink. +func (c *CassandraDataTransferDataSourceSink) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "component": + err = unpopulate(val, "Component", &c.Component) + delete(rawMsg, key) + case "keyspaceName": + err = unpopulate(val, "KeyspaceName", &c.KeyspaceName) + delete(rawMsg, key) + case "remoteAccountName": + err = unpopulate(val, "RemoteAccountName", &c.RemoteAccountName) + delete(rawMsg, key) + case "tableName": + err = unpopulate(val, "TableName", &c.TableName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CassandraError. func (c CassandraError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -587,6 +930,7 @@ func (c *CassandraError) UnmarshalJSON(data []byte) error { func (c CassandraKeyspaceCreateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) populate(objectMap, "location", c.Location) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) @@ -607,6 +951,9 @@ func (c *CassandraKeyspaceCreateUpdateParameters) UnmarshalJSON(data []byte) err case "id": err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &c.Location) delete(rawMsg, key) @@ -766,6 +1113,7 @@ func (c *CassandraKeyspaceGetPropertiesResource) UnmarshalJSON(data []byte) erro func (c CassandraKeyspaceGetResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) populate(objectMap, "location", c.Location) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) @@ -786,6 +1134,9 @@ func (c *CassandraKeyspaceGetResults) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &c.Location) delete(rawMsg, key) @@ -929,6 +1280,7 @@ func (c *CassandraSchema) UnmarshalJSON(data []byte) error { func (c CassandraTableCreateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) populate(objectMap, "location", c.Location) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) @@ -949,6 +1301,9 @@ func (c *CassandraTableCreateUpdateParameters) UnmarshalJSON(data []byte) error case "id": err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &c.Location) delete(rawMsg, key) @@ -1120,6 +1475,7 @@ func (c *CassandraTableGetPropertiesResource) UnmarshalJSON(data []byte) error { func (c CassandraTableGetResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) populate(objectMap, "location", c.Location) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) @@ -1140,6 +1496,9 @@ func (c *CassandraTableGetResults) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &c.Location) delete(rawMsg, key) @@ -1229,15 +1588,21 @@ func (c *CassandraTableResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Certificate. -func (c Certificate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CassandraViewCreateUpdateParameters. +func (c CassandraViewCreateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "pem", c.Pem) + populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Certificate. -func (c *Certificate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CassandraViewCreateUpdateParameters. +func (c *CassandraViewCreateUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1245,47 +1610,26 @@ func (c *Certificate) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "pem": - err = unpopulate(val, "Pem", &c.Pem) + case "id": + err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ClientEncryptionIncludedPath. -func (c ClientEncryptionIncludedPath) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "clientEncryptionKeyId", c.ClientEncryptionKeyID) - populate(objectMap, "encryptionAlgorithm", c.EncryptionAlgorithm) - populate(objectMap, "encryptionType", c.EncryptionType) - populate(objectMap, "path", c.Path) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientEncryptionIncludedPath. -func (c *ClientEncryptionIncludedPath) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "clientEncryptionKeyId": - err = unpopulate(val, "ClientEncryptionKeyID", &c.ClientEncryptionKeyID) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) delete(rawMsg, key) - case "encryptionAlgorithm": - err = unpopulate(val, "EncryptionAlgorithm", &c.EncryptionAlgorithm) + case "location": + err = unpopulate(val, "Location", &c.Location) delete(rawMsg, key) - case "encryptionType": - err = unpopulate(val, "EncryptionType", &c.EncryptionType) + case "name": + err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) - case "path": - err = unpopulate(val, "Path", &c.Path) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) } if err != nil { @@ -1295,15 +1639,16 @@ func (c *ClientEncryptionIncludedPath) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientEncryptionKeyCreateUpdateParameters. -func (c ClientEncryptionKeyCreateUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CassandraViewCreateUpdateProperties. +func (c CassandraViewCreateUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", c.Properties) + populate(objectMap, "options", c.Options) + populate(objectMap, "resource", c.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientEncryptionKeyCreateUpdateParameters. -func (c *ClientEncryptionKeyCreateUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CassandraViewCreateUpdateProperties. +func (c *CassandraViewCreateUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1311,8 +1656,11 @@ func (c *ClientEncryptionKeyCreateUpdateParameters) UnmarshalJSON(data []byte) e for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &c.Properties) + case "options": + err = unpopulate(val, "Options", &c.Options) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &c.Resource) delete(rawMsg, key) } if err != nil { @@ -1322,15 +1670,16 @@ func (c *ClientEncryptionKeyCreateUpdateParameters) UnmarshalJSON(data []byte) e return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientEncryptionKeyCreateUpdateProperties. -func (c ClientEncryptionKeyCreateUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CassandraViewGetProperties. +func (c CassandraViewGetProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "options", c.Options) populate(objectMap, "resource", c.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientEncryptionKeyCreateUpdateProperties. -func (c *ClientEncryptionKeyCreateUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CassandraViewGetProperties. +func (c *CassandraViewGetProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1338,6 +1687,9 @@ func (c *ClientEncryptionKeyCreateUpdateProperties) UnmarshalJSON(data []byte) e for key, val := range rawMsg { var err error switch key { + case "options": + err = unpopulate(val, "Options", &c.Options) + delete(rawMsg, key) case "resource": err = unpopulate(val, "Resource", &c.Resource) delete(rawMsg, key) @@ -1349,15 +1701,16 @@ func (c *ClientEncryptionKeyCreateUpdateProperties) UnmarshalJSON(data []byte) e return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientEncryptionKeyGetProperties. -func (c ClientEncryptionKeyGetProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CassandraViewGetPropertiesOptions. +func (c CassandraViewGetPropertiesOptions) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "resource", c.Resource) + populate(objectMap, "autoscaleSettings", c.AutoscaleSettings) + populate(objectMap, "throughput", c.Throughput) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientEncryptionKeyGetProperties. -func (c *ClientEncryptionKeyGetProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CassandraViewGetPropertiesOptions. +func (c *CassandraViewGetPropertiesOptions) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1365,8 +1718,11 @@ func (c *ClientEncryptionKeyGetProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "resource": - err = unpopulate(val, "Resource", &c.Resource) + case "autoscaleSettings": + err = unpopulate(val, "AutoscaleSettings", &c.AutoscaleSettings) + delete(rawMsg, key) + case "throughput": + err = unpopulate(val, "Throughput", &c.Throughput) delete(rawMsg, key) } if err != nil { @@ -1376,23 +1732,19 @@ func (c *ClientEncryptionKeyGetProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientEncryptionKeyGetPropertiesResource. -func (c ClientEncryptionKeyGetPropertiesResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CassandraViewGetPropertiesResource. +func (c CassandraViewGetPropertiesResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "encryptionAlgorithm", c.EncryptionAlgorithm) populate(objectMap, "_etag", c.Etag) populate(objectMap, "id", c.ID) - populate(objectMap, "keyWrapMetadata", c.KeyWrapMetadata) populate(objectMap, "_rid", c.Rid) populate(objectMap, "_ts", c.Ts) - populateByteArray(objectMap, "wrappedDataEncryptionKey", c.WrappedDataEncryptionKey, func() any { - return runtime.EncodeByteArray(c.WrappedDataEncryptionKey, runtime.Base64StdFormat) - }) + populate(objectMap, "viewDefinition", c.ViewDefinition) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientEncryptionKeyGetPropertiesResource. -func (c *ClientEncryptionKeyGetPropertiesResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CassandraViewGetPropertiesResource. +func (c *CassandraViewGetPropertiesResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1400,28 +1752,20 @@ func (c *ClientEncryptionKeyGetPropertiesResource) UnmarshalJSON(data []byte) er for key, val := range rawMsg { var err error switch key { - case "encryptionAlgorithm": - err = unpopulate(val, "EncryptionAlgorithm", &c.EncryptionAlgorithm) - delete(rawMsg, key) case "_etag": err = unpopulate(val, "Etag", &c.Etag) delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) - case "keyWrapMetadata": - err = unpopulate(val, "KeyWrapMetadata", &c.KeyWrapMetadata) - delete(rawMsg, key) case "_rid": err = unpopulate(val, "Rid", &c.Rid) delete(rawMsg, key) case "_ts": err = unpopulate(val, "Ts", &c.Ts) delete(rawMsg, key) - case "wrappedDataEncryptionKey": - if val != nil && string(val) != "null" { - err = runtime.DecodeByteArray(string(val), &c.WrappedDataEncryptionKey, runtime.Base64StdFormat) - } + case "viewDefinition": + err = unpopulate(val, "ViewDefinition", &c.ViewDefinition) delete(rawMsg, key) } if err != nil { @@ -1431,18 +1775,21 @@ func (c *ClientEncryptionKeyGetPropertiesResource) UnmarshalJSON(data []byte) er return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientEncryptionKeyGetResults. -func (c ClientEncryptionKeyGetResults) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CassandraViewGetResults. +func (c CassandraViewGetResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "location", c.Location) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientEncryptionKeyGetResults. -func (c *ClientEncryptionKeyGetResults) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CassandraViewGetResults. +func (c *CassandraViewGetResults) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1453,12 +1800,21 @@ func (c *ClientEncryptionKeyGetResults) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) @@ -1470,20 +1826,15 @@ func (c *ClientEncryptionKeyGetResults) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientEncryptionKeyResource. -func (c ClientEncryptionKeyResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CassandraViewListResult. +func (c CassandraViewListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "encryptionAlgorithm", c.EncryptionAlgorithm) - populate(objectMap, "id", c.ID) - populate(objectMap, "keyWrapMetadata", c.KeyWrapMetadata) - populateByteArray(objectMap, "wrappedDataEncryptionKey", c.WrappedDataEncryptionKey, func() any { - return runtime.EncodeByteArray(c.WrappedDataEncryptionKey, runtime.Base64StdFormat) - }) + populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientEncryptionKeyResource. -func (c *ClientEncryptionKeyResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CassandraViewListResult. +func (c *CassandraViewListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1491,19 +1842,39 @@ func (c *ClientEncryptionKeyResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "encryptionAlgorithm": - err = unpopulate(val, "EncryptionAlgorithm", &c.EncryptionAlgorithm) + case "value": + err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CassandraViewResource. +func (c CassandraViewResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "viewDefinition", c.ViewDefinition) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CassandraViewResource. +func (c *CassandraViewResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { case "id": err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) - case "keyWrapMetadata": - err = unpopulate(val, "KeyWrapMetadata", &c.KeyWrapMetadata) - delete(rawMsg, key) - case "wrappedDataEncryptionKey": - if val != nil && string(val) != "null" { - err = runtime.DecodeByteArray(string(val), &c.WrappedDataEncryptionKey, runtime.Base64StdFormat) - } + case "viewDefinition": + err = unpopulate(val, "ViewDefinition", &c.ViewDefinition) delete(rawMsg, key) } if err != nil { @@ -1513,15 +1884,15 @@ func (c *ClientEncryptionKeyResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientEncryptionKeysListResult. -func (c ClientEncryptionKeysListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Certificate. +func (c Certificate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", c.Value) + populate(objectMap, "pem", c.Pem) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientEncryptionKeysListResult. -func (c *ClientEncryptionKeysListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Certificate. +func (c *Certificate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1529,8 +1900,8 @@ func (c *ClientEncryptionKeysListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &c.Value) + case "pem": + err = unpopulate(val, "Pem", &c.Pem) delete(rawMsg, key) } if err != nil { @@ -1540,16 +1911,16 @@ func (c *ClientEncryptionKeysListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ClientEncryptionPolicy. -func (c ClientEncryptionPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ChaosFaultListResponse. +func (c ChaosFaultListResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "includedPaths", c.IncludedPaths) - populate(objectMap, "policyFormatVersion", c.PolicyFormatVersion) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClientEncryptionPolicy. -func (c *ClientEncryptionPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ChaosFaultListResponse. +func (c *ChaosFaultListResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1557,11 +1928,11 @@ func (c *ClientEncryptionPolicy) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "includedPaths": - err = unpopulate(val, "IncludedPaths", &c.IncludedPaths) + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) delete(rawMsg, key) - case "policyFormatVersion": - err = unpopulate(val, "PolicyFormatVersion", &c.PolicyFormatVersion) + case "value": + err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) } if err != nil { @@ -1571,16 +1942,19 @@ func (c *ClientEncryptionPolicy) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ClusterKey. -func (c ClusterKey) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ChaosFaultProperties. +func (c ChaosFaultProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", c.Name) - populate(objectMap, "orderBy", c.OrderBy) + populate(objectMap, "action", c.Action) + populate(objectMap, "containerName", c.ContainerName) + populate(objectMap, "databaseName", c.DatabaseName) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "region", c.Region) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterKey. -func (c *ClusterKey) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ChaosFaultProperties. +func (c *ChaosFaultProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1588,11 +1962,20 @@ func (c *ClusterKey) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &c.Name) + case "action": + err = unpopulate(val, "Action", &c.Action) delete(rawMsg, key) - case "orderBy": - err = unpopulate(val, "OrderBy", &c.OrderBy) + case "containerName": + err = unpopulate(val, "ContainerName", &c.ContainerName) + delete(rawMsg, key) + case "databaseName": + err = unpopulate(val, "DatabaseName", &c.DatabaseName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &c.Region) delete(rawMsg, key) } if err != nil { @@ -1602,21 +1985,19 @@ func (c *ClusterKey) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ClusterResource. -func (c ClusterResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ChaosFaultResource. +func (c ChaosFaultResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", c.ID) - populate(objectMap, "identity", c.Identity) - populate(objectMap, "location", c.Location) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) - populate(objectMap, "tags", c.Tags) + populate(objectMap, "systemData", c.SystemData) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterResource. -func (c *ClusterResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ChaosFaultResource. +func (c *ChaosFaultResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1627,20 +2008,14 @@ func (c *ClusterResource) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &c.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &c.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &c.Tags) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &c.Type) @@ -1653,34 +2028,18 @@ func (c *ClusterResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ClusterResourceProperties. -func (c ClusterResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClientEncryptionIncludedPath. +func (c ClientEncryptionIncludedPath) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "authenticationMethod", c.AuthenticationMethod) - populate(objectMap, "azureConnectionMethod", c.AzureConnectionMethod) - populate(objectMap, "cassandraAuditLoggingEnabled", c.CassandraAuditLoggingEnabled) - populate(objectMap, "cassandraVersion", c.CassandraVersion) - populate(objectMap, "clientCertificates", c.ClientCertificates) - populate(objectMap, "clusterNameOverride", c.ClusterNameOverride) - populate(objectMap, "deallocated", c.Deallocated) - populate(objectMap, "delegatedManagementSubnetId", c.DelegatedManagementSubnetID) - populate(objectMap, "externalGossipCertificates", c.ExternalGossipCertificates) - populate(objectMap, "externalSeedNodes", c.ExternalSeedNodes) - populate(objectMap, "gossipCertificates", c.GossipCertificates) - populate(objectMap, "hoursBetweenBackups", c.HoursBetweenBackups) - populate(objectMap, "initialCassandraAdminPassword", c.InitialCassandraAdminPassword) - populate(objectMap, "privateLinkResourceId", c.PrivateLinkResourceID) - populate(objectMap, "prometheusEndpoint", c.PrometheusEndpoint) - populate(objectMap, "provisionError", c.ProvisionError) - populate(objectMap, "provisioningState", c.ProvisioningState) - populate(objectMap, "repairEnabled", c.RepairEnabled) - populate(objectMap, "restoreFromBackupId", c.RestoreFromBackupID) - populate(objectMap, "seedNodes", c.SeedNodes) + populate(objectMap, "clientEncryptionKeyId", c.ClientEncryptionKeyID) + populate(objectMap, "encryptionAlgorithm", c.EncryptionAlgorithm) + populate(objectMap, "encryptionType", c.EncryptionType) + populate(objectMap, "path", c.Path) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterResourceProperties. -func (c *ClusterResourceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientEncryptionIncludedPath. +func (c *ClientEncryptionIncludedPath) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1688,65 +2047,17 @@ func (c *ClusterResourceProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "authenticationMethod": - err = unpopulate(val, "AuthenticationMethod", &c.AuthenticationMethod) - delete(rawMsg, key) - case "azureConnectionMethod": - err = unpopulate(val, "AzureConnectionMethod", &c.AzureConnectionMethod) + case "clientEncryptionKeyId": + err = unpopulate(val, "ClientEncryptionKeyID", &c.ClientEncryptionKeyID) delete(rawMsg, key) - case "cassandraAuditLoggingEnabled": - err = unpopulate(val, "CassandraAuditLoggingEnabled", &c.CassandraAuditLoggingEnabled) + case "encryptionAlgorithm": + err = unpopulate(val, "EncryptionAlgorithm", &c.EncryptionAlgorithm) delete(rawMsg, key) - case "cassandraVersion": - err = unpopulate(val, "CassandraVersion", &c.CassandraVersion) - delete(rawMsg, key) - case "clientCertificates": - err = unpopulate(val, "ClientCertificates", &c.ClientCertificates) - delete(rawMsg, key) - case "clusterNameOverride": - err = unpopulate(val, "ClusterNameOverride", &c.ClusterNameOverride) - delete(rawMsg, key) - case "deallocated": - err = unpopulate(val, "Deallocated", &c.Deallocated) - delete(rawMsg, key) - case "delegatedManagementSubnetId": - err = unpopulate(val, "DelegatedManagementSubnetID", &c.DelegatedManagementSubnetID) - delete(rawMsg, key) - case "externalGossipCertificates": - err = unpopulate(val, "ExternalGossipCertificates", &c.ExternalGossipCertificates) - delete(rawMsg, key) - case "externalSeedNodes": - err = unpopulate(val, "ExternalSeedNodes", &c.ExternalSeedNodes) - delete(rawMsg, key) - case "gossipCertificates": - err = unpopulate(val, "GossipCertificates", &c.GossipCertificates) - delete(rawMsg, key) - case "hoursBetweenBackups": - err = unpopulate(val, "HoursBetweenBackups", &c.HoursBetweenBackups) - delete(rawMsg, key) - case "initialCassandraAdminPassword": - err = unpopulate(val, "InitialCassandraAdminPassword", &c.InitialCassandraAdminPassword) - delete(rawMsg, key) - case "privateLinkResourceId": - err = unpopulate(val, "PrivateLinkResourceID", &c.PrivateLinkResourceID) - delete(rawMsg, key) - case "prometheusEndpoint": - err = unpopulate(val, "PrometheusEndpoint", &c.PrometheusEndpoint) - delete(rawMsg, key) - case "provisionError": - err = unpopulate(val, "ProvisionError", &c.ProvisionError) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) - delete(rawMsg, key) - case "repairEnabled": - err = unpopulate(val, "RepairEnabled", &c.RepairEnabled) - delete(rawMsg, key) - case "restoreFromBackupId": - err = unpopulate(val, "RestoreFromBackupID", &c.RestoreFromBackupID) + case "encryptionType": + err = unpopulate(val, "EncryptionType", &c.EncryptionType) delete(rawMsg, key) - case "seedNodes": - err = unpopulate(val, "SeedNodes", &c.SeedNodes) + case "path": + err = unpopulate(val, "Path", &c.Path) delete(rawMsg, key) } if err != nil { @@ -1756,16 +2067,15 @@ func (c *ClusterResourceProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Column. -func (c Column) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClientEncryptionKeyCreateUpdateParameters. +func (c ClientEncryptionKeyCreateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", c.Name) - populate(objectMap, "type", c.Type) + populate(objectMap, "properties", c.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Column. -func (c *Column) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientEncryptionKeyCreateUpdateParameters. +func (c *ClientEncryptionKeyCreateUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1773,11 +2083,8 @@ func (c *Column) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) } if err != nil { @@ -1787,15 +2094,15 @@ func (c *Column) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CommandOutput. -func (c CommandOutput) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClientEncryptionKeyCreateUpdateProperties. +func (c ClientEncryptionKeyCreateUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "commandOutput", c.CommandOutput) + populate(objectMap, "resource", c.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CommandOutput. -func (c *CommandOutput) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientEncryptionKeyCreateUpdateProperties. +func (c *ClientEncryptionKeyCreateUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1803,8 +2110,8 @@ func (c *CommandOutput) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "commandOutput": - err = unpopulate(val, "CommandOutput", &c.CommandOutput) + case "resource": + err = unpopulate(val, "Resource", &c.Resource) delete(rawMsg, key) } if err != nil { @@ -1814,19 +2121,15 @@ func (c *CommandOutput) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CommandPostBody. -func (c CommandPostBody) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClientEncryptionKeyGetProperties. +func (c ClientEncryptionKeyGetProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "arguments", c.Arguments) - populate(objectMap, "cassandra-stop-start", c.CassandraStopStart) - populate(objectMap, "command", c.Command) - populate(objectMap, "host", c.Host) - populate(objectMap, "readwrite", c.Readwrite) + populate(objectMap, "resource", c.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CommandPostBody. -func (c *CommandPostBody) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientEncryptionKeyGetProperties. +func (c *ClientEncryptionKeyGetProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1834,20 +2137,8 @@ func (c *CommandPostBody) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "arguments": - err = unpopulate(val, "Arguments", &c.Arguments) - delete(rawMsg, key) - case "cassandra-stop-start": - err = unpopulate(val, "CassandraStopStart", &c.CassandraStopStart) - delete(rawMsg, key) - case "command": - err = unpopulate(val, "Command", &c.Command) - delete(rawMsg, key) - case "host": - err = unpopulate(val, "Host", &c.Host) - delete(rawMsg, key) - case "readwrite": - err = unpopulate(val, "Readwrite", &c.Readwrite) + case "resource": + err = unpopulate(val, "Resource", &c.Resource) delete(rawMsg, key) } if err != nil { @@ -1857,16 +2148,23 @@ func (c *CommandPostBody) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. -func (c Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClientEncryptionKeyGetPropertiesResource. +func (c ClientEncryptionKeyGetPropertiesResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clientId", c.ClientID) - populate(objectMap, "principalId", c.PrincipalID) + populate(objectMap, "encryptionAlgorithm", c.EncryptionAlgorithm) + populate(objectMap, "_etag", c.Etag) + populate(objectMap, "id", c.ID) + populate(objectMap, "keyWrapMetadata", c.KeyWrapMetadata) + populate(objectMap, "_rid", c.Rid) + populate(objectMap, "_ts", c.Ts) + populateByteArray(objectMap, "wrappedDataEncryptionKey", c.WrappedDataEncryptionKey, func() any { + return runtime.EncodeByteArray(c.WrappedDataEncryptionKey, runtime.Base64StdFormat) + }) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. -func (c *Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientEncryptionKeyGetPropertiesResource. +func (c *ClientEncryptionKeyGetPropertiesResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1874,11 +2172,28 @@ func (c *Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedide for key, val := range rawMsg { var err error switch key { - case "clientId": - err = unpopulate(val, "ClientID", &c.ClientID) + case "encryptionAlgorithm": + err = unpopulate(val, "EncryptionAlgorithm", &c.EncryptionAlgorithm) delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &c.PrincipalID) + case "_etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "keyWrapMetadata": + err = unpopulate(val, "KeyWrapMetadata", &c.KeyWrapMetadata) + delete(rawMsg, key) + case "_rid": + err = unpopulate(val, "Rid", &c.Rid) + delete(rawMsg, key) + case "_ts": + err = unpopulate(val, "Ts", &c.Ts) + delete(rawMsg, key) + case "wrappedDataEncryptionKey": + if val != nil && string(val) != "null" { + err = runtime.DecodeByteArray(string(val), &c.WrappedDataEncryptionKey, runtime.Base64StdFormat) + } delete(rawMsg, key) } if err != nil { @@ -1888,31 +2203,18 @@ func (c *Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedide return nil } -// MarshalJSON implements the json.Marshaller interface for type ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems. -func (c ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClientEncryptionKeyGetResults. +func (c ClientEncryptionKeyGetResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "address", c.Address) - populate(objectMap, "cpuUsage", c.CPUUsage) - populate(objectMap, "cassandraProcessStatus", c.CassandraProcessStatus) - populate(objectMap, "diskFreeKB", c.DiskFreeKB) - populate(objectMap, "diskUsedKB", c.DiskUsedKB) - populate(objectMap, "hostID", c.HostID) - populate(objectMap, "load", c.Load) - populate(objectMap, "memoryBuffersAndCachedKB", c.MemoryBuffersAndCachedKB) - populate(objectMap, "memoryFreeKB", c.MemoryFreeKB) - populate(objectMap, "memoryTotalKB", c.MemoryTotalKB) - populate(objectMap, "memoryUsedKB", c.MemoryUsedKB) - populate(objectMap, "rack", c.Rack) - populate(objectMap, "size", c.Size) - populate(objectMap, "state", c.State) - populate(objectMap, "status", c.Status) - populate(objectMap, "timestamp", c.Timestamp) - populate(objectMap, "tokens", c.Tokens) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems. -func (c *ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientEncryptionKeyGetResults. +func (c *ClientEncryptionKeyGetResults) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1920,56 +2222,17 @@ func (c *ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacenter for key, val := range rawMsg { var err error switch key { - case "address": - err = unpopulate(val, "Address", &c.Address) - delete(rawMsg, key) - case "cpuUsage": - err = unpopulate(val, "CPUUsage", &c.CPUUsage) - delete(rawMsg, key) - case "cassandraProcessStatus": - err = unpopulate(val, "CassandraProcessStatus", &c.CassandraProcessStatus) - delete(rawMsg, key) - case "diskFreeKB": - err = unpopulate(val, "DiskFreeKB", &c.DiskFreeKB) - delete(rawMsg, key) - case "diskUsedKB": - err = unpopulate(val, "DiskUsedKB", &c.DiskUsedKB) - delete(rawMsg, key) - case "hostID": - err = unpopulate(val, "HostID", &c.HostID) - delete(rawMsg, key) - case "load": - err = unpopulate(val, "Load", &c.Load) - delete(rawMsg, key) - case "memoryBuffersAndCachedKB": - err = unpopulate(val, "MemoryBuffersAndCachedKB", &c.MemoryBuffersAndCachedKB) - delete(rawMsg, key) - case "memoryFreeKB": - err = unpopulate(val, "MemoryFreeKB", &c.MemoryFreeKB) - delete(rawMsg, key) - case "memoryTotalKB": - err = unpopulate(val, "MemoryTotalKB", &c.MemoryTotalKB) - delete(rawMsg, key) - case "memoryUsedKB": - err = unpopulate(val, "MemoryUsedKB", &c.MemoryUsedKB) - delete(rawMsg, key) - case "rack": - err = unpopulate(val, "Rack", &c.Rack) - delete(rawMsg, key) - case "size": - err = unpopulate(val, "Size", &c.Size) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &c.State) + case "id": + err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &c.Status) + case "name": + err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) - case "timestamp": - err = unpopulate(val, "Timestamp", &c.Timestamp) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) - case "tokens": - err = unpopulate(val, "Tokens", &c.Tokens) + case "type": + err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) } if err != nil { @@ -1979,16 +2242,20 @@ func (c *ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacenter return nil } -// MarshalJSON implements the json.Marshaller interface for type CompositePath. -func (c CompositePath) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClientEncryptionKeyResource. +func (c ClientEncryptionKeyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "order", c.Order) - populate(objectMap, "path", c.Path) + populate(objectMap, "encryptionAlgorithm", c.EncryptionAlgorithm) + populate(objectMap, "id", c.ID) + populate(objectMap, "keyWrapMetadata", c.KeyWrapMetadata) + populateByteArray(objectMap, "wrappedDataEncryptionKey", c.WrappedDataEncryptionKey, func() any { + return runtime.EncodeByteArray(c.WrappedDataEncryptionKey, runtime.Base64StdFormat) + }) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CompositePath. -func (c *CompositePath) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientEncryptionKeyResource. +func (c *ClientEncryptionKeyResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -1996,11 +2263,19 @@ func (c *CompositePath) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "order": - err = unpopulate(val, "Order", &c.Order) + case "encryptionAlgorithm": + err = unpopulate(val, "EncryptionAlgorithm", &c.EncryptionAlgorithm) delete(rawMsg, key) - case "path": - err = unpopulate(val, "Path", &c.Path) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "keyWrapMetadata": + err = unpopulate(val, "KeyWrapMetadata", &c.KeyWrapMetadata) + delete(rawMsg, key) + case "wrappedDataEncryptionKey": + if val != nil && string(val) != "null" { + err = runtime.DecodeByteArray(string(val), &c.WrappedDataEncryptionKey, runtime.Base64StdFormat) + } delete(rawMsg, key) } if err != nil { @@ -2010,16 +2285,15 @@ func (c *CompositePath) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ComputedProperty. -func (c ComputedProperty) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClientEncryptionKeysListResult. +func (c ClientEncryptionKeysListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", c.Name) - populate(objectMap, "query", c.Query) + populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ComputedProperty. -func (c *ComputedProperty) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientEncryptionKeysListResult. +func (c *ClientEncryptionKeysListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -2027,11 +2301,8 @@ func (c *ComputedProperty) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &c.Query) + case "value": + err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) } if err != nil { @@ -2041,17 +2312,16 @@ func (c *ComputedProperty) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ConflictResolutionPolicy. -func (c ConflictResolutionPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClientEncryptionPolicy. +func (c ClientEncryptionPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "conflictResolutionPath", c.ConflictResolutionPath) - populate(objectMap, "conflictResolutionProcedure", c.ConflictResolutionProcedure) - populate(objectMap, "mode", c.Mode) + populate(objectMap, "includedPaths", c.IncludedPaths) + populate(objectMap, "policyFormatVersion", c.PolicyFormatVersion) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConflictResolutionPolicy. -func (c *ConflictResolutionPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientEncryptionPolicy. +func (c *ClientEncryptionPolicy) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -2059,14 +2329,11 @@ func (c *ConflictResolutionPolicy) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "conflictResolutionPath": - err = unpopulate(val, "ConflictResolutionPath", &c.ConflictResolutionPath) - delete(rawMsg, key) - case "conflictResolutionProcedure": - err = unpopulate(val, "ConflictResolutionProcedure", &c.ConflictResolutionProcedure) + case "includedPaths": + err = unpopulate(val, "IncludedPaths", &c.IncludedPaths) delete(rawMsg, key) - case "mode": - err = unpopulate(val, "Mode", &c.Mode) + case "policyFormatVersion": + err = unpopulate(val, "PolicyFormatVersion", &c.PolicyFormatVersion) delete(rawMsg, key) } if err != nil { @@ -2076,19 +2343,16 @@ func (c *ConflictResolutionPolicy) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectionError. -func (c ConnectionError) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterKey. +func (c ClusterKey) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "connectionState", c.ConnectionState) - populate(objectMap, "exception", c.Exception) - populate(objectMap, "iPFrom", c.IPFrom) - populate(objectMap, "iPTo", c.IPTo) - populate(objectMap, "port", c.Port) + populate(objectMap, "name", c.Name) + populate(objectMap, "orderBy", c.OrderBy) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionError. -func (c *ConnectionError) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterKey. +func (c *ClusterKey) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -2096,20 +2360,11 @@ func (c *ConnectionError) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "connectionState": - err = unpopulate(val, "ConnectionState", &c.ConnectionState) - delete(rawMsg, key) - case "exception": - err = unpopulate(val, "Exception", &c.Exception) - delete(rawMsg, key) - case "iPFrom": - err = unpopulate(val, "IPFrom", &c.IPFrom) - delete(rawMsg, key) - case "iPTo": - err = unpopulate(val, "IPTo", &c.IPTo) + case "name": + err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) - case "port": - err = unpopulate(val, "Port", &c.Port) + case "orderBy": + err = unpopulate(val, "OrderBy", &c.OrderBy) delete(rawMsg, key) } if err != nil { @@ -2119,17 +2374,21 @@ func (c *ConnectionError) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ConsistencyPolicy. -func (c ConsistencyPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterResource. +func (c ClusterResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "defaultConsistencyLevel", c.DefaultConsistencyLevel) - populate(objectMap, "maxIntervalInSeconds", c.MaxIntervalInSeconds) - populate(objectMap, "maxStalenessPrefix", c.MaxStalenessPrefix) + populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConsistencyPolicy. -func (c *ConsistencyPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterResource. +func (c *ClusterResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -2137,14 +2396,26 @@ func (c *ConsistencyPolicy) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "defaultConsistencyLevel": - err = unpopulate(val, "DefaultConsistencyLevel", &c.DefaultConsistencyLevel) + case "id": + err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) - case "maxIntervalInSeconds": - err = unpopulate(val, "MaxIntervalInSeconds", &c.MaxIntervalInSeconds) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) delete(rawMsg, key) - case "maxStalenessPrefix": - err = unpopulate(val, "MaxStalenessPrefix", &c.MaxStalenessPrefix) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) } if err != nil { @@ -2154,18 +2425,40 @@ func (c *ConsistencyPolicy) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ContainerPartitionKey. -func (c ContainerPartitionKey) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ClusterResourceProperties. +func (c ClusterResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "kind", c.Kind) - populate(objectMap, "paths", c.Paths) - populate(objectMap, "systemKey", c.SystemKey) - populate(objectMap, "version", c.Version) + populate(objectMap, "authenticationMethod", c.AuthenticationMethod) + populate(objectMap, "autoReplicate", c.AutoReplicate) + populate(objectMap, "azureConnectionMethod", c.AzureConnectionMethod) + populate(objectMap, "backupSchedules", c.BackupSchedules) + populate(objectMap, "cassandraAuditLoggingEnabled", c.CassandraAuditLoggingEnabled) + populate(objectMap, "cassandraVersion", c.CassandraVersion) + populate(objectMap, "clientCertificates", c.ClientCertificates) + populate(objectMap, "clusterNameOverride", c.ClusterNameOverride) + populate(objectMap, "clusterType", c.ClusterType) + populate(objectMap, "deallocated", c.Deallocated) + populate(objectMap, "delegatedManagementSubnetId", c.DelegatedManagementSubnetID) + populate(objectMap, "extensions", c.Extensions) + populate(objectMap, "externalDataCenters", c.ExternalDataCenters) + populate(objectMap, "externalGossipCertificates", c.ExternalGossipCertificates) + populate(objectMap, "externalSeedNodes", c.ExternalSeedNodes) + populate(objectMap, "gossipCertificates", c.GossipCertificates) + populate(objectMap, "hoursBetweenBackups", c.HoursBetweenBackups) + populate(objectMap, "initialCassandraAdminPassword", c.InitialCassandraAdminPassword) + populate(objectMap, "privateLinkResourceId", c.PrivateLinkResourceID) + populate(objectMap, "prometheusEndpoint", c.PrometheusEndpoint) + populate(objectMap, "provisionError", c.ProvisionError) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "repairEnabled", c.RepairEnabled) + populate(objectMap, "restoreFromBackupId", c.RestoreFromBackupID) + populate(objectMap, "scheduledEventStrategy", c.ScheduledEventStrategy) + populate(objectMap, "seedNodes", c.SeedNodes) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerPartitionKey. -func (c *ContainerPartitionKey) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterResourceProperties. +func (c *ClusterResourceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -2173,17 +2466,83 @@ func (c *ContainerPartitionKey) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "kind": - err = unpopulate(val, "Kind", &c.Kind) + case "authenticationMethod": + err = unpopulate(val, "AuthenticationMethod", &c.AuthenticationMethod) delete(rawMsg, key) - case "paths": - err = unpopulate(val, "Paths", &c.Paths) + case "autoReplicate": + err = unpopulate(val, "AutoReplicate", &c.AutoReplicate) delete(rawMsg, key) - case "systemKey": - err = unpopulate(val, "SystemKey", &c.SystemKey) + case "azureConnectionMethod": + err = unpopulate(val, "AzureConnectionMethod", &c.AzureConnectionMethod) delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &c.Version) + case "backupSchedules": + err = unpopulate(val, "BackupSchedules", &c.BackupSchedules) + delete(rawMsg, key) + case "cassandraAuditLoggingEnabled": + err = unpopulate(val, "CassandraAuditLoggingEnabled", &c.CassandraAuditLoggingEnabled) + delete(rawMsg, key) + case "cassandraVersion": + err = unpopulate(val, "CassandraVersion", &c.CassandraVersion) + delete(rawMsg, key) + case "clientCertificates": + err = unpopulate(val, "ClientCertificates", &c.ClientCertificates) + delete(rawMsg, key) + case "clusterNameOverride": + err = unpopulate(val, "ClusterNameOverride", &c.ClusterNameOverride) + delete(rawMsg, key) + case "clusterType": + err = unpopulate(val, "ClusterType", &c.ClusterType) + delete(rawMsg, key) + case "deallocated": + err = unpopulate(val, "Deallocated", &c.Deallocated) + delete(rawMsg, key) + case "delegatedManagementSubnetId": + err = unpopulate(val, "DelegatedManagementSubnetID", &c.DelegatedManagementSubnetID) + delete(rawMsg, key) + case "extensions": + err = unpopulate(val, "Extensions", &c.Extensions) + delete(rawMsg, key) + case "externalDataCenters": + err = unpopulate(val, "ExternalDataCenters", &c.ExternalDataCenters) + delete(rawMsg, key) + case "externalGossipCertificates": + err = unpopulate(val, "ExternalGossipCertificates", &c.ExternalGossipCertificates) + delete(rawMsg, key) + case "externalSeedNodes": + err = unpopulate(val, "ExternalSeedNodes", &c.ExternalSeedNodes) + delete(rawMsg, key) + case "gossipCertificates": + err = unpopulate(val, "GossipCertificates", &c.GossipCertificates) + delete(rawMsg, key) + case "hoursBetweenBackups": + err = unpopulate(val, "HoursBetweenBackups", &c.HoursBetweenBackups) + delete(rawMsg, key) + case "initialCassandraAdminPassword": + err = unpopulate(val, "InitialCassandraAdminPassword", &c.InitialCassandraAdminPassword) + delete(rawMsg, key) + case "privateLinkResourceId": + err = unpopulate(val, "PrivateLinkResourceID", &c.PrivateLinkResourceID) + delete(rawMsg, key) + case "prometheusEndpoint": + err = unpopulate(val, "PrometheusEndpoint", &c.PrometheusEndpoint) + delete(rawMsg, key) + case "provisionError": + err = unpopulate(val, "ProvisionError", &c.ProvisionError) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "repairEnabled": + err = unpopulate(val, "RepairEnabled", &c.RepairEnabled) + delete(rawMsg, key) + case "restoreFromBackupId": + err = unpopulate(val, "RestoreFromBackupID", &c.RestoreFromBackupID) + delete(rawMsg, key) + case "scheduledEventStrategy": + err = unpopulate(val, "ScheduledEventStrategy", &c.ScheduledEventStrategy) + delete(rawMsg, key) + case "seedNodes": + err = unpopulate(val, "SeedNodes", &c.SeedNodes) delete(rawMsg, key) } if err != nil { @@ -2193,15 +2552,16 @@ func (c *ContainerPartitionKey) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ContinuousBackupInformation. -func (c ContinuousBackupInformation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Column. +func (c Column) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "latestRestorableTimestamp", c.LatestRestorableTimestamp) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContinuousBackupInformation. -func (c *ContinuousBackupInformation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Column. +func (c *Column) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -2209,8 +2569,11 @@ func (c *ContinuousBackupInformation) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "latestRestorableTimestamp": - err = unpopulate(val, "LatestRestorableTimestamp", &c.LatestRestorableTimestamp) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) } if err != nil { @@ -2220,15 +2583,15 @@ func (c *ContinuousBackupInformation) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ContinuousBackupRestoreLocation. -func (c ContinuousBackupRestoreLocation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CommandOutput. +func (c CommandOutput) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "location", c.Location) + populate(objectMap, "commandOutput", c.CommandOutput) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContinuousBackupRestoreLocation. -func (c *ContinuousBackupRestoreLocation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CommandOutput. +func (c *CommandOutput) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -2236,8 +2599,8 @@ func (c *ContinuousBackupRestoreLocation) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "location": - err = unpopulate(val, "Location", &c.Location) + case "commandOutput": + err = unpopulate(val, "CommandOutput", &c.CommandOutput) delete(rawMsg, key) } if err != nil { @@ -2247,17 +2610,19 @@ func (c *ContinuousBackupRestoreLocation) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ContinuousModeBackupPolicy. -func (c ContinuousModeBackupPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CommandPostBody. +func (c CommandPostBody) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "continuousModeProperties", c.ContinuousModeProperties) - populate(objectMap, "migrationState", c.MigrationState) - objectMap["type"] = BackupPolicyTypeContinuous + populateAny(objectMap, "arguments", c.Arguments) + populate(objectMap, "cassandra-stop-start", c.CassandraStopStart) + populate(objectMap, "command", c.Command) + populate(objectMap, "host", c.Host) + populate(objectMap, "readWrite", c.ReadWrite) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContinuousModeBackupPolicy. -func (c *ContinuousModeBackupPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CommandPostBody. +func (c *CommandPostBody) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -2265,14 +2630,20 @@ func (c *ContinuousModeBackupPolicy) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "continuousModeProperties": - err = unpopulate(val, "ContinuousModeProperties", &c.ContinuousModeProperties) + case "arguments": + err = unpopulate(val, "Arguments", &c.Arguments) delete(rawMsg, key) - case "migrationState": - err = unpopulate(val, "MigrationState", &c.MigrationState) + case "cassandra-stop-start": + err = unpopulate(val, "CassandraStopStart", &c.CassandraStopStart) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) + case "command": + err = unpopulate(val, "Command", &c.Command) + delete(rawMsg, key) + case "host": + err = unpopulate(val, "Host", &c.Host) + delete(rawMsg, key) + case "readWrite": + err = unpopulate(val, "ReadWrite", &c.ReadWrite) delete(rawMsg, key) } if err != nil { @@ -2282,15 +2653,24 @@ func (c *ContinuousModeBackupPolicy) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ContinuousModeProperties. -func (c ContinuousModeProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CommandPublicResource. +func (c CommandPublicResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "tier", c.Tier) + populateAny(objectMap, "arguments", c.Arguments) + populate(objectMap, "cassandraStopStart", c.CassandraStopStart) + populate(objectMap, "command", c.Command) + populate(objectMap, "commandId", c.CommandID) + populate(objectMap, "host", c.Host) + populate(objectMap, "isAdmin", c.IsAdmin) + populate(objectMap, "outputFile", c.OutputFile) + populate(objectMap, "readWrite", c.ReadWrite) + populate(objectMap, "result", c.Result) + populate(objectMap, "status", c.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContinuousModeProperties. -func (c *ContinuousModeProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CommandPublicResource. +func (c *CommandPublicResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -2298,8 +2678,35 @@ func (c *ContinuousModeProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "tier": - err = unpopulate(val, "Tier", &c.Tier) + case "arguments": + err = unpopulate(val, "Arguments", &c.Arguments) + delete(rawMsg, key) + case "cassandraStopStart": + err = unpopulate(val, "CassandraStopStart", &c.CassandraStopStart) + delete(rawMsg, key) + case "command": + err = unpopulate(val, "Command", &c.Command) + delete(rawMsg, key) + case "commandId": + err = unpopulate(val, "CommandID", &c.CommandID) + delete(rawMsg, key) + case "host": + err = unpopulate(val, "Host", &c.Host) + delete(rawMsg, key) + case "isAdmin": + err = unpopulate(val, "IsAdmin", &c.IsAdmin) + delete(rawMsg, key) + case "outputFile": + err = unpopulate(val, "OutputFile", &c.OutputFile) + delete(rawMsg, key) + case "readWrite": + err = unpopulate(val, "ReadWrite", &c.ReadWrite) + delete(rawMsg, key) + case "result": + err = unpopulate(val, "Result", &c.Result) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) delete(rawMsg, key) } if err != nil { @@ -2309,19 +2716,16 @@ func (c *ContinuousModeProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CorsPolicy. -func (c CorsPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. +func (c Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "allowedHeaders", c.AllowedHeaders) - populate(objectMap, "allowedMethods", c.AllowedMethods) - populate(objectMap, "allowedOrigins", c.AllowedOrigins) - populate(objectMap, "exposedHeaders", c.ExposedHeaders) - populate(objectMap, "maxAgeInSeconds", c.MaxAgeInSeconds) + populate(objectMap, "clientId", c.ClientID) + populate(objectMap, "principalId", c.PrincipalID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CorsPolicy. -func (c *CorsPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties. +func (c *Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -2329,20 +2733,11 @@ func (c *CorsPolicy) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "allowedHeaders": - err = unpopulate(val, "AllowedHeaders", &c.AllowedHeaders) - delete(rawMsg, key) - case "allowedMethods": - err = unpopulate(val, "AllowedMethods", &c.AllowedMethods) - delete(rawMsg, key) - case "allowedOrigins": - err = unpopulate(val, "AllowedOrigins", &c.AllowedOrigins) - delete(rawMsg, key) - case "exposedHeaders": - err = unpopulate(val, "ExposedHeaders", &c.ExposedHeaders) + case "clientId": + err = unpopulate(val, "ClientID", &c.ClientID) delete(rawMsg, key) - case "maxAgeInSeconds": - err = unpopulate(val, "MaxAgeInSeconds", &c.MaxAgeInSeconds) + case "principalId": + err = unpopulate(val, "PrincipalID", &c.PrincipalID) delete(rawMsg, key) } if err != nil { @@ -2352,16 +2747,32 @@ func (c *CorsPolicy) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CreateUpdateOptions. -func (c CreateUpdateOptions) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems. +func (c ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "autoscaleSettings", c.AutoscaleSettings) - populate(objectMap, "throughput", c.Throughput) + populate(objectMap, "address", c.Address) + populate(objectMap, "cpuUsage", c.CPUUsage) + populate(objectMap, "cassandraProcessStatus", c.CassandraProcessStatus) + populate(objectMap, "diskFreeKB", c.DiskFreeKB) + populate(objectMap, "diskUsedKB", c.DiskUsedKB) + populate(objectMap, "hostID", c.HostID) + populate(objectMap, "isLatestModel", c.IsLatestModel) + populate(objectMap, "load", c.Load) + populate(objectMap, "memoryBuffersAndCachedKB", c.MemoryBuffersAndCachedKB) + populate(objectMap, "memoryFreeKB", c.MemoryFreeKB) + populate(objectMap, "memoryTotalKB", c.MemoryTotalKB) + populate(objectMap, "memoryUsedKB", c.MemoryUsedKB) + populate(objectMap, "rack", c.Rack) + populate(objectMap, "size", c.Size) + populate(objectMap, "state", c.State) + populate(objectMap, "status", c.Status) + populate(objectMap, "timestamp", c.Timestamp) + populate(objectMap, "tokens", c.Tokens) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CreateUpdateOptions. -func (c *CreateUpdateOptions) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems. +func (c *ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", c, err) @@ -2369,11 +2780,59 @@ func (c *CreateUpdateOptions) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "autoscaleSettings": - err = unpopulate(val, "AutoscaleSettings", &c.AutoscaleSettings) + case "address": + err = unpopulate(val, "Address", &c.Address) delete(rawMsg, key) - case "throughput": - err = unpopulate(val, "Throughput", &c.Throughput) + case "cpuUsage": + err = unpopulate(val, "CPUUsage", &c.CPUUsage) + delete(rawMsg, key) + case "cassandraProcessStatus": + err = unpopulate(val, "CassandraProcessStatus", &c.CassandraProcessStatus) + delete(rawMsg, key) + case "diskFreeKB": + err = unpopulate(val, "DiskFreeKB", &c.DiskFreeKB) + delete(rawMsg, key) + case "diskUsedKB": + err = unpopulate(val, "DiskUsedKB", &c.DiskUsedKB) + delete(rawMsg, key) + case "hostID": + err = unpopulate(val, "HostID", &c.HostID) + delete(rawMsg, key) + case "isLatestModel": + err = unpopulate(val, "IsLatestModel", &c.IsLatestModel) + delete(rawMsg, key) + case "load": + err = unpopulate(val, "Load", &c.Load) + delete(rawMsg, key) + case "memoryBuffersAndCachedKB": + err = unpopulate(val, "MemoryBuffersAndCachedKB", &c.MemoryBuffersAndCachedKB) + delete(rawMsg, key) + case "memoryFreeKB": + err = unpopulate(val, "MemoryFreeKB", &c.MemoryFreeKB) + delete(rawMsg, key) + case "memoryTotalKB": + err = unpopulate(val, "MemoryTotalKB", &c.MemoryTotalKB) + delete(rawMsg, key) + case "memoryUsedKB": + err = unpopulate(val, "MemoryUsedKB", &c.MemoryUsedKB) + delete(rawMsg, key) + case "rack": + err = unpopulate(val, "Rack", &c.Rack) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &c.Size) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &c.State) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + case "timestamp": + err = unpopulate(val, "Timestamp", &c.Timestamp) + delete(rawMsg, key) + case "tokens": + err = unpopulate(val, "Tokens", &c.Tokens) delete(rawMsg, key) } if err != nil { @@ -2383,376 +2842,1560 @@ func (c *CreateUpdateOptions) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCenterResource. -func (d DataCenterResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CompositePath. +func (c CompositePath) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "type", d.Type) + populate(objectMap, "order", c.Order) + populate(objectMap, "path", c.Path) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCenterResource. -func (d *DataCenterResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CompositePath. +func (c *CompositePath) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) + case "order": + err = unpopulate(val, "Order", &c.Order) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "path": + err = unpopulate(val, "Path", &c.Path) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCenterResourceProperties. -func (d DataCenterResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ComputedProperty. +func (c ComputedProperty) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "authenticationMethodLdapProperties", d.AuthenticationMethodLdapProperties) - populate(objectMap, "availabilityZone", d.AvailabilityZone) - populate(objectMap, "backupStorageCustomerKeyUri", d.BackupStorageCustomerKeyURI) - populate(objectMap, "base64EncodedCassandraYamlFragment", d.Base64EncodedCassandraYamlFragment) - populate(objectMap, "dataCenterLocation", d.DataCenterLocation) - populate(objectMap, "deallocated", d.Deallocated) - populate(objectMap, "delegatedSubnetId", d.DelegatedSubnetID) - populate(objectMap, "diskCapacity", d.DiskCapacity) - populate(objectMap, "diskSku", d.DiskSKU) - populate(objectMap, "managedDiskCustomerKeyUri", d.ManagedDiskCustomerKeyURI) - populate(objectMap, "nodeCount", d.NodeCount) - populate(objectMap, "privateEndpointIpAddress", d.PrivateEndpointIPAddress) - populate(objectMap, "provisionError", d.ProvisionError) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "sku", d.SKU) - populate(objectMap, "seedNodes", d.SeedNodes) + populate(objectMap, "name", c.Name) + populate(objectMap, "query", c.Query) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCenterResourceProperties. -func (d *DataCenterResourceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ComputedProperty. +func (c *ComputedProperty) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "authenticationMethodLdapProperties": - err = unpopulate(val, "AuthenticationMethodLdapProperties", &d.AuthenticationMethodLdapProperties) - delete(rawMsg, key) - case "availabilityZone": - err = unpopulate(val, "AvailabilityZone", &d.AvailabilityZone) - delete(rawMsg, key) - case "backupStorageCustomerKeyUri": - err = unpopulate(val, "BackupStorageCustomerKeyURI", &d.BackupStorageCustomerKeyURI) + case "name": + err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) - case "base64EncodedCassandraYamlFragment": - err = unpopulate(val, "Base64EncodedCassandraYamlFragment", &d.Base64EncodedCassandraYamlFragment) - delete(rawMsg, key) - case "dataCenterLocation": - err = unpopulate(val, "DataCenterLocation", &d.DataCenterLocation) - delete(rawMsg, key) - case "deallocated": - err = unpopulate(val, "Deallocated", &d.Deallocated) - delete(rawMsg, key) - case "delegatedSubnetId": - err = unpopulate(val, "DelegatedSubnetID", &d.DelegatedSubnetID) - delete(rawMsg, key) - case "diskCapacity": - err = unpopulate(val, "DiskCapacity", &d.DiskCapacity) - delete(rawMsg, key) - case "diskSku": - err = unpopulate(val, "DiskSKU", &d.DiskSKU) - delete(rawMsg, key) - case "managedDiskCustomerKeyUri": - err = unpopulate(val, "ManagedDiskCustomerKeyURI", &d.ManagedDiskCustomerKeyURI) - delete(rawMsg, key) - case "nodeCount": - err = unpopulate(val, "NodeCount", &d.NodeCount) - delete(rawMsg, key) - case "privateEndpointIpAddress": - err = unpopulate(val, "PrivateEndpointIPAddress", &d.PrivateEndpointIPAddress) - delete(rawMsg, key) - case "provisionError": - err = unpopulate(val, "ProvisionError", &d.ProvisionError) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) - case "sku": - err = unpopulate(val, "SKU", &d.SKU) - delete(rawMsg, key) - case "seedNodes": - err = unpopulate(val, "SeedNodes", &d.SeedNodes) + case "query": + err = unpopulate(val, "Query", &c.Query) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DataTransferRegionalServiceResource. -func (d DataTransferRegionalServiceResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConflictResolutionPolicy. +func (c ConflictResolutionPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "status", d.Status) + populate(objectMap, "conflictResolutionPath", c.ConflictResolutionPath) + populate(objectMap, "conflictResolutionProcedure", c.ConflictResolutionProcedure) + populate(objectMap, "mode", c.Mode) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataTransferRegionalServiceResource. -func (d *DataTransferRegionalServiceResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConflictResolutionPolicy. +func (c *ConflictResolutionPolicy) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "location": - err = unpopulate(val, "Location", &d.Location) + case "conflictResolutionPath": + err = unpopulate(val, "ConflictResolutionPath", &c.ConflictResolutionPath) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) + case "conflictResolutionProcedure": + err = unpopulate(val, "ConflictResolutionProcedure", &c.ConflictResolutionProcedure) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &d.Status) + case "mode": + err = unpopulate(val, "Mode", &c.Mode) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DataTransferServiceResource. -func (d DataTransferServiceResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConnectionError. +func (c ConnectionError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", d.Properties) + populate(objectMap, "connectionState", c.ConnectionState) + populate(objectMap, "exception", c.Exception) + populate(objectMap, "iPFrom", c.IPFrom) + populate(objectMap, "iPTo", c.IPTo) + populate(objectMap, "port", c.Port) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataTransferServiceResource. -func (d *DataTransferServiceResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionError. +func (c *ConnectionError) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &d.Properties) + case "connectionState": + err = unpopulate(val, "ConnectionState", &c.ConnectionState) + delete(rawMsg, key) + case "exception": + err = unpopulate(val, "Exception", &c.Exception) + delete(rawMsg, key) + case "iPFrom": + err = unpopulate(val, "IPFrom", &c.IPFrom) + delete(rawMsg, key) + case "iPTo": + err = unpopulate(val, "IPTo", &c.IPTo) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &c.Port) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DataTransferServiceResourceCreateUpdateProperties. -func (d DataTransferServiceResourceCreateUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConsistencyPolicy. +func (c ConsistencyPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "instanceCount", d.InstanceCount) - populate(objectMap, "instanceSize", d.InstanceSize) - objectMap["serviceType"] = ServiceTypeDataTransfer + populate(objectMap, "defaultConsistencyLevel", c.DefaultConsistencyLevel) + populate(objectMap, "maxIntervalInSeconds", c.MaxIntervalInSeconds) + populate(objectMap, "maxStalenessPrefix", c.MaxStalenessPrefix) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataTransferServiceResourceCreateUpdateProperties. -func (d *DataTransferServiceResourceCreateUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConsistencyPolicy. +func (c *ConsistencyPolicy) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "instanceCount": - err = unpopulate(val, "InstanceCount", &d.InstanceCount) + case "defaultConsistencyLevel": + err = unpopulate(val, "DefaultConsistencyLevel", &c.DefaultConsistencyLevel) delete(rawMsg, key) - case "instanceSize": - err = unpopulate(val, "InstanceSize", &d.InstanceSize) + case "maxIntervalInSeconds": + err = unpopulate(val, "MaxIntervalInSeconds", &c.MaxIntervalInSeconds) delete(rawMsg, key) - case "serviceType": - err = unpopulate(val, "ServiceType", &d.ServiceType) + case "maxStalenessPrefix": + err = unpopulate(val, "MaxStalenessPrefix", &c.MaxStalenessPrefix) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DataTransferServiceResourceProperties. -func (d DataTransferServiceResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ContainerPartitionKey. +func (c ContainerPartitionKey) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "creationTime", d.CreationTime) - populate(objectMap, "instanceCount", d.InstanceCount) - populate(objectMap, "instanceSize", d.InstanceSize) - populate(objectMap, "locations", d.Locations) - objectMap["serviceType"] = ServiceTypeDataTransfer - populate(objectMap, "status", d.Status) - if d.AdditionalProperties != nil { - for key, val := range d.AdditionalProperties { - objectMap[key] = val - } - } + populate(objectMap, "kind", c.Kind) + populate(objectMap, "paths", c.Paths) + populate(objectMap, "systemKey", c.SystemKey) + populate(objectMap, "version", c.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataTransferServiceResourceProperties. -func (d *DataTransferServiceResourceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerPartitionKey. +func (c *ContainerPartitionKey) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "creationTime": - err = unpopulateDateTimeRFC3339(val, "CreationTime", &d.CreationTime) - delete(rawMsg, key) - case "instanceCount": - err = unpopulate(val, "InstanceCount", &d.InstanceCount) - delete(rawMsg, key) - case "instanceSize": - err = unpopulate(val, "InstanceSize", &d.InstanceSize) - delete(rawMsg, key) - case "locations": - err = unpopulate(val, "Locations", &d.Locations) + case "kind": + err = unpopulate(val, "Kind", &c.Kind) delete(rawMsg, key) - case "serviceType": - err = unpopulate(val, "ServiceType", &d.ServiceType) + case "paths": + err = unpopulate(val, "Paths", &c.Paths) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &d.Status) + case "systemKey": + err = unpopulate(val, "SystemKey", &c.SystemKey) delete(rawMsg, key) - default: - if d.AdditionalProperties == nil { - d.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - d.AdditionalProperties[key] = aux - } + case "version": + err = unpopulate(val, "Version", &c.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountConnectionString. -func (d DatabaseAccountConnectionString) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ContinuousBackupInformation. +func (c ContinuousBackupInformation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "connectionString", d.ConnectionString) - populate(objectMap, "description", d.Description) - populate(objectMap, "keyKind", d.KeyKind) - populate(objectMap, "type", d.Type) + populate(objectMap, "latestRestorableTimestamp", c.LatestRestorableTimestamp) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountConnectionString. -func (d *DatabaseAccountConnectionString) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ContinuousBackupInformation. +func (c *ContinuousBackupInformation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "connectionString": - err = unpopulate(val, "ConnectionString", &d.ConnectionString) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "keyKind": - err = unpopulate(val, "KeyKind", &d.KeyKind) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "latestRestorableTimestamp": + err = unpopulate(val, "LatestRestorableTimestamp", &c.LatestRestorableTimestamp) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountCreateUpdateParameters. -func (d DatabaseAccountCreateUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ContinuousBackupRestoreLocation. +func (c ContinuousBackupRestoreLocation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "identity", d.Identity) - populate(objectMap, "kind", d.Kind) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "tags", d.Tags) - populate(objectMap, "type", d.Type) + populate(objectMap, "location", c.Location) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountCreateUpdateParameters. -func (d *DatabaseAccountCreateUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ContinuousBackupRestoreLocation. +func (c *ContinuousBackupRestoreLocation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &d.Identity) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &d.Kind) - delete(rawMsg, key) case "location": - err = unpopulate(val, "Location", &d.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) + err = unpopulate(val, "Location", &c.Location) delete(rawMsg, key) - case "tags": + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContinuousModeBackupPolicy. +func (c ContinuousModeBackupPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "continuousModeProperties", c.ContinuousModeProperties) + populate(objectMap, "migrationState", c.MigrationState) + objectMap["type"] = BackupPolicyTypeContinuous + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContinuousModeBackupPolicy. +func (c *ContinuousModeBackupPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "continuousModeProperties": + err = unpopulate(val, "ContinuousModeProperties", &c.ContinuousModeProperties) + delete(rawMsg, key) + case "migrationState": + err = unpopulate(val, "MigrationState", &c.MigrationState) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContinuousModeProperties. +func (c ContinuousModeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tier", c.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContinuousModeProperties. +func (c *ContinuousModeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tier": + err = unpopulate(val, "Tier", &c.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CorsPolicy. +func (c CorsPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allowedHeaders", c.AllowedHeaders) + populate(objectMap, "allowedMethods", c.AllowedMethods) + populate(objectMap, "allowedOrigins", c.AllowedOrigins) + populate(objectMap, "exposedHeaders", c.ExposedHeaders) + populate(objectMap, "maxAgeInSeconds", c.MaxAgeInSeconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CorsPolicy. +func (c *CorsPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowedHeaders": + err = unpopulate(val, "AllowedHeaders", &c.AllowedHeaders) + delete(rawMsg, key) + case "allowedMethods": + err = unpopulate(val, "AllowedMethods", &c.AllowedMethods) + delete(rawMsg, key) + case "allowedOrigins": + err = unpopulate(val, "AllowedOrigins", &c.AllowedOrigins) + delete(rawMsg, key) + case "exposedHeaders": + err = unpopulate(val, "ExposedHeaders", &c.ExposedHeaders) + delete(rawMsg, key) + case "maxAgeInSeconds": + err = unpopulate(val, "MaxAgeInSeconds", &c.MaxAgeInSeconds) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CreateJobRequest. +func (c CreateJobRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CreateJobRequest. +func (c *CreateJobRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CreateUpdateOptions. +func (c CreateUpdateOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "autoscaleSettings", c.AutoscaleSettings) + populate(objectMap, "throughput", c.Throughput) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CreateUpdateOptions. +func (c *CreateUpdateOptions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoscaleSettings": + err = unpopulate(val, "AutoscaleSettings", &c.AutoscaleSettings) + delete(rawMsg, key) + case "throughput": + err = unpopulate(val, "Throughput", &c.Throughput) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCenterResource. +func (d DataCenterResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCenterResource. +func (d *DataCenterResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCenterResourceProperties. +func (d DataCenterResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authenticationMethodLdapProperties", d.AuthenticationMethodLdapProperties) + populate(objectMap, "availabilityZone", d.AvailabilityZone) + populate(objectMap, "backupStorageCustomerKeyUri", d.BackupStorageCustomerKeyURI) + populate(objectMap, "base64EncodedCassandraYamlFragment", d.Base64EncodedCassandraYamlFragment) + populate(objectMap, "dataCenterLocation", d.DataCenterLocation) + populate(objectMap, "deallocated", d.Deallocated) + populate(objectMap, "delegatedSubnetId", d.DelegatedSubnetID) + populate(objectMap, "diskCapacity", d.DiskCapacity) + populate(objectMap, "diskSku", d.DiskSKU) + populate(objectMap, "managedDiskCustomerKeyUri", d.ManagedDiskCustomerKeyURI) + populate(objectMap, "nodeCount", d.NodeCount) + populate(objectMap, "privateEndpointIpAddress", d.PrivateEndpointIPAddress) + populate(objectMap, "provisionError", d.ProvisionError) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "sku", d.SKU) + populate(objectMap, "seedNodes", d.SeedNodes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCenterResourceProperties. +func (d *DataCenterResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authenticationMethodLdapProperties": + err = unpopulate(val, "AuthenticationMethodLdapProperties", &d.AuthenticationMethodLdapProperties) + delete(rawMsg, key) + case "availabilityZone": + err = unpopulate(val, "AvailabilityZone", &d.AvailabilityZone) + delete(rawMsg, key) + case "backupStorageCustomerKeyUri": + err = unpopulate(val, "BackupStorageCustomerKeyURI", &d.BackupStorageCustomerKeyURI) + delete(rawMsg, key) + case "base64EncodedCassandraYamlFragment": + err = unpopulate(val, "Base64EncodedCassandraYamlFragment", &d.Base64EncodedCassandraYamlFragment) + delete(rawMsg, key) + case "dataCenterLocation": + err = unpopulate(val, "DataCenterLocation", &d.DataCenterLocation) + delete(rawMsg, key) + case "deallocated": + err = unpopulate(val, "Deallocated", &d.Deallocated) + delete(rawMsg, key) + case "delegatedSubnetId": + err = unpopulate(val, "DelegatedSubnetID", &d.DelegatedSubnetID) + delete(rawMsg, key) + case "diskCapacity": + err = unpopulate(val, "DiskCapacity", &d.DiskCapacity) + delete(rawMsg, key) + case "diskSku": + err = unpopulate(val, "DiskSKU", &d.DiskSKU) + delete(rawMsg, key) + case "managedDiskCustomerKeyUri": + err = unpopulate(val, "ManagedDiskCustomerKeyURI", &d.ManagedDiskCustomerKeyURI) + delete(rawMsg, key) + case "nodeCount": + err = unpopulate(val, "NodeCount", &d.NodeCount) + delete(rawMsg, key) + case "privateEndpointIpAddress": + err = unpopulate(val, "PrivateEndpointIPAddress", &d.PrivateEndpointIPAddress) + delete(rawMsg, key) + case "provisionError": + err = unpopulate(val, "ProvisionError", &d.ProvisionError) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &d.SKU) + delete(rawMsg, key) + case "seedNodes": + err = unpopulate(val, "SeedNodes", &d.SeedNodes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataTransferDataSourceSink. +func (d DataTransferDataSourceSink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["component"] = d.Component + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataTransferDataSourceSink. +func (d *DataTransferDataSourceSink) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "component": + err = unpopulate(val, "Component", &d.Component) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataTransferJobFeedResults. +func (d DataTransferJobFeedResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataTransferJobFeedResults. +func (d *DataTransferJobFeedResults) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataTransferJobGetResults. +func (d DataTransferJobGetResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataTransferJobGetResults. +func (d *DataTransferJobGetResults) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataTransferJobProperties. +func (d DataTransferJobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "destination", d.Destination) + populate(objectMap, "duration", d.Duration) + populate(objectMap, "error", d.Error) + populate(objectMap, "jobName", d.JobName) + populateDateTimeRFC3339(objectMap, "lastUpdatedUtcTime", d.LastUpdatedUTCTime) + populate(objectMap, "mode", d.Mode) + populate(objectMap, "processedCount", d.ProcessedCount) + populate(objectMap, "source", d.Source) + populate(objectMap, "status", d.Status) + populate(objectMap, "totalCount", d.TotalCount) + populate(objectMap, "workerCount", d.WorkerCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataTransferJobProperties. +func (d *DataTransferJobProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destination": + d.Destination, err = unmarshalDataTransferDataSourceSinkClassification(val) + delete(rawMsg, key) + case "duration": + err = unpopulate(val, "Duration", &d.Duration) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &d.Error) + delete(rawMsg, key) + case "jobName": + err = unpopulate(val, "JobName", &d.JobName) + delete(rawMsg, key) + case "lastUpdatedUtcTime": + err = unpopulateDateTimeRFC3339(val, "LastUpdatedUTCTime", &d.LastUpdatedUTCTime) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, "Mode", &d.Mode) + delete(rawMsg, key) + case "processedCount": + err = unpopulate(val, "ProcessedCount", &d.ProcessedCount) + delete(rawMsg, key) + case "source": + d.Source, err = unmarshalDataTransferDataSourceSinkClassification(val) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &d.Status) + delete(rawMsg, key) + case "totalCount": + err = unpopulate(val, "TotalCount", &d.TotalCount) + delete(rawMsg, key) + case "workerCount": + err = unpopulate(val, "WorkerCount", &d.WorkerCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataTransferRegionalServiceResource. +func (d DataTransferRegionalServiceResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "status", d.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataTransferRegionalServiceResource. +func (d *DataTransferRegionalServiceResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &d.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataTransferServiceResource. +func (d DataTransferServiceResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", d.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataTransferServiceResource. +func (d *DataTransferServiceResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataTransferServiceResourceCreateUpdateProperties. +func (d DataTransferServiceResourceCreateUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "instanceCount", d.InstanceCount) + populate(objectMap, "instanceSize", d.InstanceSize) + objectMap["serviceType"] = ServiceTypeDataTransfer + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataTransferServiceResourceCreateUpdateProperties. +func (d *DataTransferServiceResourceCreateUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "instanceCount": + err = unpopulate(val, "InstanceCount", &d.InstanceCount) + delete(rawMsg, key) + case "instanceSize": + err = unpopulate(val, "InstanceSize", &d.InstanceSize) + delete(rawMsg, key) + case "serviceType": + err = unpopulate(val, "ServiceType", &d.ServiceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataTransferServiceResourceProperties. +func (d DataTransferServiceResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "creationTime", d.CreationTime) + populate(objectMap, "instanceCount", d.InstanceCount) + populate(objectMap, "instanceSize", d.InstanceSize) + populate(objectMap, "locations", d.Locations) + objectMap["serviceType"] = ServiceTypeDataTransfer + populate(objectMap, "status", d.Status) + if d.AdditionalProperties != nil { + for key, val := range d.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataTransferServiceResourceProperties. +func (d *DataTransferServiceResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "creationTime": + err = unpopulateDateTimeRFC3339(val, "CreationTime", &d.CreationTime) + delete(rawMsg, key) + case "instanceCount": + err = unpopulate(val, "InstanceCount", &d.InstanceCount) + delete(rawMsg, key) + case "instanceSize": + err = unpopulate(val, "InstanceSize", &d.InstanceSize) + delete(rawMsg, key) + case "locations": + err = unpopulate(val, "Locations", &d.Locations) + delete(rawMsg, key) + case "serviceType": + err = unpopulate(val, "ServiceType", &d.ServiceType) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &d.Status) + delete(rawMsg, key) + default: + if d.AdditionalProperties == nil { + d.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + d.AdditionalProperties[key] = aux + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountConnectionString. +func (d DatabaseAccountConnectionString) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "connectionString", d.ConnectionString) + populate(objectMap, "description", d.Description) + populate(objectMap, "keyKind", d.KeyKind) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountConnectionString. +func (d *DatabaseAccountConnectionString) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionString": + err = unpopulate(val, "ConnectionString", &d.ConnectionString) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "keyKind": + err = unpopulate(val, "KeyKind", &d.KeyKind) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountCreateUpdateParameters. +func (d DatabaseAccountCreateUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "identity", d.Identity) + populate(objectMap, "kind", d.Kind) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountCreateUpdateParameters. +func (d *DatabaseAccountCreateUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &d.Identity) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &d.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountCreateUpdateProperties. +func (d DatabaseAccountCreateUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "apiProperties", d.APIProperties) + populate(objectMap, "analyticalStorageConfiguration", d.AnalyticalStorageConfiguration) + populate(objectMap, "backupPolicy", d.BackupPolicy) + populate(objectMap, "capabilities", d.Capabilities) + populate(objectMap, "capacity", d.Capacity) + populate(objectMap, "capacityMode", d.CapacityMode) + populate(objectMap, "connectorOffer", d.ConnectorOffer) + populate(objectMap, "consistencyPolicy", d.ConsistencyPolicy) + populate(objectMap, "cors", d.Cors) + populate(objectMap, "createMode", d.CreateMode) + populate(objectMap, "customerManagedKeyStatus", d.CustomerManagedKeyStatus) + objectMap["databaseAccountOfferType"] = "Standard" + populate(objectMap, "defaultIdentity", d.DefaultIdentity) + populate(objectMap, "defaultPriorityLevel", d.DefaultPriorityLevel) + populate(objectMap, "diagnosticLogSettings", d.DiagnosticLogSettings) + populate(objectMap, "disableKeyBasedMetadataWriteAccess", d.DisableKeyBasedMetadataWriteAccess) + populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) + populate(objectMap, "enableAnalyticalStorage", d.EnableAnalyticalStorage) + populate(objectMap, "enableAutomaticFailover", d.EnableAutomaticFailover) + populate(objectMap, "enableBurstCapacity", d.EnableBurstCapacity) + populate(objectMap, "enableCassandraConnector", d.EnableCassandraConnector) + populate(objectMap, "enableFreeTier", d.EnableFreeTier) + populate(objectMap, "enableMaterializedViews", d.EnableMaterializedViews) + populate(objectMap, "enableMultipleWriteLocations", d.EnableMultipleWriteLocations) + populate(objectMap, "enablePartitionMerge", d.EnablePartitionMerge) + populate(objectMap, "enablePerRegionPerPartitionAutoscale", d.EnablePerRegionPerPartitionAutoscale) + populate(objectMap, "enablePriorityBasedExecution", d.EnablePriorityBasedExecution) + populate(objectMap, "ipRules", d.IPRules) + populate(objectMap, "isVirtualNetworkFilterEnabled", d.IsVirtualNetworkFilterEnabled) + populate(objectMap, "keyVaultKeyUri", d.KeyVaultKeyURI) + populate(objectMap, "keysMetadata", d.KeysMetadata) + populate(objectMap, "locations", d.Locations) + populate(objectMap, "minimalTlsVersion", d.MinimalTLSVersion) + populate(objectMap, "networkAclBypass", d.NetworkACLBypass) + populate(objectMap, "networkAclBypassResourceIds", d.NetworkACLBypassResourceIDs) + populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) + populate(objectMap, "restoreParameters", d.RestoreParameters) + populate(objectMap, "virtualNetworkRules", d.VirtualNetworkRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountCreateUpdateProperties. +func (d *DatabaseAccountCreateUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apiProperties": + err = unpopulate(val, "APIProperties", &d.APIProperties) + delete(rawMsg, key) + case "analyticalStorageConfiguration": + err = unpopulate(val, "AnalyticalStorageConfiguration", &d.AnalyticalStorageConfiguration) + delete(rawMsg, key) + case "backupPolicy": + d.BackupPolicy, err = unmarshalBackupPolicyClassification(val) + delete(rawMsg, key) + case "capabilities": + err = unpopulate(val, "Capabilities", &d.Capabilities) + delete(rawMsg, key) + case "capacity": + err = unpopulate(val, "Capacity", &d.Capacity) + delete(rawMsg, key) + case "capacityMode": + err = unpopulate(val, "CapacityMode", &d.CapacityMode) + delete(rawMsg, key) + case "connectorOffer": + err = unpopulate(val, "ConnectorOffer", &d.ConnectorOffer) + delete(rawMsg, key) + case "consistencyPolicy": + err = unpopulate(val, "ConsistencyPolicy", &d.ConsistencyPolicy) + delete(rawMsg, key) + case "cors": + err = unpopulate(val, "Cors", &d.Cors) + delete(rawMsg, key) + case "createMode": + err = unpopulate(val, "CreateMode", &d.CreateMode) + delete(rawMsg, key) + case "customerManagedKeyStatus": + err = unpopulate(val, "CustomerManagedKeyStatus", &d.CustomerManagedKeyStatus) + delete(rawMsg, key) + case "databaseAccountOfferType": + err = unpopulate(val, "DatabaseAccountOfferType", &d.DatabaseAccountOfferType) + delete(rawMsg, key) + case "defaultIdentity": + err = unpopulate(val, "DefaultIdentity", &d.DefaultIdentity) + delete(rawMsg, key) + case "defaultPriorityLevel": + err = unpopulate(val, "DefaultPriorityLevel", &d.DefaultPriorityLevel) + delete(rawMsg, key) + case "diagnosticLogSettings": + err = unpopulate(val, "DiagnosticLogSettings", &d.DiagnosticLogSettings) + delete(rawMsg, key) + case "disableKeyBasedMetadataWriteAccess": + err = unpopulate(val, "DisableKeyBasedMetadataWriteAccess", &d.DisableKeyBasedMetadataWriteAccess) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, "DisableLocalAuth", &d.DisableLocalAuth) + delete(rawMsg, key) + case "enableAnalyticalStorage": + err = unpopulate(val, "EnableAnalyticalStorage", &d.EnableAnalyticalStorage) + delete(rawMsg, key) + case "enableAutomaticFailover": + err = unpopulate(val, "EnableAutomaticFailover", &d.EnableAutomaticFailover) + delete(rawMsg, key) + case "enableBurstCapacity": + err = unpopulate(val, "EnableBurstCapacity", &d.EnableBurstCapacity) + delete(rawMsg, key) + case "enableCassandraConnector": + err = unpopulate(val, "EnableCassandraConnector", &d.EnableCassandraConnector) + delete(rawMsg, key) + case "enableFreeTier": + err = unpopulate(val, "EnableFreeTier", &d.EnableFreeTier) + delete(rawMsg, key) + case "enableMaterializedViews": + err = unpopulate(val, "EnableMaterializedViews", &d.EnableMaterializedViews) + delete(rawMsg, key) + case "enableMultipleWriteLocations": + err = unpopulate(val, "EnableMultipleWriteLocations", &d.EnableMultipleWriteLocations) + delete(rawMsg, key) + case "enablePartitionMerge": + err = unpopulate(val, "EnablePartitionMerge", &d.EnablePartitionMerge) + delete(rawMsg, key) + case "enablePerRegionPerPartitionAutoscale": + err = unpopulate(val, "EnablePerRegionPerPartitionAutoscale", &d.EnablePerRegionPerPartitionAutoscale) + delete(rawMsg, key) + case "enablePriorityBasedExecution": + err = unpopulate(val, "EnablePriorityBasedExecution", &d.EnablePriorityBasedExecution) + delete(rawMsg, key) + case "ipRules": + err = unpopulate(val, "IPRules", &d.IPRules) + delete(rawMsg, key) + case "isVirtualNetworkFilterEnabled": + err = unpopulate(val, "IsVirtualNetworkFilterEnabled", &d.IsVirtualNetworkFilterEnabled) + delete(rawMsg, key) + case "keyVaultKeyUri": + err = unpopulate(val, "KeyVaultKeyURI", &d.KeyVaultKeyURI) + delete(rawMsg, key) + case "keysMetadata": + err = unpopulate(val, "KeysMetadata", &d.KeysMetadata) + delete(rawMsg, key) + case "locations": + err = unpopulate(val, "Locations", &d.Locations) + delete(rawMsg, key) + case "minimalTlsVersion": + err = unpopulate(val, "MinimalTLSVersion", &d.MinimalTLSVersion) + delete(rawMsg, key) + case "networkAclBypass": + err = unpopulate(val, "NetworkACLBypass", &d.NetworkACLBypass) + delete(rawMsg, key) + case "networkAclBypassResourceIds": + err = unpopulate(val, "NetworkACLBypassResourceIDs", &d.NetworkACLBypassResourceIDs) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) + delete(rawMsg, key) + case "restoreParameters": + err = unpopulate(val, "RestoreParameters", &d.RestoreParameters) + delete(rawMsg, key) + case "virtualNetworkRules": + err = unpopulate(val, "VirtualNetworkRules", &d.VirtualNetworkRules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountGetProperties. +func (d DatabaseAccountGetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "apiProperties", d.APIProperties) + populate(objectMap, "analyticalStorageConfiguration", d.AnalyticalStorageConfiguration) + populate(objectMap, "backupPolicy", d.BackupPolicy) + populate(objectMap, "capabilities", d.Capabilities) + populate(objectMap, "capacity", d.Capacity) + populate(objectMap, "capacityMode", d.CapacityMode) + populate(objectMap, "capacityModeChangeTransitionState", d.CapacityModeChangeTransitionState) + populate(objectMap, "connectorOffer", d.ConnectorOffer) + populate(objectMap, "consistencyPolicy", d.ConsistencyPolicy) + populate(objectMap, "cors", d.Cors) + populate(objectMap, "createMode", d.CreateMode) + populate(objectMap, "customerManagedKeyStatus", d.CustomerManagedKeyStatus) + objectMap["databaseAccountOfferType"] = "Standard" + populate(objectMap, "defaultIdentity", d.DefaultIdentity) + populate(objectMap, "defaultPriorityLevel", d.DefaultPriorityLevel) + populate(objectMap, "diagnosticLogSettings", d.DiagnosticLogSettings) + populate(objectMap, "disableKeyBasedMetadataWriteAccess", d.DisableKeyBasedMetadataWriteAccess) + populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) + populate(objectMap, "documentEndpoint", d.DocumentEndpoint) + populate(objectMap, "enableAnalyticalStorage", d.EnableAnalyticalStorage) + populate(objectMap, "enableAutomaticFailover", d.EnableAutomaticFailover) + populate(objectMap, "enableBurstCapacity", d.EnableBurstCapacity) + populate(objectMap, "enableCassandraConnector", d.EnableCassandraConnector) + populate(objectMap, "enableFreeTier", d.EnableFreeTier) + populate(objectMap, "enableMaterializedViews", d.EnableMaterializedViews) + populate(objectMap, "enableMultipleWriteLocations", d.EnableMultipleWriteLocations) + populate(objectMap, "enablePartitionMerge", d.EnablePartitionMerge) + populate(objectMap, "enablePerRegionPerPartitionAutoscale", d.EnablePerRegionPerPartitionAutoscale) + populate(objectMap, "enablePriorityBasedExecution", d.EnablePriorityBasedExecution) + populate(objectMap, "failoverPolicies", d.FailoverPolicies) + populate(objectMap, "ipRules", d.IPRules) + populate(objectMap, "instanceId", d.InstanceID) + populate(objectMap, "isVirtualNetworkFilterEnabled", d.IsVirtualNetworkFilterEnabled) + populate(objectMap, "keyVaultKeyUri", d.KeyVaultKeyURI) + populate(objectMap, "keysMetadata", d.KeysMetadata) + populate(objectMap, "locations", d.Locations) + populate(objectMap, "minimalTlsVersion", d.MinimalTLSVersion) + populate(objectMap, "networkAclBypass", d.NetworkACLBypass) + populate(objectMap, "networkAclBypassResourceIds", d.NetworkACLBypassResourceIDs) + populate(objectMap, "privateEndpointConnections", d.PrivateEndpointConnections) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) + populate(objectMap, "readLocations", d.ReadLocations) + populate(objectMap, "restoreParameters", d.RestoreParameters) + populate(objectMap, "virtualNetworkRules", d.VirtualNetworkRules) + populate(objectMap, "writeLocations", d.WriteLocations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountGetProperties. +func (d *DatabaseAccountGetProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apiProperties": + err = unpopulate(val, "APIProperties", &d.APIProperties) + delete(rawMsg, key) + case "analyticalStorageConfiguration": + err = unpopulate(val, "AnalyticalStorageConfiguration", &d.AnalyticalStorageConfiguration) + delete(rawMsg, key) + case "backupPolicy": + d.BackupPolicy, err = unmarshalBackupPolicyClassification(val) + delete(rawMsg, key) + case "capabilities": + err = unpopulate(val, "Capabilities", &d.Capabilities) + delete(rawMsg, key) + case "capacity": + err = unpopulate(val, "Capacity", &d.Capacity) + delete(rawMsg, key) + case "capacityMode": + err = unpopulate(val, "CapacityMode", &d.CapacityMode) + delete(rawMsg, key) + case "capacityModeChangeTransitionState": + err = unpopulate(val, "CapacityModeChangeTransitionState", &d.CapacityModeChangeTransitionState) + delete(rawMsg, key) + case "connectorOffer": + err = unpopulate(val, "ConnectorOffer", &d.ConnectorOffer) + delete(rawMsg, key) + case "consistencyPolicy": + err = unpopulate(val, "ConsistencyPolicy", &d.ConsistencyPolicy) + delete(rawMsg, key) + case "cors": + err = unpopulate(val, "Cors", &d.Cors) + delete(rawMsg, key) + case "createMode": + err = unpopulate(val, "CreateMode", &d.CreateMode) + delete(rawMsg, key) + case "customerManagedKeyStatus": + err = unpopulate(val, "CustomerManagedKeyStatus", &d.CustomerManagedKeyStatus) + delete(rawMsg, key) + case "databaseAccountOfferType": + err = unpopulate(val, "DatabaseAccountOfferType", &d.DatabaseAccountOfferType) + delete(rawMsg, key) + case "defaultIdentity": + err = unpopulate(val, "DefaultIdentity", &d.DefaultIdentity) + delete(rawMsg, key) + case "defaultPriorityLevel": + err = unpopulate(val, "DefaultPriorityLevel", &d.DefaultPriorityLevel) + delete(rawMsg, key) + case "diagnosticLogSettings": + err = unpopulate(val, "DiagnosticLogSettings", &d.DiagnosticLogSettings) + delete(rawMsg, key) + case "disableKeyBasedMetadataWriteAccess": + err = unpopulate(val, "DisableKeyBasedMetadataWriteAccess", &d.DisableKeyBasedMetadataWriteAccess) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, "DisableLocalAuth", &d.DisableLocalAuth) + delete(rawMsg, key) + case "documentEndpoint": + err = unpopulate(val, "DocumentEndpoint", &d.DocumentEndpoint) + delete(rawMsg, key) + case "enableAnalyticalStorage": + err = unpopulate(val, "EnableAnalyticalStorage", &d.EnableAnalyticalStorage) + delete(rawMsg, key) + case "enableAutomaticFailover": + err = unpopulate(val, "EnableAutomaticFailover", &d.EnableAutomaticFailover) + delete(rawMsg, key) + case "enableBurstCapacity": + err = unpopulate(val, "EnableBurstCapacity", &d.EnableBurstCapacity) + delete(rawMsg, key) + case "enableCassandraConnector": + err = unpopulate(val, "EnableCassandraConnector", &d.EnableCassandraConnector) + delete(rawMsg, key) + case "enableFreeTier": + err = unpopulate(val, "EnableFreeTier", &d.EnableFreeTier) + delete(rawMsg, key) + case "enableMaterializedViews": + err = unpopulate(val, "EnableMaterializedViews", &d.EnableMaterializedViews) + delete(rawMsg, key) + case "enableMultipleWriteLocations": + err = unpopulate(val, "EnableMultipleWriteLocations", &d.EnableMultipleWriteLocations) + delete(rawMsg, key) + case "enablePartitionMerge": + err = unpopulate(val, "EnablePartitionMerge", &d.EnablePartitionMerge) + delete(rawMsg, key) + case "enablePerRegionPerPartitionAutoscale": + err = unpopulate(val, "EnablePerRegionPerPartitionAutoscale", &d.EnablePerRegionPerPartitionAutoscale) + delete(rawMsg, key) + case "enablePriorityBasedExecution": + err = unpopulate(val, "EnablePriorityBasedExecution", &d.EnablePriorityBasedExecution) + delete(rawMsg, key) + case "failoverPolicies": + err = unpopulate(val, "FailoverPolicies", &d.FailoverPolicies) + delete(rawMsg, key) + case "ipRules": + err = unpopulate(val, "IPRules", &d.IPRules) + delete(rawMsg, key) + case "instanceId": + err = unpopulate(val, "InstanceID", &d.InstanceID) + delete(rawMsg, key) + case "isVirtualNetworkFilterEnabled": + err = unpopulate(val, "IsVirtualNetworkFilterEnabled", &d.IsVirtualNetworkFilterEnabled) + delete(rawMsg, key) + case "keyVaultKeyUri": + err = unpopulate(val, "KeyVaultKeyURI", &d.KeyVaultKeyURI) + delete(rawMsg, key) + case "keysMetadata": + err = unpopulate(val, "KeysMetadata", &d.KeysMetadata) + delete(rawMsg, key) + case "locations": + err = unpopulate(val, "Locations", &d.Locations) + delete(rawMsg, key) + case "minimalTlsVersion": + err = unpopulate(val, "MinimalTLSVersion", &d.MinimalTLSVersion) + delete(rawMsg, key) + case "networkAclBypass": + err = unpopulate(val, "NetworkACLBypass", &d.NetworkACLBypass) + delete(rawMsg, key) + case "networkAclBypassResourceIds": + err = unpopulate(val, "NetworkACLBypassResourceIDs", &d.NetworkACLBypassResourceIDs) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &d.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) + delete(rawMsg, key) + case "readLocations": + err = unpopulate(val, "ReadLocations", &d.ReadLocations) + delete(rawMsg, key) + case "restoreParameters": + err = unpopulate(val, "RestoreParameters", &d.RestoreParameters) + delete(rawMsg, key) + case "virtualNetworkRules": + err = unpopulate(val, "VirtualNetworkRules", &d.VirtualNetworkRules) + delete(rawMsg, key) + case "writeLocations": + err = unpopulate(val, "WriteLocations", &d.WriteLocations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountGetResults. +func (d DatabaseAccountGetResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "identity", d.Identity) + populate(objectMap, "kind", d.Kind) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountGetResults. +func (d *DatabaseAccountGetResults) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &d.Identity) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &d.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "tags": err = unpopulate(val, "Tags", &d.Tags) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountKeysMetadata. +func (d DatabaseAccountKeysMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "primaryMasterKey", d.PrimaryMasterKey) + populate(objectMap, "primaryReadonlyMasterKey", d.PrimaryReadonlyMasterKey) + populate(objectMap, "secondaryMasterKey", d.SecondaryMasterKey) + populate(objectMap, "secondaryReadonlyMasterKey", d.SecondaryReadonlyMasterKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountKeysMetadata. +func (d *DatabaseAccountKeysMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "primaryMasterKey": + err = unpopulate(val, "PrimaryMasterKey", &d.PrimaryMasterKey) + delete(rawMsg, key) + case "primaryReadonlyMasterKey": + err = unpopulate(val, "PrimaryReadonlyMasterKey", &d.PrimaryReadonlyMasterKey) + delete(rawMsg, key) + case "secondaryMasterKey": + err = unpopulate(val, "SecondaryMasterKey", &d.SecondaryMasterKey) + delete(rawMsg, key) + case "secondaryReadonlyMasterKey": + err = unpopulate(val, "SecondaryReadonlyMasterKey", &d.SecondaryReadonlyMasterKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountListConnectionStringsResult. +func (d DatabaseAccountListConnectionStringsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "connectionStrings", d.ConnectionStrings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountListConnectionStringsResult. +func (d *DatabaseAccountListConnectionStringsResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionStrings": + err = unpopulate(val, "ConnectionStrings", &d.ConnectionStrings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountListKeysResult. +func (d DatabaseAccountListKeysResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "primaryMasterKey", d.PrimaryMasterKey) + populate(objectMap, "primaryReadonlyMasterKey", d.PrimaryReadonlyMasterKey) + populate(objectMap, "secondaryMasterKey", d.SecondaryMasterKey) + populate(objectMap, "secondaryReadonlyMasterKey", d.SecondaryReadonlyMasterKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountListKeysResult. +func (d *DatabaseAccountListKeysResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "primaryMasterKey": + err = unpopulate(val, "PrimaryMasterKey", &d.PrimaryMasterKey) + delete(rawMsg, key) + case "primaryReadonlyMasterKey": + err = unpopulate(val, "PrimaryReadonlyMasterKey", &d.PrimaryReadonlyMasterKey) + delete(rawMsg, key) + case "secondaryMasterKey": + err = unpopulate(val, "SecondaryMasterKey", &d.SecondaryMasterKey) + delete(rawMsg, key) + case "secondaryReadonlyMasterKey": + err = unpopulate(val, "SecondaryReadonlyMasterKey", &d.SecondaryReadonlyMasterKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountListReadOnlyKeysResult. +func (d DatabaseAccountListReadOnlyKeysResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "primaryReadonlyMasterKey", d.PrimaryReadonlyMasterKey) + populate(objectMap, "secondaryReadonlyMasterKey", d.SecondaryReadonlyMasterKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountListReadOnlyKeysResult. +func (d *DatabaseAccountListReadOnlyKeysResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "primaryReadonlyMasterKey": + err = unpopulate(val, "PrimaryReadonlyMasterKey", &d.PrimaryReadonlyMasterKey) + delete(rawMsg, key) + case "secondaryReadonlyMasterKey": + err = unpopulate(val, "SecondaryReadonlyMasterKey", &d.SecondaryReadonlyMasterKey) delete(rawMsg, key) } if err != nil { @@ -2762,46 +4405,15 @@ func (d *DatabaseAccountCreateUpdateParameters) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountCreateUpdateProperties. -func (d DatabaseAccountCreateUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountRegenerateKeyParameters. +func (d DatabaseAccountRegenerateKeyParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "apiProperties", d.APIProperties) - populate(objectMap, "analyticalStorageConfiguration", d.AnalyticalStorageConfiguration) - populate(objectMap, "backupPolicy", d.BackupPolicy) - populate(objectMap, "capabilities", d.Capabilities) - populate(objectMap, "capacity", d.Capacity) - populate(objectMap, "connectorOffer", d.ConnectorOffer) - populate(objectMap, "consistencyPolicy", d.ConsistencyPolicy) - populate(objectMap, "cors", d.Cors) - populate(objectMap, "createMode", d.CreateMode) - populate(objectMap, "customerManagedKeyStatus", d.CustomerManagedKeyStatus) - objectMap["databaseAccountOfferType"] = "Standard" - populate(objectMap, "defaultIdentity", d.DefaultIdentity) - populate(objectMap, "disableKeyBasedMetadataWriteAccess", d.DisableKeyBasedMetadataWriteAccess) - populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) - populate(objectMap, "enableAnalyticalStorage", d.EnableAnalyticalStorage) - populate(objectMap, "enableAutomaticFailover", d.EnableAutomaticFailover) - populate(objectMap, "enableBurstCapacity", d.EnableBurstCapacity) - populate(objectMap, "enableCassandraConnector", d.EnableCassandraConnector) - populate(objectMap, "enableFreeTier", d.EnableFreeTier) - populate(objectMap, "enableMultipleWriteLocations", d.EnableMultipleWriteLocations) - populate(objectMap, "enablePartitionMerge", d.EnablePartitionMerge) - populate(objectMap, "ipRules", d.IPRules) - populate(objectMap, "isVirtualNetworkFilterEnabled", d.IsVirtualNetworkFilterEnabled) - populate(objectMap, "keyVaultKeyUri", d.KeyVaultKeyURI) - populate(objectMap, "keysMetadata", d.KeysMetadata) - populate(objectMap, "locations", d.Locations) - populate(objectMap, "minimalTlsVersion", d.MinimalTLSVersion) - populate(objectMap, "networkAclBypass", d.NetworkACLBypass) - populate(objectMap, "networkAclBypassResourceIds", d.NetworkACLBypassResourceIDs) - populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) - populate(objectMap, "restoreParameters", d.RestoreParameters) - populate(objectMap, "virtualNetworkRules", d.VirtualNetworkRules) + populate(objectMap, "keyKind", d.KeyKind) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountCreateUpdateProperties. -func (d *DatabaseAccountCreateUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountRegenerateKeyParameters. +func (d *DatabaseAccountRegenerateKeyParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2809,101 +4421,47 @@ func (d *DatabaseAccountCreateUpdateProperties) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { - case "apiProperties": - err = unpopulate(val, "APIProperties", &d.APIProperties) - delete(rawMsg, key) - case "analyticalStorageConfiguration": - err = unpopulate(val, "AnalyticalStorageConfiguration", &d.AnalyticalStorageConfiguration) - delete(rawMsg, key) - case "backupPolicy": - d.BackupPolicy, err = unmarshalBackupPolicyClassification(val) - delete(rawMsg, key) - case "capabilities": - err = unpopulate(val, "Capabilities", &d.Capabilities) - delete(rawMsg, key) - case "capacity": - err = unpopulate(val, "Capacity", &d.Capacity) - delete(rawMsg, key) - case "connectorOffer": - err = unpopulate(val, "ConnectorOffer", &d.ConnectorOffer) - delete(rawMsg, key) - case "consistencyPolicy": - err = unpopulate(val, "ConsistencyPolicy", &d.ConsistencyPolicy) - delete(rawMsg, key) - case "cors": - err = unpopulate(val, "Cors", &d.Cors) - delete(rawMsg, key) - case "createMode": - err = unpopulate(val, "CreateMode", &d.CreateMode) - delete(rawMsg, key) - case "customerManagedKeyStatus": - err = unpopulate(val, "CustomerManagedKeyStatus", &d.CustomerManagedKeyStatus) - delete(rawMsg, key) - case "databaseAccountOfferType": - err = unpopulate(val, "DatabaseAccountOfferType", &d.DatabaseAccountOfferType) - delete(rawMsg, key) - case "defaultIdentity": - err = unpopulate(val, "DefaultIdentity", &d.DefaultIdentity) - delete(rawMsg, key) - case "disableKeyBasedMetadataWriteAccess": - err = unpopulate(val, "DisableKeyBasedMetadataWriteAccess", &d.DisableKeyBasedMetadataWriteAccess) - delete(rawMsg, key) - case "disableLocalAuth": - err = unpopulate(val, "DisableLocalAuth", &d.DisableLocalAuth) - delete(rawMsg, key) - case "enableAnalyticalStorage": - err = unpopulate(val, "EnableAnalyticalStorage", &d.EnableAnalyticalStorage) - delete(rawMsg, key) - case "enableAutomaticFailover": - err = unpopulate(val, "EnableAutomaticFailover", &d.EnableAutomaticFailover) - delete(rawMsg, key) - case "enableBurstCapacity": - err = unpopulate(val, "EnableBurstCapacity", &d.EnableBurstCapacity) - delete(rawMsg, key) - case "enableCassandraConnector": - err = unpopulate(val, "EnableCassandraConnector", &d.EnableCassandraConnector) - delete(rawMsg, key) - case "enableFreeTier": - err = unpopulate(val, "EnableFreeTier", &d.EnableFreeTier) - delete(rawMsg, key) - case "enableMultipleWriteLocations": - err = unpopulate(val, "EnableMultipleWriteLocations", &d.EnableMultipleWriteLocations) - delete(rawMsg, key) - case "enablePartitionMerge": - err = unpopulate(val, "EnablePartitionMerge", &d.EnablePartitionMerge) - delete(rawMsg, key) - case "ipRules": - err = unpopulate(val, "IPRules", &d.IPRules) - delete(rawMsg, key) - case "isVirtualNetworkFilterEnabled": - err = unpopulate(val, "IsVirtualNetworkFilterEnabled", &d.IsVirtualNetworkFilterEnabled) - delete(rawMsg, key) - case "keyVaultKeyUri": - err = unpopulate(val, "KeyVaultKeyURI", &d.KeyVaultKeyURI) - delete(rawMsg, key) - case "keysMetadata": - err = unpopulate(val, "KeysMetadata", &d.KeysMetadata) - delete(rawMsg, key) - case "locations": - err = unpopulate(val, "Locations", &d.Locations) - delete(rawMsg, key) - case "minimalTlsVersion": - err = unpopulate(val, "MinimalTLSVersion", &d.MinimalTLSVersion) - delete(rawMsg, key) - case "networkAclBypass": - err = unpopulate(val, "NetworkACLBypass", &d.NetworkACLBypass) + case "keyKind": + err = unpopulate(val, "KeyKind", &d.KeyKind) delete(rawMsg, key) - case "networkAclBypassResourceIds": - err = unpopulate(val, "NetworkACLBypassResourceIDs", &d.NetworkACLBypassResourceIDs) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountUpdateParameters. +func (d DatabaseAccountUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", d.Identity) + populate(objectMap, "location", d.Location) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountUpdateParameters. +func (d *DatabaseAccountUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &d.Identity) delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) + case "location": + err = unpopulate(val, "Location", &d.Location) delete(rawMsg, key) - case "restoreParameters": - err = unpopulate(val, "RestoreParameters", &d.RestoreParameters) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) - case "virtualNetworkRules": - err = unpopulate(val, "VirtualNetworkRules", &d.VirtualNetworkRules) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) delete(rawMsg, key) } if err != nil { @@ -2913,34 +4471,35 @@ func (d *DatabaseAccountCreateUpdateProperties) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountGetProperties. -func (d DatabaseAccountGetProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountUpdateProperties. +func (d DatabaseAccountUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "apiProperties", d.APIProperties) populate(objectMap, "analyticalStorageConfiguration", d.AnalyticalStorageConfiguration) populate(objectMap, "backupPolicy", d.BackupPolicy) populate(objectMap, "capabilities", d.Capabilities) populate(objectMap, "capacity", d.Capacity) + populate(objectMap, "capacityMode", d.CapacityMode) populate(objectMap, "connectorOffer", d.ConnectorOffer) populate(objectMap, "consistencyPolicy", d.ConsistencyPolicy) populate(objectMap, "cors", d.Cors) - populate(objectMap, "createMode", d.CreateMode) populate(objectMap, "customerManagedKeyStatus", d.CustomerManagedKeyStatus) - objectMap["databaseAccountOfferType"] = "Standard" populate(objectMap, "defaultIdentity", d.DefaultIdentity) + populate(objectMap, "defaultPriorityLevel", d.DefaultPriorityLevel) + populate(objectMap, "diagnosticLogSettings", d.DiagnosticLogSettings) populate(objectMap, "disableKeyBasedMetadataWriteAccess", d.DisableKeyBasedMetadataWriteAccess) populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) - populate(objectMap, "documentEndpoint", d.DocumentEndpoint) populate(objectMap, "enableAnalyticalStorage", d.EnableAnalyticalStorage) populate(objectMap, "enableAutomaticFailover", d.EnableAutomaticFailover) populate(objectMap, "enableBurstCapacity", d.EnableBurstCapacity) populate(objectMap, "enableCassandraConnector", d.EnableCassandraConnector) populate(objectMap, "enableFreeTier", d.EnableFreeTier) + populate(objectMap, "enableMaterializedViews", d.EnableMaterializedViews) populate(objectMap, "enableMultipleWriteLocations", d.EnableMultipleWriteLocations) populate(objectMap, "enablePartitionMerge", d.EnablePartitionMerge) - populate(objectMap, "failoverPolicies", d.FailoverPolicies) + populate(objectMap, "enablePerRegionPerPartitionAutoscale", d.EnablePerRegionPerPartitionAutoscale) + populate(objectMap, "enablePriorityBasedExecution", d.EnablePriorityBasedExecution) populate(objectMap, "ipRules", d.IPRules) - populate(objectMap, "instanceId", d.InstanceID) populate(objectMap, "isVirtualNetworkFilterEnabled", d.IsVirtualNetworkFilterEnabled) populate(objectMap, "keyVaultKeyUri", d.KeyVaultKeyURI) populate(objectMap, "keysMetadata", d.KeysMetadata) @@ -2948,18 +4507,13 @@ func (d DatabaseAccountGetProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "minimalTlsVersion", d.MinimalTLSVersion) populate(objectMap, "networkAclBypass", d.NetworkACLBypass) populate(objectMap, "networkAclBypassResourceIds", d.NetworkACLBypassResourceIDs) - populate(objectMap, "privateEndpointConnections", d.PrivateEndpointConnections) - populate(objectMap, "provisioningState", d.ProvisioningState) populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) - populate(objectMap, "readLocations", d.ReadLocations) - populate(objectMap, "restoreParameters", d.RestoreParameters) populate(objectMap, "virtualNetworkRules", d.VirtualNetworkRules) - populate(objectMap, "writeLocations", d.WriteLocations) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountGetProperties. -func (d *DatabaseAccountGetProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountUpdateProperties. +func (d *DatabaseAccountUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -2982,6 +4536,9 @@ func (d *DatabaseAccountGetProperties) UnmarshalJSON(data []byte) error { case "capacity": err = unpopulate(val, "Capacity", &d.Capacity) delete(rawMsg, key) + case "capacityMode": + err = unpopulate(val, "CapacityMode", &d.CapacityMode) + delete(rawMsg, key) case "connectorOffer": err = unpopulate(val, "ConnectorOffer", &d.ConnectorOffer) delete(rawMsg, key) @@ -2991,27 +4548,24 @@ func (d *DatabaseAccountGetProperties) UnmarshalJSON(data []byte) error { case "cors": err = unpopulate(val, "Cors", &d.Cors) delete(rawMsg, key) - case "createMode": - err = unpopulate(val, "CreateMode", &d.CreateMode) - delete(rawMsg, key) case "customerManagedKeyStatus": err = unpopulate(val, "CustomerManagedKeyStatus", &d.CustomerManagedKeyStatus) delete(rawMsg, key) - case "databaseAccountOfferType": - err = unpopulate(val, "DatabaseAccountOfferType", &d.DatabaseAccountOfferType) - delete(rawMsg, key) case "defaultIdentity": err = unpopulate(val, "DefaultIdentity", &d.DefaultIdentity) delete(rawMsg, key) + case "defaultPriorityLevel": + err = unpopulate(val, "DefaultPriorityLevel", &d.DefaultPriorityLevel) + delete(rawMsg, key) + case "diagnosticLogSettings": + err = unpopulate(val, "DiagnosticLogSettings", &d.DiagnosticLogSettings) + delete(rawMsg, key) case "disableKeyBasedMetadataWriteAccess": err = unpopulate(val, "DisableKeyBasedMetadataWriteAccess", &d.DisableKeyBasedMetadataWriteAccess) delete(rawMsg, key) case "disableLocalAuth": err = unpopulate(val, "DisableLocalAuth", &d.DisableLocalAuth) delete(rawMsg, key) - case "documentEndpoint": - err = unpopulate(val, "DocumentEndpoint", &d.DocumentEndpoint) - delete(rawMsg, key) case "enableAnalyticalStorage": err = unpopulate(val, "EnableAnalyticalStorage", &d.EnableAnalyticalStorage) delete(rawMsg, key) @@ -3027,21 +4581,24 @@ func (d *DatabaseAccountGetProperties) UnmarshalJSON(data []byte) error { case "enableFreeTier": err = unpopulate(val, "EnableFreeTier", &d.EnableFreeTier) delete(rawMsg, key) + case "enableMaterializedViews": + err = unpopulate(val, "EnableMaterializedViews", &d.EnableMaterializedViews) + delete(rawMsg, key) case "enableMultipleWriteLocations": err = unpopulate(val, "EnableMultipleWriteLocations", &d.EnableMultipleWriteLocations) delete(rawMsg, key) case "enablePartitionMerge": err = unpopulate(val, "EnablePartitionMerge", &d.EnablePartitionMerge) delete(rawMsg, key) - case "failoverPolicies": - err = unpopulate(val, "FailoverPolicies", &d.FailoverPolicies) + case "enablePerRegionPerPartitionAutoscale": + err = unpopulate(val, "EnablePerRegionPerPartitionAutoscale", &d.EnablePerRegionPerPartitionAutoscale) + delete(rawMsg, key) + case "enablePriorityBasedExecution": + err = unpopulate(val, "EnablePriorityBasedExecution", &d.EnablePriorityBasedExecution) delete(rawMsg, key) case "ipRules": err = unpopulate(val, "IPRules", &d.IPRules) delete(rawMsg, key) - case "instanceId": - err = unpopulate(val, "InstanceID", &d.InstanceID) - delete(rawMsg, key) case "isVirtualNetworkFilterEnabled": err = unpopulate(val, "IsVirtualNetworkFilterEnabled", &d.IsVirtualNetworkFilterEnabled) delete(rawMsg, key) @@ -3063,26 +4620,69 @@ func (d *DatabaseAccountGetProperties) UnmarshalJSON(data []byte) error { case "networkAclBypassResourceIds": err = unpopulate(val, "NetworkACLBypassResourceIDs", &d.NetworkACLBypassResourceIDs) delete(rawMsg, key) - case "privateEndpointConnections": - err = unpopulate(val, "PrivateEndpointConnections", &d.PrivateEndpointConnections) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) case "publicNetworkAccess": err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) delete(rawMsg, key) - case "readLocations": - err = unpopulate(val, "ReadLocations", &d.ReadLocations) - delete(rawMsg, key) - case "restoreParameters": - err = unpopulate(val, "RestoreParameters", &d.RestoreParameters) - delete(rawMsg, key) case "virtualNetworkRules": err = unpopulate(val, "VirtualNetworkRules", &d.VirtualNetworkRules) delete(rawMsg, key) - case "writeLocations": - err = unpopulate(val, "WriteLocations", &d.WriteLocations) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountsListResult. +func (d DatabaseAccountsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountsListResult. +func (d *DatabaseAccountsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseRestoreResource. +func (d DatabaseRestoreResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "collectionNames", d.CollectionNames) + populate(objectMap, "databaseName", d.DatabaseName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseRestoreResource. +func (d *DatabaseRestoreResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "collectionNames": + err = unpopulate(val, "CollectionNames", &d.CollectionNames) + delete(rawMsg, key) + case "databaseName": + err = unpopulate(val, "DatabaseName", &d.DatabaseName) delete(rawMsg, key) } if err != nil { @@ -3092,23 +4692,15 @@ func (d *DatabaseAccountGetProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountGetResults. -func (d DatabaseAccountGetResults) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DiagnosticLogSettings. +func (d DiagnosticLogSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "identity", d.Identity) - populate(objectMap, "kind", d.Kind) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "tags", d.Tags) - populate(objectMap, "type", d.Type) + populate(objectMap, "enableFullTextQuery", d.EnableFullTextQuery) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountGetResults. -func (d *DatabaseAccountGetResults) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticLogSettings. +func (d *DiagnosticLogSettings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -3116,607 +4708,590 @@ func (d *DatabaseAccountGetResults) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &d.Identity) + case "enableFullTextQuery": + err = unpopulate(val, "EnableFullTextQuery", &d.EnableFullTextQuery) delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &d.Kind) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &d.Location) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) + case "details": + err = unpopulate(val, "Details", &e.Details) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &d.Tags) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "target": + err = unpopulate(val, "Target", &e.Target) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountKeysMetadata. -func (d DatabaseAccountKeysMetadata) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "primaryMasterKey", d.PrimaryMasterKey) - populate(objectMap, "primaryReadonlyMasterKey", d.PrimaryReadonlyMasterKey) - populate(objectMap, "secondaryMasterKey", d.SecondaryMasterKey) - populate(objectMap, "secondaryReadonlyMasterKey", d.SecondaryReadonlyMasterKey) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountKeysMetadata. -func (d *DatabaseAccountKeysMetadata) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "primaryMasterKey": - err = unpopulate(val, "PrimaryMasterKey", &d.PrimaryMasterKey) - delete(rawMsg, key) - case "primaryReadonlyMasterKey": - err = unpopulate(val, "PrimaryReadonlyMasterKey", &d.PrimaryReadonlyMasterKey) - delete(rawMsg, key) - case "secondaryMasterKey": - err = unpopulate(val, "SecondaryMasterKey", &d.SecondaryMasterKey) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "secondaryReadonlyMasterKey": - err = unpopulate(val, "SecondaryReadonlyMasterKey", &d.SecondaryReadonlyMasterKey) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountListConnectionStringsResult. -func (d DatabaseAccountListConnectionStringsResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated. +func (e ErrorResponseAutoGenerated) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "connectionStrings", d.ConnectionStrings) + populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountListConnectionStringsResult. -func (d *DatabaseAccountListConnectionStringsResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated. +func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "connectionStrings": - err = unpopulate(val, "ConnectionStrings", &d.ConnectionStrings) + case "error": + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountListKeysResult. -func (d DatabaseAccountListKeysResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExcludedPath. +func (e ExcludedPath) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "primaryMasterKey", d.PrimaryMasterKey) - populate(objectMap, "primaryReadonlyMasterKey", d.PrimaryReadonlyMasterKey) - populate(objectMap, "secondaryMasterKey", d.SecondaryMasterKey) - populate(objectMap, "secondaryReadonlyMasterKey", d.SecondaryReadonlyMasterKey) + populate(objectMap, "path", e.Path) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountListKeysResult. -func (d *DatabaseAccountListKeysResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExcludedPath. +func (e *ExcludedPath) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "primaryMasterKey": - err = unpopulate(val, "PrimaryMasterKey", &d.PrimaryMasterKey) - delete(rawMsg, key) - case "primaryReadonlyMasterKey": - err = unpopulate(val, "PrimaryReadonlyMasterKey", &d.PrimaryReadonlyMasterKey) - delete(rawMsg, key) - case "secondaryMasterKey": - err = unpopulate(val, "SecondaryMasterKey", &d.SecondaryMasterKey) - delete(rawMsg, key) - case "secondaryReadonlyMasterKey": - err = unpopulate(val, "SecondaryReadonlyMasterKey", &d.SecondaryReadonlyMasterKey) + case "path": + err = unpopulate(val, "Path", &e.Path) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountListReadOnlyKeysResult. -func (d DatabaseAccountListReadOnlyKeysResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtendedResourceProperties. +func (e ExtendedResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "primaryReadonlyMasterKey", d.PrimaryReadonlyMasterKey) - populate(objectMap, "secondaryReadonlyMasterKey", d.SecondaryReadonlyMasterKey) + populate(objectMap, "_etag", e.Etag) + populate(objectMap, "_rid", e.Rid) + populate(objectMap, "_ts", e.Ts) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountListReadOnlyKeysResult. -func (d *DatabaseAccountListReadOnlyKeysResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedResourceProperties. +func (e *ExtendedResourceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "primaryReadonlyMasterKey": - err = unpopulate(val, "PrimaryReadonlyMasterKey", &d.PrimaryReadonlyMasterKey) + case "_etag": + err = unpopulate(val, "Etag", &e.Etag) delete(rawMsg, key) - case "secondaryReadonlyMasterKey": - err = unpopulate(val, "SecondaryReadonlyMasterKey", &d.SecondaryReadonlyMasterKey) + case "_rid": + err = unpopulate(val, "Rid", &e.Rid) + delete(rawMsg, key) + case "_ts": + err = unpopulate(val, "Ts", &e.Ts) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountRegenerateKeyParameters. -func (d DatabaseAccountRegenerateKeyParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FailoverPolicies. +func (f FailoverPolicies) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "keyKind", d.KeyKind) + populate(objectMap, "failoverPolicies", f.FailoverPolicies) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountRegenerateKeyParameters. -func (d *DatabaseAccountRegenerateKeyParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverPolicies. +func (f *FailoverPolicies) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } for key, val := range rawMsg { var err error switch key { - case "keyKind": - err = unpopulate(val, "KeyKind", &d.KeyKind) + case "failoverPolicies": + err = unpopulate(val, "FailoverPolicies", &f.FailoverPolicies) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountUpdateParameters. -func (d DatabaseAccountUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FailoverPolicy. +func (f FailoverPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identity", d.Identity) - populate(objectMap, "location", d.Location) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "tags", d.Tags) + populate(objectMap, "failoverPriority", f.FailoverPriority) + populate(objectMap, "id", f.ID) + populate(objectMap, "locationName", f.LocationName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountUpdateParameters. -func (d *DatabaseAccountUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverPolicy. +func (f *FailoverPolicy) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } for key, val := range rawMsg { var err error switch key { - case "identity": - err = unpopulate(val, "Identity", &d.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &d.Location) + case "failoverPriority": + err = unpopulate(val, "FailoverPriority", &f.FailoverPriority) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) + case "id": + err = unpopulate(val, "ID", &f.ID) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &d.Tags) + case "locationName": + err = unpopulate(val, "LocationName", &f.LocationName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountUpdateProperties. -func (d DatabaseAccountUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GraphAPIComputeRegionalServiceResource. +func (g GraphAPIComputeRegionalServiceResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "apiProperties", d.APIProperties) - populate(objectMap, "analyticalStorageConfiguration", d.AnalyticalStorageConfiguration) - populate(objectMap, "backupPolicy", d.BackupPolicy) - populate(objectMap, "capabilities", d.Capabilities) - populate(objectMap, "capacity", d.Capacity) - populate(objectMap, "connectorOffer", d.ConnectorOffer) - populate(objectMap, "consistencyPolicy", d.ConsistencyPolicy) - populate(objectMap, "cors", d.Cors) - populate(objectMap, "customerManagedKeyStatus", d.CustomerManagedKeyStatus) - populate(objectMap, "defaultIdentity", d.DefaultIdentity) - populate(objectMap, "disableKeyBasedMetadataWriteAccess", d.DisableKeyBasedMetadataWriteAccess) - populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) - populate(objectMap, "enableAnalyticalStorage", d.EnableAnalyticalStorage) - populate(objectMap, "enableAutomaticFailover", d.EnableAutomaticFailover) - populate(objectMap, "enableBurstCapacity", d.EnableBurstCapacity) - populate(objectMap, "enableCassandraConnector", d.EnableCassandraConnector) - populate(objectMap, "enableFreeTier", d.EnableFreeTier) - populate(objectMap, "enableMultipleWriteLocations", d.EnableMultipleWriteLocations) - populate(objectMap, "enablePartitionMerge", d.EnablePartitionMerge) - populate(objectMap, "ipRules", d.IPRules) - populate(objectMap, "isVirtualNetworkFilterEnabled", d.IsVirtualNetworkFilterEnabled) - populate(objectMap, "keyVaultKeyUri", d.KeyVaultKeyURI) - populate(objectMap, "keysMetadata", d.KeysMetadata) - populate(objectMap, "locations", d.Locations) - populate(objectMap, "minimalTlsVersion", d.MinimalTLSVersion) - populate(objectMap, "networkAclBypass", d.NetworkACLBypass) - populate(objectMap, "networkAclBypassResourceIds", d.NetworkACLBypassResourceIDs) - populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) - populate(objectMap, "virtualNetworkRules", d.VirtualNetworkRules) + populate(objectMap, "graphApiComputeEndpoint", g.GraphAPIComputeEndpoint) + populate(objectMap, "location", g.Location) + populate(objectMap, "name", g.Name) + populate(objectMap, "status", g.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountUpdateProperties. -func (d *DatabaseAccountUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GraphAPIComputeRegionalServiceResource. +func (g *GraphAPIComputeRegionalServiceResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "apiProperties": - err = unpopulate(val, "APIProperties", &d.APIProperties) - delete(rawMsg, key) - case "analyticalStorageConfiguration": - err = unpopulate(val, "AnalyticalStorageConfiguration", &d.AnalyticalStorageConfiguration) - delete(rawMsg, key) - case "backupPolicy": - d.BackupPolicy, err = unmarshalBackupPolicyClassification(val) - delete(rawMsg, key) - case "capabilities": - err = unpopulate(val, "Capabilities", &d.Capabilities) - delete(rawMsg, key) - case "capacity": - err = unpopulate(val, "Capacity", &d.Capacity) - delete(rawMsg, key) - case "connectorOffer": - err = unpopulate(val, "ConnectorOffer", &d.ConnectorOffer) - delete(rawMsg, key) - case "consistencyPolicy": - err = unpopulate(val, "ConsistencyPolicy", &d.ConsistencyPolicy) - delete(rawMsg, key) - case "cors": - err = unpopulate(val, "Cors", &d.Cors) - delete(rawMsg, key) - case "customerManagedKeyStatus": - err = unpopulate(val, "CustomerManagedKeyStatus", &d.CustomerManagedKeyStatus) - delete(rawMsg, key) - case "defaultIdentity": - err = unpopulate(val, "DefaultIdentity", &d.DefaultIdentity) - delete(rawMsg, key) - case "disableKeyBasedMetadataWriteAccess": - err = unpopulate(val, "DisableKeyBasedMetadataWriteAccess", &d.DisableKeyBasedMetadataWriteAccess) - delete(rawMsg, key) - case "disableLocalAuth": - err = unpopulate(val, "DisableLocalAuth", &d.DisableLocalAuth) - delete(rawMsg, key) - case "enableAnalyticalStorage": - err = unpopulate(val, "EnableAnalyticalStorage", &d.EnableAnalyticalStorage) - delete(rawMsg, key) - case "enableAutomaticFailover": - err = unpopulate(val, "EnableAutomaticFailover", &d.EnableAutomaticFailover) - delete(rawMsg, key) - case "enableBurstCapacity": - err = unpopulate(val, "EnableBurstCapacity", &d.EnableBurstCapacity) - delete(rawMsg, key) - case "enableCassandraConnector": - err = unpopulate(val, "EnableCassandraConnector", &d.EnableCassandraConnector) - delete(rawMsg, key) - case "enableFreeTier": - err = unpopulate(val, "EnableFreeTier", &d.EnableFreeTier) - delete(rawMsg, key) - case "enableMultipleWriteLocations": - err = unpopulate(val, "EnableMultipleWriteLocations", &d.EnableMultipleWriteLocations) - delete(rawMsg, key) - case "enablePartitionMerge": - err = unpopulate(val, "EnablePartitionMerge", &d.EnablePartitionMerge) - delete(rawMsg, key) - case "ipRules": - err = unpopulate(val, "IPRules", &d.IPRules) - delete(rawMsg, key) - case "isVirtualNetworkFilterEnabled": - err = unpopulate(val, "IsVirtualNetworkFilterEnabled", &d.IsVirtualNetworkFilterEnabled) - delete(rawMsg, key) - case "keyVaultKeyUri": - err = unpopulate(val, "KeyVaultKeyURI", &d.KeyVaultKeyURI) - delete(rawMsg, key) - case "keysMetadata": - err = unpopulate(val, "KeysMetadata", &d.KeysMetadata) - delete(rawMsg, key) - case "locations": - err = unpopulate(val, "Locations", &d.Locations) - delete(rawMsg, key) - case "minimalTlsVersion": - err = unpopulate(val, "MinimalTLSVersion", &d.MinimalTLSVersion) - delete(rawMsg, key) - case "networkAclBypass": - err = unpopulate(val, "NetworkACLBypass", &d.NetworkACLBypass) + case "graphApiComputeEndpoint": + err = unpopulate(val, "GraphAPIComputeEndpoint", &g.GraphAPIComputeEndpoint) delete(rawMsg, key) - case "networkAclBypassResourceIds": - err = unpopulate(val, "NetworkACLBypassResourceIDs", &d.NetworkACLBypassResourceIDs) + case "location": + err = unpopulate(val, "Location", &g.Location) delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) + case "name": + err = unpopulate(val, "Name", &g.Name) delete(rawMsg, key) - case "virtualNetworkRules": - err = unpopulate(val, "VirtualNetworkRules", &d.VirtualNetworkRules) + case "status": + err = unpopulate(val, "Status", &g.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseAccountsListResult. -func (d DatabaseAccountsListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GraphAPIComputeServiceResource. +func (g GraphAPIComputeServiceResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", d.Value) + populate(objectMap, "properties", g.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseAccountsListResult. -func (d *DatabaseAccountsListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GraphAPIComputeServiceResource. +func (g *GraphAPIComputeServiceResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &d.Value) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DatabaseRestoreResource. -func (d DatabaseRestoreResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GraphAPIComputeServiceResourceCreateUpdateProperties. +func (g GraphAPIComputeServiceResourceCreateUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "collectionNames", d.CollectionNames) - populate(objectMap, "databaseName", d.DatabaseName) + populate(objectMap, "instanceCount", g.InstanceCount) + populate(objectMap, "instanceSize", g.InstanceSize) + objectMap["serviceType"] = ServiceTypeGraphAPICompute return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseRestoreResource. -func (d *DatabaseRestoreResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GraphAPIComputeServiceResourceCreateUpdateProperties. +func (g *GraphAPIComputeServiceResourceCreateUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "collectionNames": - err = unpopulate(val, "CollectionNames", &d.CollectionNames) + case "instanceCount": + err = unpopulate(val, "InstanceCount", &g.InstanceCount) delete(rawMsg, key) - case "databaseName": - err = unpopulate(val, "DatabaseName", &d.DatabaseName) + case "instanceSize": + err = unpopulate(val, "InstanceSize", &g.InstanceSize) + delete(rawMsg, key) + case "serviceType": + err = unpopulate(val, "ServiceType", &g.ServiceType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GraphAPIComputeServiceResourceProperties. +func (g GraphAPIComputeServiceResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "message", e.Message) + populateDateTimeRFC3339(objectMap, "creationTime", g.CreationTime) + populate(objectMap, "graphApiComputeEndpoint", g.GraphAPIComputeEndpoint) + populate(objectMap, "instanceCount", g.InstanceCount) + populate(objectMap, "instanceSize", g.InstanceSize) + populate(objectMap, "locations", g.Locations) + objectMap["serviceType"] = ServiceTypeGraphAPICompute + populate(objectMap, "status", g.Status) + if g.AdditionalProperties != nil { + for key, val := range g.AdditionalProperties { + objectMap[key] = val + } + } return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GraphAPIComputeServiceResourceProperties. +func (g *GraphAPIComputeServiceResourceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) + case "creationTime": + err = unpopulateDateTimeRFC3339(val, "CreationTime", &g.CreationTime) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + case "graphApiComputeEndpoint": + err = unpopulate(val, "GraphAPIComputeEndpoint", &g.GraphAPIComputeEndpoint) + delete(rawMsg, key) + case "instanceCount": + err = unpopulate(val, "InstanceCount", &g.InstanceCount) + delete(rawMsg, key) + case "instanceSize": + err = unpopulate(val, "InstanceSize", &g.InstanceSize) + delete(rawMsg, key) + case "locations": + err = unpopulate(val, "Locations", &g.Locations) + delete(rawMsg, key) + case "serviceType": + err = unpopulate(val, "ServiceType", &g.ServiceType) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &g.Status) + delete(rawMsg, key) + default: + if g.AdditionalProperties == nil { + g.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + g.AdditionalProperties[key] = aux + } delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExcludedPath. -func (e ExcludedPath) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GraphResource. +func (g GraphResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "path", e.Path) + populate(objectMap, "id", g.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExcludedPath. -func (e *ExcludedPath) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GraphResource. +func (g *GraphResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "path": - err = unpopulate(val, "Path", &e.Path) + case "id": + err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExtendedResourceProperties. -func (e ExtendedResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GraphResourceCreateUpdateParameters. +func (g GraphResourceCreateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "_etag", e.Etag) - populate(objectMap, "_rid", e.Rid) - populate(objectMap, "_ts", e.Ts) + populate(objectMap, "id", g.ID) + populate(objectMap, "identity", g.Identity) + populate(objectMap, "location", g.Location) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "tags", g.Tags) + populate(objectMap, "type", g.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExtendedResourceProperties. -func (e *ExtendedResourceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GraphResourceCreateUpdateParameters. +func (g *GraphResourceCreateUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "_etag": - err = unpopulate(val, "Etag", &e.Etag) + case "id": + err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) - case "_rid": - err = unpopulate(val, "Rid", &e.Rid) + case "identity": + err = unpopulate(val, "Identity", &g.Identity) delete(rawMsg, key) - case "_ts": - err = unpopulate(val, "Ts", &e.Ts) + case "location": + err = unpopulate(val, "Location", &g.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type FailoverPolicies. -func (f FailoverPolicies) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GraphResourceCreateUpdateProperties. +func (g GraphResourceCreateUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "failoverPolicies", f.FailoverPolicies) + populate(objectMap, "options", g.Options) + populate(objectMap, "resource", g.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverPolicies. -func (f *FailoverPolicies) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GraphResourceCreateUpdateProperties. +func (g *GraphResourceCreateUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "failoverPolicies": - err = unpopulate(val, "FailoverPolicies", &f.FailoverPolicies) + case "options": + err = unpopulate(val, "Options", &g.Options) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &g.Resource) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type FailoverPolicy. -func (f FailoverPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GraphResourceGetProperties. +func (g GraphResourceGetProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "failoverPriority", f.FailoverPriority) - populate(objectMap, "id", f.ID) - populate(objectMap, "locationName", f.LocationName) + populate(objectMap, "options", g.Options) + populate(objectMap, "resource", g.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverPolicy. -func (f *FailoverPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GraphResourceGetProperties. +func (g *GraphResourceGetProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "failoverPriority": - err = unpopulate(val, "FailoverPriority", &f.FailoverPriority) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &f.ID) + case "options": + err = unpopulate(val, "Options", &g.Options) delete(rawMsg, key) - case "locationName": - err = unpopulate(val, "LocationName", &f.LocationName) + case "resource": + err = unpopulate(val, "Resource", &g.Resource) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GraphAPIComputeRegionalServiceResource. -func (g GraphAPIComputeRegionalServiceResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GraphResourceGetPropertiesOptions. +func (g GraphResourceGetPropertiesOptions) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "graphApiComputeEndpoint", g.GraphAPIComputeEndpoint) - populate(objectMap, "location", g.Location) - populate(objectMap, "name", g.Name) - populate(objectMap, "status", g.Status) + populate(objectMap, "autoscaleSettings", g.AutoscaleSettings) + populate(objectMap, "throughput", g.Throughput) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GraphAPIComputeRegionalServiceResource. -func (g *GraphAPIComputeRegionalServiceResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GraphResourceGetPropertiesOptions. +func (g *GraphResourceGetPropertiesOptions) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) @@ -3724,17 +5299,11 @@ func (g *GraphAPIComputeRegionalServiceResource) UnmarshalJSON(data []byte) erro for key, val := range rawMsg { var err error switch key { - case "graphApiComputeEndpoint": - err = unpopulate(val, "GraphAPIComputeEndpoint", &g.GraphAPIComputeEndpoint) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &g.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &g.Name) + case "autoscaleSettings": + err = unpopulate(val, "AutoscaleSettings", &g.AutoscaleSettings) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &g.Status) + case "throughput": + err = unpopulate(val, "Throughput", &g.Throughput) delete(rawMsg, key) } if err != nil { @@ -3744,15 +5313,15 @@ func (g *GraphAPIComputeRegionalServiceResource) UnmarshalJSON(data []byte) erro return nil } -// MarshalJSON implements the json.Marshaller interface for type GraphAPIComputeServiceResource. -func (g GraphAPIComputeServiceResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GraphResourceGetPropertiesResource. +func (g GraphResourceGetPropertiesResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", g.Properties) + populate(objectMap, "id", g.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GraphAPIComputeServiceResource. -func (g *GraphAPIComputeServiceResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GraphResourceGetPropertiesResource. +func (g *GraphResourceGetPropertiesResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) @@ -3760,8 +5329,8 @@ func (g *GraphAPIComputeServiceResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &g.Properties) + case "id": + err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) } if err != nil { @@ -3771,17 +5340,21 @@ func (g *GraphAPIComputeServiceResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type GraphAPIComputeServiceResourceCreateUpdateProperties. -func (g GraphAPIComputeServiceResourceCreateUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GraphResourceGetResults. +func (g GraphResourceGetResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "instanceCount", g.InstanceCount) - populate(objectMap, "instanceSize", g.InstanceSize) - objectMap["serviceType"] = ServiceTypeGraphAPICompute + populate(objectMap, "id", g.ID) + populate(objectMap, "identity", g.Identity) + populate(objectMap, "location", g.Location) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "tags", g.Tags) + populate(objectMap, "type", g.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GraphAPIComputeServiceResourceCreateUpdateProperties. -func (g *GraphAPIComputeServiceResourceCreateUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GraphResourceGetResults. +func (g *GraphResourceGetResults) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) @@ -3789,14 +5362,26 @@ func (g *GraphAPIComputeServiceResourceCreateUpdateProperties) UnmarshalJSON(dat for key, val := range rawMsg { var err error switch key { - case "instanceCount": - err = unpopulate(val, "InstanceCount", &g.InstanceCount) + case "id": + err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) - case "instanceSize": - err = unpopulate(val, "InstanceSize", &g.InstanceSize) + case "identity": + err = unpopulate(val, "Identity", &g.Identity) delete(rawMsg, key) - case "serviceType": - err = unpopulate(val, "ServiceType", &g.ServiceType) + case "location": + err = unpopulate(val, "Location", &g.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &g.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) delete(rawMsg, key) } if err != nil { @@ -3806,26 +5391,15 @@ func (g *GraphAPIComputeServiceResourceCreateUpdateProperties) UnmarshalJSON(dat return nil } -// MarshalJSON implements the json.Marshaller interface for type GraphAPIComputeServiceResourceProperties. -func (g GraphAPIComputeServiceResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GraphResourcesListResult. +func (g GraphResourcesListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "creationTime", g.CreationTime) - populate(objectMap, "graphApiComputeEndpoint", g.GraphAPIComputeEndpoint) - populate(objectMap, "instanceCount", g.InstanceCount) - populate(objectMap, "instanceSize", g.InstanceSize) - populate(objectMap, "locations", g.Locations) - objectMap["serviceType"] = ServiceTypeGraphAPICompute - populate(objectMap, "status", g.Status) - if g.AdditionalProperties != nil { - for key, val := range g.AdditionalProperties { - objectMap[key] = val - } - } + populate(objectMap, "value", g.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GraphAPIComputeServiceResourceProperties. -func (g *GraphAPIComputeServiceResourceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GraphResourcesListResult. +func (g *GraphResourcesListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) @@ -3833,36 +5407,8 @@ func (g *GraphAPIComputeServiceResourceProperties) UnmarshalJSON(data []byte) er for key, val := range rawMsg { var err error switch key { - case "creationTime": - err = unpopulateDateTimeRFC3339(val, "CreationTime", &g.CreationTime) - delete(rawMsg, key) - case "graphApiComputeEndpoint": - err = unpopulate(val, "GraphAPIComputeEndpoint", &g.GraphAPIComputeEndpoint) - delete(rawMsg, key) - case "instanceCount": - err = unpopulate(val, "InstanceCount", &g.InstanceCount) - delete(rawMsg, key) - case "instanceSize": - err = unpopulate(val, "InstanceSize", &g.InstanceSize) - delete(rawMsg, key) - case "locations": - err = unpopulate(val, "Locations", &g.Locations) - delete(rawMsg, key) - case "serviceType": - err = unpopulate(val, "ServiceType", &g.ServiceType) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &g.Status) - delete(rawMsg, key) - default: - if g.AdditionalProperties == nil { - g.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - g.AdditionalProperties[key] = aux - } + case "value": + err = unpopulate(val, "Value", &g.Value) delete(rawMsg, key) } if err != nil { @@ -3876,6 +5422,7 @@ func (g *GraphAPIComputeServiceResourceProperties) UnmarshalJSON(data []byte) er func (g GremlinDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", g.ID) + populate(objectMap, "identity", g.Identity) populate(objectMap, "location", g.Location) populate(objectMap, "name", g.Name) populate(objectMap, "properties", g.Properties) @@ -3896,6 +5443,9 @@ func (g *GremlinDatabaseCreateUpdateParameters) UnmarshalJSON(data []byte) error case "id": err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &g.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &g.Location) delete(rawMsg, key) @@ -4063,6 +5613,7 @@ func (g *GremlinDatabaseGetPropertiesResource) UnmarshalJSON(data []byte) error func (g GremlinDatabaseGetResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", g.ID) + populate(objectMap, "identity", g.Identity) populate(objectMap, "location", g.Location) populate(objectMap, "name", g.Name) populate(objectMap, "properties", g.Properties) @@ -4083,6 +5634,9 @@ func (g *GremlinDatabaseGetResults) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &g.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &g.Location) delete(rawMsg, key) @@ -4203,6 +5757,7 @@ func (g *GremlinDatabaseRestoreResource) UnmarshalJSON(data []byte) error { func (g GremlinGraphCreateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", g.ID) + populate(objectMap, "identity", g.Identity) populate(objectMap, "location", g.Location) populate(objectMap, "name", g.Name) populate(objectMap, "properties", g.Properties) @@ -4223,6 +5778,9 @@ func (g *GremlinGraphCreateUpdateParameters) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &g.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &g.Location) delete(rawMsg, key) @@ -4414,6 +5972,7 @@ func (g *GremlinGraphGetPropertiesResource) UnmarshalJSON(data []byte) error { func (g GremlinGraphGetResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", g.ID) + populate(objectMap, "identity", g.Identity) populate(objectMap, "location", g.Location) populate(objectMap, "name", g.Name) populate(objectMap, "properties", g.Properties) @@ -4434,6 +5993,9 @@ func (g *GremlinGraphGetResults) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &g.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &g.Location) delete(rawMsg, key) @@ -4722,6 +6284,33 @@ func (k *KeyWrapMetadata) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ListBackups. +func (l ListBackups) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListBackups. +func (l *ListBackups) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ListClusters. func (l ListClusters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4749,6 +6338,33 @@ func (l *ListClusters) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ListCommands. +func (l ListCommands) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListCommands. +func (l *ListCommands) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ListDataCenters. func (l ListDataCenters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5092,6 +6708,41 @@ func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type MaterializedViewDefinition. +func (m MaterializedViewDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "definition", m.Definition) + populate(objectMap, "sourceCollectionId", m.SourceCollectionID) + populate(objectMap, "sourceCollectionRid", m.SourceCollectionRid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MaterializedViewDefinition. +func (m *MaterializedViewDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "definition": + err = unpopulate(val, "Definition", &m.Definition) + delete(rawMsg, key) + case "sourceCollectionId": + err = unpopulate(val, "SourceCollectionID", &m.SourceCollectionID) + delete(rawMsg, key) + case "sourceCollectionRid": + err = unpopulate(val, "SourceCollectionRid", &m.SourceCollectionRid) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type MaterializedViewsBuilderRegionalServiceResource. func (m MaterializedViewsBuilderRegionalServiceResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5251,6 +6902,33 @@ func (m *MaterializedViewsBuilderServiceResourceProperties) UnmarshalJSON(data [ return nil } +// MarshalJSON implements the json.Marshaller interface for type MergeParameters. +func (m MergeParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isDryRun", m.IsDryRun) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MergeParameters. +func (m *MergeParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isDryRun": + err = unpopulate(val, "IsDryRun", &m.IsDryRun) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Metric. func (m Metric) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5508,6 +7186,7 @@ func (m *MetricValue) UnmarshalJSON(data []byte) error { func (m MongoDBCollectionCreateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) @@ -5528,6 +7207,9 @@ func (m *MongoDBCollectionCreateUpdateParameters) UnmarshalJSON(data []byte) err case "id": err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &m.Location) delete(rawMsg, key) @@ -5707,6 +7389,7 @@ func (m *MongoDBCollectionGetPropertiesResource) UnmarshalJSON(data []byte) erro func (m MongoDBCollectionGetResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) @@ -5727,6 +7410,9 @@ func (m *MongoDBCollectionGetResults) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &m.Location) delete(rawMsg, key) @@ -5828,6 +7514,7 @@ func (m *MongoDBCollectionResource) UnmarshalJSON(data []byte) error { func (m MongoDBDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) @@ -5848,6 +7535,9 @@ func (m *MongoDBDatabaseCreateUpdateParameters) UnmarshalJSON(data []byte) error case "id": err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &m.Location) delete(rawMsg, key) @@ -6015,6 +7705,7 @@ func (m *MongoDBDatabaseGetPropertiesResource) UnmarshalJSON(data []byte) error func (m MongoDBDatabaseGetResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) @@ -6035,6 +7726,9 @@ func (m *MongoDBDatabaseGetResults) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &m.Location) delete(rawMsg, key) @@ -6120,6 +7814,45 @@ func (m *MongoDBDatabaseResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type MongoDataTransferDataSourceSink. +func (m MongoDataTransferDataSourceSink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "collectionName", m.CollectionName) + objectMap["component"] = DataTransferComponentCosmosDBMongo + populate(objectMap, "databaseName", m.DatabaseName) + populate(objectMap, "remoteAccountName", m.RemoteAccountName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MongoDataTransferDataSourceSink. +func (m *MongoDataTransferDataSourceSink) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "collectionName": + err = unpopulate(val, "CollectionName", &m.CollectionName) + delete(rawMsg, key) + case "component": + err = unpopulate(val, "Component", &m.Component) + delete(rawMsg, key) + case "databaseName": + err = unpopulate(val, "DatabaseName", &m.DatabaseName) + delete(rawMsg, key) + case "remoteAccountName": + err = unpopulate(val, "RemoteAccountName", &m.RemoteAccountName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type MongoIndex. func (m MongoIndex) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -6468,18 +8201,256 @@ func (m *MongoUserDefinitionResource) UnmarshalJSON(data []byte) error { case "mechanisms": err = unpopulate(val, "Mechanisms", &m.Mechanisms) delete(rawMsg, key) - case "password": - err = unpopulate(val, "Password", &m.Password) + case "password": + err = unpopulate(val, "Password", &m.Password) + delete(rawMsg, key) + case "roles": + err = unpopulate(val, "Roles", &m.Roles) + delete(rawMsg, key) + case "userName": + err = unpopulate(val, "UserName", &m.UserName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MongoVCoreDataTransferDataSourceSink. +func (m MongoVCoreDataTransferDataSourceSink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "collectionName", m.CollectionName) + objectMap["component"] = DataTransferComponentCosmosDBMongoVCore + populate(objectMap, "connectionStringKeyVaultUri", m.ConnectionStringKeyVaultURI) + populate(objectMap, "databaseName", m.DatabaseName) + populate(objectMap, "hostName", m.HostName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MongoVCoreDataTransferDataSourceSink. +func (m *MongoVCoreDataTransferDataSourceSink) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "collectionName": + err = unpopulate(val, "CollectionName", &m.CollectionName) + delete(rawMsg, key) + case "component": + err = unpopulate(val, "Component", &m.Component) + delete(rawMsg, key) + case "connectionStringKeyVaultUri": + err = unpopulate(val, "ConnectionStringKeyVaultURI", &m.ConnectionStringKeyVaultURI) + delete(rawMsg, key) + case "databaseName": + err = unpopulate(val, "DatabaseName", &m.DatabaseName) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &m.HostName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeter. +func (n NetworkSecurityPerimeter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", n.ID) + populate(objectMap, "location", n.Location) + populate(objectMap, "perimeterGuid", n.PerimeterGUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeter. +func (n *NetworkSecurityPerimeter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &n.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &n.Location) + delete(rawMsg, key) + case "perimeterGuid": + err = unpopulate(val, "PerimeterGUID", &n.PerimeterGUID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterConfiguration. +func (n NetworkSecurityPerimeterConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", n.ID) + populate(objectMap, "name", n.Name) + populate(objectMap, "properties", n.Properties) + populate(objectMap, "systemData", n.SystemData) + populate(objectMap, "type", n.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfiguration. +func (n *NetworkSecurityPerimeterConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &n.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &n.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &n.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterConfigurationListResult. +func (n NetworkSecurityPerimeterConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfigurationListResult. +func (n *NetworkSecurityPerimeterConfigurationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &n.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &n.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityPerimeterConfigurationProperties. +func (n NetworkSecurityPerimeterConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "networkSecurityPerimeter", n.NetworkSecurityPerimeter) + populate(objectMap, "profile", n.Profile) + populate(objectMap, "provisioningIssues", n.ProvisioningIssues) + populate(objectMap, "provisioningState", n.ProvisioningState) + populate(objectMap, "resourceAssociation", n.ResourceAssociation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityPerimeterConfigurationProperties. +func (n *NetworkSecurityPerimeterConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "networkSecurityPerimeter": + err = unpopulate(val, "NetworkSecurityPerimeter", &n.NetworkSecurityPerimeter) + delete(rawMsg, key) + case "profile": + err = unpopulate(val, "Profile", &n.Profile) + delete(rawMsg, key) + case "provisioningIssues": + err = unpopulate(val, "ProvisioningIssues", &n.ProvisioningIssues) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) + delete(rawMsg, key) + case "resourceAssociation": + err = unpopulate(val, "ResourceAssociation", &n.ResourceAssociation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityProfile. +func (n NetworkSecurityProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessRules", n.AccessRules) + populate(objectMap, "accessRulesVersion", n.AccessRulesVersion) + populate(objectMap, "diagnosticSettingsVersion", n.DiagnosticSettingsVersion) + populate(objectMap, "enabledLogCategories", n.EnabledLogCategories) + populate(objectMap, "name", n.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityProfile. +func (n *NetworkSecurityProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accessRules": + err = unpopulate(val, "AccessRules", &n.AccessRules) + delete(rawMsg, key) + case "accessRulesVersion": + err = unpopulate(val, "AccessRulesVersion", &n.AccessRulesVersion) + delete(rawMsg, key) + case "diagnosticSettingsVersion": + err = unpopulate(val, "DiagnosticSettingsVersion", &n.DiagnosticSettingsVersion) delete(rawMsg, key) - case "roles": - err = unpopulate(val, "Roles", &m.Roles) + case "enabledLogCategories": + err = unpopulate(val, "EnabledLogCategories", &n.EnabledLogCategories) delete(rawMsg, key) - case "userName": - err = unpopulate(val, "UserName", &m.UserName) + case "name": + err = unpopulate(val, "Name", &n.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil @@ -7033,8 +9004,285 @@ func (p PercentileMetricValue) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PercentileMetricValue. -func (p *PercentileMetricValue) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PercentileMetricValue. +func (p *PercentileMetricValue) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "average": + err = unpopulate(val, "Average", &p.Average) + delete(rawMsg, key) + case "_count": + err = unpopulate(val, "Count", &p.Count) + delete(rawMsg, key) + case "maximum": + err = unpopulate(val, "Maximum", &p.Maximum) + delete(rawMsg, key) + case "minimum": + err = unpopulate(val, "Minimum", &p.Minimum) + delete(rawMsg, key) + case "P10": + err = unpopulate(val, "P10", &p.P10) + delete(rawMsg, key) + case "P25": + err = unpopulate(val, "P25", &p.P25) + delete(rawMsg, key) + case "P50": + err = unpopulate(val, "P50", &p.P50) + delete(rawMsg, key) + case "P75": + err = unpopulate(val, "P75", &p.P75) + delete(rawMsg, key) + case "P90": + err = unpopulate(val, "P90", &p.P90) + delete(rawMsg, key) + case "P95": + err = unpopulate(val, "P95", &p.P95) + delete(rawMsg, key) + case "P99": + err = unpopulate(val, "P99", &p.P99) + delete(rawMsg, key) + case "timestamp": + err = unpopulateDateTimeRFC3339(val, "Timestamp", &p.Timestamp) + delete(rawMsg, key) + case "total": + err = unpopulate(val, "Total", &p.Total) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PeriodicModeBackupPolicy. +func (p PeriodicModeBackupPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "migrationState", p.MigrationState) + populate(objectMap, "periodicModeProperties", p.PeriodicModeProperties) + objectMap["type"] = BackupPolicyTypePeriodic + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PeriodicModeBackupPolicy. +func (p *PeriodicModeBackupPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "migrationState": + err = unpopulate(val, "MigrationState", &p.MigrationState) + delete(rawMsg, key) + case "periodicModeProperties": + err = unpopulate(val, "PeriodicModeProperties", &p.PeriodicModeProperties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PeriodicModeProperties. +func (p PeriodicModeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupIntervalInMinutes", p.BackupIntervalInMinutes) + populate(objectMap, "backupRetentionIntervalInHours", p.BackupRetentionIntervalInHours) + populate(objectMap, "backupStorageRedundancy", p.BackupStorageRedundancy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PeriodicModeProperties. +func (p *PeriodicModeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupIntervalInMinutes": + err = unpopulate(val, "BackupIntervalInMinutes", &p.BackupIntervalInMinutes) + delete(rawMsg, key) + case "backupRetentionIntervalInHours": + err = unpopulate(val, "BackupRetentionIntervalInHours", &p.BackupRetentionIntervalInHours) + delete(rawMsg, key) + case "backupStorageRedundancy": + err = unpopulate(val, "BackupStorageRedundancy", &p.BackupStorageRedundancy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Permission. +func (p Permission) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataActions", p.DataActions) + populate(objectMap, "notDataActions", p.NotDataActions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Permission. +func (p *Permission) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataActions": + err = unpopulate(val, "DataActions", &p.DataActions) + delete(rawMsg, key) + case "notDataActions": + err = unpopulate(val, "NotDataActions", &p.NotDataActions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PhysicalPartitionID. +func (p PhysicalPartitionID) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PhysicalPartitionID. +func (p *PhysicalPartitionID) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PhysicalPartitionStorageInfo. +func (p PhysicalPartitionStorageInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "storageInKB", p.StorageInKB) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PhysicalPartitionStorageInfo. +func (p *PhysicalPartitionStorageInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "storageInKB": + err = unpopulate(val, "StorageInKB", &p.StorageInKB) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PhysicalPartitionStorageInfoCollection. +func (p PhysicalPartitionStorageInfoCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "physicalPartitionStorageInfoCollection", p.PhysicalPartitionStorageInfoCollection) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PhysicalPartitionStorageInfoCollection. +func (p *PhysicalPartitionStorageInfoCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "physicalPartitionStorageInfoCollection": + err = unpopulate(val, "PhysicalPartitionStorageInfoCollection", &p.PhysicalPartitionStorageInfoCollection) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PhysicalPartitionThroughputInfoProperties. +func (p PhysicalPartitionThroughputInfoProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "physicalPartitionThroughputInfo", p.PhysicalPartitionThroughputInfo) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PhysicalPartitionThroughputInfoProperties. +func (p *PhysicalPartitionThroughputInfoProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "physicalPartitionThroughputInfo": + err = unpopulate(val, "PhysicalPartitionThroughputInfo", &p.PhysicalPartitionThroughputInfo) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PhysicalPartitionThroughputInfoResource. +func (p PhysicalPartitionThroughputInfoResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "throughput", p.Throughput) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PhysicalPartitionThroughputInfoResource. +func (p *PhysicalPartitionThroughputInfoResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -7042,44 +9290,11 @@ func (p *PercentileMetricValue) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "average": - err = unpopulate(val, "Average", &p.Average) - delete(rawMsg, key) - case "_count": - err = unpopulate(val, "Count", &p.Count) - delete(rawMsg, key) - case "maximum": - err = unpopulate(val, "Maximum", &p.Maximum) - delete(rawMsg, key) - case "minimum": - err = unpopulate(val, "Minimum", &p.Minimum) - delete(rawMsg, key) - case "P10": - err = unpopulate(val, "P10", &p.P10) - delete(rawMsg, key) - case "P25": - err = unpopulate(val, "P25", &p.P25) - delete(rawMsg, key) - case "P50": - err = unpopulate(val, "P50", &p.P50) - delete(rawMsg, key) - case "P75": - err = unpopulate(val, "P75", &p.P75) - delete(rawMsg, key) - case "P90": - err = unpopulate(val, "P90", &p.P90) - delete(rawMsg, key) - case "P95": - err = unpopulate(val, "P95", &p.P95) - delete(rawMsg, key) - case "P99": - err = unpopulate(val, "P99", &p.P99) - delete(rawMsg, key) - case "timestamp": - err = unpopulateDateTimeRFC3339(val, "Timestamp", &p.Timestamp) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "total": - err = unpopulate(val, "Total", &p.Total) + case "throughput": + err = unpopulate(val, "Throughput", &p.Throughput) delete(rawMsg, key) } if err != nil { @@ -7089,17 +9304,21 @@ func (p *PercentileMetricValue) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PeriodicModeBackupPolicy. -func (p PeriodicModeBackupPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PhysicalPartitionThroughputInfoResult. +func (p PhysicalPartitionThroughputInfoResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "migrationState", p.MigrationState) - populate(objectMap, "periodicModeProperties", p.PeriodicModeProperties) - objectMap["type"] = BackupPolicyTypePeriodic + populate(objectMap, "id", p.ID) + populate(objectMap, "identity", p.Identity) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PeriodicModeBackupPolicy. -func (p *PeriodicModeBackupPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PhysicalPartitionThroughputInfoResult. +func (p *PhysicalPartitionThroughputInfoResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -7107,11 +9326,23 @@ func (p *PeriodicModeBackupPolicy) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "migrationState": - err = unpopulate(val, "MigrationState", &p.MigrationState) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "periodicModeProperties": - err = unpopulate(val, "PeriodicModeProperties", &p.PeriodicModeProperties) + case "identity": + err = unpopulate(val, "Identity", &p.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) @@ -7124,17 +9355,15 @@ func (p *PeriodicModeBackupPolicy) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PeriodicModeProperties. -func (p PeriodicModeProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PhysicalPartitionThroughputInfoResultProperties. +func (p PhysicalPartitionThroughputInfoResultProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupIntervalInMinutes", p.BackupIntervalInMinutes) - populate(objectMap, "backupRetentionIntervalInHours", p.BackupRetentionIntervalInHours) - populate(objectMap, "backupStorageRedundancy", p.BackupStorageRedundancy) + populate(objectMap, "resource", p.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PeriodicModeProperties. -func (p *PeriodicModeProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PhysicalPartitionThroughputInfoResultProperties. +func (p *PhysicalPartitionThroughputInfoResultProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -7142,14 +9371,8 @@ func (p *PeriodicModeProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "backupIntervalInMinutes": - err = unpopulate(val, "BackupIntervalInMinutes", &p.BackupIntervalInMinutes) - delete(rawMsg, key) - case "backupRetentionIntervalInHours": - err = unpopulate(val, "BackupRetentionIntervalInHours", &p.BackupRetentionIntervalInHours) - delete(rawMsg, key) - case "backupStorageRedundancy": - err = unpopulate(val, "BackupStorageRedundancy", &p.BackupStorageRedundancy) + case "resource": + err = unpopulate(val, "Resource", &p.Resource) delete(rawMsg, key) } if err != nil { @@ -7159,16 +9382,15 @@ func (p *PeriodicModeProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Permission. -func (p Permission) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PhysicalPartitionThroughputInfoResultPropertiesResource. +func (p PhysicalPartitionThroughputInfoResultPropertiesResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dataActions", p.DataActions) - populate(objectMap, "notDataActions", p.NotDataActions) + populate(objectMap, "physicalPartitionThroughputInfo", p.PhysicalPartitionThroughputInfo) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Permission. -func (p *Permission) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PhysicalPartitionThroughputInfoResultPropertiesResource. +func (p *PhysicalPartitionThroughputInfoResultPropertiesResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -7176,11 +9398,8 @@ func (p *Permission) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "dataActions": - err = unpopulate(val, "DataActions", &p.DataActions) - delete(rawMsg, key) - case "notDataActions": - err = unpopulate(val, "NotDataActions", &p.NotDataActions) + case "physicalPartitionThroughputInfo": + err = unpopulate(val, "PhysicalPartitionThroughputInfo", &p.PhysicalPartitionThroughputInfo) delete(rawMsg, key) } if err != nil { @@ -7196,6 +9415,7 @@ func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } @@ -7218,6 +9438,9 @@ func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) @@ -7397,8 +9620,173 @@ func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. -func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionStateProperty. +func (p PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionStateProperty. +func (p *PrivateLinkServiceConnectionStateProperty) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Privilege. +func (p Privilege) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actions", p.Actions) + populate(objectMap, "resource", p.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Privilege. +func (p *Privilege) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actions": + err = unpopulate(val, "Actions", &p.Actions) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &p.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivilegeResource. +func (p PrivilegeResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "collection", p.Collection) + populate(objectMap, "db", p.Db) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivilegeResource. +func (p *PrivilegeResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "collection": + err = unpopulate(val, "Collection", &p.Collection) + delete(rawMsg, key) + case "db": + err = unpopulate(val, "Db", &p.Db) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProvisioningIssue. +func (p ProvisioningIssue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisioningIssue. +func (p *ProvisioningIssue) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProvisioningIssueProperties. +func (p ProvisioningIssueProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", p.Description) + populate(objectMap, "issueType", p.IssueType) + populate(objectMap, "severity", p.Severity) + populate(objectMap, "suggestedAccessRules", p.SuggestedAccessRules) + populate(objectMap, "suggestedResourceIds", p.SuggestedResourceIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProvisioningIssueProperties. +func (p *ProvisioningIssueProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -7406,14 +9794,20 @@ func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "groupId": - err = unpopulate(val, "GroupID", &p.GroupID) + case "description": + err = unpopulate(val, "Description", &p.Description) delete(rawMsg, key) - case "requiredMembers": - err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + case "issueType": + err = unpopulate(val, "IssueType", &p.IssueType) delete(rawMsg, key) - case "requiredZoneNames": - err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + case "severity": + err = unpopulate(val, "Severity", &p.Severity) + delete(rawMsg, key) + case "suggestedAccessRules": + err = unpopulate(val, "SuggestedAccessRules", &p.SuggestedAccessRules) + delete(rawMsg, key) + case "suggestedResourceIds": + err = unpopulate(val, "SuggestedResourceIDs", &p.SuggestedResourceIDs) delete(rawMsg, key) } if err != nil { @@ -7423,17 +9817,18 @@ func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionStateProperty. -func (p PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actionsRequired", p.ActionsRequired) - populate(objectMap, "description", p.Description) - populate(objectMap, "status", p.Status) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionStateProperty. -func (p *PrivateLinkServiceConnectionStateProperty) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -7441,14 +9836,17 @@ func (p *PrivateLinkServiceConnectionStateProperty) UnmarshalJSON(data []byte) e for key, val := range rawMsg { var err error switch key { - case "actionsRequired": - err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &p.Description) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { @@ -7458,98 +9856,114 @@ func (p *PrivateLinkServiceConnectionStateProperty) UnmarshalJSON(data []byte) e return nil } -// MarshalJSON implements the json.Marshaller interface for type Privilege. -func (p Privilege) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RedistributeThroughputParameters. +func (r RedistributeThroughputParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actions", p.Actions) - populate(objectMap, "resource", p.Resource) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Privilege. -func (p *Privilege) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RedistributeThroughputParameters. +func (r *RedistributeThroughputParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "actions": - err = unpopulate(val, "Actions", &p.Actions) + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &p.Resource) + case "identity": + err = unpopulate(val, "Identity", &r.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PrivilegeResource. -func (p PrivilegeResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RedistributeThroughputProperties. +func (r RedistributeThroughputProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "collection", p.Collection) - populate(objectMap, "db", p.Db) + populate(objectMap, "resource", r.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivilegeResource. -func (p *PrivilegeResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RedistributeThroughputProperties. +func (r *RedistributeThroughputProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "collection": - err = unpopulate(val, "Collection", &p.Collection) - delete(rawMsg, key) - case "db": - err = unpopulate(val, "Db", &p.Db) + case "resource": + err = unpopulate(val, "Resource", &r.Resource) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RedistributeThroughputPropertiesResource. +func (r RedistributeThroughputPropertiesResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) + populate(objectMap, "sourcePhysicalPartitionThroughputInfo", r.SourcePhysicalPartitionThroughputInfo) + populate(objectMap, "targetPhysicalPartitionThroughputInfo", r.TargetPhysicalPartitionThroughputInfo) + populate(objectMap, "throughputPolicy", r.ThroughputPolicy) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. -func (p *ProxyResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RedistributeThroughputPropertiesResource. +func (r *RedistributeThroughputPropertiesResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) + case "sourcePhysicalPartitionThroughputInfo": + err = unpopulate(val, "SourcePhysicalPartitionThroughputInfo", &r.SourcePhysicalPartitionThroughputInfo) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) + case "targetPhysicalPartitionThroughputInfo": + err = unpopulate(val, "TargetPhysicalPartitionThroughputInfo", &r.TargetPhysicalPartitionThroughputInfo) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "throughputPolicy": + err = unpopulate(val, "ThroughputPolicy", &r.ThroughputPolicy) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil @@ -7622,6 +10036,7 @@ func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -7641,6 +10056,9 @@ func (r *Resource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -7652,11 +10070,43 @@ func (r *Resource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ResourceAssociation. +func (r ResourceAssociation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessMode", r.AccessMode) + populate(objectMap, "name", r.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAssociation. +func (r *ResourceAssociation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accessMode": + err = unpopulate(val, "AccessMode", &r.AccessMode) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ResourceRestoreParameters. func (r ResourceRestoreParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "restoreSource", r.RestoreSource) populateDateTimeRFC3339(objectMap, "restoreTimestampInUtc", r.RestoreTimestampInUTC) + populate(objectMap, "restoreWithTtlDisabled", r.RestoreWithTTLDisabled) return json.Marshal(objectMap) } @@ -7675,6 +10125,9 @@ func (r *ResourceRestoreParameters) UnmarshalJSON(data []byte) error { case "restoreTimestampInUtc": err = unpopulateDateTimeRFC3339(val, "RestoreTimestampInUTC", &r.RestoreTimestampInUTC) delete(rawMsg, key) + case "restoreWithTtlDisabled": + err = unpopulate(val, "RestoreWithTTLDisabled", &r.RestoreWithTTLDisabled) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -8688,6 +11141,7 @@ func (r RestorableSQLContainerPropertiesResourceContainer) MarshalJSON() ([]byte populate(objectMap, "_etag", r.Etag) populate(objectMap, "id", r.ID) populate(objectMap, "indexingPolicy", r.IndexingPolicy) + populate(objectMap, "materializedViewDefinition", r.MaterializedViewDefinition) populate(objectMap, "partitionKey", r.PartitionKey) populate(objectMap, "restoreParameters", r.RestoreParameters) populate(objectMap, "_rid", r.Rid) @@ -8733,6 +11187,9 @@ func (r *RestorableSQLContainerPropertiesResourceContainer) UnmarshalJSON(data [ case "indexingPolicy": err = unpopulate(val, "IndexingPolicy", &r.IndexingPolicy) delete(rawMsg, key) + case "materializedViewDefinition": + err = unpopulate(val, "MaterializedViewDefinition", &r.MaterializedViewDefinition) + delete(rawMsg, key) case "partitionKey": err = unpopulate(val, "PartitionKey", &r.PartitionKey) delete(rawMsg, key) @@ -9277,6 +11734,8 @@ func (r RestoreParameters) MarshalJSON() ([]byte, error) { populate(objectMap, "restoreMode", r.RestoreMode) populate(objectMap, "restoreSource", r.RestoreSource) populateDateTimeRFC3339(objectMap, "restoreTimestampInUtc", r.RestoreTimestampInUTC) + populate(objectMap, "restoreWithTtlDisabled", r.RestoreWithTTLDisabled) + populate(objectMap, "sourceBackupLocation", r.SourceBackupLocation) populate(objectMap, "tablesToRestore", r.TablesToRestore) return json.Marshal(objectMap) } @@ -9305,6 +11764,12 @@ func (r *RestoreParameters) UnmarshalJSON(data []byte) error { case "restoreTimestampInUtc": err = unpopulateDateTimeRFC3339(val, "RestoreTimestampInUTC", &r.RestoreTimestampInUTC) delete(rawMsg, key) + case "restoreWithTtlDisabled": + err = unpopulate(val, "RestoreWithTTLDisabled", &r.RestoreWithTTLDisabled) + delete(rawMsg, key) + case "sourceBackupLocation": + err = unpopulate(val, "SourceBackupLocation", &r.SourceBackupLocation) + delete(rawMsg, key) case "tablesToRestore": err = unpopulate(val, "TablesToRestore", &r.TablesToRestore) delete(rawMsg, key) @@ -9321,6 +11786,7 @@ func (r RestoreParametersBase) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "restoreSource", r.RestoreSource) populateDateTimeRFC3339(objectMap, "restoreTimestampInUtc", r.RestoreTimestampInUTC) + populate(objectMap, "restoreWithTtlDisabled", r.RestoreWithTTLDisabled) return json.Marshal(objectMap) } @@ -9339,6 +11805,114 @@ func (r *RestoreParametersBase) UnmarshalJSON(data []byte) error { case "restoreTimestampInUtc": err = unpopulateDateTimeRFC3339(val, "RestoreTimestampInUTC", &r.RestoreTimestampInUTC) delete(rawMsg, key) + case "restoreWithTtlDisabled": + err = unpopulate(val, "RestoreWithTTLDisabled", &r.RestoreWithTTLDisabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RetrieveThroughputParameters. +func (r RetrieveThroughputParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "identity", r.Identity) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RetrieveThroughputParameters. +func (r *RetrieveThroughputParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &r.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RetrieveThroughputProperties. +func (r RetrieveThroughputProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resource", r.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RetrieveThroughputProperties. +func (r *RetrieveThroughputProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "resource": + err = unpopulate(val, "Resource", &r.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RetrieveThroughputPropertiesResource. +func (r RetrieveThroughputPropertiesResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "physicalPartitionIds", r.PhysicalPartitionIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RetrieveThroughputPropertiesResource. +func (r *RetrieveThroughputPropertiesResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "physicalPartitionIds": + err = unpopulate(val, "PhysicalPartitionIDs", &r.PhysicalPartitionIDs) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -9382,6 +11956,7 @@ func (r *Role) UnmarshalJSON(data []byte) error { func (s SQLContainerCreateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) @@ -9402,6 +11977,9 @@ func (s *SQLContainerCreateUpdateParameters) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) @@ -9530,6 +12108,7 @@ func (s SQLContainerGetPropertiesResource) MarshalJSON() ([]byte, error) { populate(objectMap, "_etag", s.Etag) populate(objectMap, "id", s.ID) populate(objectMap, "indexingPolicy", s.IndexingPolicy) + populate(objectMap, "materializedViewDefinition", s.MaterializedViewDefinition) populate(objectMap, "partitionKey", s.PartitionKey) populate(objectMap, "restoreParameters", s.RestoreParameters) populate(objectMap, "_rid", s.Rid) @@ -9574,6 +12153,9 @@ func (s *SQLContainerGetPropertiesResource) UnmarshalJSON(data []byte) error { case "indexingPolicy": err = unpopulate(val, "IndexingPolicy", &s.IndexingPolicy) delete(rawMsg, key) + case "materializedViewDefinition": + err = unpopulate(val, "MaterializedViewDefinition", &s.MaterializedViewDefinition) + delete(rawMsg, key) case "partitionKey": err = unpopulate(val, "PartitionKey", &s.PartitionKey) delete(rawMsg, key) @@ -9601,6 +12183,7 @@ func (s *SQLContainerGetPropertiesResource) UnmarshalJSON(data []byte) error { func (s SQLContainerGetResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) @@ -9621,6 +12204,9 @@ func (s *SQLContainerGetResults) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) @@ -9682,6 +12268,7 @@ func (s SQLContainerResource) MarshalJSON() ([]byte, error) { populate(objectMap, "defaultTtl", s.DefaultTTL) populate(objectMap, "id", s.ID) populate(objectMap, "indexingPolicy", s.IndexingPolicy) + populate(objectMap, "materializedViewDefinition", s.MaterializedViewDefinition) populate(objectMap, "partitionKey", s.PartitionKey) populate(objectMap, "restoreParameters", s.RestoreParameters) populate(objectMap, "uniqueKeyPolicy", s.UniqueKeyPolicy) @@ -9721,14 +12308,56 @@ func (s *SQLContainerResource) UnmarshalJSON(data []byte) error { case "indexingPolicy": err = unpopulate(val, "IndexingPolicy", &s.IndexingPolicy) delete(rawMsg, key) - case "partitionKey": - err = unpopulate(val, "PartitionKey", &s.PartitionKey) + case "materializedViewDefinition": + err = unpopulate(val, "MaterializedViewDefinition", &s.MaterializedViewDefinition) + delete(rawMsg, key) + case "partitionKey": + err = unpopulate(val, "PartitionKey", &s.PartitionKey) + delete(rawMsg, key) + case "restoreParameters": + err = unpopulate(val, "RestoreParameters", &s.RestoreParameters) + delete(rawMsg, key) + case "uniqueKeyPolicy": + err = unpopulate(val, "UniqueKeyPolicy", &s.UniqueKeyPolicy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLDataTransferDataSourceSink. +func (s SQLDataTransferDataSourceSink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["component"] = DataTransferComponentCosmosDBSQL + populate(objectMap, "containerName", s.ContainerName) + populate(objectMap, "databaseName", s.DatabaseName) + populate(objectMap, "remoteAccountName", s.RemoteAccountName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLDataTransferDataSourceSink. +func (s *SQLDataTransferDataSourceSink) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "component": + err = unpopulate(val, "Component", &s.Component) + delete(rawMsg, key) + case "containerName": + err = unpopulate(val, "ContainerName", &s.ContainerName) delete(rawMsg, key) - case "restoreParameters": - err = unpopulate(val, "RestoreParameters", &s.RestoreParameters) + case "databaseName": + err = unpopulate(val, "DatabaseName", &s.DatabaseName) delete(rawMsg, key) - case "uniqueKeyPolicy": - err = unpopulate(val, "UniqueKeyPolicy", &s.UniqueKeyPolicy) + case "remoteAccountName": + err = unpopulate(val, "RemoteAccountName", &s.RemoteAccountName) delete(rawMsg, key) } if err != nil { @@ -9742,6 +12371,7 @@ func (s *SQLContainerResource) UnmarshalJSON(data []byte) error { func (s SQLDatabaseCreateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) @@ -9762,6 +12392,9 @@ func (s *SQLDatabaseCreateUpdateParameters) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) @@ -9937,6 +12570,7 @@ func (s *SQLDatabaseGetPropertiesResource) UnmarshalJSON(data []byte) error { func (s SQLDatabaseGetResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) @@ -9957,6 +12591,9 @@ func (s *SQLDatabaseGetResults) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) @@ -10345,15 +12982,260 @@ func (s *SQLRoleAssignmentResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLRoleDefinitionCreateUpdateParameters. -func (s SQLRoleDefinitionCreateUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLRoleDefinitionCreateUpdateParameters. +func (s SQLRoleDefinitionCreateUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLRoleDefinitionCreateUpdateParameters. +func (s *SQLRoleDefinitionCreateUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLRoleDefinitionGetResults. +func (s SQLRoleDefinitionGetResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLRoleDefinitionGetResults. +func (s *SQLRoleDefinitionGetResults) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLRoleDefinitionListResult. +func (s SQLRoleDefinitionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLRoleDefinitionListResult. +func (s *SQLRoleDefinitionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLRoleDefinitionResource. +func (s SQLRoleDefinitionResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assignableScopes", s.AssignableScopes) + populate(objectMap, "permissions", s.Permissions) + populate(objectMap, "roleName", s.RoleName) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLRoleDefinitionResource. +func (s *SQLRoleDefinitionResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assignableScopes": + err = unpopulate(val, "AssignableScopes", &s.AssignableScopes) + delete(rawMsg, key) + case "permissions": + err = unpopulate(val, "Permissions", &s.Permissions) + delete(rawMsg, key) + case "roleName": + err = unpopulate(val, "RoleName", &s.RoleName) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLStoredProcedureCreateUpdateParameters. +func (s SQLStoredProcedureCreateUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLStoredProcedureCreateUpdateParameters. +func (s *SQLStoredProcedureCreateUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLStoredProcedureCreateUpdateProperties. +func (s SQLStoredProcedureCreateUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "options", s.Options) + populate(objectMap, "resource", s.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLStoredProcedureCreateUpdateProperties. +func (s *SQLStoredProcedureCreateUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "options": + err = unpopulate(val, "Options", &s.Options) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &s.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLStoredProcedureGetProperties. +func (s SQLStoredProcedureGetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resource", s.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLStoredProcedureGetProperties. +func (s *SQLStoredProcedureGetProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "resource": + err = unpopulate(val, "Resource", &s.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLStoredProcedureGetPropertiesResource. +func (s SQLStoredProcedureGetPropertiesResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", s.Properties) + populate(objectMap, "body", s.Body) + populate(objectMap, "_etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "_rid", s.Rid) + populate(objectMap, "_ts", s.Ts) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLRoleDefinitionCreateUpdateParameters. -func (s *SQLRoleDefinitionCreateUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLStoredProcedureGetPropertiesResource. +func (s *SQLStoredProcedureGetPropertiesResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10361,8 +13243,20 @@ func (s *SQLRoleDefinitionCreateUpdateParameters) UnmarshalJSON(data []byte) err for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "body": + err = unpopulate(val, "Body", &s.Body) + delete(rawMsg, key) + case "_etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "_rid": + err = unpopulate(val, "Rid", &s.Rid) + delete(rawMsg, key) + case "_ts": + err = unpopulate(val, "Ts", &s.Ts) delete(rawMsg, key) } if err != nil { @@ -10372,18 +13266,21 @@ func (s *SQLRoleDefinitionCreateUpdateParameters) UnmarshalJSON(data []byte) err return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLRoleDefinitionGetResults. -func (s SQLRoleDefinitionGetResults) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLStoredProcedureGetResults. +func (s SQLStoredProcedureGetResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLRoleDefinitionGetResults. -func (s *SQLRoleDefinitionGetResults) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLStoredProcedureGetResults. +func (s *SQLStoredProcedureGetResults) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10394,12 +13291,21 @@ func (s *SQLRoleDefinitionGetResults) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) @@ -10411,15 +13317,15 @@ func (s *SQLRoleDefinitionGetResults) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLRoleDefinitionListResult. -func (s SQLRoleDefinitionListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLStoredProcedureListResult. +func (s SQLStoredProcedureListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLRoleDefinitionListResult. -func (s *SQLRoleDefinitionListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLStoredProcedureListResult. +func (s *SQLStoredProcedureListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10438,18 +13344,16 @@ func (s *SQLRoleDefinitionListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLRoleDefinitionResource. -func (s SQLRoleDefinitionResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLStoredProcedureResource. +func (s SQLStoredProcedureResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "assignableScopes", s.AssignableScopes) - populate(objectMap, "permissions", s.Permissions) - populate(objectMap, "roleName", s.RoleName) - populate(objectMap, "type", s.Type) + populate(objectMap, "body", s.Body) + populate(objectMap, "id", s.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLRoleDefinitionResource. -func (s *SQLRoleDefinitionResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLStoredProcedureResource. +func (s *SQLStoredProcedureResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10457,17 +13361,11 @@ func (s *SQLRoleDefinitionResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "assignableScopes": - err = unpopulate(val, "AssignableScopes", &s.AssignableScopes) - delete(rawMsg, key) - case "permissions": - err = unpopulate(val, "Permissions", &s.Permissions) - delete(rawMsg, key) - case "roleName": - err = unpopulate(val, "RoleName", &s.RoleName) + case "body": + err = unpopulate(val, "Body", &s.Body) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) } if err != nil { @@ -10477,10 +13375,11 @@ func (s *SQLRoleDefinitionResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLStoredProcedureCreateUpdateParameters. -func (s SQLStoredProcedureCreateUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLTriggerCreateUpdateParameters. +func (s SQLTriggerCreateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) @@ -10489,8 +13388,8 @@ func (s SQLStoredProcedureCreateUpdateParameters) MarshalJSON() ([]byte, error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLStoredProcedureCreateUpdateParameters. -func (s *SQLStoredProcedureCreateUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLTriggerCreateUpdateParameters. +func (s *SQLTriggerCreateUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10501,6 +13400,9 @@ func (s *SQLStoredProcedureCreateUpdateParameters) UnmarshalJSON(data []byte) er case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) @@ -10524,16 +13426,16 @@ func (s *SQLStoredProcedureCreateUpdateParameters) UnmarshalJSON(data []byte) er return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLStoredProcedureCreateUpdateProperties. -func (s SQLStoredProcedureCreateUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLTriggerCreateUpdateProperties. +func (s SQLTriggerCreateUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "options", s.Options) populate(objectMap, "resource", s.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLStoredProcedureCreateUpdateProperties. -func (s *SQLStoredProcedureCreateUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLTriggerCreateUpdateProperties. +func (s *SQLTriggerCreateUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10555,15 +13457,15 @@ func (s *SQLStoredProcedureCreateUpdateProperties) UnmarshalJSON(data []byte) er return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLStoredProcedureGetProperties. -func (s SQLStoredProcedureGetProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLTriggerGetProperties. +func (s SQLTriggerGetProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "resource", s.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLStoredProcedureGetProperties. -func (s *SQLStoredProcedureGetProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLTriggerGetProperties. +func (s *SQLTriggerGetProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10582,19 +13484,21 @@ func (s *SQLStoredProcedureGetProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLStoredProcedureGetPropertiesResource. -func (s SQLStoredProcedureGetPropertiesResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLTriggerGetPropertiesResource. +func (s SQLTriggerGetPropertiesResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "body", s.Body) populate(objectMap, "_etag", s.Etag) populate(objectMap, "id", s.ID) populate(objectMap, "_rid", s.Rid) + populate(objectMap, "triggerOperation", s.TriggerOperation) + populate(objectMap, "triggerType", s.TriggerType) populate(objectMap, "_ts", s.Ts) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLStoredProcedureGetPropertiesResource. -func (s *SQLStoredProcedureGetPropertiesResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLTriggerGetPropertiesResource. +func (s *SQLTriggerGetPropertiesResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10614,6 +13518,12 @@ func (s *SQLStoredProcedureGetPropertiesResource) UnmarshalJSON(data []byte) err case "_rid": err = unpopulate(val, "Rid", &s.Rid) delete(rawMsg, key) + case "triggerOperation": + err = unpopulate(val, "TriggerOperation", &s.TriggerOperation) + delete(rawMsg, key) + case "triggerType": + err = unpopulate(val, "TriggerType", &s.TriggerType) + delete(rawMsg, key) case "_ts": err = unpopulate(val, "Ts", &s.Ts) delete(rawMsg, key) @@ -10625,10 +13535,11 @@ func (s *SQLStoredProcedureGetPropertiesResource) UnmarshalJSON(data []byte) err return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLStoredProcedureGetResults. -func (s SQLStoredProcedureGetResults) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLTriggerGetResults. +func (s SQLTriggerGetResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) @@ -10637,8 +13548,8 @@ func (s SQLStoredProcedureGetResults) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLStoredProcedureGetResults. -func (s *SQLStoredProcedureGetResults) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLTriggerGetResults. +func (s *SQLTriggerGetResults) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10649,6 +13560,9 @@ func (s *SQLStoredProcedureGetResults) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) @@ -10672,15 +13586,15 @@ func (s *SQLStoredProcedureGetResults) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLStoredProcedureListResult. -func (s SQLStoredProcedureListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLTriggerListResult. +func (s SQLTriggerListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLStoredProcedureListResult. -func (s *SQLStoredProcedureListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLTriggerListResult. +func (s *SQLTriggerListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10699,16 +13613,18 @@ func (s *SQLStoredProcedureListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLStoredProcedureResource. -func (s SQLStoredProcedureResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLTriggerResource. +func (s SQLTriggerResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "body", s.Body) populate(objectMap, "id", s.ID) + populate(objectMap, "triggerOperation", s.TriggerOperation) + populate(objectMap, "triggerType", s.TriggerType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLStoredProcedureResource. -func (s *SQLStoredProcedureResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLTriggerResource. +func (s *SQLTriggerResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10722,6 +13638,12 @@ func (s *SQLStoredProcedureResource) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) + case "triggerOperation": + err = unpopulate(val, "TriggerOperation", &s.TriggerOperation) + delete(rawMsg, key) + case "triggerType": + err = unpopulate(val, "TriggerType", &s.TriggerType) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10730,10 +13652,11 @@ func (s *SQLStoredProcedureResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLTriggerCreateUpdateParameters. -func (s SQLTriggerCreateUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLUserDefinedFunctionCreateUpdateParameters. +func (s SQLUserDefinedFunctionCreateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) @@ -10742,8 +13665,8 @@ func (s SQLTriggerCreateUpdateParameters) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLTriggerCreateUpdateParameters. -func (s *SQLTriggerCreateUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLUserDefinedFunctionCreateUpdateParameters. +func (s *SQLUserDefinedFunctionCreateUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10754,6 +13677,9 @@ func (s *SQLTriggerCreateUpdateParameters) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) @@ -10777,16 +13703,16 @@ func (s *SQLTriggerCreateUpdateParameters) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLTriggerCreateUpdateProperties. -func (s SQLTriggerCreateUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLUserDefinedFunctionCreateUpdateProperties. +func (s SQLUserDefinedFunctionCreateUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "options", s.Options) populate(objectMap, "resource", s.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLTriggerCreateUpdateProperties. -func (s *SQLTriggerCreateUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLUserDefinedFunctionCreateUpdateProperties. +func (s *SQLUserDefinedFunctionCreateUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10808,15 +13734,15 @@ func (s *SQLTriggerCreateUpdateProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLTriggerGetProperties. -func (s SQLTriggerGetProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLUserDefinedFunctionGetProperties. +func (s SQLUserDefinedFunctionGetProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "resource", s.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLTriggerGetProperties. -func (s *SQLTriggerGetProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLUserDefinedFunctionGetProperties. +func (s *SQLUserDefinedFunctionGetProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10835,21 +13761,19 @@ func (s *SQLTriggerGetProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLTriggerGetPropertiesResource. -func (s SQLTriggerGetPropertiesResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLUserDefinedFunctionGetPropertiesResource. +func (s SQLUserDefinedFunctionGetPropertiesResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "body", s.Body) populate(objectMap, "_etag", s.Etag) populate(objectMap, "id", s.ID) populate(objectMap, "_rid", s.Rid) - populate(objectMap, "triggerOperation", s.TriggerOperation) - populate(objectMap, "triggerType", s.TriggerType) populate(objectMap, "_ts", s.Ts) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLTriggerGetPropertiesResource. -func (s *SQLTriggerGetPropertiesResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLUserDefinedFunctionGetPropertiesResource. +func (s *SQLUserDefinedFunctionGetPropertiesResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10869,12 +13793,6 @@ func (s *SQLTriggerGetPropertiesResource) UnmarshalJSON(data []byte) error { case "_rid": err = unpopulate(val, "Rid", &s.Rid) delete(rawMsg, key) - case "triggerOperation": - err = unpopulate(val, "TriggerOperation", &s.TriggerOperation) - delete(rawMsg, key) - case "triggerType": - err = unpopulate(val, "TriggerType", &s.TriggerType) - delete(rawMsg, key) case "_ts": err = unpopulate(val, "Ts", &s.Ts) delete(rawMsg, key) @@ -10886,10 +13804,11 @@ func (s *SQLTriggerGetPropertiesResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLTriggerGetResults. -func (s SQLTriggerGetResults) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLUserDefinedFunctionGetResults. +func (s SQLUserDefinedFunctionGetResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) @@ -10898,8 +13817,8 @@ func (s SQLTriggerGetResults) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLTriggerGetResults. -func (s *SQLTriggerGetResults) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLUserDefinedFunctionGetResults. +func (s *SQLUserDefinedFunctionGetResults) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10910,6 +13829,9 @@ func (s *SQLTriggerGetResults) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) @@ -10933,15 +13855,15 @@ func (s *SQLTriggerGetResults) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLTriggerListResult. -func (s SQLTriggerListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLUserDefinedFunctionListResult. +func (s SQLUserDefinedFunctionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLTriggerListResult. -func (s *SQLTriggerListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLUserDefinedFunctionListResult. +func (s *SQLUserDefinedFunctionListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10960,18 +13882,46 @@ func (s *SQLTriggerListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLTriggerResource. -func (s SQLTriggerResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLUserDefinedFunctionResource. +func (s SQLUserDefinedFunctionResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "body", s.Body) + populate(objectMap, "id", s.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLUserDefinedFunctionResource. +func (s *SQLUserDefinedFunctionResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "body": + err = unpopulate(val, "Body", &s.Body) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SeedNode. +func (s SeedNode) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "body", s.Body) - populate(objectMap, "id", s.ID) - populate(objectMap, "triggerOperation", s.TriggerOperation) - populate(objectMap, "triggerType", s.TriggerType) + populate(objectMap, "ipAddress", s.IPAddress) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLTriggerResource. -func (s *SQLTriggerResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SeedNode. +func (s *SeedNode) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -10979,17 +13929,8 @@ func (s *SQLTriggerResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "body": - err = unpopulate(val, "Body", &s.Body) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "triggerOperation": - err = unpopulate(val, "TriggerOperation", &s.TriggerOperation) - delete(rawMsg, key) - case "triggerType": - err = unpopulate(val, "TriggerType", &s.TriggerType) + case "ipAddress": + err = unpopulate(val, "IPAddress", &s.IPAddress) delete(rawMsg, key) } if err != nil { @@ -10999,20 +13940,18 @@ func (s *SQLTriggerResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLUserDefinedFunctionCreateUpdateParameters. -func (s SQLUserDefinedFunctionCreateUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServiceResource. +func (s ServiceResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) - populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) - populate(objectMap, "tags", s.Tags) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLUserDefinedFunctionCreateUpdateParameters. -func (s *SQLUserDefinedFunctionCreateUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceResource. +func (s *ServiceResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -11023,17 +13962,11 @@ func (s *SQLUserDefinedFunctionCreateUpdateParameters) UnmarshalJSON(data []byte case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &s.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &s.Tags) + s.Properties, err = unmarshalServiceResourcePropertiesClassification(val) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) @@ -11046,16 +13979,15 @@ func (s *SQLUserDefinedFunctionCreateUpdateParameters) UnmarshalJSON(data []byte return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLUserDefinedFunctionCreateUpdateProperties. -func (s SQLUserDefinedFunctionCreateUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServiceResourceCreateUpdateParameters. +func (s ServiceResourceCreateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "options", s.Options) - populate(objectMap, "resource", s.Resource) + populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLUserDefinedFunctionCreateUpdateProperties. -func (s *SQLUserDefinedFunctionCreateUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceResourceCreateUpdateParameters. +func (s *ServiceResourceCreateUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -11063,11 +13995,8 @@ func (s *SQLUserDefinedFunctionCreateUpdateProperties) UnmarshalJSON(data []byte for key, val := range rawMsg { var err error switch key { - case "options": - err = unpopulate(val, "Options", &s.Options) - delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &s.Resource) + case "properties": + s.Properties, err = unmarshalServiceResourceCreateUpdatePropertiesClassification(val) delete(rawMsg, key) } if err != nil { @@ -11077,15 +14006,17 @@ func (s *SQLUserDefinedFunctionCreateUpdateProperties) UnmarshalJSON(data []byte return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLUserDefinedFunctionGetProperties. -func (s SQLUserDefinedFunctionGetProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServiceResourceCreateUpdateProperties. +func (s ServiceResourceCreateUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "resource", s.Resource) + populate(objectMap, "instanceCount", s.InstanceCount) + populate(objectMap, "instanceSize", s.InstanceSize) + objectMap["serviceType"] = s.ServiceType return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLUserDefinedFunctionGetProperties. -func (s *SQLUserDefinedFunctionGetProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceResourceCreateUpdateProperties. +func (s *ServiceResourceCreateUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -11093,8 +14024,14 @@ func (s *SQLUserDefinedFunctionGetProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "resource": - err = unpopulate(val, "Resource", &s.Resource) + case "instanceCount": + err = unpopulate(val, "InstanceCount", &s.InstanceCount) + delete(rawMsg, key) + case "instanceSize": + err = unpopulate(val, "InstanceSize", &s.InstanceSize) + delete(rawMsg, key) + case "serviceType": + err = unpopulate(val, "ServiceType", &s.ServiceType) delete(rawMsg, key) } if err != nil { @@ -11104,19 +14041,15 @@ func (s *SQLUserDefinedFunctionGetProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLUserDefinedFunctionGetPropertiesResource. -func (s SQLUserDefinedFunctionGetPropertiesResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServiceResourceListResult. +func (s ServiceResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "body", s.Body) - populate(objectMap, "_etag", s.Etag) - populate(objectMap, "id", s.ID) - populate(objectMap, "_rid", s.Rid) - populate(objectMap, "_ts", s.Ts) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLUserDefinedFunctionGetPropertiesResource. -func (s *SQLUserDefinedFunctionGetPropertiesResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceResourceListResult. +func (s *ServiceResourceListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -11124,20 +14057,8 @@ func (s *SQLUserDefinedFunctionGetPropertiesResource) UnmarshalJSON(data []byte) for key, val := range rawMsg { var err error switch key { - case "body": - err = unpopulate(val, "Body", &s.Body) - delete(rawMsg, key) - case "_etag": - err = unpopulate(val, "Etag", &s.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "_rid": - err = unpopulate(val, "Rid", &s.Rid) - delete(rawMsg, key) - case "_ts": - err = unpopulate(val, "Ts", &s.Ts) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { @@ -11147,20 +14068,24 @@ func (s *SQLUserDefinedFunctionGetPropertiesResource) UnmarshalJSON(data []byte) return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLUserDefinedFunctionGetResults. -func (s SQLUserDefinedFunctionGetResults) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ServiceResourceProperties. +func (s ServiceResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "tags", s.Tags) - populate(objectMap, "type", s.Type) + populateDateTimeRFC3339(objectMap, "creationTime", s.CreationTime) + populate(objectMap, "instanceCount", s.InstanceCount) + populate(objectMap, "instanceSize", s.InstanceSize) + objectMap["serviceType"] = s.ServiceType + populate(objectMap, "status", s.Status) + if s.AdditionalProperties != nil { + for key, val := range s.AdditionalProperties { + objectMap[key] = val + } + } return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLUserDefinedFunctionGetResults. -func (s *SQLUserDefinedFunctionGetResults) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceResourceProperties. +func (s *ServiceResourceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -11168,23 +14093,30 @@ func (s *SQLUserDefinedFunctionGetResults) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) + case "creationTime": + err = unpopulateDateTimeRFC3339(val, "CreationTime", &s.CreationTime) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &s.Location) + case "instanceCount": + err = unpopulate(val, "InstanceCount", &s.InstanceCount) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) + case "instanceSize": + err = unpopulate(val, "InstanceSize", &s.InstanceSize) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) + case "serviceType": + err = unpopulate(val, "ServiceType", &s.ServiceType) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &s.Tags) + case "status": + err = unpopulate(val, "Status", &s.Status) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + default: + if s.AdditionalProperties == nil { + s.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + s.AdditionalProperties[key] = aux + } delete(rawMsg, key) } if err != nil { @@ -11194,15 +14126,16 @@ func (s *SQLUserDefinedFunctionGetResults) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLUserDefinedFunctionListResult. -func (s SQLUserDefinedFunctionListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SpatialSpec. +func (s SpatialSpec) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", s.Value) + populate(objectMap, "path", s.Path) + populate(objectMap, "types", s.Types) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLUserDefinedFunctionListResult. -func (s *SQLUserDefinedFunctionListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SpatialSpec. +func (s *SpatialSpec) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -11210,8 +14143,11 @@ func (s *SQLUserDefinedFunctionListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &s.Value) + case "path": + err = unpopulate(val, "Path", &s.Path) + delete(rawMsg, key) + case "types": + err = unpopulate(val, "Types", &s.Types) delete(rawMsg, key) } if err != nil { @@ -11221,16 +14157,20 @@ func (s *SQLUserDefinedFunctionListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SQLUserDefinedFunctionResource. -func (s SQLUserDefinedFunctionResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "body", s.Body) - populate(objectMap, "id", s.ID) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLUserDefinedFunctionResource. -func (s *SQLUserDefinedFunctionResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -11238,38 +14178,23 @@ func (s *SQLUserDefinedFunctionResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "body": - err = unpopulate(val, "Body", &s.Body) + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SeedNode. -func (s SeedNode) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "ipAddress", s.IPAddress) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SeedNode. -func (s *SeedNode) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "ipAddress": - err = unpopulate(val, "IPAddress", &s.IPAddress) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) delete(rawMsg, key) } if err != nil { @@ -11279,284 +14204,286 @@ func (s *SeedNode) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceResource. -func (s ServiceResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) +// MarshalJSON implements the json.Marshaller interface for type TableCreateUpdateParameters. +func (t TableCreateUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "identity", t.Identity) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceResource. -func (s *ServiceResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TableCreateUpdateParameters. +func (t *TableCreateUpdateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &s.ID) + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &t.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &s.Name) + err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) case "properties": - s.Properties, err = unmarshalServiceResourcePropertiesClassification(val) + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &s.Type) + err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceResourceCreateUpdateParameters. -func (s ServiceResourceCreateUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TableCreateUpdateProperties. +func (t TableCreateUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", s.Properties) + populate(objectMap, "options", t.Options) + populate(objectMap, "resource", t.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceResourceCreateUpdateParameters. -func (s *ServiceResourceCreateUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TableCreateUpdateProperties. +func (t *TableCreateUpdateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - s.Properties, err = unmarshalServiceResourceCreateUpdatePropertiesClassification(val) + case "options": + err = unpopulate(val, "Options", &t.Options) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &t.Resource) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceResourceCreateUpdateProperties. -func (s ServiceResourceCreateUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TableGetProperties. +func (t TableGetProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "instanceCount", s.InstanceCount) - populate(objectMap, "instanceSize", s.InstanceSize) - objectMap["serviceType"] = s.ServiceType + populate(objectMap, "options", t.Options) + populate(objectMap, "resource", t.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceResourceCreateUpdateProperties. -func (s *ServiceResourceCreateUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TableGetProperties. +func (t *TableGetProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "instanceCount": - err = unpopulate(val, "InstanceCount", &s.InstanceCount) - delete(rawMsg, key) - case "instanceSize": - err = unpopulate(val, "InstanceSize", &s.InstanceSize) + case "options": + err = unpopulate(val, "Options", &t.Options) delete(rawMsg, key) - case "serviceType": - err = unpopulate(val, "ServiceType", &s.ServiceType) + case "resource": + err = unpopulate(val, "Resource", &t.Resource) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceResourceListResult. -func (s ServiceResourceListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TableGetPropertiesOptions. +func (t TableGetPropertiesOptions) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", s.Value) + populate(objectMap, "autoscaleSettings", t.AutoscaleSettings) + populate(objectMap, "throughput", t.Throughput) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceResourceListResult. -func (s *ServiceResourceListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TableGetPropertiesOptions. +func (t *TableGetPropertiesOptions) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &s.Value) + case "autoscaleSettings": + err = unpopulate(val, "AutoscaleSettings", &t.AutoscaleSettings) + delete(rawMsg, key) + case "throughput": + err = unpopulate(val, "Throughput", &t.Throughput) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ServiceResourceProperties. -func (s ServiceResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TableGetPropertiesResource. +func (t TableGetPropertiesResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "creationTime", s.CreationTime) - populate(objectMap, "instanceCount", s.InstanceCount) - populate(objectMap, "instanceSize", s.InstanceSize) - objectMap["serviceType"] = s.ServiceType - populate(objectMap, "status", s.Status) - if s.AdditionalProperties != nil { - for key, val := range s.AdditionalProperties { - objectMap[key] = val - } - } + populate(objectMap, "createMode", t.CreateMode) + populate(objectMap, "_etag", t.Etag) + populate(objectMap, "id", t.ID) + populate(objectMap, "restoreParameters", t.RestoreParameters) + populate(objectMap, "_rid", t.Rid) + populate(objectMap, "_ts", t.Ts) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceResourceProperties. -func (s *ServiceResourceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TableGetPropertiesResource. +func (t *TableGetPropertiesResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "creationTime": - err = unpopulateDateTimeRFC3339(val, "CreationTime", &s.CreationTime) + case "createMode": + err = unpopulate(val, "CreateMode", &t.CreateMode) delete(rawMsg, key) - case "instanceCount": - err = unpopulate(val, "InstanceCount", &s.InstanceCount) + case "_etag": + err = unpopulate(val, "Etag", &t.Etag) delete(rawMsg, key) - case "instanceSize": - err = unpopulate(val, "InstanceSize", &s.InstanceSize) + case "id": + err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) - case "serviceType": - err = unpopulate(val, "ServiceType", &s.ServiceType) + case "restoreParameters": + err = unpopulate(val, "RestoreParameters", &t.RestoreParameters) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) + case "_rid": + err = unpopulate(val, "Rid", &t.Rid) delete(rawMsg, key) - default: - if s.AdditionalProperties == nil { - s.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - s.AdditionalProperties[key] = aux - } + case "_ts": + err = unpopulate(val, "Ts", &t.Ts) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SpatialSpec. -func (s SpatialSpec) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TableGetResults. +func (t TableGetResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "path", s.Path) - populate(objectMap, "types", s.Types) + populate(objectMap, "id", t.ID) + populate(objectMap, "identity", t.Identity) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SpatialSpec. -func (s *SpatialSpec) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TableGetResults. +func (t *TableGetResults) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "path": - err = unpopulate(val, "Path", &s.Path) + case "id": + err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) - case "types": - err = unpopulate(val, "Types", &s.Types) + case "identity": + err = unpopulate(val, "Identity", &t.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TableListResult. +func (t TableListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + populate(objectMap, "value", t.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TableListResult. +func (t *TableListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + case "value": + err = unpopulate(val, "Value", &t.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type TableCreateUpdateParameters. -func (t TableCreateUpdateParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TableResource. +func (t TableResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "createMode", t.CreateMode) populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) + populate(objectMap, "restoreParameters", t.RestoreParameters) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TableCreateUpdateParameters. -func (t *TableCreateUpdateParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TableResource. +func (t *TableResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -11564,23 +14491,14 @@ func (t *TableCreateUpdateParameters) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "createMode": + err = unpopulate(val, "CreateMode", &t.CreateMode) + delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &t.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) + case "restoreParameters": + err = unpopulate(val, "RestoreParameters", &t.RestoreParameters) delete(rawMsg, key) } if err != nil { @@ -11590,16 +14508,16 @@ func (t *TableCreateUpdateParameters) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TableCreateUpdateProperties. -func (t TableCreateUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ThroughputPolicyResource. +func (t ThroughputPolicyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "options", t.Options) - populate(objectMap, "resource", t.Resource) + populate(objectMap, "incrementPercent", t.IncrementPercent) + populate(objectMap, "isEnabled", t.IsEnabled) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TableCreateUpdateProperties. -func (t *TableCreateUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ThroughputPolicyResource. +func (t *ThroughputPolicyResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -11607,11 +14525,11 @@ func (t *TableCreateUpdateProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "options": - err = unpopulate(val, "Options", &t.Options) + case "incrementPercent": + err = unpopulate(val, "IncrementPercent", &t.IncrementPercent) delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &t.Resource) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &t.IsEnabled) delete(rawMsg, key) } if err != nil { @@ -11621,16 +14539,16 @@ func (t *TableCreateUpdateProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TableGetProperties. -func (t TableGetProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ThroughputPoolAccountCreateParameters. +func (t ThroughputPoolAccountCreateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "options", t.Options) - populate(objectMap, "resource", t.Resource) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "tags", t.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TableGetProperties. -func (t *TableGetProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ThroughputPoolAccountCreateParameters. +func (t *ThroughputPoolAccountCreateParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -11638,11 +14556,11 @@ func (t *TableGetProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "options": - err = unpopulate(val, "Options", &t.Options) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &t.Resource) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) } if err != nil { @@ -11652,16 +14570,16 @@ func (t *TableGetProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TableGetPropertiesOptions. -func (t TableGetPropertiesOptions) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ThroughputPoolAccountCreateProperties. +func (t ThroughputPoolAccountCreateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "autoscaleSettings", t.AutoscaleSettings) - populate(objectMap, "throughput", t.Throughput) + populate(objectMap, "accountLocation", t.AccountLocation) + populate(objectMap, "accountResourceIdentifier", t.AccountResourceIdentifier) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TableGetPropertiesOptions. -func (t *TableGetPropertiesOptions) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ThroughputPoolAccountCreateProperties. +func (t *ThroughputPoolAccountCreateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -11669,11 +14587,11 @@ func (t *TableGetPropertiesOptions) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "autoscaleSettings": - err = unpopulate(val, "AutoscaleSettings", &t.AutoscaleSettings) + case "accountLocation": + err = unpopulate(val, "AccountLocation", &t.AccountLocation) delete(rawMsg, key) - case "throughput": - err = unpopulate(val, "Throughput", &t.Throughput) + case "accountResourceIdentifier": + err = unpopulate(val, "AccountResourceIdentifier", &t.AccountResourceIdentifier) delete(rawMsg, key) } if err != nil { @@ -11683,20 +14601,18 @@ func (t *TableGetPropertiesOptions) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TableGetPropertiesResource. -func (t TableGetPropertiesResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ThroughputPoolAccountProperties. +func (t ThroughputPoolAccountProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "createMode", t.CreateMode) - populate(objectMap, "_etag", t.Etag) - populate(objectMap, "id", t.ID) - populate(objectMap, "restoreParameters", t.RestoreParameters) - populate(objectMap, "_rid", t.Rid) - populate(objectMap, "_ts", t.Ts) + populate(objectMap, "accountInstanceId", t.AccountInstanceID) + populate(objectMap, "accountLocation", t.AccountLocation) + populate(objectMap, "accountResourceIdentifier", t.AccountResourceIdentifier) + populate(objectMap, "provisioningState", t.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TableGetPropertiesResource. -func (t *TableGetPropertiesResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ThroughputPoolAccountProperties. +func (t *ThroughputPoolAccountProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -11704,23 +14620,17 @@ func (t *TableGetPropertiesResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "createMode": - err = unpopulate(val, "CreateMode", &t.CreateMode) - delete(rawMsg, key) - case "_etag": - err = unpopulate(val, "Etag", &t.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &t.ID) + case "accountInstanceId": + err = unpopulate(val, "AccountInstanceID", &t.AccountInstanceID) delete(rawMsg, key) - case "restoreParameters": - err = unpopulate(val, "RestoreParameters", &t.RestoreParameters) + case "accountLocation": + err = unpopulate(val, "AccountLocation", &t.AccountLocation) delete(rawMsg, key) - case "_rid": - err = unpopulate(val, "Rid", &t.Rid) + case "accountResourceIdentifier": + err = unpopulate(val, "AccountResourceIdentifier", &t.AccountResourceIdentifier) delete(rawMsg, key) - case "_ts": - err = unpopulate(val, "Ts", &t.Ts) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) delete(rawMsg, key) } if err != nil { @@ -11730,20 +14640,19 @@ func (t *TableGetPropertiesResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TableGetResults. -func (t TableGetResults) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ThroughputPoolAccountResource. +func (t ThroughputPoolAccountResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) populate(objectMap, "properties", t.Properties) - populate(objectMap, "tags", t.Tags) + populate(objectMap, "systemData", t.SystemData) populate(objectMap, "type", t.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TableGetResults. -func (t *TableGetResults) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ThroughputPoolAccountResource. +func (t *ThroughputPoolAccountResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -11754,17 +14663,14 @@ func (t *TableGetResults) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &t.Properties) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &t.Type) @@ -11777,15 +14683,16 @@ func (t *TableGetResults) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TableListResult. -func (t TableListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ThroughputPoolAccountsListResult. +func (t ThroughputPoolAccountsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", t.NextLink) populate(objectMap, "value", t.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TableListResult. -func (t *TableListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ThroughputPoolAccountsListResult. +func (t *ThroughputPoolAccountsListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -11793,6 +14700,9 @@ func (t *TableListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &t.Value) delete(rawMsg, key) @@ -11804,17 +14714,16 @@ func (t *TableListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TableResource. -func (t TableResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ThroughputPoolProperties. +func (t ThroughputPoolProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "createMode", t.CreateMode) - populate(objectMap, "id", t.ID) - populate(objectMap, "restoreParameters", t.RestoreParameters) + populate(objectMap, "maxThroughput", t.MaxThroughput) + populate(objectMap, "provisioningState", t.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TableResource. -func (t *TableResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ThroughputPoolProperties. +func (t *ThroughputPoolProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -11822,14 +14731,62 @@ func (t *TableResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "createMode": - err = unpopulate(val, "CreateMode", &t.CreateMode) + case "maxThroughput": + err = unpopulate(val, "MaxThroughput", &t.MaxThroughput) delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThroughputPoolResource. +func (t ThroughputPoolResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThroughputPoolResource. +func (t *ThroughputPoolResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { case "id": err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) - case "restoreParameters": - err = unpopulate(val, "RestoreParameters", &t.RestoreParameters) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) } if err != nil { @@ -11839,16 +14796,15 @@ func (t *TableResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ThroughputPolicyResource. -func (t ThroughputPolicyResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ThroughputPoolUpdate. +func (t ThroughputPoolUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "incrementPercent", t.IncrementPercent) - populate(objectMap, "isEnabled", t.IsEnabled) + populate(objectMap, "properties", t.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ThroughputPolicyResource. -func (t *ThroughputPolicyResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ThroughputPoolUpdate. +func (t *ThroughputPoolUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -11856,11 +14812,39 @@ func (t *ThroughputPolicyResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "incrementPercent": - err = unpopulate(val, "IncrementPercent", &t.IncrementPercent) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &t.IsEnabled) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThroughputPoolsListResult. +func (t ThroughputPoolsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThroughputPoolsListResult. +func (t *ThroughputPoolsListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) delete(rawMsg, key) } if err != nil { @@ -11960,6 +14944,7 @@ func (t *ThroughputSettingsGetPropertiesResource) UnmarshalJSON(data []byte) err func (t ThroughputSettingsGetResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", t.ID) + populate(objectMap, "identity", t.Identity) populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) populate(objectMap, "properties", t.Properties) @@ -11980,6 +14965,9 @@ func (t *ThroughputSettingsGetResults) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &t.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &t.Location) delete(rawMsg, key) @@ -12054,6 +15042,7 @@ func (t *ThroughputSettingsResource) UnmarshalJSON(data []byte) error { func (t ThroughputSettingsUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", t.ID) + populate(objectMap, "identity", t.Identity) populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) populate(objectMap, "properties", t.Properties) @@ -12074,6 +15063,9 @@ func (t *ThroughputSettingsUpdateParameters) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &t.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &t.Location) delete(rawMsg, key) @@ -12124,6 +15116,53 @@ func (t *ThroughputSettingsUpdateProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type UniqueKey. func (u UniqueKey) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -12289,6 +15328,16 @@ func populate(m map[string]any, k string, v any) { } } +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + func populateByteArray[T any](m map[string]any, k string, b []T, convert func() any) { if azcore.IsNullValue(b) { m[k] = nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/mongodbresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/mongodbresources_client.go index c8861f8d051c..c88d28ac4f7e 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/mongodbresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/mongodbresources_client.go @@ -46,7 +46,7 @@ func NewMongoDBResourcesClient(subscriptionID string, credential azcore.TokenCre // BeginCreateUpdateMongoDBCollection - Create or update an Azure Cosmos DB MongoDB Collection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -74,7 +74,7 @@ func (client *MongoDBResourcesClient) BeginCreateUpdateMongoDBCollection(ctx con // CreateUpdateMongoDBCollection - Create or update an Azure Cosmos DB MongoDB Collection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *MongoDBResourcesClient) createUpdateMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, createUpdateMongoDBCollectionParameters MongoDBCollectionCreateUpdateParameters, options *MongoDBResourcesClientBeginCreateUpdateMongoDBCollectionOptions) (*http.Response, error) { var err error const operationName = "MongoDBResourcesClient.BeginCreateUpdateMongoDBCollection" @@ -124,7 +124,7 @@ func (client *MongoDBResourcesClient) createUpdateMongoDBCollectionCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateMongoDBCollectionParameters); err != nil { @@ -136,7 +136,7 @@ func (client *MongoDBResourcesClient) createUpdateMongoDBCollectionCreateRequest // BeginCreateUpdateMongoDBDatabase - Create or updates Azure Cosmos DB MongoDB database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -163,7 +163,7 @@ func (client *MongoDBResourcesClient) BeginCreateUpdateMongoDBDatabase(ctx conte // CreateUpdateMongoDBDatabase - Create or updates Azure Cosmos DB MongoDB database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *MongoDBResourcesClient) createUpdateMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters MongoDBDatabaseCreateUpdateParameters, options *MongoDBResourcesClientBeginCreateUpdateMongoDBDatabaseOptions) (*http.Response, error) { var err error const operationName = "MongoDBResourcesClient.BeginCreateUpdateMongoDBDatabase" @@ -209,7 +209,7 @@ func (client *MongoDBResourcesClient) createUpdateMongoDBDatabaseCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateMongoDBDatabaseParameters); err != nil { @@ -221,7 +221,7 @@ func (client *MongoDBResourcesClient) createUpdateMongoDBDatabaseCreateRequest(c // BeginCreateUpdateMongoRoleDefinition - Creates or updates an Azure Cosmos DB Mongo Role Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - mongoRoleDefinitionID - The ID for the Role Definition {dbName.roleName}. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. @@ -248,7 +248,7 @@ func (client *MongoDBResourcesClient) BeginCreateUpdateMongoRoleDefinition(ctx c // CreateUpdateMongoRoleDefinition - Creates or updates an Azure Cosmos DB Mongo Role Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *MongoDBResourcesClient) createUpdateMongoRoleDefinition(ctx context.Context, mongoRoleDefinitionID string, resourceGroupName string, accountName string, createUpdateMongoRoleDefinitionParameters MongoRoleDefinitionCreateUpdateParameters, options *MongoDBResourcesClientBeginCreateUpdateMongoRoleDefinitionOptions) (*http.Response, error) { var err error const operationName = "MongoDBResourcesClient.BeginCreateUpdateMongoRoleDefinition" @@ -294,7 +294,7 @@ func (client *MongoDBResourcesClient) createUpdateMongoRoleDefinitionCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateMongoRoleDefinitionParameters); err != nil { @@ -306,7 +306,7 @@ func (client *MongoDBResourcesClient) createUpdateMongoRoleDefinitionCreateReque // BeginCreateUpdateMongoUserDefinition - Creates or updates an Azure Cosmos DB Mongo User Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - mongoUserDefinitionID - The ID for the User Definition {dbName.userName}. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. @@ -333,7 +333,7 @@ func (client *MongoDBResourcesClient) BeginCreateUpdateMongoUserDefinition(ctx c // CreateUpdateMongoUserDefinition - Creates or updates an Azure Cosmos DB Mongo User Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *MongoDBResourcesClient) createUpdateMongoUserDefinition(ctx context.Context, mongoUserDefinitionID string, resourceGroupName string, accountName string, createUpdateMongoUserDefinitionParameters MongoUserDefinitionCreateUpdateParameters, options *MongoDBResourcesClientBeginCreateUpdateMongoUserDefinitionOptions) (*http.Response, error) { var err error const operationName = "MongoDBResourcesClient.BeginCreateUpdateMongoUserDefinition" @@ -379,7 +379,7 @@ func (client *MongoDBResourcesClient) createUpdateMongoUserDefinitionCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateMongoUserDefinitionParameters); err != nil { @@ -391,7 +391,7 @@ func (client *MongoDBResourcesClient) createUpdateMongoUserDefinitionCreateReque // BeginDeleteMongoDBCollection - Deletes an existing Azure Cosmos DB MongoDB Collection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -418,7 +418,7 @@ func (client *MongoDBResourcesClient) BeginDeleteMongoDBCollection(ctx context.C // DeleteMongoDBCollection - Deletes an existing Azure Cosmos DB MongoDB Collection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *MongoDBResourcesClient) deleteMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, options *MongoDBResourcesClientBeginDeleteMongoDBCollectionOptions) (*http.Response, error) { var err error const operationName = "MongoDBResourcesClient.BeginDeleteMongoDBCollection" @@ -468,7 +468,7 @@ func (client *MongoDBResourcesClient) deleteMongoDBCollectionCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -476,7 +476,7 @@ func (client *MongoDBResourcesClient) deleteMongoDBCollectionCreateRequest(ctx c // BeginDeleteMongoDBDatabase - Deletes an existing Azure Cosmos DB MongoDB database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -502,7 +502,7 @@ func (client *MongoDBResourcesClient) BeginDeleteMongoDBDatabase(ctx context.Con // DeleteMongoDBDatabase - Deletes an existing Azure Cosmos DB MongoDB database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *MongoDBResourcesClient) deleteMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *MongoDBResourcesClientBeginDeleteMongoDBDatabaseOptions) (*http.Response, error) { var err error const operationName = "MongoDBResourcesClient.BeginDeleteMongoDBDatabase" @@ -548,7 +548,7 @@ func (client *MongoDBResourcesClient) deleteMongoDBDatabaseCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -556,7 +556,7 @@ func (client *MongoDBResourcesClient) deleteMongoDBDatabaseCreateRequest(ctx con // BeginDeleteMongoRoleDefinition - Deletes an existing Azure Cosmos DB Mongo Role Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - mongoRoleDefinitionID - The ID for the Role Definition {dbName.roleName}. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. @@ -582,7 +582,7 @@ func (client *MongoDBResourcesClient) BeginDeleteMongoRoleDefinition(ctx context // DeleteMongoRoleDefinition - Deletes an existing Azure Cosmos DB Mongo Role Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *MongoDBResourcesClient) deleteMongoRoleDefinition(ctx context.Context, mongoRoleDefinitionID string, resourceGroupName string, accountName string, options *MongoDBResourcesClientBeginDeleteMongoRoleDefinitionOptions) (*http.Response, error) { var err error const operationName = "MongoDBResourcesClient.BeginDeleteMongoRoleDefinition" @@ -628,7 +628,7 @@ func (client *MongoDBResourcesClient) deleteMongoRoleDefinitionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -637,7 +637,7 @@ func (client *MongoDBResourcesClient) deleteMongoRoleDefinitionCreateRequest(ctx // BeginDeleteMongoUserDefinition - Deletes an existing Azure Cosmos DB Mongo User Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - mongoUserDefinitionID - The ID for the User Definition {dbName.userName}. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. @@ -663,7 +663,7 @@ func (client *MongoDBResourcesClient) BeginDeleteMongoUserDefinition(ctx context // DeleteMongoUserDefinition - Deletes an existing Azure Cosmos DB Mongo User Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *MongoDBResourcesClient) deleteMongoUserDefinition(ctx context.Context, mongoUserDefinitionID string, resourceGroupName string, accountName string, options *MongoDBResourcesClientBeginDeleteMongoUserDefinitionOptions) (*http.Response, error) { var err error const operationName = "MongoDBResourcesClient.BeginDeleteMongoUserDefinition" @@ -709,7 +709,7 @@ func (client *MongoDBResourcesClient) deleteMongoUserDefinitionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -718,7 +718,7 @@ func (client *MongoDBResourcesClient) deleteMongoUserDefinitionCreateRequest(ctx // GetMongoDBCollection - Gets the MongoDB collection under an existing Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -775,7 +775,7 @@ func (client *MongoDBResourcesClient) getMongoDBCollectionCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -794,7 +794,7 @@ func (client *MongoDBResourcesClient) getMongoDBCollectionHandleResponse(resp *h // account with the provided name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -851,7 +851,7 @@ func (client *MongoDBResourcesClient) getMongoDBCollectionThroughputCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -869,7 +869,7 @@ func (client *MongoDBResourcesClient) getMongoDBCollectionThroughputHandleRespon // GetMongoDBDatabase - Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -921,7 +921,7 @@ func (client *MongoDBResourcesClient) getMongoDBDatabaseCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -940,7 +940,7 @@ func (client *MongoDBResourcesClient) getMongoDBDatabaseHandleResponse(resp *htt // account with the provided name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -992,7 +992,7 @@ func (client *MongoDBResourcesClient) getMongoDBDatabaseThroughputCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1010,7 +1010,7 @@ func (client *MongoDBResourcesClient) getMongoDBDatabaseThroughputHandleResponse // GetMongoRoleDefinition - Retrieves the properties of an existing Azure Cosmos DB Mongo Role Definition with the given Id. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - mongoRoleDefinitionID - The ID for the Role Definition {dbName.roleName}. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. @@ -1062,7 +1062,7 @@ func (client *MongoDBResourcesClient) getMongoRoleDefinitionCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1080,7 +1080,7 @@ func (client *MongoDBResourcesClient) getMongoRoleDefinitionHandleResponse(resp // GetMongoUserDefinition - Retrieves the properties of an existing Azure Cosmos DB Mongo User Definition with the given Id. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - mongoUserDefinitionID - The ID for the User Definition {dbName.userName}. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. @@ -1132,7 +1132,7 @@ func (client *MongoDBResourcesClient) getMongoUserDefinitionCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1147,9 +1147,100 @@ func (client *MongoDBResourcesClient) getMongoUserDefinitionHandleResponse(resp return result, nil } +// BeginListMongoDBCollectionPartitionMerge - Merges the partitions of a MongoDB Collection +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - databaseName - Cosmos DB database name. +// - collectionName - Cosmos DB collection name. +// - mergeParameters - The parameters for the merge operation. +// - options - MongoDBResourcesClientBeginListMongoDBCollectionPartitionMergeOptions contains the optional parameters for the +// MongoDBResourcesClient.BeginListMongoDBCollectionPartitionMerge method. +func (client *MongoDBResourcesClient) BeginListMongoDBCollectionPartitionMerge(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, mergeParameters MergeParameters, options *MongoDBResourcesClientBeginListMongoDBCollectionPartitionMergeOptions) (*runtime.Poller[MongoDBResourcesClientListMongoDBCollectionPartitionMergeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listMongoDBCollectionPartitionMerge(ctx, resourceGroupName, accountName, databaseName, collectionName, mergeParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientListMongoDBCollectionPartitionMergeResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MongoDBResourcesClientListMongoDBCollectionPartitionMergeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ListMongoDBCollectionPartitionMerge - Merges the partitions of a MongoDB Collection +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *MongoDBResourcesClient) listMongoDBCollectionPartitionMerge(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, mergeParameters MergeParameters, options *MongoDBResourcesClientBeginListMongoDBCollectionPartitionMergeOptions) (*http.Response, error) { + var err error + const operationName = "MongoDBResourcesClient.BeginListMongoDBCollectionPartitionMerge" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listMongoDBCollectionPartitionMergeCreateRequest(ctx, resourceGroupName, accountName, databaseName, collectionName, mergeParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// listMongoDBCollectionPartitionMergeCreateRequest creates the ListMongoDBCollectionPartitionMerge request. +func (client *MongoDBResourcesClient) listMongoDBCollectionPartitionMergeCreateRequest(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, mergeParameters MergeParameters, options *MongoDBResourcesClientBeginListMongoDBCollectionPartitionMergeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/partitionMerge" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if collectionName == "" { + return nil, errors.New("parameter collectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{collectionName}", url.PathEscape(collectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, mergeParameters); err != nil { + return nil, err + } + return req, nil +} + // NewListMongoDBCollectionsPager - Lists the MongoDB collection under an existing Azure Cosmos DB database account. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1203,7 +1294,7 @@ func (client *MongoDBResourcesClient) listMongoDBCollectionsCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1220,7 +1311,7 @@ func (client *MongoDBResourcesClient) listMongoDBCollectionsHandleResponse(resp // NewListMongoDBDatabasesPager - Lists the MongoDB databases under an existing Azure Cosmos DB database account. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - MongoDBResourcesClientListMongoDBDatabasesOptions contains the optional parameters for the MongoDBResourcesClient.NewListMongoDBDatabasesPager @@ -1269,7 +1360,7 @@ func (client *MongoDBResourcesClient) listMongoDBDatabasesCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1286,7 +1377,7 @@ func (client *MongoDBResourcesClient) listMongoDBDatabasesHandleResponse(resp *h // NewListMongoRoleDefinitionsPager - Retrieves the list of all Azure Cosmos DB Mongo Role Definitions. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - MongoDBResourcesClientListMongoRoleDefinitionsOptions contains the optional parameters for the MongoDBResourcesClient.NewListMongoRoleDefinitionsPager @@ -1335,7 +1426,7 @@ func (client *MongoDBResourcesClient) listMongoRoleDefinitionsCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1352,7 +1443,7 @@ func (client *MongoDBResourcesClient) listMongoRoleDefinitionsHandleResponse(res // NewListMongoUserDefinitionsPager - Retrieves the list of all Azure Cosmos DB Mongo User Definition. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - MongoDBResourcesClientListMongoUserDefinitionsOptions contains the optional parameters for the MongoDBResourcesClient.NewListMongoUserDefinitionsPager @@ -1401,7 +1492,7 @@ func (client *MongoDBResourcesClient) listMongoUserDefinitionsCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1419,7 +1510,7 @@ func (client *MongoDBResourcesClient) listMongoUserDefinitionsHandleResponse(res // BeginMigrateMongoDBCollectionToAutoscale - Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1446,7 +1537,7 @@ func (client *MongoDBResourcesClient) BeginMigrateMongoDBCollectionToAutoscale(c // MigrateMongoDBCollectionToAutoscale - Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *MongoDBResourcesClient) migrateMongoDBCollectionToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, options *MongoDBResourcesClientBeginMigrateMongoDBCollectionToAutoscaleOptions) (*http.Response, error) { var err error const operationName = "MongoDBResourcesClient.BeginMigrateMongoDBCollectionToAutoscale" @@ -1496,7 +1587,7 @@ func (client *MongoDBResourcesClient) migrateMongoDBCollectionToAutoscaleCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1506,7 +1597,7 @@ func (client *MongoDBResourcesClient) migrateMongoDBCollectionToAutoscaleCreateR // throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1533,7 +1624,7 @@ func (client *MongoDBResourcesClient) BeginMigrateMongoDBCollectionToManualThrou // MigrateMongoDBCollectionToManualThroughput - Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *MongoDBResourcesClient) migrateMongoDBCollectionToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, options *MongoDBResourcesClientBeginMigrateMongoDBCollectionToManualThroughputOptions) (*http.Response, error) { var err error const operationName = "MongoDBResourcesClient.BeginMigrateMongoDBCollectionToManualThroughput" @@ -1583,7 +1674,7 @@ func (client *MongoDBResourcesClient) migrateMongoDBCollectionToManualThroughput return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1592,7 +1683,7 @@ func (client *MongoDBResourcesClient) migrateMongoDBCollectionToManualThroughput // BeginMigrateMongoDBDatabaseToAutoscale - Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1618,7 +1709,7 @@ func (client *MongoDBResourcesClient) BeginMigrateMongoDBDatabaseToAutoscale(ctx // MigrateMongoDBDatabaseToAutoscale - Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *MongoDBResourcesClient) migrateMongoDBDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *MongoDBResourcesClientBeginMigrateMongoDBDatabaseToAutoscaleOptions) (*http.Response, error) { var err error const operationName = "MongoDBResourcesClient.BeginMigrateMongoDBDatabaseToAutoscale" @@ -1664,7 +1755,7 @@ func (client *MongoDBResourcesClient) migrateMongoDBDatabaseToAutoscaleCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1673,7 +1764,7 @@ func (client *MongoDBResourcesClient) migrateMongoDBDatabaseToAutoscaleCreateReq // BeginMigrateMongoDBDatabaseToManualThroughput - Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1699,7 +1790,7 @@ func (client *MongoDBResourcesClient) BeginMigrateMongoDBDatabaseToManualThrough // MigrateMongoDBDatabaseToManualThroughput - Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *MongoDBResourcesClient) migrateMongoDBDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *MongoDBResourcesClientBeginMigrateMongoDBDatabaseToManualThroughputOptions) (*http.Response, error) { var err error const operationName = "MongoDBResourcesClient.BeginMigrateMongoDBDatabaseToManualThroughput" @@ -1745,16 +1836,458 @@ func (client *MongoDBResourcesClient) migrateMongoDBDatabaseToManualThroughputCr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginMongoDBContainerRedistributeThroughput - Redistribute throughput for an Azure Cosmos DB MongoDB container +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - databaseName - Cosmos DB database name. +// - collectionName - Cosmos DB collection name. +// - redistributeThroughputParameters - The parameters to provide for redistributing throughput for the current MongoDB container. +// - options - MongoDBResourcesClientBeginMongoDBContainerRedistributeThroughputOptions contains the optional parameters for +// the MongoDBResourcesClient.BeginMongoDBContainerRedistributeThroughput method. +func (client *MongoDBResourcesClient) BeginMongoDBContainerRedistributeThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, redistributeThroughputParameters RedistributeThroughputParameters, options *MongoDBResourcesClientBeginMongoDBContainerRedistributeThroughputOptions) (*runtime.Poller[MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.mongoDBContainerRedistributeThroughput(ctx, resourceGroupName, accountName, databaseName, collectionName, redistributeThroughputParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// MongoDBContainerRedistributeThroughput - Redistribute throughput for an Azure Cosmos DB MongoDB container +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *MongoDBResourcesClient) mongoDBContainerRedistributeThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, redistributeThroughputParameters RedistributeThroughputParameters, options *MongoDBResourcesClientBeginMongoDBContainerRedistributeThroughputOptions) (*http.Response, error) { + var err error + const operationName = "MongoDBResourcesClient.BeginMongoDBContainerRedistributeThroughput" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.mongoDBContainerRedistributeThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, collectionName, redistributeThroughputParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// mongoDBContainerRedistributeThroughputCreateRequest creates the MongoDBContainerRedistributeThroughput request. +func (client *MongoDBResourcesClient) mongoDBContainerRedistributeThroughputCreateRequest(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, redistributeThroughputParameters RedistributeThroughputParameters, options *MongoDBResourcesClientBeginMongoDBContainerRedistributeThroughputOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/redistributeThroughput" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if collectionName == "" { + return nil, errors.New("parameter collectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{collectionName}", url.PathEscape(collectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, redistributeThroughputParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginMongoDBContainerRetrieveThroughputDistribution - Retrieve throughput distribution for an Azure Cosmos DB MongoDB container +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - databaseName - Cosmos DB database name. +// - collectionName - Cosmos DB collection name. +// - retrieveThroughputParameters - The parameters to provide for retrieving throughput distribution for the current MongoDB +// container. +// - options - MongoDBResourcesClientBeginMongoDBContainerRetrieveThroughputDistributionOptions contains the optional parameters +// for the MongoDBResourcesClient.BeginMongoDBContainerRetrieveThroughputDistribution method. +func (client *MongoDBResourcesClient) BeginMongoDBContainerRetrieveThroughputDistribution(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, retrieveThroughputParameters RetrieveThroughputParameters, options *MongoDBResourcesClientBeginMongoDBContainerRetrieveThroughputDistributionOptions) (*runtime.Poller[MongoDBResourcesClientMongoDBContainerRetrieveThroughputDistributionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.mongoDBContainerRetrieveThroughputDistribution(ctx, resourceGroupName, accountName, databaseName, collectionName, retrieveThroughputParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientMongoDBContainerRetrieveThroughputDistributionResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MongoDBResourcesClientMongoDBContainerRetrieveThroughputDistributionResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// MongoDBContainerRetrieveThroughputDistribution - Retrieve throughput distribution for an Azure Cosmos DB MongoDB container +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *MongoDBResourcesClient) mongoDBContainerRetrieveThroughputDistribution(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, retrieveThroughputParameters RetrieveThroughputParameters, options *MongoDBResourcesClientBeginMongoDBContainerRetrieveThroughputDistributionOptions) (*http.Response, error) { + var err error + const operationName = "MongoDBResourcesClient.BeginMongoDBContainerRetrieveThroughputDistribution" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.mongoDBContainerRetrieveThroughputDistributionCreateRequest(ctx, resourceGroupName, accountName, databaseName, collectionName, retrieveThroughputParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// mongoDBContainerRetrieveThroughputDistributionCreateRequest creates the MongoDBContainerRetrieveThroughputDistribution request. +func (client *MongoDBResourcesClient) mongoDBContainerRetrieveThroughputDistributionCreateRequest(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, retrieveThroughputParameters RetrieveThroughputParameters, options *MongoDBResourcesClientBeginMongoDBContainerRetrieveThroughputDistributionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/retrieveThroughputDistribution" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if collectionName == "" { + return nil, errors.New("parameter collectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{collectionName}", url.PathEscape(collectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, retrieveThroughputParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginMongoDBDatabasePartitionMerge - Merges the partitions of a MongoDB database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - databaseName - Cosmos DB database name. +// - mergeParameters - The parameters for the merge operation. +// - options - MongoDBResourcesClientBeginMongoDBDatabasePartitionMergeOptions contains the optional parameters for the MongoDBResourcesClient.BeginMongoDBDatabasePartitionMerge +// method. +func (client *MongoDBResourcesClient) BeginMongoDBDatabasePartitionMerge(ctx context.Context, resourceGroupName string, accountName string, databaseName string, mergeParameters MergeParameters, options *MongoDBResourcesClientBeginMongoDBDatabasePartitionMergeOptions) (*runtime.Poller[MongoDBResourcesClientMongoDBDatabasePartitionMergeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.mongoDBDatabasePartitionMerge(ctx, resourceGroupName, accountName, databaseName, mergeParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientMongoDBDatabasePartitionMergeResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MongoDBResourcesClientMongoDBDatabasePartitionMergeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// MongoDBDatabasePartitionMerge - Merges the partitions of a MongoDB database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *MongoDBResourcesClient) mongoDBDatabasePartitionMerge(ctx context.Context, resourceGroupName string, accountName string, databaseName string, mergeParameters MergeParameters, options *MongoDBResourcesClientBeginMongoDBDatabasePartitionMergeOptions) (*http.Response, error) { + var err error + const operationName = "MongoDBResourcesClient.BeginMongoDBDatabasePartitionMerge" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.mongoDBDatabasePartitionMergeCreateRequest(ctx, resourceGroupName, accountName, databaseName, mergeParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// mongoDBDatabasePartitionMergeCreateRequest creates the MongoDBDatabasePartitionMerge request. +func (client *MongoDBResourcesClient) mongoDBDatabasePartitionMergeCreateRequest(ctx context.Context, resourceGroupName string, accountName string, databaseName string, mergeParameters MergeParameters, options *MongoDBResourcesClientBeginMongoDBDatabasePartitionMergeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/partitionMerge" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, mergeParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginMongoDBDatabaseRedistributeThroughput - Redistribute throughput for an Azure Cosmos DB MongoDB database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - databaseName - Cosmos DB database name. +// - redistributeThroughputParameters - The parameters to provide for redistributing throughput for the current MongoDB database. +// - options - MongoDBResourcesClientBeginMongoDBDatabaseRedistributeThroughputOptions contains the optional parameters for +// the MongoDBResourcesClient.BeginMongoDBDatabaseRedistributeThroughput method. +func (client *MongoDBResourcesClient) BeginMongoDBDatabaseRedistributeThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, redistributeThroughputParameters RedistributeThroughputParameters, options *MongoDBResourcesClientBeginMongoDBDatabaseRedistributeThroughputOptions) (*runtime.Poller[MongoDBResourcesClientMongoDBDatabaseRedistributeThroughputResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.mongoDBDatabaseRedistributeThroughput(ctx, resourceGroupName, accountName, databaseName, redistributeThroughputParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientMongoDBDatabaseRedistributeThroughputResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MongoDBResourcesClientMongoDBDatabaseRedistributeThroughputResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// MongoDBDatabaseRedistributeThroughput - Redistribute throughput for an Azure Cosmos DB MongoDB database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *MongoDBResourcesClient) mongoDBDatabaseRedistributeThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, redistributeThroughputParameters RedistributeThroughputParameters, options *MongoDBResourcesClientBeginMongoDBDatabaseRedistributeThroughputOptions) (*http.Response, error) { + var err error + const operationName = "MongoDBResourcesClient.BeginMongoDBDatabaseRedistributeThroughput" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.mongoDBDatabaseRedistributeThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, redistributeThroughputParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// mongoDBDatabaseRedistributeThroughputCreateRequest creates the MongoDBDatabaseRedistributeThroughput request. +func (client *MongoDBResourcesClient) mongoDBDatabaseRedistributeThroughputCreateRequest(ctx context.Context, resourceGroupName string, accountName string, databaseName string, redistributeThroughputParameters RedistributeThroughputParameters, options *MongoDBResourcesClientBeginMongoDBDatabaseRedistributeThroughputOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/redistributeThroughput" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, redistributeThroughputParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginMongoDBDatabaseRetrieveThroughputDistribution - Retrieve throughput distribution for an Azure Cosmos DB MongoDB database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - databaseName - Cosmos DB database name. +// - retrieveThroughputParameters - The parameters to provide for retrieving throughput distribution for the current MongoDB +// database. +// - options - MongoDBResourcesClientBeginMongoDBDatabaseRetrieveThroughputDistributionOptions contains the optional parameters +// for the MongoDBResourcesClient.BeginMongoDBDatabaseRetrieveThroughputDistribution method. +func (client *MongoDBResourcesClient) BeginMongoDBDatabaseRetrieveThroughputDistribution(ctx context.Context, resourceGroupName string, accountName string, databaseName string, retrieveThroughputParameters RetrieveThroughputParameters, options *MongoDBResourcesClientBeginMongoDBDatabaseRetrieveThroughputDistributionOptions) (*runtime.Poller[MongoDBResourcesClientMongoDBDatabaseRetrieveThroughputDistributionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.mongoDBDatabaseRetrieveThroughputDistribution(ctx, resourceGroupName, accountName, databaseName, retrieveThroughputParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientMongoDBDatabaseRetrieveThroughputDistributionResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MongoDBResourcesClientMongoDBDatabaseRetrieveThroughputDistributionResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// MongoDBDatabaseRetrieveThroughputDistribution - Retrieve throughput distribution for an Azure Cosmos DB MongoDB database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *MongoDBResourcesClient) mongoDBDatabaseRetrieveThroughputDistribution(ctx context.Context, resourceGroupName string, accountName string, databaseName string, retrieveThroughputParameters RetrieveThroughputParameters, options *MongoDBResourcesClientBeginMongoDBDatabaseRetrieveThroughputDistributionOptions) (*http.Response, error) { + var err error + const operationName = "MongoDBResourcesClient.BeginMongoDBDatabaseRetrieveThroughputDistribution" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.mongoDBDatabaseRetrieveThroughputDistributionCreateRequest(ctx, resourceGroupName, accountName, databaseName, retrieveThroughputParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// mongoDBDatabaseRetrieveThroughputDistributionCreateRequest creates the MongoDBDatabaseRetrieveThroughputDistribution request. +func (client *MongoDBResourcesClient) mongoDBDatabaseRetrieveThroughputDistributionCreateRequest(ctx context.Context, resourceGroupName string, accountName string, databaseName string, retrieveThroughputParameters RetrieveThroughputParameters, options *MongoDBResourcesClientBeginMongoDBDatabaseRetrieveThroughputDistributionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/retrieveThroughputDistribution" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, retrieveThroughputParameters); err != nil { + return nil, err + } return req, nil } // BeginRetrieveContinuousBackupInformation - Retrieves continuous backup information for a Mongodb collection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1783,7 +2316,7 @@ func (client *MongoDBResourcesClient) BeginRetrieveContinuousBackupInformation(c // RetrieveContinuousBackupInformation - Retrieves continuous backup information for a Mongodb collection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *MongoDBResourcesClient) retrieveContinuousBackupInformation(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, location ContinuousBackupRestoreLocation, options *MongoDBResourcesClientBeginRetrieveContinuousBackupInformationOptions) (*http.Response, error) { var err error const operationName = "MongoDBResourcesClient.BeginRetrieveContinuousBackupInformation" @@ -1833,7 +2366,7 @@ func (client *MongoDBResourcesClient) retrieveContinuousBackupInformationCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, location); err != nil { @@ -1845,7 +2378,7 @@ func (client *MongoDBResourcesClient) retrieveContinuousBackupInformationCreateR // BeginUpdateMongoDBCollectionThroughput - Update the RUs per second of an Azure Cosmos DB MongoDB collection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1873,7 +2406,7 @@ func (client *MongoDBResourcesClient) BeginUpdateMongoDBCollectionThroughput(ctx // UpdateMongoDBCollectionThroughput - Update the RUs per second of an Azure Cosmos DB MongoDB collection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *MongoDBResourcesClient) updateMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *MongoDBResourcesClientBeginUpdateMongoDBCollectionThroughputOptions) (*http.Response, error) { var err error const operationName = "MongoDBResourcesClient.BeginUpdateMongoDBCollectionThroughput" @@ -1923,7 +2456,7 @@ func (client *MongoDBResourcesClient) updateMongoDBCollectionThroughputCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { @@ -1935,7 +2468,7 @@ func (client *MongoDBResourcesClient) updateMongoDBCollectionThroughputCreateReq // BeginUpdateMongoDBDatabaseThroughput - Update RUs per second of the an Azure Cosmos DB MongoDB database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1962,7 +2495,7 @@ func (client *MongoDBResourcesClient) BeginUpdateMongoDBDatabaseThroughput(ctx c // UpdateMongoDBDatabaseThroughput - Update RUs per second of the an Azure Cosmos DB MongoDB database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *MongoDBResourcesClient) updateMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *MongoDBResourcesClientBeginUpdateMongoDBDatabaseThroughputOptions) (*http.Response, error) { var err error const operationName = "MongoDBResourcesClient.BeginUpdateMongoDBDatabaseThroughput" @@ -2008,7 +2541,7 @@ func (client *MongoDBResourcesClient) updateMongoDBDatabaseThroughputCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { diff --git a/sdk/resourcemanager/cosmos/armcosmos/mongodbresources_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/mongodbresources_client_example_test.go deleted file mode 100644 index 90903aef854c..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/mongodbresources_client_example_test.go +++ /dev/null @@ -1,1078 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBDatabaseList.json -func ExampleMongoDBResourcesClient_NewListMongoDBDatabasesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMongoDBResourcesClient().NewListMongoDBDatabasesPager("rgName", "ddb1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MongoDBDatabaseListResult = armcosmos.MongoDBDatabaseListResult{ - // Value: []*armcosmos.MongoDBDatabaseGetResults{ - // { - // Name: to.Ptr("databaseName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/mongodbDatabases"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/mongodbDatabases/databaseName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.MongoDBDatabaseGetProperties{ - // Resource: &armcosmos.MongoDBDatabaseGetPropertiesResource{ - // ID: to.Ptr("databaseName"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBDatabaseGet.json -func ExampleMongoDBResourcesClient_GetMongoDBDatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMongoDBResourcesClient().GetMongoDBDatabase(ctx, "rg1", "ddb1", "databaseName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MongoDBDatabaseGetResults = armcosmos.MongoDBDatabaseGetResults{ - // Name: to.Ptr("databaseName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/mongodbDatabases"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/mongodbDatabases/databaseName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.MongoDBDatabaseGetProperties{ - // Resource: &armcosmos.MongoDBDatabaseGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // ID: to.Ptr("databaseName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBDatabaseCreateUpdate.json -func ExampleMongoDBResourcesClient_BeginCreateUpdateMongoDBDatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMongoDBResourcesClient().BeginCreateUpdateMongoDBDatabase(ctx, "rg1", "ddb1", "databaseName", armcosmos.MongoDBDatabaseCreateUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.MongoDBDatabaseCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.MongoDBDatabaseResource{ - ID: to.Ptr("databaseName"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MongoDBDatabaseGetResults = armcosmos.MongoDBDatabaseGetResults{ - // Name: to.Ptr("databaseName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/mongodbDatabases"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/mongodbDatabases/databaseName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.MongoDBDatabaseGetProperties{ - // Resource: &armcosmos.MongoDBDatabaseGetPropertiesResource{ - // ID: to.Ptr("updatedDatabaseName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBDatabaseDelete.json -func ExampleMongoDBResourcesClient_BeginDeleteMongoDBDatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMongoDBResourcesClient().BeginDeleteMongoDBDatabase(ctx, "rg1", "ddb1", "databaseName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBDatabaseThroughputGet.json -func ExampleMongoDBResourcesClient_GetMongoDBDatabaseThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMongoDBResourcesClient().GetMongoDBDatabaseThroughput(ctx, "rg1", "ddb1", "databaseName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/mongodbDatabases/databaseName/throughputSettings/default"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // InstantMaximumThroughput: to.Ptr("10000"), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // SoftAllowedMaximumThroughput: to.Ptr("1000000"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBDatabaseThroughputUpdate.json -func ExampleMongoDBResourcesClient_BeginUpdateMongoDBDatabaseThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMongoDBResourcesClient().BeginUpdateMongoDBDatabaseThroughput(ctx, "rg1", "ddb1", "databaseName", armcosmos.ThroughputSettingsUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.ThroughputSettingsUpdateProperties{ - Resource: &armcosmos.ThroughputSettingsResource{ - Throughput: to.Ptr[int32](400), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/mongodbDatabases/databaseName/throughputSettings/default"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBDatabaseMigrateToAutoscale.json -func ExampleMongoDBResourcesClient_BeginMigrateMongoDBDatabaseToAutoscale() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMongoDBResourcesClient().BeginMigrateMongoDBDatabaseToAutoscale(ctx, "rg1", "ddb1", "databaseName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // AutoscaleSettings: &armcosmos.AutoscaleSettingsResource{ - // MaxThroughput: to.Ptr[int32](4000), - // }, - // MinimumThroughput: to.Ptr("4000"), - // OfferReplacePending: to.Ptr("false"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBDatabaseMigrateToManualThroughput.json -func ExampleMongoDBResourcesClient_BeginMigrateMongoDBDatabaseToManualThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMongoDBResourcesClient().BeginMigrateMongoDBDatabaseToManualThroughput(ctx, "rg1", "ddb1", "databaseName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBCollectionList.json -func ExampleMongoDBResourcesClient_NewListMongoDBCollectionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMongoDBResourcesClient().NewListMongoDBCollectionsPager("rgName", "ddb1", "databaseName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MongoDBCollectionListResult = armcosmos.MongoDBCollectionListResult{ - // Value: []*armcosmos.MongoDBCollectionGetResults{ - // { - // Name: to.Ptr("collectionName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/mongodbCollections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/mongodbDatabases/databaseName/mongodbCollections/collectionName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.MongoDBCollectionGetProperties{ - // Resource: &armcosmos.MongoDBCollectionGetPropertiesResource{ - // ID: to.Ptr("testcoll"), - // Indexes: []*armcosmos.MongoIndex{ - // { - // Key: &armcosmos.MongoIndexKeys{ - // Keys: []*string{ - // to.Ptr("testKey")}, - // }, - // Options: &armcosmos.MongoIndexOptions{ - // ExpireAfterSeconds: to.Ptr[int32](100), - // Unique: to.Ptr(true), - // }, - // }}, - // ShardKey: map[string]*string{ - // "testKey": to.Ptr("Hash"), - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBCollectionGet.json -func ExampleMongoDBResourcesClient_GetMongoDBCollection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMongoDBResourcesClient().GetMongoDBCollection(ctx, "rgName", "ddb1", "databaseName", "collectionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MongoDBCollectionGetResults = armcosmos.MongoDBCollectionGetResults{ - // Name: to.Ptr("collectionName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/mongodbCollections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/mongodbDatabases/databaseName/mongodbCollections/collectionName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.MongoDBCollectionGetProperties{ - // Resource: &armcosmos.MongoDBCollectionGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // ID: to.Ptr("testcoll"), - // Indexes: []*armcosmos.MongoIndex{ - // { - // Key: &armcosmos.MongoIndexKeys{ - // Keys: []*string{ - // to.Ptr("testKey")}, - // }, - // Options: &armcosmos.MongoIndexOptions{ - // ExpireAfterSeconds: to.Ptr[int32](100), - // Unique: to.Ptr(true), - // }, - // }}, - // ShardKey: map[string]*string{ - // "testKey": to.Ptr("Hash"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBCollectionCreateUpdate.json -func ExampleMongoDBResourcesClient_BeginCreateUpdateMongoDBCollection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMongoDBResourcesClient().BeginCreateUpdateMongoDBCollection(ctx, "rg1", "ddb1", "databaseName", "collectionName", armcosmos.MongoDBCollectionCreateUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.MongoDBCollectionCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.MongoDBCollectionResource{ - ID: to.Ptr("collectionName"), - Indexes: []*armcosmos.MongoIndex{ - { - Key: &armcosmos.MongoIndexKeys{ - Keys: []*string{ - to.Ptr("_ts")}, - }, - Options: &armcosmos.MongoIndexOptions{ - ExpireAfterSeconds: to.Ptr[int32](100), - Unique: to.Ptr(true), - }, - }, - { - Key: &armcosmos.MongoIndexKeys{ - Keys: []*string{ - to.Ptr("_id")}, - }, - }}, - ShardKey: map[string]*string{ - "testKey": to.Ptr("Hash"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MongoDBCollectionGetResults = armcosmos.MongoDBCollectionGetResults{ - // Name: to.Ptr("collectionName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/mongodbCollections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/mongodbDatabases/databaseName/mongodbCollections/collectionName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.MongoDBCollectionGetProperties{ - // Resource: &armcosmos.MongoDBCollectionGetPropertiesResource{ - // ID: to.Ptr("collectionName"), - // Indexes: []*armcosmos.MongoIndex{ - // { - // Key: &armcosmos.MongoIndexKeys{ - // Keys: []*string{ - // to.Ptr("_ts")}, - // }, - // Options: &armcosmos.MongoIndexOptions{ - // ExpireAfterSeconds: to.Ptr[int32](100), - // Unique: to.Ptr(true), - // }, - // }, - // { - // Key: &armcosmos.MongoIndexKeys{ - // Keys: []*string{ - // to.Ptr("_id")}, - // }, - // }}, - // ShardKey: map[string]*string{ - // "testKey": to.Ptr("Hash"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBCollectionDelete.json -func ExampleMongoDBResourcesClient_BeginDeleteMongoDBCollection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMongoDBResourcesClient().BeginDeleteMongoDBCollection(ctx, "rg1", "ddb1", "databaseName", "collectionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBCollectionThroughputGet.json -func ExampleMongoDBResourcesClient_GetMongoDBCollectionThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMongoDBResourcesClient().GetMongoDBCollectionThroughput(ctx, "rg1", "ddb1", "databaseName", "collectionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/mongodbCollections/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/mongodbDatabases/databaseName/mongodbCollections/collectionName/throughputSettings/default"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // InstantMaximumThroughput: to.Ptr("10000"), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // SoftAllowedMaximumThroughput: to.Ptr("1000000"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBCollectionThroughputUpdate.json -func ExampleMongoDBResourcesClient_BeginUpdateMongoDBCollectionThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMongoDBResourcesClient().BeginUpdateMongoDBCollectionThroughput(ctx, "rg1", "ddb1", "databaseName", "collectionName", armcosmos.ThroughputSettingsUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.ThroughputSettingsUpdateProperties{ - Resource: &armcosmos.ThroughputSettingsResource{ - Throughput: to.Ptr[int32](400), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/mongodbCollections/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/mongodbDatabases/databaseName/mongodbCollections/collectionName/throughputSettings/default"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBCollectionMigrateToAutoscale.json -func ExampleMongoDBResourcesClient_BeginMigrateMongoDBCollectionToAutoscale() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMongoDBResourcesClient().BeginMigrateMongoDBCollectionToAutoscale(ctx, "rg1", "ddb1", "databaseName", "collectionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // AutoscaleSettings: &armcosmos.AutoscaleSettingsResource{ - // MaxThroughput: to.Ptr[int32](4000), - // }, - // MinimumThroughput: to.Ptr("4000"), - // OfferReplacePending: to.Ptr("false"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBCollectionMigrateToManualThroughput.json -func ExampleMongoDBResourcesClient_BeginMigrateMongoDBCollectionToManualThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMongoDBResourcesClient().BeginMigrateMongoDBCollectionToManualThroughput(ctx, "rg1", "ddb1", "databaseName", "collectionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBRoleDefinitionGet.json -func ExampleMongoDBResourcesClient_GetMongoRoleDefinition() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMongoDBResourcesClient().GetMongoRoleDefinition(ctx, "myMongoRoleDefinitionId", "myResourceGroupName", "myAccountName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MongoRoleDefinitionGetResults = armcosmos.MongoRoleDefinitionGetResults{ - // Name: to.Ptr("myMongoRoleDefinitionId"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/mongodbRoleDefinitions"), - // ID: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/mongodbRoleDefinitions/myMongoDbRoleDefinitionId"), - // Properties: &armcosmos.MongoRoleDefinitionResource{ - // Type: to.Ptr(armcosmos.MongoRoleDefinitionTypeCustomRole), - // DatabaseName: to.Ptr("sales"), - // Privileges: []*armcosmos.Privilege{ - // { - // Actions: []*string{ - // to.Ptr("find"), - // to.Ptr("insert")}, - // Resource: &armcosmos.PrivilegeResource{ - // Collection: to.Ptr("coll"), - // Db: to.Ptr("sales"), - // }, - // }}, - // RoleName: to.Ptr("myRoleName"), - // Roles: []*armcosmos.Role{ - // { - // Db: to.Ptr("sales"), - // Role: to.Ptr("myReadRole"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBRoleDefinitionCreateUpdate.json -func ExampleMongoDBResourcesClient_BeginCreateUpdateMongoRoleDefinition() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMongoDBResourcesClient().BeginCreateUpdateMongoRoleDefinition(ctx, "myMongoRoleDefinitionId", "myResourceGroupName", "myAccountName", armcosmos.MongoRoleDefinitionCreateUpdateParameters{ - Properties: &armcosmos.MongoRoleDefinitionResource{ - DatabaseName: to.Ptr("sales"), - Privileges: []*armcosmos.Privilege{ - { - Actions: []*string{ - to.Ptr("insert"), - to.Ptr("find")}, - Resource: &armcosmos.PrivilegeResource{ - Collection: to.Ptr("sales"), - Db: to.Ptr("sales"), - }, - }}, - RoleName: to.Ptr("myRoleName"), - Roles: []*armcosmos.Role{ - { - Db: to.Ptr("sales"), - Role: to.Ptr("myInheritedRole"), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MongoRoleDefinitionGetResults = armcosmos.MongoRoleDefinitionGetResults{ - // Name: to.Ptr("myMongoDbRoleDefinitionId"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/mongoDbRoleDefinitionId"), - // ID: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/mongodbRoleDefinitions/myMongoDbRoleDefinitionId"), - // Properties: &armcosmos.MongoRoleDefinitionResource{ - // Type: to.Ptr(armcosmos.MongoRoleDefinitionTypeCustomRole), - // DatabaseName: to.Ptr("sales"), - // Privileges: []*armcosmos.Privilege{ - // { - // Actions: []*string{ - // to.Ptr("find"), - // to.Ptr("insert")}, - // Resource: &armcosmos.PrivilegeResource{ - // Collection: to.Ptr("coll"), - // Db: to.Ptr("sales"), - // }, - // }}, - // RoleName: to.Ptr("myRoleName"), - // Roles: []*armcosmos.Role{ - // { - // Db: to.Ptr("sales"), - // Role: to.Ptr("myReadRole"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBRoleDefinitionDelete.json -func ExampleMongoDBResourcesClient_BeginDeleteMongoRoleDefinition() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMongoDBResourcesClient().BeginDeleteMongoRoleDefinition(ctx, "myMongoRoleDefinitionId", "myResourceGroupName", "myAccountName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBRoleDefinitionList.json -func ExampleMongoDBResourcesClient_NewListMongoRoleDefinitionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMongoDBResourcesClient().NewListMongoRoleDefinitionsPager("myResourceGroupName", "myAccountName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MongoRoleDefinitionListResult = armcosmos.MongoRoleDefinitionListResult{ - // Value: []*armcosmos.MongoRoleDefinitionGetResults{ - // { - // Name: to.Ptr("myRoleDefinitionId"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/mongodbRoleDefinitions"), - // ID: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/mongodbRoleDefinitions/myRoleDefinitionId"), - // Properties: &armcosmos.MongoRoleDefinitionResource{ - // Type: to.Ptr(armcosmos.MongoRoleDefinitionTypeCustomRole), - // DatabaseName: to.Ptr("sales"), - // Privileges: []*armcosmos.Privilege{ - // { - // Actions: []*string{ - // to.Ptr("find"), - // to.Ptr("insert")}, - // Resource: &armcosmos.PrivilegeResource{ - // Collection: to.Ptr("coll"), - // Db: to.Ptr("sales"), - // }, - // }}, - // RoleName: to.Ptr("myRoleName"), - // Roles: []*armcosmos.Role{ - // { - // Db: to.Ptr("sales"), - // Role: to.Ptr("myReadRole"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBUserDefinitionGet.json -func ExampleMongoDBResourcesClient_GetMongoUserDefinition() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMongoDBResourcesClient().GetMongoUserDefinition(ctx, "myMongoUserDefinitionId", "myResourceGroupName", "myAccountName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MongoUserDefinitionGetResults = armcosmos.MongoUserDefinitionGetResults{ - // Name: to.Ptr("myUserId"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/mongodbUserDefinitions"), - // ID: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/mongodbUserDefinitions/myUserId"), - // Properties: &armcosmos.MongoUserDefinitionResource{ - // CustomData: to.Ptr("My custom data"), - // DatabaseName: to.Ptr("sales"), - // Mechanisms: to.Ptr("SCRAM-SHA-256"), - // Roles: []*armcosmos.Role{ - // { - // Db: to.Ptr("sales"), - // Role: to.Ptr("myReadRole"), - // }}, - // UserName: to.Ptr("myUserName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBUserDefinitionCreateUpdate.json -func ExampleMongoDBResourcesClient_BeginCreateUpdateMongoUserDefinition() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMongoDBResourcesClient().BeginCreateUpdateMongoUserDefinition(ctx, "myMongoUserDefinitionId", "myResourceGroupName", "myAccountName", armcosmos.MongoUserDefinitionCreateUpdateParameters{ - Properties: &armcosmos.MongoUserDefinitionResource{ - CustomData: to.Ptr("My custom data"), - DatabaseName: to.Ptr("sales"), - Mechanisms: to.Ptr("SCRAM-SHA-256"), - Password: to.Ptr("myPassword"), - Roles: []*armcosmos.Role{ - { - Db: to.Ptr("sales"), - Role: to.Ptr("myReadRole"), - }}, - UserName: to.Ptr("myUserName"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.MongoUserDefinitionGetResults = armcosmos.MongoUserDefinitionGetResults{ - // Name: to.Ptr("myUserName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/mongodbUserDefinitions"), - // ID: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/mongodbUserDefinitions/myUserId"), - // Properties: &armcosmos.MongoUserDefinitionResource{ - // CustomData: to.Ptr("My custom data"), - // DatabaseName: to.Ptr("sales"), - // Mechanisms: to.Ptr("SCRAM-SHA-256"), - // Roles: []*armcosmos.Role{ - // { - // Db: to.Ptr("sales"), - // Role: to.Ptr("myReadRole"), - // }}, - // UserName: to.Ptr("myUserName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBUserDefinitionDelete.json -func ExampleMongoDBResourcesClient_BeginDeleteMongoUserDefinition() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMongoDBResourcesClient().BeginDeleteMongoUserDefinition(ctx, "myMongoUserDefinitionId", "myResourceGroupName", "myAccountName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBUserDefinitionList.json -func ExampleMongoDBResourcesClient_NewListMongoUserDefinitionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMongoDBResourcesClient().NewListMongoUserDefinitionsPager("myResourceGroupName", "myAccountName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.MongoUserDefinitionListResult = armcosmos.MongoUserDefinitionListResult{ - // Value: []*armcosmos.MongoUserDefinitionGetResults{ - // { - // Name: to.Ptr("myUserId"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/mongodbUserDefinitions"), - // ID: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/mongodbUserDefinitions/myUserId"), - // Properties: &armcosmos.MongoUserDefinitionResource{ - // CustomData: to.Ptr("My custom data"), - // DatabaseName: to.Ptr("sales"), - // Mechanisms: to.Ptr("SCRAM-SHA-256"), - // Roles: []*armcosmos.Role{ - // { - // Db: to.Ptr("sales"), - // Role: to.Ptr("myReadRole"), - // }}, - // UserName: to.Ptr("myUserName"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMongoDBCollectionBackupInformation.json -func ExampleMongoDBResourcesClient_BeginRetrieveContinuousBackupInformation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewMongoDBResourcesClient().BeginRetrieveContinuousBackupInformation(ctx, "rgName", "ddb1", "databaseName", "collectionName", armcosmos.ContinuousBackupRestoreLocation{ - Location: to.Ptr("North Europe"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupInformation = armcosmos.BackupInformation{ - // ContinuousBackupInformation: &armcosmos.ContinuousBackupInformation{ - // LatestRestorableTimestamp: to.Ptr("2021-02-05T02:40:50Z"), - // }, - // } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/mongodbresources_live_test.go b/sdk/resourcemanager/cosmos/armcosmos/mongodbresources_live_test.go index e06f0acadc52..8fb413be95fe 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/mongodbresources_live_test.go +++ b/sdk/resourcemanager/cosmos/armcosmos/mongodbresources_live_test.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/cosmos/armcosmos/networksecurityperimeterconfigurations_client.go b/sdk/resourcemanager/cosmos/armcosmos/networksecurityperimeterconfigurations_client.go new file mode 100644 index 000000000000..e30049037611 --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/networksecurityperimeterconfigurations_client.go @@ -0,0 +1,261 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcosmos + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// NetworkSecurityPerimeterConfigurationsClient contains the methods for the NetworkSecurityPerimeterConfigurations group. +// Don't use this type directly, use NewNetworkSecurityPerimeterConfigurationsClient() instead. +type NetworkSecurityPerimeterConfigurationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewNetworkSecurityPerimeterConfigurationsClient creates a new instance of NetworkSecurityPerimeterConfigurationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewNetworkSecurityPerimeterConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*NetworkSecurityPerimeterConfigurationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &NetworkSecurityPerimeterConfigurationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets effective Network Security Perimeter Configuration for association +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - networkSecurityPerimeterConfigurationName - The name for Network Security Perimeter configuration +// - options - NetworkSecurityPerimeterConfigurationsClientGetOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.Get +// method. +func (client *NetworkSecurityPerimeterConfigurationsClient) Get(ctx context.Context, resourceGroupName string, accountName string, networkSecurityPerimeterConfigurationName string, options *NetworkSecurityPerimeterConfigurationsClientGetOptions) (NetworkSecurityPerimeterConfigurationsClientGetResponse, error) { + var err error + const operationName = "NetworkSecurityPerimeterConfigurationsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, networkSecurityPerimeterConfigurationName, options) + if err != nil { + return NetworkSecurityPerimeterConfigurationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return NetworkSecurityPerimeterConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NetworkSecurityPerimeterConfigurationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *NetworkSecurityPerimeterConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, networkSecurityPerimeterConfigurationName string, options *NetworkSecurityPerimeterConfigurationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if networkSecurityPerimeterConfigurationName == "" { + return nil, errors.New("parameter networkSecurityPerimeterConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityPerimeterConfigurationName}", url.PathEscape(networkSecurityPerimeterConfigurationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *NetworkSecurityPerimeterConfigurationsClient) getHandleResponse(resp *http.Response) (NetworkSecurityPerimeterConfigurationsClientGetResponse, error) { + result := NetworkSecurityPerimeterConfigurationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityPerimeterConfiguration); err != nil { + return NetworkSecurityPerimeterConfigurationsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets list of effective Network Security Perimeter Configuration for cosmos db account +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - options - NetworkSecurityPerimeterConfigurationsClientListOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.NewListPager +// method. +func (client *NetworkSecurityPerimeterConfigurationsClient) NewListPager(resourceGroupName string, accountName string, options *NetworkSecurityPerimeterConfigurationsClientListOptions) *runtime.Pager[NetworkSecurityPerimeterConfigurationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[NetworkSecurityPerimeterConfigurationsClientListResponse]{ + More: func(page NetworkSecurityPerimeterConfigurationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *NetworkSecurityPerimeterConfigurationsClientListResponse) (NetworkSecurityPerimeterConfigurationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "NetworkSecurityPerimeterConfigurationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, nil) + if err != nil { + return NetworkSecurityPerimeterConfigurationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *NetworkSecurityPerimeterConfigurationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *NetworkSecurityPerimeterConfigurationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/networkSecurityPerimeterConfigurations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *NetworkSecurityPerimeterConfigurationsClient) listHandleResponse(resp *http.Response) (NetworkSecurityPerimeterConfigurationsClientListResponse, error) { + result := NetworkSecurityPerimeterConfigurationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityPerimeterConfigurationListResult); err != nil { + return NetworkSecurityPerimeterConfigurationsClientListResponse{}, err + } + return result, nil +} + +// BeginReconcile - Refreshes any information about the association. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - networkSecurityPerimeterConfigurationName - The name for Network Security Perimeter configuration +// - options - NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.BeginReconcile +// method. +func (client *NetworkSecurityPerimeterConfigurationsClient) BeginReconcile(ctx context.Context, resourceGroupName string, accountName string, networkSecurityPerimeterConfigurationName string, options *NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions) (*runtime.Poller[NetworkSecurityPerimeterConfigurationsClientReconcileResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.reconcile(ctx, resourceGroupName, accountName, networkSecurityPerimeterConfigurationName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NetworkSecurityPerimeterConfigurationsClientReconcileResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[NetworkSecurityPerimeterConfigurationsClientReconcileResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Reconcile - Refreshes any information about the association. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *NetworkSecurityPerimeterConfigurationsClient) reconcile(ctx context.Context, resourceGroupName string, accountName string, networkSecurityPerimeterConfigurationName string, options *NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions) (*http.Response, error) { + var err error + const operationName = "NetworkSecurityPerimeterConfigurationsClient.BeginReconcile" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.reconcileCreateRequest(ctx, resourceGroupName, accountName, networkSecurityPerimeterConfigurationName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// reconcileCreateRequest creates the Reconcile request. +func (client *NetworkSecurityPerimeterConfigurationsClient) reconcileCreateRequest(ctx context.Context, resourceGroupName string, accountName string, networkSecurityPerimeterConfigurationName string, options *NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}/reconcile" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if networkSecurityPerimeterConfigurationName == "" { + return nil, errors.New("parameter networkSecurityPerimeterConfigurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{networkSecurityPerimeterConfigurationName}", url.PathEscape(networkSecurityPerimeterConfigurationName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/notebookworkspaces_client.go b/sdk/resourcemanager/cosmos/armcosmos/notebookworkspaces_client.go index a0d9d66b15eb..dceff5275ccf 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/notebookworkspaces_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/notebookworkspaces_client.go @@ -46,7 +46,7 @@ func NewNotebookWorkspacesClient(subscriptionID string, credential azcore.TokenC // BeginCreateOrUpdate - Creates the notebook workspace for a Cosmos DB account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - notebookWorkspaceName - The name of the notebook workspace resource. @@ -73,7 +73,7 @@ func (client *NotebookWorkspacesClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - Creates the notebook workspace for a Cosmos DB account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *NotebookWorkspacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, notebookWorkspaceName NotebookWorkspaceName, notebookCreateUpdateParameters NotebookWorkspaceCreateUpdateParameters, options *NotebookWorkspacesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "NotebookWorkspacesClient.BeginCreateOrUpdate" @@ -119,7 +119,7 @@ func (client *NotebookWorkspacesClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, notebookCreateUpdateParameters); err != nil { @@ -131,7 +131,7 @@ func (client *NotebookWorkspacesClient) createOrUpdateCreateRequest(ctx context. // BeginDelete - Deletes the notebook workspace for a Cosmos DB account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - notebookWorkspaceName - The name of the notebook workspace resource. @@ -157,7 +157,7 @@ func (client *NotebookWorkspacesClient) BeginDelete(ctx context.Context, resourc // Delete - Deletes the notebook workspace for a Cosmos DB account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *NotebookWorkspacesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, notebookWorkspaceName NotebookWorkspaceName, options *NotebookWorkspacesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "NotebookWorkspacesClient.BeginDelete" @@ -203,7 +203,7 @@ func (client *NotebookWorkspacesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,7 +212,7 @@ func (client *NotebookWorkspacesClient) deleteCreateRequest(ctx context.Context, // Get - Gets the notebook workspace for a Cosmos DB account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - notebookWorkspaceName - The name of the notebook workspace resource. @@ -263,7 +263,7 @@ func (client *NotebookWorkspacesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,7 +280,7 @@ func (client *NotebookWorkspacesClient) getHandleResponse(resp *http.Response) ( // NewListByDatabaseAccountPager - Gets the notebook workspace resources of an existing Cosmos DB account. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - NotebookWorkspacesClientListByDatabaseAccountOptions contains the optional parameters for the NotebookWorkspacesClient.NewListByDatabaseAccountPager @@ -329,7 +329,7 @@ func (client *NotebookWorkspacesClient) listByDatabaseAccountCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -347,7 +347,7 @@ func (client *NotebookWorkspacesClient) listByDatabaseAccountHandleResponse(resp // ListConnectionInfo - Retrieves the connection info for the notebook workspace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - notebookWorkspaceName - The name of the notebook workspace resource. @@ -399,7 +399,7 @@ func (client *NotebookWorkspacesClient) listConnectionInfoCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -417,7 +417,7 @@ func (client *NotebookWorkspacesClient) listConnectionInfoHandleResponse(resp *h // BeginRegenerateAuthToken - Regenerates the auth token for the notebook workspace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - notebookWorkspaceName - The name of the notebook workspace resource. @@ -443,7 +443,7 @@ func (client *NotebookWorkspacesClient) BeginRegenerateAuthToken(ctx context.Con // RegenerateAuthToken - Regenerates the auth token for the notebook workspace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *NotebookWorkspacesClient) regenerateAuthToken(ctx context.Context, resourceGroupName string, accountName string, notebookWorkspaceName NotebookWorkspaceName, options *NotebookWorkspacesClientBeginRegenerateAuthTokenOptions) (*http.Response, error) { var err error const operationName = "NotebookWorkspacesClient.BeginRegenerateAuthToken" @@ -489,7 +489,7 @@ func (client *NotebookWorkspacesClient) regenerateAuthTokenCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -498,7 +498,7 @@ func (client *NotebookWorkspacesClient) regenerateAuthTokenCreateRequest(ctx con // BeginStart - Starts the notebook workspace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - notebookWorkspaceName - The name of the notebook workspace resource. @@ -524,7 +524,7 @@ func (client *NotebookWorkspacesClient) BeginStart(ctx context.Context, resource // Start - Starts the notebook workspace // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *NotebookWorkspacesClient) start(ctx context.Context, resourceGroupName string, accountName string, notebookWorkspaceName NotebookWorkspaceName, options *NotebookWorkspacesClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "NotebookWorkspacesClient.BeginStart" @@ -570,7 +570,7 @@ func (client *NotebookWorkspacesClient) startCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/notebookworkspaces_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/notebookworkspaces_client_example_test.go deleted file mode 100644 index bc51baf408cb..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/notebookworkspaces_client_example_test.go +++ /dev/null @@ -1,204 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBNotebookWorkspaceList.json -func ExampleNotebookWorkspacesClient_NewListByDatabaseAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewNotebookWorkspacesClient().NewListByDatabaseAccountPager("rg1", "ddb1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.NotebookWorkspaceListResult = armcosmos.NotebookWorkspaceListResult{ - // Value: []*armcosmos.NotebookWorkspace{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/notebookWorkspaces"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/notebookWorkspaces/default"), - // Properties: &armcosmos.NotebookWorkspaceProperties{ - // NotebookServerEndpoint: to.Ptr("endpoint"), - // Status: to.Ptr("Online"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBNotebookWorkspaceGet.json -func ExampleNotebookWorkspacesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNotebookWorkspacesClient().Get(ctx, "rg1", "ddb1", armcosmos.NotebookWorkspaceNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NotebookWorkspace = armcosmos.NotebookWorkspace{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/notebookWorkspaces"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/notebookWorkspaces/default"), - // Properties: &armcosmos.NotebookWorkspaceProperties{ - // NotebookServerEndpoint: to.Ptr("endpoint"), - // Status: to.Ptr("Online"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBNotebookWorkspaceCreate.json -func ExampleNotebookWorkspacesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNotebookWorkspacesClient().BeginCreateOrUpdate(ctx, "rg1", "ddb1", armcosmos.NotebookWorkspaceNameDefault, armcosmos.NotebookWorkspaceCreateUpdateParameters{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NotebookWorkspace = armcosmos.NotebookWorkspace{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/notebookWorkspaces"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/notebookWorkspaces/default"), - // Properties: &armcosmos.NotebookWorkspaceProperties{ - // NotebookServerEndpoint: to.Ptr("endpoint"), - // Status: to.Ptr("Online"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBNotebookWorkspaceDelete.json -func ExampleNotebookWorkspacesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNotebookWorkspacesClient().BeginDelete(ctx, "rg1", "ddb1", armcosmos.NotebookWorkspaceNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBNotebookWorkspaceListConnectionInfo.json -func ExampleNotebookWorkspacesClient_ListConnectionInfo() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNotebookWorkspacesClient().ListConnectionInfo(ctx, "rg1", "ddb1", armcosmos.NotebookWorkspaceNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NotebookWorkspaceConnectionInfoResult = armcosmos.NotebookWorkspaceConnectionInfoResult{ - // AuthToken: to.Ptr("auth-token"), - // NotebookServerEndpoint: to.Ptr("notebook endpoint"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBNotebookWorkspaceRegenerateAuthToken.json -func ExampleNotebookWorkspacesClient_BeginRegenerateAuthToken() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNotebookWorkspacesClient().BeginRegenerateAuthToken(ctx, "rg1", "ddb1", armcosmos.NotebookWorkspaceNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBNotebookWorkspaceStart.json -func ExampleNotebookWorkspacesClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNotebookWorkspacesClient().BeginStart(ctx, "rg1", "ddb1", armcosmos.NotebookWorkspaceNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/operations_client.go b/sdk/resourcemanager/cosmos/armcosmos/operations_client.go index 6c9b44dc6f6d..fbd3e3a1286c 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/operations_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available Cosmos DB Resource Provider operations. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/operations_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/operations_client_example_test.go deleted file mode 100644 index 369383c078a5..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/operations_client_example_test.go +++ /dev/null @@ -1,55 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBOperationsList.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armcosmos.OperationListResult{ - // Value: []*armcosmos.Operation{ - // { - // Name: to.Ptr("operationName"), - // Display: &armcosmos.OperationDisplay{ - // Description: to.Ptr("description"), - // Operation: to.Ptr("operationName"), - // Provider: to.Ptr("providerName"), - // Resource: to.Ptr("resourceName"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/operations_live_test.go b/sdk/resourcemanager/cosmos/armcosmos/operations_live_test.go index 752cd0f3e018..1433a0b1980c 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/operations_live_test.go +++ b/sdk/resourcemanager/cosmos/armcosmos/operations_live_test.go @@ -14,7 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/cosmos/armcosmos/options.go b/sdk/resourcemanager/cosmos/armcosmos/options.go index a72459f6a8db..bfac793ca327 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/options.go +++ b/sdk/resourcemanager/cosmos/armcosmos/options.go @@ -20,6 +20,10 @@ type CassandraClustersClientBeginCreateUpdateOptions struct { type CassandraClustersClientBeginDeallocateOptions struct { // Resumes the LRO from the provided token. ResumeToken string + + // Force to deallocate a cluster of Cluster Type Production. Force to deallocate a cluster of Cluster Type Production might + // cause data loss + XMSForceDeallocate *string } // CassandraClustersClientBeginDeleteOptions contains the optional parameters for the CassandraClustersClient.BeginDelete @@ -29,6 +33,13 @@ type CassandraClustersClientBeginDeleteOptions struct { ResumeToken string } +// CassandraClustersClientBeginInvokeCommandAsyncOptions contains the optional parameters for the CassandraClustersClient.BeginInvokeCommandAsync +// method. +type CassandraClustersClientBeginInvokeCommandAsyncOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // CassandraClustersClientBeginInvokeCommandOptions contains the optional parameters for the CassandraClustersClient.BeginInvokeCommand // method. type CassandraClustersClientBeginInvokeCommandOptions struct { @@ -49,11 +60,28 @@ type CassandraClustersClientBeginUpdateOptions struct { ResumeToken string } +// CassandraClustersClientGetBackupOptions contains the optional parameters for the CassandraClustersClient.GetBackup method. +type CassandraClustersClientGetBackupOptions struct { + // placeholder for future optional parameters +} + +// CassandraClustersClientGetCommandAsyncOptions contains the optional parameters for the CassandraClustersClient.GetCommandAsync +// method. +type CassandraClustersClientGetCommandAsyncOptions struct { + // placeholder for future optional parameters +} + // CassandraClustersClientGetOptions contains the optional parameters for the CassandraClustersClient.Get method. type CassandraClustersClientGetOptions struct { // placeholder for future optional parameters } +// CassandraClustersClientListBackupsOptions contains the optional parameters for the CassandraClustersClient.NewListBackupsPager +// method. +type CassandraClustersClientListBackupsOptions struct { + // placeholder for future optional parameters +} + // CassandraClustersClientListByResourceGroupOptions contains the optional parameters for the CassandraClustersClient.NewListByResourceGroupPager // method. type CassandraClustersClientListByResourceGroupOptions struct { @@ -66,6 +94,12 @@ type CassandraClustersClientListBySubscriptionOptions struct { // placeholder for future optional parameters } +// CassandraClustersClientListCommandOptions contains the optional parameters for the CassandraClustersClient.NewListCommandPager +// method. +type CassandraClustersClientListCommandOptions struct { + // placeholder for future optional parameters +} + // CassandraClustersClientStatusOptions contains the optional parameters for the CassandraClustersClient.Status method. type CassandraClustersClientStatusOptions struct { // placeholder for future optional parameters @@ -117,6 +151,13 @@ type CassandraResourcesClientBeginCreateUpdateCassandraTableOptions struct { ResumeToken string } +// CassandraResourcesClientBeginCreateUpdateCassandraViewOptions contains the optional parameters for the CassandraResourcesClient.BeginCreateUpdateCassandraView +// method. +type CassandraResourcesClientBeginCreateUpdateCassandraViewOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // CassandraResourcesClientBeginDeleteCassandraKeyspaceOptions contains the optional parameters for the CassandraResourcesClient.BeginDeleteCassandraKeyspace // method. type CassandraResourcesClientBeginDeleteCassandraKeyspaceOptions struct { @@ -131,6 +172,13 @@ type CassandraResourcesClientBeginDeleteCassandraTableOptions struct { ResumeToken string } +// CassandraResourcesClientBeginDeleteCassandraViewOptions contains the optional parameters for the CassandraResourcesClient.BeginDeleteCassandraView +// method. +type CassandraResourcesClientBeginDeleteCassandraViewOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // CassandraResourcesClientBeginMigrateCassandraKeyspaceToAutoscaleOptions contains the optional parameters for the CassandraResourcesClient.BeginMigrateCassandraKeyspaceToAutoscale // method. type CassandraResourcesClientBeginMigrateCassandraKeyspaceToAutoscaleOptions struct { @@ -159,6 +207,20 @@ type CassandraResourcesClientBeginMigrateCassandraTableToManualThroughputOptions ResumeToken string } +// CassandraResourcesClientBeginMigrateCassandraViewToAutoscaleOptions contains the optional parameters for the CassandraResourcesClient.BeginMigrateCassandraViewToAutoscale +// method. +type CassandraResourcesClientBeginMigrateCassandraViewToAutoscaleOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CassandraResourcesClientBeginMigrateCassandraViewToManualThroughputOptions contains the optional parameters for the CassandraResourcesClient.BeginMigrateCassandraViewToManualThroughput +// method. +type CassandraResourcesClientBeginMigrateCassandraViewToManualThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // CassandraResourcesClientBeginUpdateCassandraKeyspaceThroughputOptions contains the optional parameters for the CassandraResourcesClient.BeginUpdateCassandraKeyspaceThroughput // method. type CassandraResourcesClientBeginUpdateCassandraKeyspaceThroughputOptions struct { @@ -173,6 +235,13 @@ type CassandraResourcesClientBeginUpdateCassandraTableThroughputOptions struct { ResumeToken string } +// CassandraResourcesClientBeginUpdateCassandraViewThroughputOptions contains the optional parameters for the CassandraResourcesClient.BeginUpdateCassandraViewThroughput +// method. +type CassandraResourcesClientBeginUpdateCassandraViewThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // CassandraResourcesClientGetCassandraKeyspaceOptions contains the optional parameters for the CassandraResourcesClient.GetCassandraKeyspace // method. type CassandraResourcesClientGetCassandraKeyspaceOptions struct { @@ -197,6 +266,18 @@ type CassandraResourcesClientGetCassandraTableThroughputOptions struct { // placeholder for future optional parameters } +// CassandraResourcesClientGetCassandraViewOptions contains the optional parameters for the CassandraResourcesClient.GetCassandraView +// method. +type CassandraResourcesClientGetCassandraViewOptions struct { + // placeholder for future optional parameters +} + +// CassandraResourcesClientGetCassandraViewThroughputOptions contains the optional parameters for the CassandraResourcesClient.GetCassandraViewThroughput +// method. +type CassandraResourcesClientGetCassandraViewThroughputOptions struct { + // placeholder for future optional parameters +} + // CassandraResourcesClientListCassandraKeyspacesOptions contains the optional parameters for the CassandraResourcesClient.NewListCassandraKeyspacesPager // method. type CassandraResourcesClientListCassandraKeyspacesOptions struct { @@ -209,6 +290,29 @@ type CassandraResourcesClientListCassandraTablesOptions struct { // placeholder for future optional parameters } +// CassandraResourcesClientListCassandraViewsOptions contains the optional parameters for the CassandraResourcesClient.NewListCassandraViewsPager +// method. +type CassandraResourcesClientListCassandraViewsOptions struct { + // placeholder for future optional parameters +} + +// ChaosFaultClientBeginEnableDisableOptions contains the optional parameters for the ChaosFaultClient.BeginEnableDisable +// method. +type ChaosFaultClientBeginEnableDisableOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ChaosFaultClientGetOptions contains the optional parameters for the ChaosFaultClient.Get method. +type ChaosFaultClientGetOptions struct { + // placeholder for future optional parameters +} + +// ChaosFaultClientListOptions contains the optional parameters for the ChaosFaultClient.NewListPager method. +type ChaosFaultClientListOptions struct { + // placeholder for future optional parameters +} + // CollectionClientListMetricDefinitionsOptions contains the optional parameters for the CollectionClient.NewListMetricDefinitionsPager // method. type CollectionClientListMetricDefinitionsOptions struct { @@ -253,6 +357,42 @@ type CollectionRegionClientListMetricsOptions struct { // placeholder for future optional parameters } +// DataTransferJobsClientCancelOptions contains the optional parameters for the DataTransferJobsClient.Cancel method. +type DataTransferJobsClientCancelOptions struct { + // placeholder for future optional parameters +} + +// DataTransferJobsClientCompleteOptions contains the optional parameters for the DataTransferJobsClient.Complete method. +type DataTransferJobsClientCompleteOptions struct { + // placeholder for future optional parameters +} + +// DataTransferJobsClientCreateOptions contains the optional parameters for the DataTransferJobsClient.Create method. +type DataTransferJobsClientCreateOptions struct { + // placeholder for future optional parameters +} + +// DataTransferJobsClientGetOptions contains the optional parameters for the DataTransferJobsClient.Get method. +type DataTransferJobsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DataTransferJobsClientListByDatabaseAccountOptions contains the optional parameters for the DataTransferJobsClient.NewListByDatabaseAccountPager +// method. +type DataTransferJobsClientListByDatabaseAccountOptions struct { + // placeholder for future optional parameters +} + +// DataTransferJobsClientPauseOptions contains the optional parameters for the DataTransferJobsClient.Pause method. +type DataTransferJobsClientPauseOptions struct { + // placeholder for future optional parameters +} + +// DataTransferJobsClientResumeOptions contains the optional parameters for the DataTransferJobsClient.Resume method. +type DataTransferJobsClientResumeOptions struct { + // placeholder for future optional parameters +} + // DatabaseAccountRegionClientListMetricsOptions contains the optional parameters for the DatabaseAccountRegionClient.NewListMetricsPager // method. type DatabaseAccountRegionClientListMetricsOptions struct { @@ -389,6 +529,31 @@ type DatabaseClientListUsagesOptions struct { Filter *string } +// GraphResourcesClientBeginCreateUpdateGraphOptions contains the optional parameters for the GraphResourcesClient.BeginCreateUpdateGraph +// method. +type GraphResourcesClientBeginCreateUpdateGraphOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GraphResourcesClientBeginDeleteGraphResourceOptions contains the optional parameters for the GraphResourcesClient.BeginDeleteGraphResource +// method. +type GraphResourcesClientBeginDeleteGraphResourceOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GraphResourcesClientGetGraphOptions contains the optional parameters for the GraphResourcesClient.GetGraph method. +type GraphResourcesClientGetGraphOptions struct { + // placeholder for future optional parameters +} + +// GraphResourcesClientListGraphsOptions contains the optional parameters for the GraphResourcesClient.NewListGraphsPager +// method. +type GraphResourcesClientListGraphsOptions struct { + // placeholder for future optional parameters +} + // GremlinResourcesClientBeginCreateUpdateGremlinDatabaseOptions contains the optional parameters for the GremlinResourcesClient.BeginCreateUpdateGremlinDatabase // method. type GremlinResourcesClientBeginCreateUpdateGremlinDatabaseOptions struct { @@ -568,6 +733,13 @@ type MongoDBResourcesClientBeginDeleteMongoUserDefinitionOptions struct { ResumeToken string } +// MongoDBResourcesClientBeginListMongoDBCollectionPartitionMergeOptions contains the optional parameters for the MongoDBResourcesClient.BeginListMongoDBCollectionPartitionMerge +// method. +type MongoDBResourcesClientBeginListMongoDBCollectionPartitionMergeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // MongoDBResourcesClientBeginMigrateMongoDBCollectionToAutoscaleOptions contains the optional parameters for the MongoDBResourcesClient.BeginMigrateMongoDBCollectionToAutoscale // method. type MongoDBResourcesClientBeginMigrateMongoDBCollectionToAutoscaleOptions struct { @@ -596,6 +768,41 @@ type MongoDBResourcesClientBeginMigrateMongoDBDatabaseToManualThroughputOptions ResumeToken string } +// MongoDBResourcesClientBeginMongoDBContainerRedistributeThroughputOptions contains the optional parameters for the MongoDBResourcesClient.BeginMongoDBContainerRedistributeThroughput +// method. +type MongoDBResourcesClientBeginMongoDBContainerRedistributeThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoDBResourcesClientBeginMongoDBContainerRetrieveThroughputDistributionOptions contains the optional parameters for the +// MongoDBResourcesClient.BeginMongoDBContainerRetrieveThroughputDistribution method. +type MongoDBResourcesClientBeginMongoDBContainerRetrieveThroughputDistributionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoDBResourcesClientBeginMongoDBDatabasePartitionMergeOptions contains the optional parameters for the MongoDBResourcesClient.BeginMongoDBDatabasePartitionMerge +// method. +type MongoDBResourcesClientBeginMongoDBDatabasePartitionMergeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoDBResourcesClientBeginMongoDBDatabaseRedistributeThroughputOptions contains the optional parameters for the MongoDBResourcesClient.BeginMongoDBDatabaseRedistributeThroughput +// method. +type MongoDBResourcesClientBeginMongoDBDatabaseRedistributeThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoDBResourcesClientBeginMongoDBDatabaseRetrieveThroughputDistributionOptions contains the optional parameters for the +// MongoDBResourcesClient.BeginMongoDBDatabaseRetrieveThroughputDistribution method. +type MongoDBResourcesClientBeginMongoDBDatabaseRetrieveThroughputDistributionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // MongoDBResourcesClientBeginRetrieveContinuousBackupInformationOptions contains the optional parameters for the MongoDBResourcesClient.BeginRetrieveContinuousBackupInformation // method. type MongoDBResourcesClientBeginRetrieveContinuousBackupInformationOptions struct { @@ -677,6 +884,25 @@ type MongoDBResourcesClientListMongoUserDefinitionsOptions struct { // placeholder for future optional parameters } +// NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.BeginReconcile +// method. +type NetworkSecurityPerimeterConfigurationsClientBeginReconcileOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NetworkSecurityPerimeterConfigurationsClientGetOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.Get +// method. +type NetworkSecurityPerimeterConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// NetworkSecurityPerimeterConfigurationsClientListOptions contains the optional parameters for the NetworkSecurityPerimeterConfigurationsClient.NewListPager +// method. +type NetworkSecurityPerimeterConfigurationsClientListOptions struct { + // placeholder for future optional parameters +} + // NotebookWorkspacesClientBeginCreateOrUpdateOptions contains the optional parameters for the NotebookWorkspacesClient.BeginCreateOrUpdate // method. type NotebookWorkspacesClientBeginCreateOrUpdateOptions struct { @@ -1022,6 +1248,13 @@ type SQLResourcesClientBeginDeleteSQLUserDefinedFunctionOptions struct { ResumeToken string } +// SQLResourcesClientBeginListSQLContainerPartitionMergeOptions contains the optional parameters for the SQLResourcesClient.BeginListSQLContainerPartitionMerge +// method. +type SQLResourcesClientBeginListSQLContainerPartitionMergeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // SQLResourcesClientBeginMigrateSQLContainerToAutoscaleOptions contains the optional parameters for the SQLResourcesClient.BeginMigrateSQLContainerToAutoscale // method. type SQLResourcesClientBeginMigrateSQLContainerToAutoscaleOptions struct { @@ -1057,6 +1290,41 @@ type SQLResourcesClientBeginRetrieveContinuousBackupInformationOptions struct { ResumeToken string } +// SQLResourcesClientBeginSQLContainerRedistributeThroughputOptions contains the optional parameters for the SQLResourcesClient.BeginSQLContainerRedistributeThroughput +// method. +type SQLResourcesClientBeginSQLContainerRedistributeThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions contains the optional parameters for the SQLResourcesClient.BeginSQLContainerRetrieveThroughputDistribution +// method. +type SQLResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginSQLDatabasePartitionMergeOptions contains the optional parameters for the SQLResourcesClient.BeginSQLDatabasePartitionMerge +// method. +type SQLResourcesClientBeginSQLDatabasePartitionMergeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginSQLDatabaseRedistributeThroughputOptions contains the optional parameters for the SQLResourcesClient.BeginSQLDatabaseRedistributeThroughput +// method. +type SQLResourcesClientBeginSQLDatabaseRedistributeThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginSQLDatabaseRetrieveThroughputDistributionOptions contains the optional parameters for the SQLResourcesClient.BeginSQLDatabaseRetrieveThroughputDistribution +// method. +type SQLResourcesClientBeginSQLDatabaseRetrieveThroughputDistributionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // SQLResourcesClientBeginUpdateSQLContainerThroughputOptions contains the optional parameters for the SQLResourcesClient.BeginUpdateSQLContainerThroughput // method. type SQLResourcesClientBeginUpdateSQLContainerThroughputOptions struct { @@ -1256,3 +1524,66 @@ type TableResourcesClientGetTableThroughputOptions struct { type TableResourcesClientListTablesOptions struct { // placeholder for future optional parameters } + +// ThroughputPoolAccountClientBeginCreateOptions contains the optional parameters for the ThroughputPoolAccountClient.BeginCreate +// method. +type ThroughputPoolAccountClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ThroughputPoolAccountClientBeginDeleteOptions contains the optional parameters for the ThroughputPoolAccountClient.BeginDelete +// method. +type ThroughputPoolAccountClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ThroughputPoolAccountClientGetOptions contains the optional parameters for the ThroughputPoolAccountClient.Get method. +type ThroughputPoolAccountClientGetOptions struct { + // placeholder for future optional parameters +} + +// ThroughputPoolAccountsClientListOptions contains the optional parameters for the ThroughputPoolAccountsClient.NewListPager +// method. +type ThroughputPoolAccountsClientListOptions struct { + // placeholder for future optional parameters +} + +// ThroughputPoolClientBeginCreateOrUpdateOptions contains the optional parameters for the ThroughputPoolClient.BeginCreateOrUpdate +// method. +type ThroughputPoolClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ThroughputPoolClientBeginDeleteOptions contains the optional parameters for the ThroughputPoolClient.BeginDelete method. +type ThroughputPoolClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ThroughputPoolClientBeginUpdateOptions contains the optional parameters for the ThroughputPoolClient.BeginUpdate method. +type ThroughputPoolClientBeginUpdateOptions struct { + // The parameters to provide for the current Throughput Pool. + Body *ThroughputPoolUpdate + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ThroughputPoolClientGetOptions contains the optional parameters for the ThroughputPoolClient.Get method. +type ThroughputPoolClientGetOptions struct { + // placeholder for future optional parameters +} + +// ThroughputPoolsClientListByResourceGroupOptions contains the optional parameters for the ThroughputPoolsClient.NewListByResourceGroupPager +// method. +type ThroughputPoolsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ThroughputPoolsClientListOptions contains the optional parameters for the ThroughputPoolsClient.NewListPager method. +type ThroughputPoolsClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/partitionkeyrangeid_client.go b/sdk/resourcemanager/cosmos/armcosmos/partitionkeyrangeid_client.go index b635844f5001..0235d7bbe4d9 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/partitionkeyrangeid_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/partitionkeyrangeid_client.go @@ -45,7 +45,7 @@ func NewPartitionKeyRangeIDClient(subscriptionID string, credential azcore.Token // NewListMetricsPager - Retrieves the metrics determined by the given filter for the given partition key range id. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseRid - Cosmos DB database rid. @@ -113,7 +113,7 @@ func (client *PartitionKeyRangeIDClient) listMetricsCreateRequest(ctx context.Co } reqQP := req.Raw().URL.Query() reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/partitionkeyrangeid_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/partitionkeyrangeid_client_example_test.go deleted file mode 100644 index d0e7399633b0..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/partitionkeyrangeid_client_example_test.go +++ /dev/null @@ -1,83 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBPKeyRangeIdGetMetrics.json -func ExamplePartitionKeyRangeIDClient_NewListMetricsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPartitionKeyRangeIDClient().NewListMetricsPager("rg1", "ddb1", "databaseRid", "collectionRid", "0", "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PartitionMetricListResult = armcosmos.PartitionMetricListResult{ - // Value: []*armcosmos.PartitionMetric{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Max RUs Per Second"), - // Value: to.Ptr("Max RUs Per Second"), - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T23:58:55.278Z"); return t}()), - // MetricValues: []*armcosmos.MetricValue{ - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:54:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:55:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:56:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:57:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:58:55.278Z"); return t}()), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // TimeGrain: to.Ptr("PT1M"), - // Unit: to.Ptr(armcosmos.UnitTypeCount), - // PartitionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PartitionKeyRangeID: to.Ptr("0"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/partitionkeyrangeidregion_client.go b/sdk/resourcemanager/cosmos/armcosmos/partitionkeyrangeidregion_client.go index 8d200ca3b262..2102694094fa 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/partitionkeyrangeidregion_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/partitionkeyrangeidregion_client.go @@ -45,7 +45,7 @@ func NewPartitionKeyRangeIDRegionClient(subscriptionID string, credential azcore // NewListMetricsPager - Retrieves the metrics determined by the given filter for the given partition key range id and region. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - region - Cosmos DB region, with spaces between words and each word capitalized. @@ -118,7 +118,7 @@ func (client *PartitionKeyRangeIDRegionClient) listMetricsCreateRequest(ctx cont } reqQP := req.Raw().URL.Query() reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/partitionkeyrangeidregion_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/partitionkeyrangeidregion_client_example_test.go deleted file mode 100644 index 83675a524280..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/partitionkeyrangeidregion_client_example_test.go +++ /dev/null @@ -1,83 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBPKeyRangeIdRegionGetMetrics.json -func ExamplePartitionKeyRangeIDRegionClient_NewListMetricsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPartitionKeyRangeIDRegionClient().NewListMetricsPager("rg1", "ddb1", "West US", "databaseRid", "collectionRid", "0", "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PartitionMetricListResult = armcosmos.PartitionMetricListResult{ - // Value: []*armcosmos.PartitionMetric{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Max RUs Per Second"), - // Value: to.Ptr("Max RUs Per Second"), - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T23:58:55.278Z"); return t}()), - // MetricValues: []*armcosmos.MetricValue{ - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:54:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:55:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:56:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:57:55.278Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:58:55.278Z"); return t}()), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // TimeGrain: to.Ptr("PT1M"), - // Unit: to.Ptr(armcosmos.UnitTypeCount), - // PartitionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // PartitionKeyRangeID: to.Ptr("0"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/percentile_client.go b/sdk/resourcemanager/cosmos/armcosmos/percentile_client.go index 7560707221b7..f168be115efa 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/percentile_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/percentile_client.go @@ -46,7 +46,7 @@ func NewPercentileClient(subscriptionID string, credential azcore.TokenCredentia // NewListMetricsPager - Retrieves the metrics determined by the given filter for the given database account. This url is // only for PBS and Replication Latency data // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - filter - An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are @@ -99,7 +99,7 @@ func (client *PercentileClient) listMetricsCreateRequest(ctx context.Context, re } reqQP := req.Raw().URL.Query() reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/percentile_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/percentile_client_example_test.go deleted file mode 100644 index 8370a7102a4b..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/percentile_client_example_test.go +++ /dev/null @@ -1,88 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBPercentileGetMetrics.json -func ExamplePercentileClient_NewListMetricsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPercentileClient().NewListMetricsPager("rg1", "ddb1", "$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PercentileMetricListResult = armcosmos.PercentileMetricListResult{ - // Value: []*armcosmos.PercentileMetric{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Probabilistic Bounded Staleness-S-West Central US-T-East US"), - // Value: to.Ptr("Probabilistic Bounded Staleness-S-West Central US-T-East US"), - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:13:55.278Z"); return t}()), - // MetricValues: []*armcosmos.PercentileMetricValue{ - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // P10: to.Ptr[float64](1.11), - // P25: to.Ptr[float64](2.5), - // P50: to.Ptr[float64](4.34), - // P75: to.Ptr[float64](5.2), - // P90: to.Ptr[float64](6.77), - // P95: to.Ptr[float64](7.1), - // P99: to.Ptr[float64](8.3), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // TimeGrain: to.Ptr("PT5M"), - // Unit: to.Ptr(armcosmos.UnitTypeMilliseconds), - // }, - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Probabilistic Bounded Staleness-S-West Central US-T-West US"), - // Value: to.Ptr("Probabilistic Bounded Staleness-S-West Central US-T-West US"), - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:13:55.278Z"); return t}()), - // MetricValues: []*armcosmos.PercentileMetricValue{ - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // P10: to.Ptr[float64](1.11), - // P25: to.Ptr[float64](2.5), - // P50: to.Ptr[float64](4.34), - // P75: to.Ptr[float64](5.2), - // P90: to.Ptr[float64](6.77), - // P95: to.Ptr[float64](7.1), - // P99: to.Ptr[float64](8.3), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // TimeGrain: to.Ptr("PT5M"), - // Unit: to.Ptr(armcosmos.UnitTypeMilliseconds), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/percentilesourcetarget_client.go b/sdk/resourcemanager/cosmos/armcosmos/percentilesourcetarget_client.go index 2d26f06ec1ca..0ec41609f99b 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/percentilesourcetarget_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/percentilesourcetarget_client.go @@ -46,7 +46,7 @@ func NewPercentileSourceTargetClient(subscriptionID string, credential azcore.To // NewListMetricsPager - Retrieves the metrics determined by the given filter for the given account, source and target region. // This url is only for PBS and Replication Latency data // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - sourceRegion - Source region from which data is written. Cosmos DB region, with spaces between words and each word capitalized. @@ -109,7 +109,7 @@ func (client *PercentileSourceTargetClient) listMetricsCreateRequest(ctx context } reqQP := req.Raw().URL.Query() reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/percentilesourcetarget_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/percentilesourcetarget_client_example_test.go deleted file mode 100644 index 9641e0782f1d..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/percentilesourcetarget_client_example_test.go +++ /dev/null @@ -1,67 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBPercentileSourceTargetGetMetrics.json -func ExamplePercentileSourceTargetClient_NewListMetricsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPercentileSourceTargetClient().NewListMetricsPager("rg1", "ddb1", "West Central US", "East US", "$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PercentileMetricListResult = armcosmos.PercentileMetricListResult{ - // Value: []*armcosmos.PercentileMetric{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Probabilistic Bounded Staleness-S-West Central US-T-East US"), - // Value: to.Ptr("Probabilistic Bounded Staleness-S-West Central US-T-East US"), - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:13:55.278Z"); return t}()), - // MetricValues: []*armcosmos.PercentileMetricValue{ - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // P10: to.Ptr[float64](1.11), - // P25: to.Ptr[float64](2.5), - // P50: to.Ptr[float64](4.34), - // P75: to.Ptr[float64](5.2), - // P90: to.Ptr[float64](6.77), - // P95: to.Ptr[float64](7.1), - // P99: to.Ptr[float64](8.3), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // TimeGrain: to.Ptr("PT5M"), - // Unit: to.Ptr(armcosmos.UnitTypeMilliseconds), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/percentiletarget_client.go b/sdk/resourcemanager/cosmos/armcosmos/percentiletarget_client.go index fcfac983534e..bacbdcfa4012 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/percentiletarget_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/percentiletarget_client.go @@ -46,7 +46,7 @@ func NewPercentileTargetClient(subscriptionID string, credential azcore.TokenCre // NewListMetricsPager - Retrieves the metrics determined by the given filter for the given account target region. This url // is only for PBS and Replication Latency data // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - targetRegion - Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. @@ -104,7 +104,7 @@ func (client *PercentileTargetClient) listMetricsCreateRequest(ctx context.Conte } reqQP := req.Raw().URL.Query() reqQP.Set("$filter", filter) - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/percentiletarget_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/percentiletarget_client_example_test.go deleted file mode 100644 index b0661148a164..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/percentiletarget_client_example_test.go +++ /dev/null @@ -1,88 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBPercentileTargetGetMetrics.json -func ExamplePercentileTargetClient_NewListMetricsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPercentileTargetClient().NewListMetricsPager("rg1", "ddb1", "East US", "$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PercentileMetricListResult = armcosmos.PercentileMetricListResult{ - // Value: []*armcosmos.PercentileMetric{ - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Probabilistic Bounded Staleness-S-West Central US-T-East US"), - // Value: to.Ptr("Probabilistic Bounded Staleness-S-West Central US-T-East US"), - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:13:55.278Z"); return t}()), - // MetricValues: []*armcosmos.PercentileMetricValue{ - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // P10: to.Ptr[float64](1.11), - // P25: to.Ptr[float64](2.5), - // P50: to.Ptr[float64](4.34), - // P75: to.Ptr[float64](5.2), - // P90: to.Ptr[float64](6.77), - // P95: to.Ptr[float64](7.1), - // P99: to.Ptr[float64](8.3), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // TimeGrain: to.Ptr("PT5M"), - // Unit: to.Ptr(armcosmos.UnitTypeMilliseconds), - // }, - // { - // Name: &armcosmos.MetricName{ - // LocalizedValue: to.Ptr("Probabilistic Bounded Staleness-S-West Central US-T-West US"), - // Value: to.Ptr("Probabilistic Bounded Staleness-S-West US-T-East US"), - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-20T00:13:55.278Z"); return t}()), - // MetricValues: []*armcosmos.PercentileMetricValue{ - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // P10: to.Ptr[float64](1.11), - // P25: to.Ptr[float64](2.5), - // P50: to.Ptr[float64](4.34), - // P75: to.Ptr[float64](5.2), - // P90: to.Ptr[float64](6.77), - // P95: to.Ptr[float64](7.1), - // P99: to.Ptr[float64](8.3), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.278Z"); return t}()), - // TimeGrain: to.Ptr("PT5M"), - // Unit: to.Ptr(armcosmos.UnitTypeMilliseconds), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/polymorphic_helpers.go b/sdk/resourcemanager/cosmos/armcosmos/polymorphic_helpers.go index 2b9352eac07f..6122989558ff 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/polymorphic_helpers.go +++ b/sdk/resourcemanager/cosmos/armcosmos/polymorphic_helpers.go @@ -33,6 +33,37 @@ func unmarshalBackupPolicyClassification(rawMsg json.RawMessage) (BackupPolicyCl return b, nil } +func unmarshalDataTransferDataSourceSinkClassification(rawMsg json.RawMessage) (DataTransferDataSourceSinkClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b DataTransferDataSourceSinkClassification + switch m["component"] { + case "BaseCosmosDataTransferDataSourceSink": + b = &BaseCosmosDataTransferDataSourceSink{} + case string(DataTransferComponentAzureBlobStorage): + b = &AzureBlobDataTransferDataSourceSink{} + case string(DataTransferComponentCosmosDBCassandra): + b = &CassandraDataTransferDataSourceSink{} + case string(DataTransferComponentCosmosDBMongo): + b = &MongoDataTransferDataSourceSink{} + case string(DataTransferComponentCosmosDBMongoVCore): + b = &MongoVCoreDataTransferDataSourceSink{} + case string(DataTransferComponentCosmosDBSQL): + b = &SQLDataTransferDataSourceSink{} + default: + b = &DataTransferDataSourceSink{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + func unmarshalServiceResourceCreateUpdatePropertiesClassification(rawMsg json.RawMessage) (ServiceResourceCreateUpdatePropertiesClassification, error) { if rawMsg == nil || string(rawMsg) == "null" { return nil, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/privateendpointconnection_live_test.go b/sdk/resourcemanager/cosmos/armcosmos/privateendpointconnection_live_test.go index b640df4fe894..8df865296135 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/privateendpointconnection_live_test.go +++ b/sdk/resourcemanager/cosmos/armcosmos/privateendpointconnection_live_test.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" "github.com/stretchr/testify/suite" diff --git a/sdk/resourcemanager/cosmos/armcosmos/privateendpointconnections_client.go b/sdk/resourcemanager/cosmos/armcosmos/privateendpointconnections_client.go index 1208e99cfb91..db28b26834db 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/privateendpointconnections_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/privateendpointconnections_client.go @@ -46,7 +46,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -72,7 +72,7 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginCreateOrUpdate" @@ -118,7 +118,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -130,7 +130,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -156,7 +156,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -202,7 +202,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -211,7 +211,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets a private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -263,7 +263,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,7 +280,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListByDatabaseAccountPager - List all private endpoint connections on a Cosmos DB account. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - PrivateEndpointConnectionsClientListByDatabaseAccountOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByDatabaseAccountPager @@ -329,7 +329,7 @@ func (client *PrivateEndpointConnectionsClient) listByDatabaseAccountCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/privateendpointconnections_client_example_test.go deleted file mode 100644 index eb18f20fed2c..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,187 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBPrivateEndpointConnectionListGet.json -func ExamplePrivateEndpointConnectionsClient_NewListByDatabaseAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListByDatabaseAccountPager("rg1", "ddb1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateEndpointConnectionListResult = armcosmos.PrivateEndpointConnectionListResult{ - // Value: []*armcosmos.PrivateEndpointConnection{ - // { - // Name: to.Ptr("privateEndpointConnectionName"), - // Type: to.Ptr("Microsoft.DocumentDb/databaseAccounts/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDb/databaseAccounts/ddb1/privateEndpointConnections/privateEndpointConnectionName"), - // Properties: &armcosmos.PrivateEndpointConnectionProperties{ - // GroupID: to.Ptr("Sql"), - // PrivateEndpoint: &armcosmos.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rg1Network/providers/Microsoft.Network/privateEndpoints/privateEndpointName"), - // }, - // PrivateLinkServiceConnectionState: &armcosmos.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }, - // { - // Name: to.Ptr("privateEndpointConnectionName"), - // Type: to.Ptr("Microsoft.DocumentDb/databaseAccounts/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDb/databaseAccounts/ddb1/privateEndpointConnections/privateEndpointConnectionName2"), - // Properties: &armcosmos.PrivateEndpointConnectionProperties{ - // GroupID: to.Ptr("Sql"), - // PrivateEndpoint: &armcosmos.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rg1Network/providers/Microsoft.Network/privateEndpoints/privateEndpointName2"), - // }, - // PrivateLinkServiceConnectionState: &armcosmos.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBPrivateEndpointConnectionGet.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "rg1", "ddb1", "privateEndpointConnectionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armcosmos.PrivateEndpointConnection{ - // Name: to.Ptr("privateEndpointConnectionName"), - // Type: to.Ptr("Microsoft.DocumentDb/databaseAccounts/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rg1/providers/Microsoft.DocumentDb/databaseAccounts/ddb1/privateEndpointConnections/privateEndpointConnectionName"), - // Properties: &armcosmos.PrivateEndpointConnectionProperties{ - // GroupID: to.Ptr("Sql"), - // PrivateEndpoint: &armcosmos.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rg1Network/providers/Microsoft.Network/privateEndpoints/privateEndpointName"), - // }, - // PrivateLinkServiceConnectionState: &armcosmos.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBPrivateEndpointConnectionUpdate.json -func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreateOrUpdate(ctx, "rg1", "ddb1", "privateEndpointConnectionName", armcosmos.PrivateEndpointConnection{ - Properties: &armcosmos.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armcosmos.PrivateLinkServiceConnectionStateProperty{ - Description: to.Ptr("Approved by johndoe@contoso.com"), - Status: to.Ptr("Approved"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armcosmos.PrivateEndpointConnection{ - // Name: to.Ptr("privateEndpointConnectionName"), - // Type: to.Ptr("Microsoft.DocumentDb/databaseAccounts/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rg1/providers/Microsoft.DocumentDb/databaseAccounts/ddb1/privateEndpointConnections/privateEndpointConnectionName"), - // Properties: &armcosmos.PrivateEndpointConnectionProperties{ - // GroupID: to.Ptr("Sql"), - // PrivateEndpoint: &armcosmos.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rg1Network/providers/Microsoft.Network/privateEndpoints/privateEndpointName"), - // }, - // PrivateLinkServiceConnectionState: &armcosmos.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBPrivateEndpointConnectionDelete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "rg1", "ddb1", "privateEndpointConnectionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/privatelinkresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/privatelinkresources_client.go index d0a8fdfc02ab..195b6e777d52 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/privatelinkresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/privatelinkresources_client.go @@ -46,7 +46,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // Get - Gets the private link resources that need to be created for a Cosmos DB account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - groupName - The name of the private link resource. @@ -98,7 +98,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -115,7 +115,7 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) // NewListByDatabaseAccountPager - Gets the private link resources that need to be created for a Cosmos DB account. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - PrivateLinkResourcesClientListByDatabaseAccountOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByDatabaseAccountPager @@ -164,7 +164,7 @@ func (client *PrivateLinkResourcesClient) listByDatabaseAccountCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/privatelinkresources_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/privatelinkresources_client_example_test.go deleted file mode 100644 index 6bc9a6b1d4b5..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBPrivateLinkResourceListGet.json -func ExamplePrivateLinkResourcesClient_NewListByDatabaseAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkResourcesClient().NewListByDatabaseAccountPager("rg1", "ddb1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateLinkResourceListResult = armcosmos.PrivateLinkResourceListResult{ - // Value: []*armcosmos.PrivateLinkResource{ - // { - // Name: to.Ptr("sql"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/privateLinkResources"), - // ID: to.Ptr("subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.DocumentDb/databaseAccounts/ddb1/privateLinkResources/sql"), - // Properties: &armcosmos.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("sql"), - // RequiredMembers: []*string{ - // to.Ptr("ddb1"), - // to.Ptr("ddb1-westus")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.documents.azure.net")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBPrivateLinkResourceGet.json -func ExamplePrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "rg1", "ddb1", "sql", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResource = armcosmos.PrivateLinkResource{ - // Name: to.Ptr("sql"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/privateLinkResources"), - // ID: to.Ptr("subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.DocumentDb/databaseAccounts/ddb1/privateLinkResources/sql"), - // Properties: &armcosmos.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("sql"), - // RequiredMembers: []*string{ - // to.Ptr("ddb1"), - // to.Ptr("ddb1-westus")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.documents.azure.net")}, - // }, - // } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/responses.go b/sdk/resourcemanager/cosmos/armcosmos/responses.go index ae0249938975..e48e87599043 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/responses.go +++ b/sdk/resourcemanager/cosmos/armcosmos/responses.go @@ -24,18 +24,42 @@ type CassandraClustersClientDeleteResponse struct { // placeholder for future response values } +// CassandraClustersClientGetBackupResponse contains the response from method CassandraClustersClient.GetBackup. +type CassandraClustersClientGetBackupResponse struct { + // A restorable backup of a Cassandra cluster. + BackupResource +} + +// CassandraClustersClientGetCommandAsyncResponse contains the response from method CassandraClustersClient.GetCommandAsync. +type CassandraClustersClientGetCommandAsyncResponse struct { + // List of commands for cluster. + ListCommands +} + // CassandraClustersClientGetResponse contains the response from method CassandraClustersClient.Get. type CassandraClustersClientGetResponse struct { // Representation of a managed Cassandra cluster. ClusterResource } +// CassandraClustersClientInvokeCommandAsyncResponse contains the response from method CassandraClustersClient.BeginInvokeCommandAsync. +type CassandraClustersClientInvokeCommandAsyncResponse struct { + // resource representing a command + CommandPublicResource +} + // CassandraClustersClientInvokeCommandResponse contains the response from method CassandraClustersClient.BeginInvokeCommand. type CassandraClustersClientInvokeCommandResponse struct { // Response of /command api CommandOutput } +// CassandraClustersClientListBackupsResponse contains the response from method CassandraClustersClient.NewListBackupsPager. +type CassandraClustersClientListBackupsResponse struct { + // List of restorable backups for a Cassandra cluster. + ListBackups +} + // CassandraClustersClientListByResourceGroupResponse contains the response from method CassandraClustersClient.NewListByResourceGroupPager. type CassandraClustersClientListByResourceGroupResponse struct { // List of managed Cassandra clusters. @@ -48,6 +72,12 @@ type CassandraClustersClientListBySubscriptionResponse struct { ListClusters } +// CassandraClustersClientListCommandResponse contains the response from method CassandraClustersClient.NewListCommandPager. +type CassandraClustersClientListCommandResponse struct { + // List of commands for cluster. + ListCommands +} + // CassandraClustersClientStartResponse contains the response from method CassandraClustersClient.BeginStart. type CassandraClustersClientStartResponse struct { // placeholder for future response values @@ -106,6 +136,12 @@ type CassandraResourcesClientCreateUpdateCassandraTableResponse struct { CassandraTableGetResults } +// CassandraResourcesClientCreateUpdateCassandraViewResponse contains the response from method CassandraResourcesClient.BeginCreateUpdateCassandraView. +type CassandraResourcesClientCreateUpdateCassandraViewResponse struct { + // An Azure Cosmos DB Cassandra view. + CassandraViewGetResults +} + // CassandraResourcesClientDeleteCassandraKeyspaceResponse contains the response from method CassandraResourcesClient.BeginDeleteCassandraKeyspace. type CassandraResourcesClientDeleteCassandraKeyspaceResponse struct { // placeholder for future response values @@ -116,6 +152,11 @@ type CassandraResourcesClientDeleteCassandraTableResponse struct { // placeholder for future response values } +// CassandraResourcesClientDeleteCassandraViewResponse contains the response from method CassandraResourcesClient.BeginDeleteCassandraView. +type CassandraResourcesClientDeleteCassandraViewResponse struct { + // placeholder for future response values +} + // CassandraResourcesClientGetCassandraKeyspaceResponse contains the response from method CassandraResourcesClient.GetCassandraKeyspace. type CassandraResourcesClientGetCassandraKeyspaceResponse struct { // An Azure Cosmos DB Cassandra keyspace. @@ -140,6 +181,18 @@ type CassandraResourcesClientGetCassandraTableThroughputResponse struct { ThroughputSettingsGetResults } +// CassandraResourcesClientGetCassandraViewResponse contains the response from method CassandraResourcesClient.GetCassandraView. +type CassandraResourcesClientGetCassandraViewResponse struct { + // An Azure Cosmos DB Cassandra view. + CassandraViewGetResults +} + +// CassandraResourcesClientGetCassandraViewThroughputResponse contains the response from method CassandraResourcesClient.GetCassandraViewThroughput. +type CassandraResourcesClientGetCassandraViewThroughputResponse struct { + // An Azure Cosmos DB resource throughput. + ThroughputSettingsGetResults +} + // CassandraResourcesClientListCassandraKeyspacesResponse contains the response from method CassandraResourcesClient.NewListCassandraKeyspacesPager. type CassandraResourcesClientListCassandraKeyspacesResponse struct { // The List operation response, that contains the Cassandra keyspaces and their properties. @@ -152,6 +205,12 @@ type CassandraResourcesClientListCassandraTablesResponse struct { CassandraTableListResult } +// CassandraResourcesClientListCassandraViewsResponse contains the response from method CassandraResourcesClient.NewListCassandraViewsPager. +type CassandraResourcesClientListCassandraViewsResponse struct { + // The List operation response, that contains the Cassandra views and their properties. + CassandraViewListResult +} + // CassandraResourcesClientMigrateCassandraKeyspaceToAutoscaleResponse contains the response from method CassandraResourcesClient.BeginMigrateCassandraKeyspaceToAutoscale. type CassandraResourcesClientMigrateCassandraKeyspaceToAutoscaleResponse struct { // An Azure Cosmos DB resource throughput. @@ -176,6 +235,18 @@ type CassandraResourcesClientMigrateCassandraTableToManualThroughputResponse str ThroughputSettingsGetResults } +// CassandraResourcesClientMigrateCassandraViewToAutoscaleResponse contains the response from method CassandraResourcesClient.BeginMigrateCassandraViewToAutoscale. +type CassandraResourcesClientMigrateCassandraViewToAutoscaleResponse struct { + // An Azure Cosmos DB resource throughput. + ThroughputSettingsGetResults +} + +// CassandraResourcesClientMigrateCassandraViewToManualThroughputResponse contains the response from method CassandraResourcesClient.BeginMigrateCassandraViewToManualThroughput. +type CassandraResourcesClientMigrateCassandraViewToManualThroughputResponse struct { + // An Azure Cosmos DB resource throughput. + ThroughputSettingsGetResults +} + // CassandraResourcesClientUpdateCassandraKeyspaceThroughputResponse contains the response from method CassandraResourcesClient.BeginUpdateCassandraKeyspaceThroughput. type CassandraResourcesClientUpdateCassandraKeyspaceThroughputResponse struct { // An Azure Cosmos DB resource throughput. @@ -188,6 +259,30 @@ type CassandraResourcesClientUpdateCassandraTableThroughputResponse struct { ThroughputSettingsGetResults } +// CassandraResourcesClientUpdateCassandraViewThroughputResponse contains the response from method CassandraResourcesClient.BeginUpdateCassandraViewThroughput. +type CassandraResourcesClientUpdateCassandraViewThroughputResponse struct { + // An Azure Cosmos DB resource throughput. + ThroughputSettingsGetResults +} + +// ChaosFaultClientEnableDisableResponse contains the response from method ChaosFaultClient.BeginEnableDisable. +type ChaosFaultClientEnableDisableResponse struct { + // A request object to enable/disable the chaos fault + ChaosFaultResource +} + +// ChaosFaultClientGetResponse contains the response from method ChaosFaultClient.Get. +type ChaosFaultClientGetResponse struct { + // A request object to enable/disable the chaos fault + ChaosFaultResource +} + +// ChaosFaultClientListResponse contains the response from method ChaosFaultClient.NewListPager. +type ChaosFaultClientListResponse struct { + // Chaos Fault List Response. + ChaosFaultListResponse +} + // CollectionClientListMetricDefinitionsResponse contains the response from method CollectionClient.NewListMetricDefinitionsPager. type CollectionClientListMetricDefinitionsResponse struct { // The response to a list metric definitions request. @@ -230,6 +325,48 @@ type CollectionRegionClientListMetricsResponse struct { MetricListResult } +// DataTransferJobsClientCancelResponse contains the response from method DataTransferJobsClient.Cancel. +type DataTransferJobsClientCancelResponse struct { + // A Cosmos DB Data Transfer Job + DataTransferJobGetResults +} + +// DataTransferJobsClientCompleteResponse contains the response from method DataTransferJobsClient.Complete. +type DataTransferJobsClientCompleteResponse struct { + // A Cosmos DB Data Transfer Job + DataTransferJobGetResults +} + +// DataTransferJobsClientCreateResponse contains the response from method DataTransferJobsClient.Create. +type DataTransferJobsClientCreateResponse struct { + // A Cosmos DB Data Transfer Job + DataTransferJobGetResults +} + +// DataTransferJobsClientGetResponse contains the response from method DataTransferJobsClient.Get. +type DataTransferJobsClientGetResponse struct { + // A Cosmos DB Data Transfer Job + DataTransferJobGetResults +} + +// DataTransferJobsClientListByDatabaseAccountResponse contains the response from method DataTransferJobsClient.NewListByDatabaseAccountPager. +type DataTransferJobsClientListByDatabaseAccountResponse struct { + // The List operation response, that contains the Data Transfer jobs and their properties. + DataTransferJobFeedResults +} + +// DataTransferJobsClientPauseResponse contains the response from method DataTransferJobsClient.Pause. +type DataTransferJobsClientPauseResponse struct { + // A Cosmos DB Data Transfer Job + DataTransferJobGetResults +} + +// DataTransferJobsClientResumeResponse contains the response from method DataTransferJobsClient.Resume. +type DataTransferJobsClientResumeResponse struct { + // A Cosmos DB Data Transfer Job + DataTransferJobGetResults +} + // DatabaseAccountRegionClientListMetricsResponse contains the response from method DatabaseAccountRegionClient.NewListMetricsPager. type DatabaseAccountRegionClientListMetricsResponse struct { // The response to a list metrics request. @@ -357,6 +494,29 @@ type DatabaseClientListUsagesResponse struct { UsagesResult } +// GraphResourcesClientCreateUpdateGraphResponse contains the response from method GraphResourcesClient.BeginCreateUpdateGraph. +type GraphResourcesClientCreateUpdateGraphResponse struct { + // An Azure Cosmos DB Graph resource. + GraphResourceGetResults +} + +// GraphResourcesClientDeleteGraphResourceResponse contains the response from method GraphResourcesClient.BeginDeleteGraphResource. +type GraphResourcesClientDeleteGraphResourceResponse struct { + // placeholder for future response values +} + +// GraphResourcesClientGetGraphResponse contains the response from method GraphResourcesClient.GetGraph. +type GraphResourcesClientGetGraphResponse struct { + // An Azure Cosmos DB Graph resource. + GraphResourceGetResults +} + +// GraphResourcesClientListGraphsResponse contains the response from method GraphResourcesClient.NewListGraphsPager. +type GraphResourcesClientListGraphsResponse struct { + // The List operation response, that contains the Graph resource and their properties. + GraphResourcesListResult +} + // GremlinResourcesClientCreateUpdateGremlinDatabaseResponse contains the response from method GremlinResourcesClient.BeginCreateUpdateGremlinDatabase. type GremlinResourcesClientCreateUpdateGremlinDatabaseResponse struct { // An Azure Cosmos DB Gremlin database. @@ -549,6 +709,12 @@ type MongoDBResourcesClientGetMongoUserDefinitionResponse struct { MongoUserDefinitionGetResults } +// MongoDBResourcesClientListMongoDBCollectionPartitionMergeResponse contains the response from method MongoDBResourcesClient.BeginListMongoDBCollectionPartitionMerge. +type MongoDBResourcesClientListMongoDBCollectionPartitionMergeResponse struct { + // List of physical partitions and their properties returned by a merge operation. + PhysicalPartitionStorageInfoCollection +} + // MongoDBResourcesClientListMongoDBCollectionsResponse contains the response from method MongoDBResourcesClient.NewListMongoDBCollectionsPager. type MongoDBResourcesClientListMongoDBCollectionsResponse struct { // The List operation response, that contains the MongoDB collections and their properties. @@ -597,6 +763,36 @@ type MongoDBResourcesClientMigrateMongoDBDatabaseToManualThroughputResponse stru ThroughputSettingsGetResults } +// MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse contains the response from method MongoDBResourcesClient.BeginMongoDBContainerRedistributeThroughput. +type MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse struct { + // An Azure Cosmos DB PhysicalPartitionThroughputInfoResult object. + PhysicalPartitionThroughputInfoResult +} + +// MongoDBResourcesClientMongoDBContainerRetrieveThroughputDistributionResponse contains the response from method MongoDBResourcesClient.BeginMongoDBContainerRetrieveThroughputDistribution. +type MongoDBResourcesClientMongoDBContainerRetrieveThroughputDistributionResponse struct { + // An Azure Cosmos DB PhysicalPartitionThroughputInfoResult object. + PhysicalPartitionThroughputInfoResult +} + +// MongoDBResourcesClientMongoDBDatabasePartitionMergeResponse contains the response from method MongoDBResourcesClient.BeginMongoDBDatabasePartitionMerge. +type MongoDBResourcesClientMongoDBDatabasePartitionMergeResponse struct { + // List of physical partitions and their properties returned by a merge operation. + PhysicalPartitionStorageInfoCollection +} + +// MongoDBResourcesClientMongoDBDatabaseRedistributeThroughputResponse contains the response from method MongoDBResourcesClient.BeginMongoDBDatabaseRedistributeThroughput. +type MongoDBResourcesClientMongoDBDatabaseRedistributeThroughputResponse struct { + // An Azure Cosmos DB PhysicalPartitionThroughputInfoResult object. + PhysicalPartitionThroughputInfoResult +} + +// MongoDBResourcesClientMongoDBDatabaseRetrieveThroughputDistributionResponse contains the response from method MongoDBResourcesClient.BeginMongoDBDatabaseRetrieveThroughputDistribution. +type MongoDBResourcesClientMongoDBDatabaseRetrieveThroughputDistributionResponse struct { + // An Azure Cosmos DB PhysicalPartitionThroughputInfoResult object. + PhysicalPartitionThroughputInfoResult +} + // MongoDBResourcesClientRetrieveContinuousBackupInformationResponse contains the response from method MongoDBResourcesClient.BeginRetrieveContinuousBackupInformation. type MongoDBResourcesClientRetrieveContinuousBackupInformationResponse struct { // Backup information of a resource. @@ -615,6 +811,23 @@ type MongoDBResourcesClientUpdateMongoDBDatabaseThroughputResponse struct { ThroughputSettingsGetResults } +// NetworkSecurityPerimeterConfigurationsClientGetResponse contains the response from method NetworkSecurityPerimeterConfigurationsClient.Get. +type NetworkSecurityPerimeterConfigurationsClientGetResponse struct { + // Network security perimeter (NSP) configuration resource + NetworkSecurityPerimeterConfiguration +} + +// NetworkSecurityPerimeterConfigurationsClientListResponse contains the response from method NetworkSecurityPerimeterConfigurationsClient.NewListPager. +type NetworkSecurityPerimeterConfigurationsClientListResponse struct { + // Result of a list NSP (network security perimeter) configurations request. + NetworkSecurityPerimeterConfigurationListResult +} + +// NetworkSecurityPerimeterConfigurationsClientReconcileResponse contains the response from method NetworkSecurityPerimeterConfigurationsClient.BeginReconcile. +type NetworkSecurityPerimeterConfigurationsClientReconcileResponse struct { + // placeholder for future response values +} + // NotebookWorkspacesClientCreateOrUpdateResponse contains the response from method NotebookWorkspacesClient.BeginCreateOrUpdate. type NotebookWorkspacesClientCreateOrUpdateResponse struct { // A notebook workspace resource @@ -959,6 +1172,12 @@ type SQLResourcesClientListClientEncryptionKeysResponse struct { ClientEncryptionKeysListResult } +// SQLResourcesClientListSQLContainerPartitionMergeResponse contains the response from method SQLResourcesClient.BeginListSQLContainerPartitionMerge. +type SQLResourcesClientListSQLContainerPartitionMergeResponse struct { + // List of physical partitions and their properties returned by a merge operation. + PhysicalPartitionStorageInfoCollection +} + // SQLResourcesClientListSQLContainersResponse contains the response from method SQLResourcesClient.NewListSQLContainersPager. type SQLResourcesClientListSQLContainersResponse struct { // The List operation response, that contains the containers and their properties. @@ -1031,6 +1250,36 @@ type SQLResourcesClientRetrieveContinuousBackupInformationResponse struct { BackupInformation } +// SQLResourcesClientSQLContainerRedistributeThroughputResponse contains the response from method SQLResourcesClient.BeginSQLContainerRedistributeThroughput. +type SQLResourcesClientSQLContainerRedistributeThroughputResponse struct { + // An Azure Cosmos DB PhysicalPartitionThroughputInfoResult object. + PhysicalPartitionThroughputInfoResult +} + +// SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse contains the response from method SQLResourcesClient.BeginSQLContainerRetrieveThroughputDistribution. +type SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse struct { + // An Azure Cosmos DB PhysicalPartitionThroughputInfoResult object. + PhysicalPartitionThroughputInfoResult +} + +// SQLResourcesClientSQLDatabasePartitionMergeResponse contains the response from method SQLResourcesClient.BeginSQLDatabasePartitionMerge. +type SQLResourcesClientSQLDatabasePartitionMergeResponse struct { + // List of physical partitions and their properties returned by a merge operation. + PhysicalPartitionStorageInfoCollection +} + +// SQLResourcesClientSQLDatabaseRedistributeThroughputResponse contains the response from method SQLResourcesClient.BeginSQLDatabaseRedistributeThroughput. +type SQLResourcesClientSQLDatabaseRedistributeThroughputResponse struct { + // An Azure Cosmos DB PhysicalPartitionThroughputInfoResult object. + PhysicalPartitionThroughputInfoResult +} + +// SQLResourcesClientSQLDatabaseRetrieveThroughputDistributionResponse contains the response from method SQLResourcesClient.BeginSQLDatabaseRetrieveThroughputDistribution. +type SQLResourcesClientSQLDatabaseRetrieveThroughputDistributionResponse struct { + // An Azure Cosmos DB PhysicalPartitionThroughputInfoResult object. + PhysicalPartitionThroughputInfoResult +} + // SQLResourcesClientUpdateSQLContainerThroughputResponse contains the response from method SQLResourcesClient.BeginUpdateSQLContainerThroughput. type SQLResourcesClientUpdateSQLContainerThroughputResponse struct { // An Azure Cosmos DB resource throughput. @@ -1118,3 +1367,61 @@ type TableResourcesClientUpdateTableThroughputResponse struct { // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } + +// ThroughputPoolAccountClientCreateResponse contains the response from method ThroughputPoolAccountClient.BeginCreate. +type ThroughputPoolAccountClientCreateResponse struct { + // An Azure Cosmos DB Throughputpool Account + ThroughputPoolAccountResource +} + +// ThroughputPoolAccountClientDeleteResponse contains the response from method ThroughputPoolAccountClient.BeginDelete. +type ThroughputPoolAccountClientDeleteResponse struct { + // placeholder for future response values +} + +// ThroughputPoolAccountClientGetResponse contains the response from method ThroughputPoolAccountClient.Get. +type ThroughputPoolAccountClientGetResponse struct { + // An Azure Cosmos DB Throughputpool Account + ThroughputPoolAccountResource +} + +// ThroughputPoolAccountsClientListResponse contains the response from method ThroughputPoolAccountsClient.NewListPager. +type ThroughputPoolAccountsClientListResponse struct { + // The List operation response, that contains the global database accounts and their properties. + ThroughputPoolAccountsListResult +} + +// ThroughputPoolClientCreateOrUpdateResponse contains the response from method ThroughputPoolClient.BeginCreateOrUpdate. +type ThroughputPoolClientCreateOrUpdateResponse struct { + // An Azure Cosmos DB Throughputpool. + ThroughputPoolResource +} + +// ThroughputPoolClientDeleteResponse contains the response from method ThroughputPoolClient.BeginDelete. +type ThroughputPoolClientDeleteResponse struct { + // placeholder for future response values +} + +// ThroughputPoolClientGetResponse contains the response from method ThroughputPoolClient.Get. +type ThroughputPoolClientGetResponse struct { + // An Azure Cosmos DB Throughputpool. + ThroughputPoolResource +} + +// ThroughputPoolClientUpdateResponse contains the response from method ThroughputPoolClient.BeginUpdate. +type ThroughputPoolClientUpdateResponse struct { + // An Azure Cosmos DB Throughputpool. + ThroughputPoolResource +} + +// ThroughputPoolsClientListByResourceGroupResponse contains the response from method ThroughputPoolsClient.NewListByResourceGroupPager. +type ThroughputPoolsClientListByResourceGroupResponse struct { + // The List operation response, that contains the throughput pools and their properties. + ThroughputPoolsListResult +} + +// ThroughputPoolsClientListResponse contains the response from method ThroughputPoolsClient.NewListPager. +type ThroughputPoolsClientListResponse struct { + // The List operation response, that contains the throughput pools and their properties. + ThroughputPoolsListResult +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorabledatabaseaccounts_client.go b/sdk/resourcemanager/cosmos/armcosmos/restorabledatabaseaccounts_client.go index 69dcebacc392..d2c00124da80 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorabledatabaseaccounts_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorabledatabaseaccounts_client.go @@ -47,7 +47,7 @@ func NewRestorableDatabaseAccountsClient(subscriptionID string, credential azcor // 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - location - Cosmos DB region, with spaces between words and each word capitalized. // - instanceID - The instanceId GUID of a restorable database account. // - options - RestorableDatabaseAccountsClientGetByLocationOptions contains the optional parameters for the RestorableDatabaseAccountsClient.GetByLocation @@ -94,7 +94,7 @@ func (client *RestorableDatabaseAccountsClient) getByLocationCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -112,7 +112,7 @@ func (client *RestorableDatabaseAccountsClient) getByLocationHandleResponse(resp // NewListPager - Lists all the restorable Azure Cosmos DB database accounts available under the subscription. This call requires // 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - options - RestorableDatabaseAccountsClientListOptions contains the optional parameters for the RestorableDatabaseAccountsClient.NewListPager // method. func (client *RestorableDatabaseAccountsClient) NewListPager(options *RestorableDatabaseAccountsClientListOptions) *runtime.Pager[RestorableDatabaseAccountsClientListResponse] { @@ -151,7 +151,7 @@ func (client *RestorableDatabaseAccountsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -170,7 +170,7 @@ func (client *RestorableDatabaseAccountsClient) listHandleResponse(resp *http.Re // in a region. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' // permission. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - location - Cosmos DB region, with spaces between words and each word capitalized. // - options - RestorableDatabaseAccountsClientListByLocationOptions contains the optional parameters for the RestorableDatabaseAccountsClient.NewListByLocationPager // method. @@ -214,7 +214,7 @@ func (client *RestorableDatabaseAccountsClient) listByLocationCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorabledatabaseaccounts_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/restorabledatabaseaccounts_client_example_test.go deleted file mode 100644 index c4e906fa0e1b..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorabledatabaseaccounts_client_example_test.go +++ /dev/null @@ -1,217 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBRestorableDatabaseAccountList.json -func ExampleRestorableDatabaseAccountsClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorableDatabaseAccountsClient().NewListByLocationPager("West US", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorableDatabaseAccountsListResult = armcosmos.RestorableDatabaseAccountsListResult{ - // Value: []*armcosmos.RestorableDatabaseAccountGetResult{ - // { - // Name: to.Ptr("d9b26648-2f53-4541-b3d8-3044f4f9810d"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDB/locations/West US/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d"), - // Location: to.Ptr("West US"), - // Properties: &armcosmos.RestorableDatabaseAccountProperties{ - // AccountName: to.Ptr("ddb1"), - // APIType: to.Ptr(armcosmos.APITypeSQL), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-11T21:56:15.000Z"); return t}()), - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09.000Z"); return t}()), - // OldestRestorableTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09.000Z"); return t}()), - // RestorableLocations: []*armcosmos.RestorableLocationResource{ - // { - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:10.000Z"); return t}()), - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:35.000Z"); return t}()), - // LocationName: to.Ptr("South Central US"), - // RegionalDatabaseAccountInstanceID: to.Ptr("d7a01f78-606f-45c6-9dac-0df32f433bb5"), - // }, - // { - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:10.000Z"); return t}()), - // LocationName: to.Ptr("West US"), - // RegionalDatabaseAccountInstanceID: to.Ptr("fdb43d84-1572-4697-b6e7-2bcda0c51b2c"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("4f9e6ace-ac7a-446c-98bc-194c502a06b4"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDB/locations/West US/restorableDatabaseAccounts/4f9e6ace-ac7a-446c-98bc-194c502a06b4"), - // Location: to.Ptr("West US"), - // Properties: &armcosmos.RestorableDatabaseAccountProperties{ - // AccountName: to.Ptr("ddb2"), - // APIType: to.Ptr(armcosmos.APITypeSQL), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T08:05:18.000Z"); return t}()), - // OldestRestorableTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T08:05:18.000Z"); return t}()), - // RestorableLocations: []*armcosmos.RestorableLocationResource{ - // { - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:10.000Z"); return t}()), - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:35.000Z"); return t}()), - // LocationName: to.Ptr("South Central US"), - // RegionalDatabaseAccountInstanceID: to.Ptr("d7a01f78-606f-45c6-9dac-0df32f433bb5"), - // }, - // { - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:10.000Z"); return t}()), - // LocationName: to.Ptr("West US"), - // RegionalDatabaseAccountInstanceID: to.Ptr("fdb43d84-1572-4697-b6e7-2bcda0c51b2c"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBRestorableDatabaseAccountNoLocationList.json -func ExampleRestorableDatabaseAccountsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorableDatabaseAccountsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorableDatabaseAccountsListResult = armcosmos.RestorableDatabaseAccountsListResult{ - // Value: []*armcosmos.RestorableDatabaseAccountGetResult{ - // { - // Name: to.Ptr("d9b26648-2f53-4541-b3d8-3044f4f9810d"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDB/locations/West US/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d"), - // Location: to.Ptr("West US"), - // Properties: &armcosmos.RestorableDatabaseAccountProperties{ - // AccountName: to.Ptr("ddb1"), - // APIType: to.Ptr(armcosmos.APITypeSQL), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-11T21:56:15.000Z"); return t}()), - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09.000Z"); return t}()), - // OldestRestorableTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09.000Z"); return t}()), - // RestorableLocations: []*armcosmos.RestorableLocationResource{ - // { - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:10.000Z"); return t}()), - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:35.000Z"); return t}()), - // LocationName: to.Ptr("South Central US"), - // RegionalDatabaseAccountInstanceID: to.Ptr("d7a01f78-606f-45c6-9dac-0df32f433bb5"), - // }, - // { - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:10.000Z"); return t}()), - // LocationName: to.Ptr("West US"), - // RegionalDatabaseAccountInstanceID: to.Ptr("fdb43d84-1572-4697-b6e7-2bcda0c51b2c"), - // }}, - // }, - // }, - // { - // Name: to.Ptr("4f9e6ace-ac7a-446c-98bc-194c502a06b4"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDB/locations/West US/restorableDatabaseAccounts/4f9e6ace-ac7a-446c-98bc-194c502a06b4"), - // Location: to.Ptr("East US"), - // Properties: &armcosmos.RestorableDatabaseAccountProperties{ - // AccountName: to.Ptr("ddb2"), - // APIType: to.Ptr(armcosmos.APITypeSQL), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T08:05:18.000Z"); return t}()), - // OldestRestorableTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-01T08:05:18.000Z"); return t}()), - // RestorableLocations: []*armcosmos.RestorableLocationResource{ - // { - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:10.000Z"); return t}()), - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:35.000Z"); return t}()), - // LocationName: to.Ptr("South Central US"), - // RegionalDatabaseAccountInstanceID: to.Ptr("d7a01f78-606f-45c6-9dac-0df32f433bb5"), - // }, - // { - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:10.000Z"); return t}()), - // LocationName: to.Ptr("West US"), - // RegionalDatabaseAccountInstanceID: to.Ptr("fdb43d84-1572-4697-b6e7-2bcda0c51b2c"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBRestorableDatabaseAccountGet.json -func ExampleRestorableDatabaseAccountsClient_GetByLocation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorableDatabaseAccountsClient().GetByLocation(ctx, "West US", "d9b26648-2f53-4541-b3d8-3044f4f9810d", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RestorableDatabaseAccountGetResult = armcosmos.RestorableDatabaseAccountGetResult{ - // Name: to.Ptr("d9b26648-2f53-4541-b3d8-3044f4f9810d"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDB/locations/West US/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d"), - // Location: to.Ptr("West US"), - // Properties: &armcosmos.RestorableDatabaseAccountProperties{ - // AccountName: to.Ptr("ddb1"), - // APIType: to.Ptr(armcosmos.APITypeSQL), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-04-11T21:56:15.000Z"); return t}()), - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09.000Z"); return t}()), - // OldestRestorableTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-01T22:05:09.000Z"); return t}()), - // RestorableLocations: []*armcosmos.RestorableLocationResource{ - // { - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:10.000Z"); return t}()), - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:35.000Z"); return t}()), - // LocationName: to.Ptr("South Central US"), - // RegionalDatabaseAccountInstanceID: to.Ptr("d7a01f78-606f-45c6-9dac-0df32f433bb5"), - // }, - // { - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:10.000Z"); return t}()), - // LocationName: to.Ptr("West US"), - // RegionalDatabaseAccountInstanceID: to.Ptr("fdb43d84-1572-4697-b6e7-2bcda0c51b2c"), - // }}, - // }, - // } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorablegremlindatabases_client.go b/sdk/resourcemanager/cosmos/armcosmos/restorablegremlindatabases_client.go index df9b7e2a9e12..7c62d959b31a 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablegremlindatabases_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorablegremlindatabases_client.go @@ -47,7 +47,7 @@ func NewRestorableGremlinDatabasesClient(subscriptionID string, credential azcor // account. This helps in scenario where database was accidentally deleted to get the deletion // time. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/…/read' permission // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - location - Cosmos DB region, with spaces between words and each word capitalized. // - instanceID - The instanceId GUID of a restorable database account. // - options - RestorableGremlinDatabasesClientListOptions contains the optional parameters for the RestorableGremlinDatabasesClient.NewListPager @@ -96,7 +96,7 @@ func (client *RestorableGremlinDatabasesClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorablegremlindatabases_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/restorablegremlindatabases_client_example_test.go deleted file mode 100644 index f5279704479f..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablegremlindatabases_client_example_test.go +++ /dev/null @@ -1,77 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBRestorableGremlinDatabaseList.json -func ExampleRestorableGremlinDatabasesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorableGremlinDatabasesClient().NewListPager("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorableGremlinDatabasesListResult = armcosmos.RestorableGremlinDatabasesListResult{ - // Value: []*armcosmos.RestorableGremlinDatabaseGetResult{ - // { - // Name: to.Ptr("59c21367-b98b-4a8e-abb7-b6f46600decc"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableGremlinDatabases"), - // ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/36f09704-6be3-4f33-aa05-17b73e504c75/restorableGremlinDatabases/59c21367-b98b-4a8e-abb7-b6f46600decc"), - // Properties: &armcosmos.RestorableGremlinDatabaseProperties{ - // Resource: &armcosmos.RestorableGremlinDatabasePropertiesResource{ - // Rid: to.Ptr("DLB14gAAAA=="), - // CanUndelete: to.Ptr("invalid"), - // EventTimestamp: to.Ptr("2020-09-02T19:45:03Z"), - // OperationType: to.Ptr(armcosmos.OperationTypeCreate), - // OwnerID: to.Ptr("Database1"), - // OwnerResourceID: to.Ptr("PD5DALigDgw="), - // }, - // }, - // }, - // { - // Name: to.Ptr("8456cb17-cdb0-4c6a-8db8-d0ff3f886257"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableGremlinDatabases"), - // ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorableGremlinDatabases/8456cb17-cdb0-4c6a-8db8-d0ff3f886257"), - // Properties: &armcosmos.RestorableGremlinDatabaseProperties{ - // Resource: &armcosmos.RestorableGremlinDatabasePropertiesResource{ - // Rid: to.Ptr("ESXNLAAAAA=="), - // CanUndelete: to.Ptr("notRestorable"), - // CanUndeleteReason: to.Ptr("Database already exists. Only deleted resources can be restored within same account."), - // EventTimestamp: to.Ptr("2020-09-02T19:53:42Z"), - // OperationType: to.Ptr(armcosmos.OperationTypeDelete), - // OwnerID: to.Ptr("Database1"), - // OwnerResourceID: to.Ptr("PD5DALigDgw="), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorablegremlingraphs_client.go b/sdk/resourcemanager/cosmos/armcosmos/restorablegremlingraphs_client.go index 308fcc2f51f5..66514dc7c50f 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablegremlingraphs_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorablegremlingraphs_client.go @@ -47,7 +47,7 @@ func NewRestorableGremlinGraphsClient(subscriptionID string, credential azcore.T // This helps in scenario where container was accidentally deleted. This API requires // 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/…/read' permission // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - location - Cosmos DB region, with spaces between words and each word capitalized. // - instanceID - The instanceId GUID of a restorable database account. // - options - RestorableGremlinGraphsClientListOptions contains the optional parameters for the RestorableGremlinGraphsClient.NewListPager @@ -96,7 +96,7 @@ func (client *RestorableGremlinGraphsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") if options != nil && options.EndTime != nil { reqQP.Set("endTime", *options.EndTime) } diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorablegremlingraphs_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/restorablegremlingraphs_client_example_test.go deleted file mode 100644 index 8c56ce05f0ca..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablegremlingraphs_client_example_test.go +++ /dev/null @@ -1,81 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBRestorableGremlinGraphList.json -func ExampleRestorableGremlinGraphsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorableGremlinGraphsClient().NewListPager("WestUS", "98a570f2-63db-4117-91f0-366327b7b353", &armcosmos.RestorableGremlinGraphsClientListOptions{RestorableGremlinDatabaseRid: to.Ptr("PD5DALigDgw="), - StartTime: nil, - EndTime: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorableGremlinGraphsListResult = armcosmos.RestorableGremlinGraphsListResult{ - // Value: []*armcosmos.RestorableGremlinGraphGetResult{ - // { - // Name: to.Ptr("79609a98-3394-41f8-911f-cfab0c075c86"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableGraphs"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/98a570f2-63db-4117-91f0-366327b7b353/restorableGraphs/79609a98-3394-41f8-911f-cfab0c075c86"), - // Properties: &armcosmos.RestorableGremlinGraphProperties{ - // Resource: &armcosmos.RestorableGremlinGraphPropertiesResource{ - // Rid: to.Ptr("zAyAPQAAAA=="), - // CanUndelete: to.Ptr("invalid"), - // EventTimestamp: to.Ptr("2020-10-13T04:56:42Z"), - // OperationType: to.Ptr(armcosmos.OperationTypeCreate), - // OwnerID: to.Ptr("Graph1"), - // OwnerResourceID: to.Ptr("V18LoLrv-qA="), - // }, - // }, - // }, - // { - // Name: to.Ptr("79609a98-3394-41f8-911f-cfab0c075c86"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableGraphs"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/98a570f2-63db-4117-91f0-366327b7b353/restorableGraphs/79609a98-3394-41f8-911f-cfab0c075c86"), - // Properties: &armcosmos.RestorableGremlinGraphProperties{ - // Resource: &armcosmos.RestorableGremlinGraphPropertiesResource{ - // Rid: to.Ptr("zAyAPQAAAA=="), - // CanUndelete: to.Ptr("notRestorable"), - // CanUndeleteReason: to.Ptr("Individual shared database collections restore is not supported. Please restore shared database to restore its collections that share the throughput."), - // EventTimestamp: to.Ptr("2020-10-13T04:56:42Z"), - // OperationType: to.Ptr(armcosmos.OperationTypeDelete), - // OwnerID: to.Ptr("Graph1"), - // OwnerResourceID: to.Ptr("V18LoLrv-qA="), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorablegremlinresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/restorablegremlinresources_client.go index 329132627c07..88e40c839cd9 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablegremlinresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorablegremlinresources_client.go @@ -47,7 +47,7 @@ func NewRestorableGremlinResourcesClient(subscriptionID string, credential azcor // location. This helps in scenarios to validate what resources exist at given timestamp and // location. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/…/read' permission. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - location - Cosmos DB region, with spaces between words and each word capitalized. // - instanceID - The instanceId GUID of a restorable database account. // - options - RestorableGremlinResourcesClientListOptions contains the optional parameters for the RestorableGremlinResourcesClient.NewListPager @@ -96,7 +96,7 @@ func (client *RestorableGremlinResourcesClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") if options != nil && options.RestoreLocation != nil { reqQP.Set("restoreLocation", *options.RestoreLocation) } diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorablegremlinresources_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/restorablegremlinresources_client_example_test.go deleted file mode 100644 index c8a2fc74fc48..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablegremlinresources_client_example_test.go +++ /dev/null @@ -1,74 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBRestorableGremlinResourceList.json -func ExampleRestorableGremlinResourcesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorableGremlinResourcesClient().NewListPager("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", &armcosmos.RestorableGremlinResourcesClientListOptions{RestoreLocation: to.Ptr("WestUS"), - RestoreTimestampInUTC: to.Ptr("06/01/2022 4:56"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorableGremlinResourcesListResult = armcosmos.RestorableGremlinResourcesListResult{ - // Value: []*armcosmos.RestorableGremlinResourcesGetResult{ - // { - // Name: to.Ptr("Database1"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableGremlinResources"), - // DatabaseName: to.Ptr("Database1"), - // GraphNames: []*string{ - // to.Ptr("Graph1")}, - // ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorableGremlinResources/Database1"), - // }, - // { - // Name: to.Ptr("Database2"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableGremlinResources"), - // DatabaseName: to.Ptr("Database2"), - // GraphNames: []*string{ - // to.Ptr("Graph1"), - // to.Ptr("Graph2")}, - // ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorableGremlinResources/Database2"), - // }, - // { - // Name: to.Ptr("Database3"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableGremlinResources"), - // DatabaseName: to.Ptr("Database3"), - // GraphNames: []*string{ - // }, - // ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorableGremlinResources/Database3"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbcollections_client.go b/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbcollections_client.go index a42980172354..9a6da40b8a23 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbcollections_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbcollections_client.go @@ -47,7 +47,7 @@ func NewRestorableMongodbCollectionsClient(subscriptionID string, credential azc // database. This helps in scenario where container was accidentally deleted. This API requires // 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/…/read' permission // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - location - Cosmos DB region, with spaces between words and each word capitalized. // - instanceID - The instanceId GUID of a restorable database account. // - options - RestorableMongodbCollectionsClientListOptions contains the optional parameters for the RestorableMongodbCollectionsClient.NewListPager @@ -96,7 +96,7 @@ func (client *RestorableMongodbCollectionsClient) listCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") if options != nil && options.EndTime != nil { reqQP.Set("endTime", *options.EndTime) } diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbcollections_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbcollections_client_example_test.go deleted file mode 100644 index bd873b99370d..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbcollections_client_example_test.go +++ /dev/null @@ -1,81 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBRestorableMongodbCollectionList.json -func ExampleRestorableMongodbCollectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorableMongodbCollectionsClient().NewListPager("WestUS", "98a570f2-63db-4117-91f0-366327b7b353", &armcosmos.RestorableMongodbCollectionsClientListOptions{RestorableMongodbDatabaseRid: to.Ptr("PD5DALigDgw="), - StartTime: nil, - EndTime: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorableMongodbCollectionsListResult = armcosmos.RestorableMongodbCollectionsListResult{ - // Value: []*armcosmos.RestorableMongodbCollectionGetResult{ - // { - // Name: to.Ptr("79609a98-3394-41f8-911f-cfab0c075c86"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableMongodbCollections"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/98a570f2-63db-4117-91f0-366327b7b353/restorableMongodbCollections/79609a98-3394-41f8-911f-cfab0c075c86"), - // Properties: &armcosmos.RestorableMongodbCollectionProperties{ - // Resource: &armcosmos.RestorableMongodbCollectionPropertiesResource{ - // Rid: to.Ptr("zAyAPQAAAA=="), - // CanUndelete: to.Ptr("invalid"), - // EventTimestamp: to.Ptr("2020-10-13T04:56:42Z"), - // OperationType: to.Ptr(armcosmos.OperationTypeCreate), - // OwnerID: to.Ptr("Collection1"), - // OwnerResourceID: to.Ptr("V18LoLrv-qA="), - // }, - // }, - // }, - // { - // Name: to.Ptr("79609a98-3394-41f8-911f-cfab0c075c86"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableMongodbCollections"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/98a570f2-63db-4117-91f0-366327b7b353/restorableMongodbCollections/79609a98-3394-41f8-911f-cfab0c075c86"), - // Properties: &armcosmos.RestorableMongodbCollectionProperties{ - // Resource: &armcosmos.RestorableMongodbCollectionPropertiesResource{ - // Rid: to.Ptr("zAyAPQAAAA=="), - // CanUndelete: to.Ptr("notRestorable"), - // CanUndeleteReason: to.Ptr("Individual shared database collections restore is not supported. Please restore shared database to restore its collections that share the throughput."), - // EventTimestamp: to.Ptr("2020-10-13T04:56:42Z"), - // OperationType: to.Ptr(armcosmos.OperationTypeDelete), - // OwnerID: to.Ptr("Collection1"), - // OwnerResourceID: to.Ptr("V18LoLrv-qA="), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbdatabases_client.go b/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbdatabases_client.go index 39913c488532..10b268da704e 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbdatabases_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbdatabases_client.go @@ -47,7 +47,7 @@ func NewRestorableMongodbDatabasesClient(subscriptionID string, credential azcor // account. This helps in scenario where database was accidentally deleted to get the deletion // time. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/…/read' permission // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - location - Cosmos DB region, with spaces between words and each word capitalized. // - instanceID - The instanceId GUID of a restorable database account. // - options - RestorableMongodbDatabasesClientListOptions contains the optional parameters for the RestorableMongodbDatabasesClient.NewListPager @@ -96,7 +96,7 @@ func (client *RestorableMongodbDatabasesClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbdatabases_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbdatabases_client_example_test.go deleted file mode 100644 index 66b79e142ef8..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbdatabases_client_example_test.go +++ /dev/null @@ -1,77 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBRestorableMongodbDatabaseList.json -func ExampleRestorableMongodbDatabasesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorableMongodbDatabasesClient().NewListPager("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorableMongodbDatabasesListResult = armcosmos.RestorableMongodbDatabasesListResult{ - // Value: []*armcosmos.RestorableMongodbDatabaseGetResult{ - // { - // Name: to.Ptr("59c21367-b98b-4a8e-abb7-b6f46600decc"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableMongodbDatabases"), - // ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/36f09704-6be3-4f33-aa05-17b73e504c75/restorableMongodbDatabases/59c21367-b98b-4a8e-abb7-b6f46600decc"), - // Properties: &armcosmos.RestorableMongodbDatabaseProperties{ - // Resource: &armcosmos.RestorableMongodbDatabasePropertiesResource{ - // Rid: to.Ptr("DLB14gAAAA=="), - // CanUndelete: to.Ptr("invalid"), - // EventTimestamp: to.Ptr("2020-09-02T19:45:03Z"), - // OperationType: to.Ptr(armcosmos.OperationTypeCreate), - // OwnerID: to.Ptr("Database1"), - // OwnerResourceID: to.Ptr("PD5DALigDgw="), - // }, - // }, - // }, - // { - // Name: to.Ptr("8456cb17-cdb0-4c6a-8db8-d0ff3f886257"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableMongodbDatabases"), - // ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorableMongodbDatabases/8456cb17-cdb0-4c6a-8db8-d0ff3f886257"), - // Properties: &armcosmos.RestorableMongodbDatabaseProperties{ - // Resource: &armcosmos.RestorableMongodbDatabasePropertiesResource{ - // Rid: to.Ptr("ESXNLAAAAA=="), - // CanUndelete: to.Ptr("notRestorable"), - // CanUndeleteReason: to.Ptr("Database already exists. Only deleted resources can be restored within same account."), - // EventTimestamp: to.Ptr("2020-09-02T19:53:42Z"), - // OperationType: to.Ptr(armcosmos.OperationTypeDelete), - // OwnerID: to.Ptr("Database1"), - // OwnerResourceID: to.Ptr("PD5DALigDgw="), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbresources_client.go index 6b9c3d7292e4..9de0bba347ea 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbresources_client.go @@ -47,7 +47,7 @@ func NewRestorableMongodbResourcesClient(subscriptionID string, credential azcor // This helps in scenarios to validate what resources exist at given timestamp and location. // This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/…/read' permission. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - location - Cosmos DB region, with spaces between words and each word capitalized. // - instanceID - The instanceId GUID of a restorable database account. // - options - RestorableMongodbResourcesClientListOptions contains the optional parameters for the RestorableMongodbResourcesClient.NewListPager @@ -96,7 +96,7 @@ func (client *RestorableMongodbResourcesClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") if options != nil && options.RestoreLocation != nil { reqQP.Set("restoreLocation", *options.RestoreLocation) } diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbresources_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbresources_client_example_test.go deleted file mode 100644 index caefbf5eaf77..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbresources_client_example_test.go +++ /dev/null @@ -1,74 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBRestorableMongodbResourceList.json -func ExampleRestorableMongodbResourcesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorableMongodbResourcesClient().NewListPager("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", &armcosmos.RestorableMongodbResourcesClientListOptions{RestoreLocation: to.Ptr("WestUS"), - RestoreTimestampInUTC: to.Ptr("06/01/2022 4:56"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorableMongodbResourcesListResult = armcosmos.RestorableMongodbResourcesListResult{ - // Value: []*armcosmos.RestorableMongodbResourcesGetResult{ - // { - // Name: to.Ptr("Database1"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorablemongodbresources"), - // CollectionNames: []*string{ - // to.Ptr("Collection1")}, - // DatabaseName: to.Ptr("Database1"), - // ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorablemongodbresources/Database1"), - // }, - // { - // Name: to.Ptr("Database2"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorablemongodbresources"), - // CollectionNames: []*string{ - // to.Ptr("Collection1"), - // to.Ptr("Collection2")}, - // DatabaseName: to.Ptr("Database2"), - // ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorablemongodbresources/Database2"), - // }, - // { - // Name: to.Ptr("Database3"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorablemongodbresources"), - // CollectionNames: []*string{ - // }, - // DatabaseName: to.Ptr("Database3"), - // ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorablemongodbresources/Database3"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorablesqlcontainers_client.go b/sdk/resourcemanager/cosmos/armcosmos/restorablesqlcontainers_client.go index 6e14453bea54..7bb4390fa479 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablesqlcontainers_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorablesqlcontainers_client.go @@ -47,7 +47,7 @@ func NewRestorableSQLContainersClient(subscriptionID string, credential azcore.T // This helps in scenario where container was accidentally deleted. This API requires // 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/…/read' permission // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - location - Cosmos DB region, with spaces between words and each word capitalized. // - instanceID - The instanceId GUID of a restorable database account. // - options - RestorableSQLContainersClientListOptions contains the optional parameters for the RestorableSQLContainersClient.NewListPager @@ -96,7 +96,7 @@ func (client *RestorableSQLContainersClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") if options != nil && options.EndTime != nil { reqQP.Set("endTime", *options.EndTime) } diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorablesqlcontainers_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/restorablesqlcontainers_client_example_test.go deleted file mode 100644 index 18a31f12024e..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablesqlcontainers_client_example_test.go +++ /dev/null @@ -1,133 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBRestorableSqlContainerList.json -func ExampleRestorableSQLContainersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorableSQLContainersClient().NewListPager("WestUS", "98a570f2-63db-4117-91f0-366327b7b353", &armcosmos.RestorableSQLContainersClientListOptions{RestorableSQLDatabaseRid: to.Ptr("3fu-hg=="), - StartTime: nil, - EndTime: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorableSQLContainersListResult = armcosmos.RestorableSQLContainersListResult{ - // Value: []*armcosmos.RestorableSQLContainerGetResult{ - // { - // Name: to.Ptr("79609a98-3394-41f8-911f-cfab0c075c86"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableSqlContainers"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/98a570f2-63db-4117-91f0-366327b7b353/restorableSqlContainers/79609a98-3394-41f8-911f-cfab0c075c86"), - // Properties: &armcosmos.RestorableSQLContainerProperties{ - // Resource: &armcosmos.RestorableSQLContainerPropertiesResource{ - // Rid: to.Ptr("zAyAPQAAAA=="), - // CanUndelete: to.Ptr("invalid"), - // Container: &armcosmos.RestorableSQLContainerPropertiesResourceContainer{ - // Etag: to.Ptr("\"00003e00-0000-0700-0000-5f85338a0000\""), - // Rid: to.Ptr("V18LoLrv-qA="), - // ConflictResolutionPolicy: &armcosmos.ConflictResolutionPolicy{ - // ConflictResolutionPath: to.Ptr("/_ts"), - // ConflictResolutionProcedure: to.Ptr(""), - // Mode: to.Ptr(armcosmos.ConflictResolutionModeLastWriterWins), - // }, - // ID: to.Ptr("Container1"), - // IndexingPolicy: &armcosmos.IndexingPolicy{ - // Automatic: to.Ptr(true), - // ExcludedPaths: []*armcosmos.ExcludedPath{ - // { - // Path: to.Ptr("/\"_etag\"/?"), - // }}, - // IncludedPaths: []*armcosmos.IncludedPath{ - // { - // Path: to.Ptr("/*"), - // }, - // { - // Path: to.Ptr("/\"_ts\"/?"), - // }}, - // IndexingMode: to.Ptr(armcosmos.IndexingModeConsistent), - // }, - // Self: to.Ptr("dbs/V18LoA==/colls/V18LoLrv-qA=/"), - // }, - // EventTimestamp: to.Ptr("2020-10-13T04:56:42Z"), - // OperationType: to.Ptr(armcosmos.OperationTypeCreate), - // OwnerID: to.Ptr("Container1"), - // OwnerResourceID: to.Ptr("V18LoLrv-qA="), - // }, - // }, - // }, - // { - // Name: to.Ptr("e85298a1-c631-4726-825e-a7ca092e9098"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableSqlContainers"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/98a570f2-63db-4117-91f0-366327b7b353/restorableSqlContainers/e85298a1-c631-4726-825e-a7ca092e9098"), - // Properties: &armcosmos.RestorableSQLContainerProperties{ - // Resource: &armcosmos.RestorableSQLContainerPropertiesResource{ - // Rid: to.Ptr("PrArcgAAAA=="), - // CanUndelete: to.Ptr("invalid"), - // Container: &armcosmos.RestorableSQLContainerPropertiesResourceContainer{ - // Etag: to.Ptr("\"00004400-0000-0700-0000-5f85351f0000\""), - // Rid: to.Ptr("V18LoLrv-qA="), - // ConflictResolutionPolicy: &armcosmos.ConflictResolutionPolicy{ - // ConflictResolutionPath: to.Ptr("/_ts"), - // ConflictResolutionProcedure: to.Ptr(""), - // Mode: to.Ptr(armcosmos.ConflictResolutionModeLastWriterWins), - // }, - // DefaultTTL: to.Ptr[int32](12345), - // ID: to.Ptr("Container1"), - // IndexingPolicy: &armcosmos.IndexingPolicy{ - // Automatic: to.Ptr(true), - // ExcludedPaths: []*armcosmos.ExcludedPath{ - // { - // Path: to.Ptr("/\"_etag\"/?"), - // }}, - // IncludedPaths: []*armcosmos.IncludedPath{ - // { - // Path: to.Ptr("/*"), - // }, - // { - // Path: to.Ptr("/\"_ts\"/?"), - // }}, - // IndexingMode: to.Ptr(armcosmos.IndexingModeConsistent), - // }, - // Self: to.Ptr("dbs/V18LoA==/colls/V18LoLrv-qA=/"), - // }, - // EventTimestamp: to.Ptr("2020-10-13T05:03:27Z"), - // OperationType: to.Ptr(armcosmos.OperationTypeReplace), - // OwnerID: to.Ptr("Container1"), - // OwnerResourceID: to.Ptr("V18LoLrv-qA="), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorablesqldatabases_client.go b/sdk/resourcemanager/cosmos/armcosmos/restorablesqldatabases_client.go index da79669ed4d3..1b32171dada0 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablesqldatabases_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorablesqldatabases_client.go @@ -47,7 +47,7 @@ func NewRestorableSQLDatabasesClient(subscriptionID string, credential azcore.To // account. This helps in scenario where database was accidentally deleted to get the deletion // time. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/…/read' permission // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - location - Cosmos DB region, with spaces between words and each word capitalized. // - instanceID - The instanceId GUID of a restorable database account. // - options - RestorableSQLDatabasesClientListOptions contains the optional parameters for the RestorableSQLDatabasesClient.NewListPager @@ -96,7 +96,7 @@ func (client *RestorableSQLDatabasesClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorablesqldatabases_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/restorablesqldatabases_client_example_test.go deleted file mode 100644 index ef3c275e3e38..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablesqldatabases_client_example_test.go +++ /dev/null @@ -1,117 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBRestorableSqlDatabaseList.json -func ExampleRestorableSQLDatabasesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorableSQLDatabasesClient().NewListPager("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorableSQLDatabasesListResult = armcosmos.RestorableSQLDatabasesListResult{ - // Value: []*armcosmos.RestorableSQLDatabaseGetResult{ - // { - // Name: to.Ptr("59c21367-b98b-4a8e-abb7-b6f46600decc"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableSqlDatabases"), - // ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/36f09704-6be3-4f33-aa05-17b73e504c75/restorableSqlDatabases/59c21367-b98b-4a8e-abb7-b6f46600decc"), - // Properties: &armcosmos.RestorableSQLDatabaseProperties{ - // Resource: &armcosmos.RestorableSQLDatabasePropertiesResource{ - // Rid: to.Ptr("DLB14gAAAA=="), - // CanUndelete: to.Ptr("invalid"), - // Database: &armcosmos.RestorableSQLDatabasePropertiesResourceDatabase{ - // Etag: to.Ptr("\"0000c20a-0000-0700-0000-5f4ff63f0000\""), - // Rid: to.Ptr("3fu-hg=="), - // ID: to.Ptr("Database1"), - // Colls: to.Ptr("colls/"), - // Self: to.Ptr("dbs/3fu-hg==/"), - // Users: to.Ptr("users/"), - // }, - // EventTimestamp: to.Ptr("2020-09-02T19:45:03Z"), - // OperationType: to.Ptr(armcosmos.OperationTypeCreate), - // OwnerID: to.Ptr("Database1"), - // OwnerResourceID: to.Ptr("3fu-hg=="), - // }, - // }, - // }, - // { - // Name: to.Ptr("8456cb17-cdb0-4c6a-8db8-d0ff3f886257"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableSqlDatabases"), - // ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorableSqlDatabases/8456cb17-cdb0-4c6a-8db8-d0ff3f886257"), - // Properties: &armcosmos.RestorableSQLDatabaseProperties{ - // Resource: &armcosmos.RestorableSQLDatabasePropertiesResource{ - // Rid: to.Ptr("ESXNLAAAAA=="), - // CanUndelete: to.Ptr("notRestorable"), - // CanUndeleteReason: to.Ptr("Database already exists. Only deleted resources can be restored within same account."), - // Database: &armcosmos.RestorableSQLDatabasePropertiesResourceDatabase{ - // Etag: to.Ptr("\"0000c20a-0000-0700-0000-5f4ff63f0000\""), - // Rid: to.Ptr("3fu-hg=="), - // Ts: to.Ptr[float32](1599075903), - // ID: to.Ptr("Database1"), - // Colls: to.Ptr("colls/"), - // Self: to.Ptr("dbs/3fu-hg==/"), - // Users: to.Ptr("users/"), - // }, - // EventTimestamp: to.Ptr("2020-09-02T19:53:42Z"), - // OperationType: to.Ptr(armcosmos.OperationTypeDelete), - // OwnerID: to.Ptr("Database1"), - // OwnerResourceID: to.Ptr("3fu-hg=="), - // }, - // }, - // }, - // { - // Name: to.Ptr("2c07991b-9c7c-4e85-be68-b18c1f2ff326"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableSqlDatabases"), - // ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorableSqlDatabases/2c07991b-9c7c-4e85-be68-b18c1f2ff326"), - // Properties: &armcosmos.RestorableSQLDatabaseProperties{ - // Resource: &armcosmos.RestorableSQLDatabasePropertiesResource{ - // Rid: to.Ptr("aXFqUQAAAA=="), - // CanUndelete: to.Ptr("invalid"), - // Database: &armcosmos.RestorableSQLDatabasePropertiesResourceDatabase{ - // Etag: to.Ptr("\"0000ca0a-0000-0700-0000-5f4ff82b0000\""), - // Rid: to.Ptr("0SziSg=="), - // ID: to.Ptr("Database2"), - // Colls: to.Ptr("colls/"), - // Self: to.Ptr("dbs/0SziSg==/"), - // Users: to.Ptr("users/"), - // }, - // EventTimestamp: to.Ptr("2020-09-02T19:53:15Z"), - // OperationType: to.Ptr(armcosmos.OperationTypeCreate), - // OwnerID: to.Ptr("Database2"), - // OwnerResourceID: to.Ptr("0SziSg=="), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorablesqlresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/restorablesqlresources_client.go index a7464b61e0b5..f3cbd3a4f496 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablesqlresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorablesqlresources_client.go @@ -47,7 +47,7 @@ func NewRestorableSQLResourcesClient(subscriptionID string, credential azcore.To // This helps in scenarios to validate what resources exist at given timestamp and location. // This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/…/read' permission. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - location - Cosmos DB region, with spaces between words and each word capitalized. // - instanceID - The instanceId GUID of a restorable database account. // - options - RestorableSQLResourcesClientListOptions contains the optional parameters for the RestorableSQLResourcesClient.NewListPager @@ -96,7 +96,7 @@ func (client *RestorableSQLResourcesClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") if options != nil && options.RestoreLocation != nil { reqQP.Set("restoreLocation", *options.RestoreLocation) } diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorablesqlresources_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/restorablesqlresources_client_example_test.go deleted file mode 100644 index 8d5c958ec0b9..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablesqlresources_client_example_test.go +++ /dev/null @@ -1,74 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBRestorableSqlResourceList.json -func ExampleRestorableSQLResourcesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorableSQLResourcesClient().NewListPager("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", &armcosmos.RestorableSQLResourcesClientListOptions{RestoreLocation: to.Ptr("WestUS"), - RestoreTimestampInUTC: to.Ptr("06/01/2022 4:56"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorableSQLResourcesListResult = armcosmos.RestorableSQLResourcesListResult{ - // Value: []*armcosmos.RestorableSQLResourcesGetResult{ - // { - // Name: to.Ptr("Database1"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorablesqlresources"), - // CollectionNames: []*string{ - // to.Ptr("Container1")}, - // DatabaseName: to.Ptr("Database1"), - // ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorablesqlresources/Database1"), - // }, - // { - // Name: to.Ptr("Database2"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorablesqlresources"), - // CollectionNames: []*string{ - // to.Ptr("Container1"), - // to.Ptr("Container2")}, - // DatabaseName: to.Ptr("Database2"), - // ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorablesqlresources/Database2"), - // }, - // { - // Name: to.Ptr("Database3"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorablesqlresources"), - // CollectionNames: []*string{ - // }, - // DatabaseName: to.Ptr("Database3"), - // ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorablesqlresources/Database3"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorabletableresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/restorabletableresources_client.go index d50d1a202e95..1ac94f78a7cc 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorabletableresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorabletableresources_client.go @@ -47,7 +47,7 @@ func NewRestorableTableResourcesClient(subscriptionID string, credential azcore. // to validate what resources exist at given timestamp and location. This API requires // 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/…/read' permission. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - location - Cosmos DB region, with spaces between words and each word capitalized. // - instanceID - The instanceId GUID of a restorable database account. // - options - RestorableTableResourcesClientListOptions contains the optional parameters for the RestorableTableResourcesClient.NewListPager @@ -96,7 +96,7 @@ func (client *RestorableTableResourcesClient) listCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") if options != nil && options.RestoreLocation != nil { reqQP.Set("restoreLocation", *options.RestoreLocation) } diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorabletableresources_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/restorabletableresources_client_example_test.go deleted file mode 100644 index a36028c553c4..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorabletableresources_client_example_test.go +++ /dev/null @@ -1,59 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBRestorableTableResourceList.json -func ExampleRestorableTableResourcesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorableTableResourcesClient().NewListPager("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", &armcosmos.RestorableTableResourcesClientListOptions{RestoreLocation: to.Ptr("WestUS"), - RestoreTimestampInUTC: to.Ptr("06/01/2022 4:56"), - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorableTableResourcesListResult = armcosmos.RestorableTableResourcesListResult{ - // Value: []*armcosmos.RestorableTableResourcesGetResult{ - // { - // Name: to.Ptr("table1"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorablesqlresources"), - // ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorabletableresources/table1"), - // }, - // { - // Name: to.Ptr("table2"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorablesqlresources"), - // ID: to.Ptr("/subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/d9b26648-2f53-4541-b3d8-3044f4f9810d/restorabletableresources/table2"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorabletables_client.go b/sdk/resourcemanager/cosmos/armcosmos/restorabletables_client.go index 9900fadaf6d7..809dad6514cd 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorabletables_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorabletables_client.go @@ -47,7 +47,7 @@ func NewRestorableTablesClient(subscriptionID string, credential azcore.TokenCre // table was accidentally deleted. This API requires // 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/…/read' permission // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - location - Cosmos DB region, with spaces between words and each word capitalized. // - instanceID - The instanceId GUID of a restorable database account. // - options - RestorableTablesClientListOptions contains the optional parameters for the RestorableTablesClient.NewListPager @@ -96,7 +96,7 @@ func (client *RestorableTablesClient) listCreateRequest(ctx context.Context, loc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") if options != nil && options.EndTime != nil { reqQP.Set("endTime", *options.EndTime) } diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorabletables_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/restorabletables_client_example_test.go deleted file mode 100644 index 2ee5ab526a09..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorabletables_client_example_test.go +++ /dev/null @@ -1,79 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBRestorableTableList.json -func ExampleRestorableTablesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRestorableTablesClient().NewListPager("WestUS", "98a570f2-63db-4117-91f0-366327b7b353", &armcosmos.RestorableTablesClientListOptions{StartTime: nil, - EndTime: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RestorableTablesListResult = armcosmos.RestorableTablesListResult{ - // Value: []*armcosmos.RestorableTableGetResult{ - // { - // Name: to.Ptr("79609a98-3394-41f8-911f-cfab0c075c86"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableTables"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/98a570f2-63db-4117-91f0-366327b7b353/restorableTables/79609a98-3394-41f8-911f-cfab0c075c86"), - // Properties: &armcosmos.RestorableTableProperties{ - // Resource: &armcosmos.RestorableTablePropertiesResource{ - // Rid: to.Ptr("zAyAPQAAAA=="), - // CanUndelete: to.Ptr("invalid"), - // EventTimestamp: to.Ptr("2020-10-13T04:56:42Z"), - // OperationType: to.Ptr(armcosmos.OperationTypeCreate), - // OwnerID: to.Ptr("Table1"), - // OwnerResourceID: to.Ptr("V18LoLrv-qA="), - // }, - // }, - // }, - // { - // Name: to.Ptr("79609a98-3394-41f8-911f-cfab0c075c86"), - // Type: to.Ptr("Microsoft.DocumentDB/locations/restorableDatabaseAccounts/restorableTables"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDb/locations/westus/restorableDatabaseAccounts/98a570f2-63db-4117-91f0-366327b7b353/restorableTables/79609a98-3394-41f8-911f-cfab0c075c86"), - // Properties: &armcosmos.RestorableTableProperties{ - // Resource: &armcosmos.RestorableTablePropertiesResource{ - // Rid: to.Ptr("zAyAPQAAAA=="), - // CanUndelete: to.Ptr("notRestorable"), - // CanUndeleteReason: to.Ptr("Collection with same name already exist as live collection."), - // EventTimestamp: to.Ptr("2020-10-13T04:56:42Z"), - // OperationType: to.Ptr(armcosmos.OperationTypeDelete), - // OwnerID: to.Ptr("Table1"), - // OwnerResourceID: to.Ptr("V18LoLrv-qA="), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/service_client.go b/sdk/resourcemanager/cosmos/armcosmos/service_client.go index a437dc0e801f..6c71c3b6e8a2 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/service_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/service_client.go @@ -46,7 +46,7 @@ func NewServiceClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreate - Creates a service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - serviceName - Cosmos DB service name. @@ -72,7 +72,7 @@ func (client *ServiceClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Creates a service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *ServiceClient) create(ctx context.Context, resourceGroupName string, accountName string, serviceName string, createUpdateParameters ServiceResourceCreateUpdateParameters, options *ServiceClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ServiceClient.BeginCreate" @@ -118,7 +118,7 @@ func (client *ServiceClient) createCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateParameters); err != nil { @@ -130,7 +130,7 @@ func (client *ServiceClient) createCreateRequest(ctx context.Context, resourceGr // BeginDelete - Deletes service with the given serviceName. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - serviceName - Cosmos DB service name. @@ -155,7 +155,7 @@ func (client *ServiceClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes service with the given serviceName. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *ServiceClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, serviceName string, options *ServiceClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ServiceClient.BeginDelete" @@ -201,7 +201,7 @@ func (client *ServiceClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -210,7 +210,7 @@ func (client *ServiceClient) deleteCreateRequest(ctx context.Context, resourceGr // Get - Gets the status of service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - serviceName - Cosmos DB service name. @@ -261,7 +261,7 @@ func (client *ServiceClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -278,7 +278,7 @@ func (client *ServiceClient) getHandleResponse(resp *http.Response) (ServiceClie // NewListPager - Gets the status of service. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - ServiceClientListOptions contains the optional parameters for the ServiceClient.NewListPager method. @@ -326,7 +326,7 @@ func (client *ServiceClient) listCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/service_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/service_client_example_test.go deleted file mode 100644 index 5b45197aab9e..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/service_client_example_test.go +++ /dev/null @@ -1,506 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBServicesList.json -func ExampleServiceClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServiceClient().NewListPager("rg1", "ddb1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServiceResourceListResult = armcosmos.ServiceResourceListResult{ - // Value: []*armcosmos.ServiceResource{ - // { - // Name: to.Ptr("sqlDedicatedGateway"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/services"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/services/sqlDedicatedGateway"), - // Properties: &armcosmos.SQLDedicatedGatewayServiceResourceProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-25T12:56:05.462Z"); return t}()), - // InstanceCount: to.Ptr[int32](1), - // InstanceSize: to.Ptr(armcosmos.ServiceSizeCosmosD4S), - // ServiceType: to.Ptr(armcosmos.ServiceTypeSQLDedicatedGateway), - // Status: to.Ptr(armcosmos.ServiceStatusRunning), - // Locations: []*armcosmos.SQLDedicatedGatewayRegionalServiceResource{ - // { - // Name: to.Ptr("sqlDedicatedGateway-westus2"), - // Location: to.Ptr("West US 2"), - // Status: to.Ptr(armcosmos.ServiceStatusRunning), - // SQLDedicatedGatewayEndpoint: to.Ptr("https://sqlDedicatedGateway-westus.sqlx.cosmos.windows-int.net/"), - // }}, - // SQLDedicatedGatewayEndpoint: to.Ptr("https://sqlDedicatedGateway.sqlx.cosmos.windows-int.net/"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDataTransferServiceCreate.json -func ExampleServiceClient_BeginCreate_dataTransferServiceCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginCreate(ctx, "rg1", "ddb1", "DataTransfer", armcosmos.ServiceResourceCreateUpdateParameters{ - Properties: &armcosmos.DataTransferServiceResourceCreateUpdateProperties{ - InstanceCount: to.Ptr[int32](1), - InstanceSize: to.Ptr(armcosmos.ServiceSizeCosmosD4S), - ServiceType: to.Ptr(armcosmos.ServiceTypeDataTransfer), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceResource = armcosmos.ServiceResource{ - // Name: to.Ptr("DataTransfer"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/services"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/services/DataTransfer"), - // Properties: &armcosmos.DataTransferServiceResourceProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-25T12:56:05.462Z"); return t}()), - // InstanceCount: to.Ptr[int32](1), - // InstanceSize: to.Ptr(armcosmos.ServiceSizeCosmosD4S), - // ServiceType: to.Ptr(armcosmos.ServiceTypeDataTransfer), - // Status: to.Ptr(armcosmos.ServiceStatusRunning), - // Locations: []*armcosmos.DataTransferRegionalServiceResource{ - // { - // Name: to.Ptr("DataTransfer-westus2"), - // Location: to.Ptr("West US 2"), - // Status: to.Ptr(armcosmos.ServiceStatusRunning), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGraphAPIComputeServiceCreate.json -func ExampleServiceClient_BeginCreate_graphApiComputeServiceCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginCreate(ctx, "rg1", "ddb1", "GraphAPICompute", armcosmos.ServiceResourceCreateUpdateParameters{ - Properties: &armcosmos.GraphAPIComputeServiceResourceCreateUpdateProperties{ - InstanceCount: to.Ptr[int32](1), - InstanceSize: to.Ptr(armcosmos.ServiceSizeCosmosD4S), - ServiceType: to.Ptr(armcosmos.ServiceTypeGraphAPICompute), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceResource = armcosmos.ServiceResource{ - // Name: to.Ptr("GraphAPICompute"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/services"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/services/GraphAPICompute"), - // Properties: &armcosmos.GraphAPIComputeServiceResourceProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-25T12:56:05.462Z"); return t}()), - // InstanceCount: to.Ptr[int32](1), - // InstanceSize: to.Ptr(armcosmos.ServiceSizeCosmosD4S), - // ServiceType: to.Ptr(armcosmos.ServiceTypeGraphAPICompute), - // Status: to.Ptr(armcosmos.ServiceStatusRunning), - // GraphAPIComputeEndpoint: to.Ptr("https://graphAPICompute.gremlin.cosmos.windows-int.net/"), - // Locations: []*armcosmos.GraphAPIComputeRegionalServiceResource{ - // { - // Name: to.Ptr("GraphAPICompute-westus2"), - // Location: to.Ptr("West US 2"), - // Status: to.Ptr(armcosmos.ServiceStatusRunning), - // GraphAPIComputeEndpoint: to.Ptr("https://graphAPICompute-westus.gremlin.cosmos.windows-int.net/"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMaterializedViewsBuilderServiceCreate.json -func ExampleServiceClient_BeginCreate_materializedViewsBuilderServiceCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginCreate(ctx, "rg1", "ddb1", "MaterializedViewsBuilder", armcosmos.ServiceResourceCreateUpdateParameters{ - Properties: &armcosmos.MaterializedViewsBuilderServiceResourceCreateUpdateProperties{ - InstanceCount: to.Ptr[int32](1), - InstanceSize: to.Ptr(armcosmos.ServiceSizeCosmosD4S), - ServiceType: to.Ptr(armcosmos.ServiceTypeMaterializedViewsBuilder), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceResource = armcosmos.ServiceResource{ - // Name: to.Ptr("MaterializedViewsBuilder"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/services"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/services/MaterializedViewsBuilder"), - // Properties: &armcosmos.MaterializedViewsBuilderServiceResourceProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-25T12:56:05.462Z"); return t}()), - // InstanceCount: to.Ptr[int32](1), - // InstanceSize: to.Ptr(armcosmos.ServiceSizeCosmosD4S), - // ServiceType: to.Ptr(armcosmos.ServiceTypeMaterializedViewsBuilder), - // Status: to.Ptr(armcosmos.ServiceStatusRunning), - // Locations: []*armcosmos.MaterializedViewsBuilderRegionalServiceResource{ - // { - // Name: to.Ptr("MaterializedViewsBuilder-westus2"), - // Location: to.Ptr("West US 2"), - // Status: to.Ptr(armcosmos.ServiceStatusRunning), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/services/sqldedicatedgateway/CosmosDBSqlDedicatedGatewayServiceCreate.json -func ExampleServiceClient_BeginCreate_sqlDedicatedGatewayServiceCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginCreate(ctx, "rg1", "ddb1", "SqlDedicatedGateway", armcosmos.ServiceResourceCreateUpdateParameters{ - Properties: &armcosmos.SQLDedicatedGatewayServiceResourceCreateUpdateProperties{ - InstanceCount: to.Ptr[int32](1), - InstanceSize: to.Ptr(armcosmos.ServiceSizeCosmosD4S), - ServiceType: to.Ptr(armcosmos.ServiceTypeSQLDedicatedGateway), - DedicatedGatewayType: to.Ptr(armcosmos.DedicatedGatewayTypeIntegratedCache), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceResource = armcosmos.ServiceResource{ - // Name: to.Ptr("SqlDedicatedGateway"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/services"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/services/SqlDedicatedGateway"), - // Properties: &armcosmos.SQLDedicatedGatewayServiceResourceProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-25T12:56:05.462Z"); return t}()), - // InstanceCount: to.Ptr[int32](1), - // InstanceSize: to.Ptr(armcosmos.ServiceSizeCosmosD4S), - // ServiceType: to.Ptr(armcosmos.ServiceTypeSQLDedicatedGateway), - // Status: to.Ptr(armcosmos.ServiceStatusRunning), - // DedicatedGatewayType: to.Ptr(armcosmos.DedicatedGatewayTypeIntegratedCache), - // Locations: []*armcosmos.SQLDedicatedGatewayRegionalServiceResource{ - // { - // Name: to.Ptr("SqlDedicatedGateway-westus2"), - // Location: to.Ptr("West US 2"), - // Status: to.Ptr(armcosmos.ServiceStatusRunning), - // SQLDedicatedGatewayEndpoint: to.Ptr("https://sqlDedicatedGateway-westus.sqlx.cosmos.windows-int.net/"), - // }}, - // SQLDedicatedGatewayEndpoint: to.Ptr("https://sqlDedicatedGateway.sqlx.cosmos.windows-int.net/"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDataTransferServiceGet.json -func ExampleServiceClient_Get_dataTransferServiceGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceClient().Get(ctx, "rg1", "ddb1", "DataTransfer", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceResource = armcosmos.ServiceResource{ - // Name: to.Ptr("DataTransfer"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/services"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/services/DataTransfer"), - // Properties: &armcosmos.DataTransferServiceResourceProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-25T12:56:05.462Z"); return t}()), - // InstanceCount: to.Ptr[int32](1), - // InstanceSize: to.Ptr(armcosmos.ServiceSizeCosmosD4S), - // ServiceType: to.Ptr(armcosmos.ServiceTypeDataTransfer), - // Status: to.Ptr(armcosmos.ServiceStatusRunning), - // Locations: []*armcosmos.DataTransferRegionalServiceResource{ - // { - // Name: to.Ptr("DataTransfer-westus2"), - // Location: to.Ptr("West US 2"), - // Status: to.Ptr(armcosmos.ServiceStatusRunning), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGraphAPIComputeServiceGet.json -func ExampleServiceClient_Get_graphApiComputeServiceGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceClient().Get(ctx, "rg1", "ddb1", "GraphAPICompute", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceResource = armcosmos.ServiceResource{ - // Name: to.Ptr("GraphAPICompute"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/services"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/services/GraphAPICompute"), - // Properties: &armcosmos.GraphAPIComputeServiceResourceProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-25T12:56:05.462Z"); return t}()), - // InstanceCount: to.Ptr[int32](1), - // InstanceSize: to.Ptr(armcosmos.ServiceSizeCosmosD4S), - // ServiceType: to.Ptr(armcosmos.ServiceTypeGraphAPICompute), - // Status: to.Ptr(armcosmos.ServiceStatusRunning), - // GraphAPIComputeEndpoint: to.Ptr("https://graphAPICompute.gremlin.cosmos.windows-int.net/"), - // Locations: []*armcosmos.GraphAPIComputeRegionalServiceResource{ - // { - // Name: to.Ptr("GraphAPICompute-westus2"), - // Location: to.Ptr("West US 2"), - // Status: to.Ptr(armcosmos.ServiceStatusRunning), - // GraphAPIComputeEndpoint: to.Ptr("https://graphAPICompute-westus.gremlin.cosmos.windows-int.net/"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMaterializedViewsBuilderServiceGet.json -func ExampleServiceClient_Get_materializedViewsBuilderServiceGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceClient().Get(ctx, "rg1", "ddb1", "MaterializedViewsBuilder", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceResource = armcosmos.ServiceResource{ - // Name: to.Ptr("MaterializedViewsBuilder"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/services"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/services/MaterializedViewsBuilder"), - // Properties: &armcosmos.MaterializedViewsBuilderServiceResourceProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-25T12:56:05.462Z"); return t}()), - // InstanceCount: to.Ptr[int32](1), - // InstanceSize: to.Ptr(armcosmos.ServiceSizeCosmosD4S), - // ServiceType: to.Ptr(armcosmos.ServiceTypeMaterializedViewsBuilder), - // Status: to.Ptr(armcosmos.ServiceStatusRunning), - // Locations: []*armcosmos.MaterializedViewsBuilderRegionalServiceResource{ - // { - // Name: to.Ptr("MaterializedViewsBuilder-westus2"), - // Location: to.Ptr("West US 2"), - // Status: to.Ptr(armcosmos.ServiceStatusRunning), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/services/sqldedicatedgateway/CosmosDBSqlDedicatedGatewayServiceGet.json -func ExampleServiceClient_Get_sqlDedicatedGatewayServiceGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServiceClient().Get(ctx, "rg1", "ddb1", "SqlDedicatedGateway", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServiceResource = armcosmos.ServiceResource{ - // Name: to.Ptr("SqlDedicatedGateway"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/services"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/services/SqlDedicatedGateway"), - // Properties: &armcosmos.SQLDedicatedGatewayServiceResourceProperties{ - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-25T12:56:05.462Z"); return t}()), - // InstanceCount: to.Ptr[int32](1), - // InstanceSize: to.Ptr(armcosmos.ServiceSizeCosmosD4S), - // ServiceType: to.Ptr(armcosmos.ServiceTypeSQLDedicatedGateway), - // Status: to.Ptr(armcosmos.ServiceStatusRunning), - // DedicatedGatewayType: to.Ptr(armcosmos.DedicatedGatewayTypeIntegratedCache), - // Locations: []*armcosmos.SQLDedicatedGatewayRegionalServiceResource{ - // { - // Name: to.Ptr("SqlDedicatedGateway-westus2"), - // Location: to.Ptr("West US 2"), - // Status: to.Ptr(armcosmos.ServiceStatusRunning), - // SQLDedicatedGatewayEndpoint: to.Ptr("https://sqlDedicatedGateway-westus.sqlx.cosmos.windows-int.net/"), - // }}, - // SQLDedicatedGatewayEndpoint: to.Ptr("https://sqlDedicatedGateway.sqlx.cosmos.windows-int.net/"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBDataTransferServiceDelete.json -func ExampleServiceClient_BeginDelete_dataTransferServiceDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginDelete(ctx, "rg1", "ddb1", "DataTransfer", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBGraphAPIComputeServiceDelete.json -func ExampleServiceClient_BeginDelete_graphApiComputeServiceDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginDelete(ctx, "rg1", "ddb1", "GraphAPICompute", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBMaterializedViewsBuilderServiceDelete.json -func ExampleServiceClient_BeginDelete_materializedViewsBuilderServiceDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginDelete(ctx, "rg1", "ddb1", "MaterializedViewsBuilder", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/services/sqldedicatedgateway/CosmosDBSqlDedicatedGatewayServiceDelete.json -func ExampleServiceClient_BeginDelete_sqlDedicatedGatewayServiceDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServiceClient().BeginDelete(ctx, "rg1", "ddb1", "SqlDedicatedGateway", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/services_live_test.go b/sdk/resourcemanager/cosmos/armcosmos/services_live_test.go index 53b5c8601dbe..863cf12f00bf 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/services_live_test.go +++ b/sdk/resourcemanager/cosmos/armcosmos/services_live_test.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/cosmos/armcosmos/sqlresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/sqlresources_client.go index 96067218392b..f712929f79b8 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/sqlresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/sqlresources_client.go @@ -47,7 +47,7 @@ func NewSQLResourcesClient(subscriptionID string, credential azcore.TokenCredent // such as the Azure Powershell (instead of directly). // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -76,7 +76,7 @@ func (client *SQLResourcesClient) BeginCreateUpdateClientEncryptionKey(ctx conte // as the Azure Powershell (instead of directly). // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) createUpdateClientEncryptionKey(ctx context.Context, resourceGroupName string, accountName string, databaseName string, clientEncryptionKeyName string, createUpdateClientEncryptionKeyParameters ClientEncryptionKeyCreateUpdateParameters, options *SQLResourcesClientBeginCreateUpdateClientEncryptionKeyOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginCreateUpdateClientEncryptionKey" @@ -126,7 +126,7 @@ func (client *SQLResourcesClient) createUpdateClientEncryptionKeyCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateClientEncryptionKeyParameters); err != nil { @@ -138,7 +138,7 @@ func (client *SQLResourcesClient) createUpdateClientEncryptionKeyCreateRequest(c // BeginCreateUpdateSQLContainer - Create or update an Azure Cosmos DB SQL container // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -166,7 +166,7 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLContainer(ctx context.Cont // CreateUpdateSQLContainer - Create or update an Azure Cosmos DB SQL container // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) createUpdateSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, createUpdateSQLContainerParameters SQLContainerCreateUpdateParameters, options *SQLResourcesClientBeginCreateUpdateSQLContainerOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginCreateUpdateSQLContainer" @@ -216,7 +216,7 @@ func (client *SQLResourcesClient) createUpdateSQLContainerCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateSQLContainerParameters); err != nil { @@ -228,7 +228,7 @@ func (client *SQLResourcesClient) createUpdateSQLContainerCreateRequest(ctx cont // BeginCreateUpdateSQLDatabase - Create or update an Azure Cosmos DB SQL database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -255,7 +255,7 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLDatabase(ctx context.Conte // CreateUpdateSQLDatabase - Create or update an Azure Cosmos DB SQL database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) createUpdateSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters SQLDatabaseCreateUpdateParameters, options *SQLResourcesClientBeginCreateUpdateSQLDatabaseOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginCreateUpdateSQLDatabase" @@ -301,7 +301,7 @@ func (client *SQLResourcesClient) createUpdateSQLDatabaseCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateSQLDatabaseParameters); err != nil { @@ -313,7 +313,7 @@ func (client *SQLResourcesClient) createUpdateSQLDatabaseCreateRequest(ctx conte // BeginCreateUpdateSQLRoleAssignment - Creates or updates an Azure Cosmos DB SQL Role Assignment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - 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. @@ -340,7 +340,7 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLRoleAssignment(ctx context // CreateUpdateSQLRoleAssignment - Creates or updates an Azure Cosmos DB SQL Role Assignment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) createUpdateSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string, createUpdateSQLRoleAssignmentParameters SQLRoleAssignmentCreateUpdateParameters, options *SQLResourcesClientBeginCreateUpdateSQLRoleAssignmentOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginCreateUpdateSQLRoleAssignment" @@ -386,7 +386,7 @@ func (client *SQLResourcesClient) createUpdateSQLRoleAssignmentCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateSQLRoleAssignmentParameters); err != nil { @@ -398,7 +398,7 @@ func (client *SQLResourcesClient) createUpdateSQLRoleAssignmentCreateRequest(ctx // BeginCreateUpdateSQLRoleDefinition - Creates or updates an Azure Cosmos DB SQL Role Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - 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. @@ -425,7 +425,7 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLRoleDefinition(ctx context // CreateUpdateSQLRoleDefinition - Creates or updates an Azure Cosmos DB SQL Role Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) createUpdateSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string, createUpdateSQLRoleDefinitionParameters SQLRoleDefinitionCreateUpdateParameters, options *SQLResourcesClientBeginCreateUpdateSQLRoleDefinitionOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginCreateUpdateSQLRoleDefinition" @@ -471,7 +471,7 @@ func (client *SQLResourcesClient) createUpdateSQLRoleDefinitionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateSQLRoleDefinitionParameters); err != nil { @@ -483,7 +483,7 @@ func (client *SQLResourcesClient) createUpdateSQLRoleDefinitionCreateRequest(ctx // BeginCreateUpdateSQLStoredProcedure - Create or update an Azure Cosmos DB SQL storedProcedure // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -512,7 +512,7 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLStoredProcedure(ctx contex // CreateUpdateSQLStoredProcedure - Create or update an Azure Cosmos DB SQL storedProcedure // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) createUpdateSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, createUpdateSQLStoredProcedureParameters SQLStoredProcedureCreateUpdateParameters, options *SQLResourcesClientBeginCreateUpdateSQLStoredProcedureOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginCreateUpdateSQLStoredProcedure" @@ -566,7 +566,7 @@ func (client *SQLResourcesClient) createUpdateSQLStoredProcedureCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateSQLStoredProcedureParameters); err != nil { @@ -578,7 +578,7 @@ func (client *SQLResourcesClient) createUpdateSQLStoredProcedureCreateRequest(ct // BeginCreateUpdateSQLTrigger - Create or update an Azure Cosmos DB SQL trigger // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -607,7 +607,7 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLTrigger(ctx context.Contex // CreateUpdateSQLTrigger - Create or update an Azure Cosmos DB SQL trigger // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) createUpdateSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, createUpdateSQLTriggerParameters SQLTriggerCreateUpdateParameters, options *SQLResourcesClientBeginCreateUpdateSQLTriggerOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginCreateUpdateSQLTrigger" @@ -661,7 +661,7 @@ func (client *SQLResourcesClient) createUpdateSQLTriggerCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateSQLTriggerParameters); err != nil { @@ -673,7 +673,7 @@ func (client *SQLResourcesClient) createUpdateSQLTriggerCreateRequest(ctx contex // BeginCreateUpdateSQLUserDefinedFunction - Create or update an Azure Cosmos DB SQL userDefinedFunction // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -702,7 +702,7 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLUserDefinedFunction(ctx co // CreateUpdateSQLUserDefinedFunction - Create or update an Azure Cosmos DB SQL userDefinedFunction // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) createUpdateSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, createUpdateSQLUserDefinedFunctionParameters SQLUserDefinedFunctionCreateUpdateParameters, options *SQLResourcesClientBeginCreateUpdateSQLUserDefinedFunctionOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginCreateUpdateSQLUserDefinedFunction" @@ -756,7 +756,7 @@ func (client *SQLResourcesClient) createUpdateSQLUserDefinedFunctionCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateSQLUserDefinedFunctionParameters); err != nil { @@ -768,7 +768,7 @@ func (client *SQLResourcesClient) createUpdateSQLUserDefinedFunctionCreateReques // BeginDeleteSQLContainer - Deletes an existing Azure Cosmos DB SQL container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -795,7 +795,7 @@ func (client *SQLResourcesClient) BeginDeleteSQLContainer(ctx context.Context, r // DeleteSQLContainer - Deletes an existing Azure Cosmos DB SQL container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) deleteSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, options *SQLResourcesClientBeginDeleteSQLContainerOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginDeleteSQLContainer" @@ -845,7 +845,7 @@ func (client *SQLResourcesClient) deleteSQLContainerCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -853,7 +853,7 @@ func (client *SQLResourcesClient) deleteSQLContainerCreateRequest(ctx context.Co // BeginDeleteSQLDatabase - Deletes an existing Azure Cosmos DB SQL database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -879,7 +879,7 @@ func (client *SQLResourcesClient) BeginDeleteSQLDatabase(ctx context.Context, re // DeleteSQLDatabase - Deletes an existing Azure Cosmos DB SQL database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) deleteSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *SQLResourcesClientBeginDeleteSQLDatabaseOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginDeleteSQLDatabase" @@ -925,7 +925,7 @@ func (client *SQLResourcesClient) deleteSQLDatabaseCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -933,7 +933,7 @@ func (client *SQLResourcesClient) deleteSQLDatabaseCreateRequest(ctx context.Con // BeginDeleteSQLRoleAssignment - Deletes an existing Azure Cosmos DB SQL Role Assignment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - 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. @@ -959,7 +959,7 @@ func (client *SQLResourcesClient) BeginDeleteSQLRoleAssignment(ctx context.Conte // DeleteSQLRoleAssignment - Deletes an existing Azure Cosmos DB SQL Role Assignment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) deleteSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string, options *SQLResourcesClientBeginDeleteSQLRoleAssignmentOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginDeleteSQLRoleAssignment" @@ -1005,7 +1005,7 @@ func (client *SQLResourcesClient) deleteSQLRoleAssignmentCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1014,7 +1014,7 @@ func (client *SQLResourcesClient) deleteSQLRoleAssignmentCreateRequest(ctx conte // BeginDeleteSQLRoleDefinition - Deletes an existing Azure Cosmos DB SQL Role Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - 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. @@ -1040,7 +1040,7 @@ func (client *SQLResourcesClient) BeginDeleteSQLRoleDefinition(ctx context.Conte // DeleteSQLRoleDefinition - Deletes an existing Azure Cosmos DB SQL Role Definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) deleteSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string, options *SQLResourcesClientBeginDeleteSQLRoleDefinitionOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginDeleteSQLRoleDefinition" @@ -1086,7 +1086,7 @@ func (client *SQLResourcesClient) deleteSQLRoleDefinitionCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1095,7 +1095,7 @@ func (client *SQLResourcesClient) deleteSQLRoleDefinitionCreateRequest(ctx conte // BeginDeleteSQLStoredProcedure - Deletes an existing Azure Cosmos DB SQL storedProcedure. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1123,7 +1123,7 @@ func (client *SQLResourcesClient) BeginDeleteSQLStoredProcedure(ctx context.Cont // DeleteSQLStoredProcedure - Deletes an existing Azure Cosmos DB SQL storedProcedure. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) deleteSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, options *SQLResourcesClientBeginDeleteSQLStoredProcedureOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginDeleteSQLStoredProcedure" @@ -1177,7 +1177,7 @@ func (client *SQLResourcesClient) deleteSQLStoredProcedureCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -1185,7 +1185,7 @@ func (client *SQLResourcesClient) deleteSQLStoredProcedureCreateRequest(ctx cont // BeginDeleteSQLTrigger - Deletes an existing Azure Cosmos DB SQL trigger. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1213,7 +1213,7 @@ func (client *SQLResourcesClient) BeginDeleteSQLTrigger(ctx context.Context, res // DeleteSQLTrigger - Deletes an existing Azure Cosmos DB SQL trigger. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) deleteSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, options *SQLResourcesClientBeginDeleteSQLTriggerOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginDeleteSQLTrigger" @@ -1267,7 +1267,7 @@ func (client *SQLResourcesClient) deleteSQLTriggerCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -1275,7 +1275,7 @@ func (client *SQLResourcesClient) deleteSQLTriggerCreateRequest(ctx context.Cont // BeginDeleteSQLUserDefinedFunction - Deletes an existing Azure Cosmos DB SQL userDefinedFunction. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1303,7 +1303,7 @@ func (client *SQLResourcesClient) BeginDeleteSQLUserDefinedFunction(ctx context. // DeleteSQLUserDefinedFunction - Deletes an existing Azure Cosmos DB SQL userDefinedFunction. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) deleteSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, options *SQLResourcesClientBeginDeleteSQLUserDefinedFunctionOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginDeleteSQLUserDefinedFunction" @@ -1357,7 +1357,7 @@ func (client *SQLResourcesClient) deleteSQLUserDefinedFunctionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -1365,7 +1365,7 @@ func (client *SQLResourcesClient) deleteSQLUserDefinedFunctionCreateRequest(ctx // GetClientEncryptionKey - Gets the ClientEncryptionKey under an existing Azure Cosmos DB SQL database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1422,7 +1422,7 @@ func (client *SQLResourcesClient) getClientEncryptionKeyCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1440,7 +1440,7 @@ func (client *SQLResourcesClient) getClientEncryptionKeyHandleResponse(resp *htt // GetSQLContainer - Gets the SQL container under an existing Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1497,7 +1497,7 @@ func (client *SQLResourcesClient) getSQLContainerCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1515,7 +1515,7 @@ func (client *SQLResourcesClient) getSQLContainerHandleResponse(resp *http.Respo // GetSQLContainerThroughput - Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1572,7 +1572,7 @@ func (client *SQLResourcesClient) getSQLContainerThroughputCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1590,7 +1590,7 @@ func (client *SQLResourcesClient) getSQLContainerThroughputHandleResponse(resp * // GetSQLDatabase - Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1642,7 +1642,7 @@ func (client *SQLResourcesClient) getSQLDatabaseCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1661,7 +1661,7 @@ func (client *SQLResourcesClient) getSQLDatabaseHandleResponse(resp *http.Respon // with the provided name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1713,7 +1713,7 @@ func (client *SQLResourcesClient) getSQLDatabaseThroughputCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1731,7 +1731,7 @@ func (client *SQLResourcesClient) getSQLDatabaseThroughputHandleResponse(resp *h // GetSQLRoleAssignment - Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - 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. @@ -1783,7 +1783,7 @@ func (client *SQLResourcesClient) getSQLRoleAssignmentCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1801,7 +1801,7 @@ func (client *SQLResourcesClient) getSQLRoleAssignmentHandleResponse(resp *http. // GetSQLRoleDefinition - Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - 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. @@ -1853,7 +1853,7 @@ func (client *SQLResourcesClient) getSQLRoleDefinitionCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1871,7 +1871,7 @@ func (client *SQLResourcesClient) getSQLRoleDefinitionHandleResponse(resp *http. // GetSQLStoredProcedure - Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1933,7 +1933,7 @@ func (client *SQLResourcesClient) getSQLStoredProcedureCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1951,7 +1951,7 @@ func (client *SQLResourcesClient) getSQLStoredProcedureHandleResponse(resp *http // GetSQLTrigger - Gets the SQL trigger under an existing Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2013,7 +2013,7 @@ func (client *SQLResourcesClient) getSQLTriggerCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2031,7 +2031,7 @@ func (client *SQLResourcesClient) getSQLTriggerHandleResponse(resp *http.Respons // GetSQLUserDefinedFunction - Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2093,7 +2093,7 @@ func (client *SQLResourcesClient) getSQLUserDefinedFunctionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2110,7 +2110,7 @@ func (client *SQLResourcesClient) getSQLUserDefinedFunctionHandleResponse(resp * // NewListClientEncryptionKeysPager - Lists the ClientEncryptionKeys under an existing Azure Cosmos DB SQL database. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2164,7 +2164,7 @@ func (client *SQLResourcesClient) listClientEncryptionKeysCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2179,9 +2179,100 @@ func (client *SQLResourcesClient) listClientEncryptionKeysHandleResponse(resp *h return result, nil } +// BeginListSQLContainerPartitionMerge - Merges the partitions of a SQL Container +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - 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. +// - mergeParameters - The parameters for the merge operation. +// - options - SQLResourcesClientBeginListSQLContainerPartitionMergeOptions contains the optional parameters for the SQLResourcesClient.BeginListSQLContainerPartitionMerge +// method. +func (client *SQLResourcesClient) BeginListSQLContainerPartitionMerge(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, mergeParameters MergeParameters, options *SQLResourcesClientBeginListSQLContainerPartitionMergeOptions) (*runtime.Poller[SQLResourcesClientListSQLContainerPartitionMergeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.listSQLContainerPartitionMerge(ctx, resourceGroupName, accountName, databaseName, containerName, mergeParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientListSQLContainerPartitionMergeResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SQLResourcesClientListSQLContainerPartitionMergeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ListSQLContainerPartitionMerge - Merges the partitions of a SQL Container +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *SQLResourcesClient) listSQLContainerPartitionMerge(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, mergeParameters MergeParameters, options *SQLResourcesClientBeginListSQLContainerPartitionMergeOptions) (*http.Response, error) { + var err error + const operationName = "SQLResourcesClient.BeginListSQLContainerPartitionMerge" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listSQLContainerPartitionMergeCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, mergeParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// listSQLContainerPartitionMergeCreateRequest creates the ListSQLContainerPartitionMerge request. +func (client *SQLResourcesClient) listSQLContainerPartitionMergeCreateRequest(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, mergeParameters MergeParameters, options *SQLResourcesClientBeginListSQLContainerPartitionMergeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/partitionMerge" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, mergeParameters); err != nil { + return nil, err + } + return req, nil +} + // NewListSQLContainersPager - Lists the SQL container under an existing Azure Cosmos DB database account. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2235,7 +2326,7 @@ func (client *SQLResourcesClient) listSQLContainersCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2252,7 +2343,7 @@ func (client *SQLResourcesClient) listSQLContainersHandleResponse(resp *http.Res // NewListSQLDatabasesPager - Lists the SQL databases under an existing Azure Cosmos DB database account. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - SQLResourcesClientListSQLDatabasesOptions contains the optional parameters for the SQLResourcesClient.NewListSQLDatabasesPager @@ -2301,7 +2392,7 @@ func (client *SQLResourcesClient) listSQLDatabasesCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2318,7 +2409,7 @@ func (client *SQLResourcesClient) listSQLDatabasesHandleResponse(resp *http.Resp // NewListSQLRoleAssignmentsPager - Retrieves the list of all Azure Cosmos DB SQL Role Assignments. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - SQLResourcesClientListSQLRoleAssignmentsOptions contains the optional parameters for the SQLResourcesClient.NewListSQLRoleAssignmentsPager @@ -2367,7 +2458,7 @@ func (client *SQLResourcesClient) listSQLRoleAssignmentsCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2384,7 +2475,7 @@ func (client *SQLResourcesClient) listSQLRoleAssignmentsHandleResponse(resp *htt // NewListSQLRoleDefinitionsPager - Retrieves the list of all Azure Cosmos DB SQL Role Definitions. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - SQLResourcesClientListSQLRoleDefinitionsOptions contains the optional parameters for the SQLResourcesClient.NewListSQLRoleDefinitionsPager @@ -2433,7 +2524,7 @@ func (client *SQLResourcesClient) listSQLRoleDefinitionsCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2450,7 +2541,7 @@ func (client *SQLResourcesClient) listSQLRoleDefinitionsHandleResponse(resp *htt // NewListSQLStoredProceduresPager - Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2509,7 +2600,7 @@ func (client *SQLResourcesClient) listSQLStoredProceduresCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2526,7 +2617,7 @@ func (client *SQLResourcesClient) listSQLStoredProceduresHandleResponse(resp *ht // NewListSQLTriggersPager - Lists the SQL trigger under an existing Azure Cosmos DB database account. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2585,7 +2676,7 @@ func (client *SQLResourcesClient) listSQLTriggersCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2602,7 +2693,7 @@ func (client *SQLResourcesClient) listSQLTriggersHandleResponse(resp *http.Respo // NewListSQLUserDefinedFunctionsPager - Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2661,7 +2752,7 @@ func (client *SQLResourcesClient) listSQLUserDefinedFunctionsCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2679,7 +2770,7 @@ func (client *SQLResourcesClient) listSQLUserDefinedFunctionsHandleResponse(resp // BeginMigrateSQLContainerToAutoscale - Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2706,7 +2797,7 @@ func (client *SQLResourcesClient) BeginMigrateSQLContainerToAutoscale(ctx contex // MigrateSQLContainerToAutoscale - Migrate an Azure Cosmos DB SQL container from manual throughput to autoscale // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) migrateSQLContainerToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, options *SQLResourcesClientBeginMigrateSQLContainerToAutoscaleOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginMigrateSQLContainerToAutoscale" @@ -2756,7 +2847,7 @@ func (client *SQLResourcesClient) migrateSQLContainerToAutoscaleCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2765,7 +2856,7 @@ func (client *SQLResourcesClient) migrateSQLContainerToAutoscaleCreateRequest(ct // BeginMigrateSQLContainerToManualThroughput - Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2792,7 +2883,7 @@ func (client *SQLResourcesClient) BeginMigrateSQLContainerToManualThroughput(ctx // MigrateSQLContainerToManualThroughput - Migrate an Azure Cosmos DB SQL container from autoscale to manual throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) migrateSQLContainerToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, options *SQLResourcesClientBeginMigrateSQLContainerToManualThroughputOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginMigrateSQLContainerToManualThroughput" @@ -2842,7 +2933,7 @@ func (client *SQLResourcesClient) migrateSQLContainerToManualThroughputCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2851,7 +2942,7 @@ func (client *SQLResourcesClient) migrateSQLContainerToManualThroughputCreateReq // BeginMigrateSQLDatabaseToAutoscale - Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2877,7 +2968,7 @@ func (client *SQLResourcesClient) BeginMigrateSQLDatabaseToAutoscale(ctx context // MigrateSQLDatabaseToAutoscale - Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) migrateSQLDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *SQLResourcesClientBeginMigrateSQLDatabaseToAutoscaleOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginMigrateSQLDatabaseToAutoscale" @@ -2923,7 +3014,7 @@ func (client *SQLResourcesClient) migrateSQLDatabaseToAutoscaleCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2932,7 +3023,7 @@ func (client *SQLResourcesClient) migrateSQLDatabaseToAutoscaleCreateRequest(ctx // BeginMigrateSQLDatabaseToManualThroughput - Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2958,7 +3049,7 @@ func (client *SQLResourcesClient) BeginMigrateSQLDatabaseToManualThroughput(ctx // MigrateSQLDatabaseToManualThroughput - Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) migrateSQLDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *SQLResourcesClientBeginMigrateSQLDatabaseToManualThroughputOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginMigrateSQLDatabaseToManualThroughput" @@ -3004,7 +3095,7 @@ func (client *SQLResourcesClient) migrateSQLDatabaseToManualThroughputCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -3013,7 +3104,7 @@ func (client *SQLResourcesClient) migrateSQLDatabaseToManualThroughputCreateRequ // BeginRetrieveContinuousBackupInformation - Retrieves continuous backup information for a container resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -3042,7 +3133,7 @@ func (client *SQLResourcesClient) BeginRetrieveContinuousBackupInformation(ctx c // RetrieveContinuousBackupInformation - Retrieves continuous backup information for a container resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) retrieveContinuousBackupInformation(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, location ContinuousBackupRestoreLocation, options *SQLResourcesClientBeginRetrieveContinuousBackupInformationOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginRetrieveContinuousBackupInformation" @@ -3092,7 +3183,7 @@ func (client *SQLResourcesClient) retrieveContinuousBackupInformationCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, location); err != nil { @@ -3101,10 +3192,450 @@ func (client *SQLResourcesClient) retrieveContinuousBackupInformationCreateReque return req, nil } +// BeginSQLContainerRedistributeThroughput - Redistribute throughput for an Azure Cosmos DB SQL container +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - 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. +// - redistributeThroughputParameters - The parameters to provide for redistributing throughput for the current SQL container. +// - options - SQLResourcesClientBeginSQLContainerRedistributeThroughputOptions contains the optional parameters for the SQLResourcesClient.BeginSQLContainerRedistributeThroughput +// method. +func (client *SQLResourcesClient) BeginSQLContainerRedistributeThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, redistributeThroughputParameters RedistributeThroughputParameters, options *SQLResourcesClientBeginSQLContainerRedistributeThroughputOptions) (*runtime.Poller[SQLResourcesClientSQLContainerRedistributeThroughputResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.sQLContainerRedistributeThroughput(ctx, resourceGroupName, accountName, databaseName, containerName, redistributeThroughputParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientSQLContainerRedistributeThroughputResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SQLResourcesClientSQLContainerRedistributeThroughputResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// SQLContainerRedistributeThroughput - Redistribute throughput for an Azure Cosmos DB SQL container +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *SQLResourcesClient) sQLContainerRedistributeThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, redistributeThroughputParameters RedistributeThroughputParameters, options *SQLResourcesClientBeginSQLContainerRedistributeThroughputOptions) (*http.Response, error) { + var err error + const operationName = "SQLResourcesClient.BeginSQLContainerRedistributeThroughput" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.sqlContainerRedistributeThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, redistributeThroughputParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// sqlContainerRedistributeThroughputCreateRequest creates the SQLContainerRedistributeThroughput request. +func (client *SQLResourcesClient) sqlContainerRedistributeThroughputCreateRequest(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, redistributeThroughputParameters RedistributeThroughputParameters, options *SQLResourcesClientBeginSQLContainerRedistributeThroughputOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/redistributeThroughput" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, redistributeThroughputParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginSQLContainerRetrieveThroughputDistribution - Retrieve throughput distribution for an Azure Cosmos DB SQL container +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - 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. +// - retrieveThroughputParameters - The parameters to provide for retrieving throughput distribution for the current SQL container. +// - options - SQLResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions contains the optional parameters for +// the SQLResourcesClient.BeginSQLContainerRetrieveThroughputDistribution method. +func (client *SQLResourcesClient) BeginSQLContainerRetrieveThroughputDistribution(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, retrieveThroughputParameters RetrieveThroughputParameters, options *SQLResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions) (*runtime.Poller[SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.sQLContainerRetrieveThroughputDistribution(ctx, resourceGroupName, accountName, databaseName, containerName, retrieveThroughputParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// SQLContainerRetrieveThroughputDistribution - Retrieve throughput distribution for an Azure Cosmos DB SQL container +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *SQLResourcesClient) sQLContainerRetrieveThroughputDistribution(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, retrieveThroughputParameters RetrieveThroughputParameters, options *SQLResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions) (*http.Response, error) { + var err error + const operationName = "SQLResourcesClient.BeginSQLContainerRetrieveThroughputDistribution" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.sqlContainerRetrieveThroughputDistributionCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, retrieveThroughputParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// sqlContainerRetrieveThroughputDistributionCreateRequest creates the SQLContainerRetrieveThroughputDistribution request. +func (client *SQLResourcesClient) sqlContainerRetrieveThroughputDistributionCreateRequest(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, retrieveThroughputParameters RetrieveThroughputParameters, options *SQLResourcesClientBeginSQLContainerRetrieveThroughputDistributionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/retrieveThroughputDistribution" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if containerName == "" { + return nil, errors.New("parameter containerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{containerName}", url.PathEscape(containerName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, retrieveThroughputParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginSQLDatabasePartitionMerge - Merges the partitions of a SQL database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - databaseName - Cosmos DB database name. +// - mergeParameters - The parameters for the merge operation. +// - options - SQLResourcesClientBeginSQLDatabasePartitionMergeOptions contains the optional parameters for the SQLResourcesClient.BeginSQLDatabasePartitionMerge +// method. +func (client *SQLResourcesClient) BeginSQLDatabasePartitionMerge(ctx context.Context, resourceGroupName string, accountName string, databaseName string, mergeParameters MergeParameters, options *SQLResourcesClientBeginSQLDatabasePartitionMergeOptions) (*runtime.Poller[SQLResourcesClientSQLDatabasePartitionMergeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.sQLDatabasePartitionMerge(ctx, resourceGroupName, accountName, databaseName, mergeParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientSQLDatabasePartitionMergeResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SQLResourcesClientSQLDatabasePartitionMergeResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// SQLDatabasePartitionMerge - Merges the partitions of a SQL database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *SQLResourcesClient) sQLDatabasePartitionMerge(ctx context.Context, resourceGroupName string, accountName string, databaseName string, mergeParameters MergeParameters, options *SQLResourcesClientBeginSQLDatabasePartitionMergeOptions) (*http.Response, error) { + var err error + const operationName = "SQLResourcesClient.BeginSQLDatabasePartitionMerge" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.sqlDatabasePartitionMergeCreateRequest(ctx, resourceGroupName, accountName, databaseName, mergeParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// sqlDatabasePartitionMergeCreateRequest creates the SQLDatabasePartitionMerge request. +func (client *SQLResourcesClient) sqlDatabasePartitionMergeCreateRequest(ctx context.Context, resourceGroupName string, accountName string, databaseName string, mergeParameters MergeParameters, options *SQLResourcesClientBeginSQLDatabasePartitionMergeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/partitionMerge" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, mergeParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginSQLDatabaseRedistributeThroughput - Redistribute throughput for an Azure Cosmos DB SQL database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - databaseName - Cosmos DB database name. +// - redistributeThroughputParameters - The parameters to provide for redistributing throughput for the current SQL database. +// - options - SQLResourcesClientBeginSQLDatabaseRedistributeThroughputOptions contains the optional parameters for the SQLResourcesClient.BeginSQLDatabaseRedistributeThroughput +// method. +func (client *SQLResourcesClient) BeginSQLDatabaseRedistributeThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, redistributeThroughputParameters RedistributeThroughputParameters, options *SQLResourcesClientBeginSQLDatabaseRedistributeThroughputOptions) (*runtime.Poller[SQLResourcesClientSQLDatabaseRedistributeThroughputResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.sQLDatabaseRedistributeThroughput(ctx, resourceGroupName, accountName, databaseName, redistributeThroughputParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientSQLDatabaseRedistributeThroughputResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SQLResourcesClientSQLDatabaseRedistributeThroughputResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// SQLDatabaseRedistributeThroughput - Redistribute throughput for an Azure Cosmos DB SQL database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *SQLResourcesClient) sQLDatabaseRedistributeThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, redistributeThroughputParameters RedistributeThroughputParameters, options *SQLResourcesClientBeginSQLDatabaseRedistributeThroughputOptions) (*http.Response, error) { + var err error + const operationName = "SQLResourcesClient.BeginSQLDatabaseRedistributeThroughput" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.sqlDatabaseRedistributeThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, redistributeThroughputParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// sqlDatabaseRedistributeThroughputCreateRequest creates the SQLDatabaseRedistributeThroughput request. +func (client *SQLResourcesClient) sqlDatabaseRedistributeThroughputCreateRequest(ctx context.Context, resourceGroupName string, accountName string, databaseName string, redistributeThroughputParameters RedistributeThroughputParameters, options *SQLResourcesClientBeginSQLDatabaseRedistributeThroughputOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/redistributeThroughput" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, redistributeThroughputParameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginSQLDatabaseRetrieveThroughputDistribution - Retrieve throughput distribution for an Azure Cosmos DB SQL database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - Cosmos DB database account name. +// - databaseName - Cosmos DB database name. +// - retrieveThroughputParameters - The parameters to provide for retrieving throughput distribution for the current SQL database. +// - options - SQLResourcesClientBeginSQLDatabaseRetrieveThroughputDistributionOptions contains the optional parameters for +// the SQLResourcesClient.BeginSQLDatabaseRetrieveThroughputDistribution method. +func (client *SQLResourcesClient) BeginSQLDatabaseRetrieveThroughputDistribution(ctx context.Context, resourceGroupName string, accountName string, databaseName string, retrieveThroughputParameters RetrieveThroughputParameters, options *SQLResourcesClientBeginSQLDatabaseRetrieveThroughputDistributionOptions) (*runtime.Poller[SQLResourcesClientSQLDatabaseRetrieveThroughputDistributionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.sQLDatabaseRetrieveThroughputDistribution(ctx, resourceGroupName, accountName, databaseName, retrieveThroughputParameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientSQLDatabaseRetrieveThroughputDistributionResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SQLResourcesClientSQLDatabaseRetrieveThroughputDistributionResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// SQLDatabaseRetrieveThroughputDistribution - Retrieve throughput distribution for an Azure Cosmos DB SQL database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *SQLResourcesClient) sQLDatabaseRetrieveThroughputDistribution(ctx context.Context, resourceGroupName string, accountName string, databaseName string, retrieveThroughputParameters RetrieveThroughputParameters, options *SQLResourcesClientBeginSQLDatabaseRetrieveThroughputDistributionOptions) (*http.Response, error) { + var err error + const operationName = "SQLResourcesClient.BeginSQLDatabaseRetrieveThroughputDistribution" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.sqlDatabaseRetrieveThroughputDistributionCreateRequest(ctx, resourceGroupName, accountName, databaseName, retrieveThroughputParameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// sqlDatabaseRetrieveThroughputDistributionCreateRequest creates the SQLDatabaseRetrieveThroughputDistribution request. +func (client *SQLResourcesClient) sqlDatabaseRetrieveThroughputDistributionCreateRequest(ctx context.Context, resourceGroupName string, accountName string, databaseName string, retrieveThroughputParameters RetrieveThroughputParameters, options *SQLResourcesClientBeginSQLDatabaseRetrieveThroughputDistributionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/retrieveThroughputDistribution" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, retrieveThroughputParameters); err != nil { + return nil, err + } + return req, nil +} + // BeginUpdateSQLContainerThroughput - Update RUs per second of an Azure Cosmos DB SQL container // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -3132,7 +3663,7 @@ func (client *SQLResourcesClient) BeginUpdateSQLContainerThroughput(ctx context. // UpdateSQLContainerThroughput - Update RUs per second of an Azure Cosmos DB SQL container // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) updateSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *SQLResourcesClientBeginUpdateSQLContainerThroughputOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginUpdateSQLContainerThroughput" @@ -3182,7 +3713,7 @@ func (client *SQLResourcesClient) updateSQLContainerThroughputCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { @@ -3194,7 +3725,7 @@ func (client *SQLResourcesClient) updateSQLContainerThroughputCreateRequest(ctx // BeginUpdateSQLDatabaseThroughput - Update RUs per second of an Azure Cosmos DB SQL database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -3221,7 +3752,7 @@ func (client *SQLResourcesClient) BeginUpdateSQLDatabaseThroughput(ctx context.C // UpdateSQLDatabaseThroughput - Update RUs per second of an Azure Cosmos DB SQL database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *SQLResourcesClient) updateSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *SQLResourcesClientBeginUpdateSQLDatabaseThroughputOptions) (*http.Response, error) { var err error const operationName = "SQLResourcesClient.BeginUpdateSQLDatabaseThroughput" @@ -3267,7 +3798,7 @@ func (client *SQLResourcesClient) updateSQLDatabaseThroughputCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { diff --git a/sdk/resourcemanager/cosmos/armcosmos/sqlresources_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/sqlresources_client_example_test.go deleted file mode 100644 index d3e0e28752e3..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/sqlresources_client_example_test.go +++ /dev/null @@ -1,1934 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlDatabaseList.json -func ExampleSQLResourcesClient_NewListSQLDatabasesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSQLResourcesClient().NewListSQLDatabasesPager("rgName", "ddb1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SQLDatabaseListResult = armcosmos.SQLDatabaseListResult{ - // Value: []*armcosmos.SQLDatabaseGetResults{ - // { - // Name: to.Ptr("databaseName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.SQLDatabaseGetProperties{ - // Resource: &armcosmos.SQLDatabaseGetPropertiesResource{ - // Etag: to.Ptr("\"00000a00-0000-0000-0000-56672f920000\""), - // Rid: to.Ptr("CqNBAA=="), - // Ts: to.Ptr[float32](1449602962), - // ID: to.Ptr("databaseName"), - // Colls: to.Ptr("colls/"), - // Users: to.Ptr("users/"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlDatabaseGet.json -func ExampleSQLResourcesClient_GetSQLDatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSQLResourcesClient().GetSQLDatabase(ctx, "rg1", "ddb1", "databaseName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SQLDatabaseGetResults = armcosmos.SQLDatabaseGetResults{ - // Name: to.Ptr("databaseName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.SQLDatabaseGetProperties{ - // Resource: &armcosmos.SQLDatabaseGetPropertiesResource{ - // Etag: to.Ptr("\"00000a00-0000-0000-0000-56672f920000\""), - // Rid: to.Ptr("CqNBAA=="), - // Ts: to.Ptr[float32](1449602962), - // ID: to.Ptr("databaseName"), - // Colls: to.Ptr("colls/"), - // Users: to.Ptr("users/"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlDatabaseCreateUpdate.json -func ExampleSQLResourcesClient_BeginCreateUpdateSQLDatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginCreateUpdateSQLDatabase(ctx, "rg1", "ddb1", "databaseName", armcosmos.SQLDatabaseCreateUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.SQLDatabaseCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.SQLDatabaseResource{ - ID: to.Ptr("databaseName"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SQLDatabaseGetResults = armcosmos.SQLDatabaseGetResults{ - // Name: to.Ptr("databaseName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.SQLDatabaseGetProperties{ - // Resource: &armcosmos.SQLDatabaseGetPropertiesResource{ - // Etag: to.Ptr("\"00000a00-0000-0000-0000-56672f920000\""), - // Rid: to.Ptr("CqNBAA=="), - // Ts: to.Ptr[float32](1449602962), - // ID: to.Ptr("databaseName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlDatabaseDelete.json -func ExampleSQLResourcesClient_BeginDeleteSQLDatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginDeleteSQLDatabase(ctx, "rg1", "ddb1", "databaseName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlDatabaseThroughputGet.json -func ExampleSQLResourcesClient_GetSQLDatabaseThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSQLResourcesClient().GetSQLDatabaseThroughput(ctx, "rg1", "ddb1", "databaseName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/throughputSettings/default"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // InstantMaximumThroughput: to.Ptr("10000"), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // SoftAllowedMaximumThroughput: to.Ptr("1000000"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlDatabaseThroughputUpdate.json -func ExampleSQLResourcesClient_BeginUpdateSQLDatabaseThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginUpdateSQLDatabaseThroughput(ctx, "rg1", "ddb1", "databaseName", armcosmos.ThroughputSettingsUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.ThroughputSettingsUpdateProperties{ - Resource: &armcosmos.ThroughputSettingsResource{ - Throughput: to.Ptr[int32](400), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/throughputSettings/default"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlDatabaseMigrateToAutoscale.json -func ExampleSQLResourcesClient_BeginMigrateSQLDatabaseToAutoscale() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginMigrateSQLDatabaseToAutoscale(ctx, "rg1", "ddb1", "databaseName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // AutoscaleSettings: &armcosmos.AutoscaleSettingsResource{ - // MaxThroughput: to.Ptr[int32](4000), - // }, - // MinimumThroughput: to.Ptr("4000"), - // OfferReplacePending: to.Ptr("false"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlDatabaseMigrateToManualThroughput.json -func ExampleSQLResourcesClient_BeginMigrateSQLDatabaseToManualThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginMigrateSQLDatabaseToManualThroughput(ctx, "rg1", "ddb1", "databaseName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlContainerList.json -func ExampleSQLResourcesClient_NewListSQLContainersPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSQLResourcesClient().NewListSQLContainersPager("rgName", "ddb1", "databaseName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SQLContainerListResult = armcosmos.SQLContainerListResult{ - // Value: []*armcosmos.SQLContainerGetResults{ - // { - // Name: to.Ptr("containerName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/containers/containerName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.SQLContainerGetProperties{ - // Resource: &armcosmos.SQLContainerGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // ClientEncryptionPolicy: &armcosmos.ClientEncryptionPolicy{ - // IncludedPaths: []*armcosmos.ClientEncryptionIncludedPath{ - // { - // Path: to.Ptr("/path"), - // ClientEncryptionKeyID: to.Ptr("keyId"), - // EncryptionAlgorithm: to.Ptr("AEAD_AES_256_CBC_HMAC_SHA256"), - // EncryptionType: to.Ptr("Deterministic"), - // }}, - // PolicyFormatVersion: to.Ptr[int32](1), - // }, - // ComputedProperties: []*armcosmos.ComputedProperty{ - // { - // Name: to.Ptr("cp_lowerName"), - // Query: to.Ptr("SELECT VALUE LOWER(c.name) FROM c"), - // }}, - // ConflictResolutionPolicy: &armcosmos.ConflictResolutionPolicy{ - // ConflictResolutionPath: to.Ptr("/path"), - // Mode: to.Ptr(armcosmos.ConflictResolutionModeLastWriterWins), - // }, - // DefaultTTL: to.Ptr[int32](100), - // ID: to.Ptr("testctn"), - // IndexingPolicy: &armcosmos.IndexingPolicy{ - // Automatic: to.Ptr(true), - // ExcludedPaths: []*armcosmos.ExcludedPath{ - // }, - // IncludedPaths: []*armcosmos.IncludedPath{ - // { - // Path: to.Ptr("/*"), - // Indexes: []*armcosmos.Indexes{ - // { - // DataType: to.Ptr(armcosmos.DataTypeString), - // Kind: to.Ptr(armcosmos.IndexKindRange), - // Precision: to.Ptr[int32](-1), - // }, - // { - // DataType: to.Ptr(armcosmos.DataTypeNumber), - // Kind: to.Ptr(armcosmos.IndexKindRange), - // Precision: to.Ptr[int32](-1), - // }}, - // }}, - // IndexingMode: to.Ptr(armcosmos.IndexingModeConsistent), - // }, - // PartitionKey: &armcosmos.ContainerPartitionKey{ - // Kind: to.Ptr(armcosmos.PartitionKindHash), - // Paths: []*string{ - // to.Ptr("/AccountNumber")}, - // }, - // UniqueKeyPolicy: &armcosmos.UniqueKeyPolicy{ - // UniqueKeys: []*armcosmos.UniqueKey{ - // { - // Paths: []*string{ - // to.Ptr("/testPath")}, - // }}, - // }, - // }, - // }, - // }, - // { - // Name: to.Ptr("containerName1"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/sqlContainers/containerName1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.SQLContainerGetProperties{ - // Resource: &armcosmos.SQLContainerGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDiw="), - // Ts: to.Ptr[float32](1459200611), - // ClientEncryptionPolicy: &armcosmos.ClientEncryptionPolicy{ - // IncludedPaths: []*armcosmos.ClientEncryptionIncludedPath{ - // { - // Path: to.Ptr("/path"), - // ClientEncryptionKeyID: to.Ptr("keyId"), - // EncryptionAlgorithm: to.Ptr("AEAD_AES_256_CBC_HMAC_SHA256"), - // EncryptionType: to.Ptr("Deterministic"), - // }}, - // PolicyFormatVersion: to.Ptr[int32](1), - // }, - // ComputedProperties: []*armcosmos.ComputedProperty{ - // }, - // ConflictResolutionPolicy: &armcosmos.ConflictResolutionPolicy{ - // ConflictResolutionPath: to.Ptr("/path"), - // Mode: to.Ptr(armcosmos.ConflictResolutionModeLastWriterWins), - // }, - // DefaultTTL: to.Ptr[int32](100), - // ID: to.Ptr("testctn1"), - // IndexingPolicy: &armcosmos.IndexingPolicy{ - // Automatic: to.Ptr(true), - // ExcludedPaths: []*armcosmos.ExcludedPath{ - // }, - // IncludedPaths: []*armcosmos.IncludedPath{ - // { - // Path: to.Ptr("/*"), - // Indexes: []*armcosmos.Indexes{ - // { - // DataType: to.Ptr(armcosmos.DataTypeString), - // Kind: to.Ptr(armcosmos.IndexKindRange), - // Precision: to.Ptr[int32](-1), - // }, - // { - // DataType: to.Ptr(armcosmos.DataTypeNumber), - // Kind: to.Ptr(armcosmos.IndexKindRange), - // Precision: to.Ptr[int32](-1), - // }}, - // }}, - // IndexingMode: to.Ptr(armcosmos.IndexingModeConsistent), - // }, - // PartitionKey: &armcosmos.ContainerPartitionKey{ - // Kind: to.Ptr(armcosmos.PartitionKindMultiHash), - // Paths: []*string{ - // to.Ptr("/AccountNumber"), - // to.Ptr("/AccountLocation")}, - // Version: to.Ptr[int32](2), - // }, - // UniqueKeyPolicy: &armcosmos.UniqueKeyPolicy{ - // UniqueKeys: []*armcosmos.UniqueKey{ - // { - // Paths: []*string{ - // to.Ptr("/testPath")}, - // }}, - // }, - // }, - // }, - // }, - // { - // Name: to.Ptr("containerName2"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/sqlContainers/containerName2"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.SQLContainerGetProperties{ - // Resource: &armcosmos.SQLContainerGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDhw="), - // Ts: to.Ptr[float32](1459200611), - // ClientEncryptionPolicy: &armcosmos.ClientEncryptionPolicy{ - // IncludedPaths: []*armcosmos.ClientEncryptionIncludedPath{ - // { - // Path: to.Ptr("/path"), - // ClientEncryptionKeyID: to.Ptr("keyId"), - // EncryptionAlgorithm: to.Ptr("AEAD_AES_256_CBC_HMAC_SHA256"), - // EncryptionType: to.Ptr("Deterministic"), - // }}, - // PolicyFormatVersion: to.Ptr[int32](1), - // }, - // ConflictResolutionPolicy: &armcosmos.ConflictResolutionPolicy{ - // ConflictResolutionPath: to.Ptr("/path"), - // Mode: to.Ptr(armcosmos.ConflictResolutionModeLastWriterWins), - // }, - // DefaultTTL: to.Ptr[int32](100), - // ID: to.Ptr("testctn2"), - // IndexingPolicy: &armcosmos.IndexingPolicy{ - // Automatic: to.Ptr(true), - // ExcludedPaths: []*armcosmos.ExcludedPath{ - // }, - // IncludedPaths: []*armcosmos.IncludedPath{ - // { - // Path: to.Ptr("/*"), - // Indexes: []*armcosmos.Indexes{ - // { - // DataType: to.Ptr(armcosmos.DataTypeString), - // Kind: to.Ptr(armcosmos.IndexKindRange), - // Precision: to.Ptr[int32](-1), - // }, - // { - // DataType: to.Ptr(armcosmos.DataTypeNumber), - // Kind: to.Ptr(armcosmos.IndexKindRange), - // Precision: to.Ptr[int32](-1), - // }}, - // }}, - // IndexingMode: to.Ptr(armcosmos.IndexingModeConsistent), - // }, - // PartitionKey: &armcosmos.ContainerPartitionKey{ - // Kind: to.Ptr(armcosmos.PartitionKindHash), - // Paths: []*string{ - // to.Ptr("/_partitionKey")}, - // SystemKey: to.Ptr(true), - // Version: to.Ptr[int32](2), - // }, - // UniqueKeyPolicy: &armcosmos.UniqueKeyPolicy{ - // UniqueKeys: []*armcosmos.UniqueKey{ - // { - // Paths: []*string{ - // to.Ptr("/testPath")}, - // }}, - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlContainerGet.json -func ExampleSQLResourcesClient_GetSQLContainer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSQLResourcesClient().GetSQLContainer(ctx, "rgName", "ddb1", "databaseName", "containerName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SQLContainerGetResults = armcosmos.SQLContainerGetResults{ - // Name: to.Ptr("containerName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/containers/containerName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.SQLContainerGetProperties{ - // Options: &armcosmos.SQLContainerGetPropertiesOptions{ - // Throughput: to.Ptr[int32](400), - // }, - // Resource: &armcosmos.SQLContainerGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // ClientEncryptionPolicy: &armcosmos.ClientEncryptionPolicy{ - // IncludedPaths: []*armcosmos.ClientEncryptionIncludedPath{ - // { - // Path: to.Ptr("/path"), - // ClientEncryptionKeyID: to.Ptr("keyId"), - // EncryptionAlgorithm: to.Ptr("AEAD_AES_256_CBC_HMAC_SHA256"), - // EncryptionType: to.Ptr("Deterministic"), - // }}, - // PolicyFormatVersion: to.Ptr[int32](1), - // }, - // ComputedProperties: []*armcosmos.ComputedProperty{ - // { - // Name: to.Ptr("cp_lowerName"), - // Query: to.Ptr("SELECT VALUE LOWER(c.name) FROM c"), - // }}, - // ConflictResolutionPolicy: &armcosmos.ConflictResolutionPolicy{ - // ConflictResolutionPath: to.Ptr("/path"), - // Mode: to.Ptr(armcosmos.ConflictResolutionModeLastWriterWins), - // }, - // DefaultTTL: to.Ptr[int32](100), - // ID: to.Ptr("containerName"), - // IndexingPolicy: &armcosmos.IndexingPolicy{ - // Automatic: to.Ptr(true), - // ExcludedPaths: []*armcosmos.ExcludedPath{ - // }, - // IncludedPaths: []*armcosmos.IncludedPath{ - // { - // Path: to.Ptr("/*"), - // Indexes: []*armcosmos.Indexes{ - // { - // DataType: to.Ptr(armcosmos.DataTypeString), - // Kind: to.Ptr(armcosmos.IndexKindRange), - // Precision: to.Ptr[int32](-1), - // }, - // { - // DataType: to.Ptr(armcosmos.DataTypeNumber), - // Kind: to.Ptr(armcosmos.IndexKindRange), - // Precision: to.Ptr[int32](-1), - // }}, - // }}, - // IndexingMode: to.Ptr(armcosmos.IndexingModeConsistent), - // }, - // PartitionKey: &armcosmos.ContainerPartitionKey{ - // Kind: to.Ptr(armcosmos.PartitionKindHash), - // Paths: []*string{ - // to.Ptr("/AccountNumber")}, - // }, - // UniqueKeyPolicy: &armcosmos.UniqueKeyPolicy{ - // UniqueKeys: []*armcosmos.UniqueKey{ - // { - // Paths: []*string{ - // to.Ptr("/testPath")}, - // }}, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlContainerCreateUpdate.json -func ExampleSQLResourcesClient_BeginCreateUpdateSQLContainer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginCreateUpdateSQLContainer(ctx, "rg1", "ddb1", "databaseName", "containerName", armcosmos.SQLContainerCreateUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.SQLContainerCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.SQLContainerResource{ - ClientEncryptionPolicy: &armcosmos.ClientEncryptionPolicy{ - IncludedPaths: []*armcosmos.ClientEncryptionIncludedPath{ - { - Path: to.Ptr("/path"), - ClientEncryptionKeyID: to.Ptr("keyId"), - EncryptionAlgorithm: to.Ptr("AEAD_AES_256_CBC_HMAC_SHA256"), - EncryptionType: to.Ptr("Deterministic"), - }}, - PolicyFormatVersion: to.Ptr[int32](2), - }, - ComputedProperties: []*armcosmos.ComputedProperty{ - { - Name: to.Ptr("cp_lowerName"), - Query: to.Ptr("SELECT VALUE LOWER(c.name) FROM c"), - }}, - ConflictResolutionPolicy: &armcosmos.ConflictResolutionPolicy{ - ConflictResolutionPath: to.Ptr("/path"), - Mode: to.Ptr(armcosmos.ConflictResolutionModeLastWriterWins), - }, - DefaultTTL: to.Ptr[int32](100), - ID: to.Ptr("containerName"), - IndexingPolicy: &armcosmos.IndexingPolicy{ - Automatic: to.Ptr(true), - ExcludedPaths: []*armcosmos.ExcludedPath{}, - IncludedPaths: []*armcosmos.IncludedPath{ - { - Path: to.Ptr("/*"), - Indexes: []*armcosmos.Indexes{ - { - DataType: to.Ptr(armcosmos.DataTypeString), - Kind: to.Ptr(armcosmos.IndexKindRange), - Precision: to.Ptr[int32](-1), - }, - { - DataType: to.Ptr(armcosmos.DataTypeNumber), - Kind: to.Ptr(armcosmos.IndexKindRange), - Precision: to.Ptr[int32](-1), - }}, - }}, - IndexingMode: to.Ptr(armcosmos.IndexingModeConsistent), - }, - PartitionKey: &armcosmos.ContainerPartitionKey{ - Kind: to.Ptr(armcosmos.PartitionKindHash), - Paths: []*string{ - to.Ptr("/AccountNumber")}, - }, - UniqueKeyPolicy: &armcosmos.UniqueKeyPolicy{ - UniqueKeys: []*armcosmos.UniqueKey{ - { - Paths: []*string{ - to.Ptr("/testPath")}, - }}, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SQLContainerGetResults = armcosmos.SQLContainerGetResults{ - // Name: to.Ptr("containerName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/containers/containerName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.SQLContainerGetProperties{ - // Resource: &armcosmos.SQLContainerGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // ClientEncryptionPolicy: &armcosmos.ClientEncryptionPolicy{ - // IncludedPaths: []*armcosmos.ClientEncryptionIncludedPath{ - // { - // Path: to.Ptr("/path"), - // ClientEncryptionKeyID: to.Ptr("keyId"), - // EncryptionAlgorithm: to.Ptr("AEAD_AES_256_CBC_HMAC_SHA256"), - // EncryptionType: to.Ptr("Deterministic"), - // }}, - // PolicyFormatVersion: to.Ptr[int32](1), - // }, - // ComputedProperties: []*armcosmos.ComputedProperty{ - // { - // Name: to.Ptr("cp_lowerName"), - // Query: to.Ptr("SELECT VALUE LOWER(c.name) FROM c"), - // }}, - // ConflictResolutionPolicy: &armcosmos.ConflictResolutionPolicy{ - // ConflictResolutionPath: to.Ptr("/path"), - // Mode: to.Ptr(armcosmos.ConflictResolutionModeLastWriterWins), - // }, - // DefaultTTL: to.Ptr[int32](100), - // ID: to.Ptr("containerName"), - // IndexingPolicy: &armcosmos.IndexingPolicy{ - // Automatic: to.Ptr(true), - // ExcludedPaths: []*armcosmos.ExcludedPath{ - // }, - // IncludedPaths: []*armcosmos.IncludedPath{ - // { - // Path: to.Ptr("/*"), - // Indexes: []*armcosmos.Indexes{ - // { - // DataType: to.Ptr(armcosmos.DataTypeString), - // Kind: to.Ptr(armcosmos.IndexKindRange), - // Precision: to.Ptr[int32](-1), - // }, - // { - // DataType: to.Ptr(armcosmos.DataTypeNumber), - // Kind: to.Ptr(armcosmos.IndexKindRange), - // Precision: to.Ptr[int32](-1), - // }}, - // }}, - // IndexingMode: to.Ptr(armcosmos.IndexingModeConsistent), - // }, - // PartitionKey: &armcosmos.ContainerPartitionKey{ - // Kind: to.Ptr(armcosmos.PartitionKindHash), - // Paths: []*string{ - // to.Ptr("/AccountNumber")}, - // }, - // UniqueKeyPolicy: &armcosmos.UniqueKeyPolicy{ - // UniqueKeys: []*armcosmos.UniqueKey{ - // { - // Paths: []*string{ - // to.Ptr("/testPath")}, - // }}, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlContainerDelete.json -func ExampleSQLResourcesClient_BeginDeleteSQLContainer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginDeleteSQLContainer(ctx, "rg1", "ddb1", "databaseName", "containerName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlContainerThroughputGet.json -func ExampleSQLResourcesClient_GetSQLContainerThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSQLResourcesClient().GetSQLContainerThroughput(ctx, "rg1", "ddb1", "databaseName", "containerName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/sqlContainers/containerName/throughputSettings/default"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // InstantMaximumThroughput: to.Ptr("10000"), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // SoftAllowedMaximumThroughput: to.Ptr("1000000"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlContainerThroughputUpdate.json -func ExampleSQLResourcesClient_BeginUpdateSQLContainerThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginUpdateSQLContainerThroughput(ctx, "rg1", "ddb1", "databaseName", "containerName", armcosmos.ThroughputSettingsUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.ThroughputSettingsUpdateProperties{ - Resource: &armcosmos.ThroughputSettingsResource{ - Throughput: to.Ptr[int32](400), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/sqlContainers/containerName/throughputSettings/default"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlContainerMigrateToAutoscale.json -func ExampleSQLResourcesClient_BeginMigrateSQLContainerToAutoscale() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginMigrateSQLContainerToAutoscale(ctx, "rg1", "ddb1", "databaseName", "containerName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // AutoscaleSettings: &armcosmos.AutoscaleSettingsResource{ - // MaxThroughput: to.Ptr[int32](4000), - // }, - // MinimumThroughput: to.Ptr("4000"), - // OfferReplacePending: to.Ptr("false"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlContainerMigrateToManualThroughput.json -func ExampleSQLResourcesClient_BeginMigrateSQLContainerToManualThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginMigrateSQLContainerToManualThroughput(ctx, "rg1", "ddb1", "databaseName", "containerName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlClientEncryptionKeysList.json -func ExampleSQLResourcesClient_NewListClientEncryptionKeysPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSQLResourcesClient().NewListClientEncryptionKeysPager("rgName", "accountName", "databaseName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ClientEncryptionKeysListResult = armcosmos.ClientEncryptionKeysListResult{ - // Value: []*armcosmos.ClientEncryptionKeyGetResults{ - // { - // Name: to.Ptr("cekName1"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/clientEncryptionKey"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rgName/providers/Microsoft.DocumentDB/databaseAccounts/accountName/sqlDatabases/databaseName/clientEncryptionKeys/cekName1"), - // Properties: &armcosmos.ClientEncryptionKeyGetProperties{ - // Resource: &armcosmos.ClientEncryptionKeyGetPropertiesResource{ - // EncryptionAlgorithm: to.Ptr("AEAD_AES_256_CBC_HMAC_SHA256"), - // ID: to.Ptr("cekName1"), - // KeyWrapMetadata: &armcosmos.KeyWrapMetadata{ - // Name: to.Ptr("customerManagedKey1"), - // Type: to.Ptr("AzureKeyVault"), - // Algorithm: to.Ptr("RSA-OAEP"), - // Value: to.Ptr("AzureKeyVault Key URL for customerManagedKey1"), - // }, - // WrappedDataEncryptionKey: []byte("U3dhZ2dlciByb2Nrcw=="), - // Etag: to.Ptr("00000000-0000-0000-7a1f-bc0828e801d7"), - // Rid: to.Ptr("nAMyAAAAAADPw1kKAgAAAA=="), - // Ts: to.Ptr[float32](1626425552), - // }, - // }, - // }, - // { - // Name: to.Ptr("cekName2"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/clientEncryptionKey"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rgName/providers/Microsoft.DocumentDB/databaseAccounts/accountName/sqlDatabases/databaseName/clientEncryptionKeys/cekName2"), - // Properties: &armcosmos.ClientEncryptionKeyGetProperties{ - // Resource: &armcosmos.ClientEncryptionKeyGetPropertiesResource{ - // EncryptionAlgorithm: to.Ptr("AEAD_AES_256_CBC_HMAC_SHA256"), - // ID: to.Ptr("cekName2"), - // KeyWrapMetadata: &armcosmos.KeyWrapMetadata{ - // Name: to.Ptr("customerManagedKey2"), - // Type: to.Ptr("AzureKeyVault"), - // Algorithm: to.Ptr("RSA-OAEP"), - // Value: to.Ptr("AzureKeyVault Key URL for customerManagedKey2"), - // }, - // WrappedDataEncryptionKey: []byte("U3dhZ2dlciByb2Nrcw=="), - // Etag: to.Ptr("00000000-0000-0000-7a21-7788a38c01d7"), - // Rid: to.Ptr("nAMyAAAAAAAWWfxHAgAAAA=="), - // Ts: to.Ptr[float32](1626425631), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlClientEncryptionKeyGet.json -func ExampleSQLResourcesClient_GetClientEncryptionKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSQLResourcesClient().GetClientEncryptionKey(ctx, "rgName", "accountName", "databaseName", "cekName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ClientEncryptionKeyGetResults = armcosmos.ClientEncryptionKeyGetResults{ - // Name: to.Ptr("cekName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/clientEncryptionKey"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rgName/providers/Microsoft.DocumentDB/databaseAccounts/accountName/sqlDatabases/databaseName/clientEncryptionKeys/cekName"), - // Properties: &armcosmos.ClientEncryptionKeyGetProperties{ - // Resource: &armcosmos.ClientEncryptionKeyGetPropertiesResource{ - // EncryptionAlgorithm: to.Ptr("AEAD_AES_256_CBC_HMAC_SHA256"), - // ID: to.Ptr("cekName"), - // KeyWrapMetadata: &armcosmos.KeyWrapMetadata{ - // Name: to.Ptr("customerManagedKey"), - // Type: to.Ptr("AzureKeyVault"), - // Algorithm: to.Ptr("RSA-OAEP"), - // Value: to.Ptr("AzureKeyVault Key URL"), - // }, - // WrappedDataEncryptionKey: []byte("U3dhZ2dlciByb2Nrcw=="), - // Etag: to.Ptr("00000000-0000-0000-7a1f-bc0828e801d7"), - // Rid: to.Ptr("tNc4AAAAAAAQkjzWAgAAAA=="), - // Ts: to.Ptr[float32](1626425552), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlClientEncryptionKeyCreateUpdate.json -func ExampleSQLResourcesClient_BeginCreateUpdateClientEncryptionKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginCreateUpdateClientEncryptionKey(ctx, "rgName", "accountName", "databaseName", "cekName", armcosmos.ClientEncryptionKeyCreateUpdateParameters{ - Properties: &armcosmos.ClientEncryptionKeyCreateUpdateProperties{ - Resource: &armcosmos.ClientEncryptionKeyResource{ - EncryptionAlgorithm: to.Ptr("AEAD_AES_256_CBC_HMAC_SHA256"), - ID: to.Ptr("cekName"), - KeyWrapMetadata: &armcosmos.KeyWrapMetadata{ - Name: to.Ptr("customerManagedKey"), - Type: to.Ptr("AzureKeyVault"), - Algorithm: to.Ptr("RSA-OAEP"), - Value: to.Ptr("AzureKeyVault Key URL"), - }, - WrappedDataEncryptionKey: []byte("U3dhZ2dlciByb2Nrcw=="), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ClientEncryptionKeyGetResults = armcosmos.ClientEncryptionKeyGetResults{ - // Name: to.Ptr("cekName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/clientEncryptionKey"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rgName/providers/Microsoft.DocumentDB/databaseAccounts/accountName/sqlDatabases/databaseName/clientEncryptionKeys/cekName"), - // Properties: &armcosmos.ClientEncryptionKeyGetProperties{ - // Resource: &armcosmos.ClientEncryptionKeyGetPropertiesResource{ - // EncryptionAlgorithm: to.Ptr("AEAD_AES_256_CBC_HMAC_SHA256"), - // ID: to.Ptr("cekName"), - // KeyWrapMetadata: &armcosmos.KeyWrapMetadata{ - // Name: to.Ptr("customerManagedKey"), - // Type: to.Ptr("AzureKeyVault"), - // Algorithm: to.Ptr("RSA-OAEP"), - // Value: to.Ptr("AzureKeyVault Key URL"), - // }, - // WrappedDataEncryptionKey: []byte("U3dhZ2dlciByb2Nrcw=="), - // Etag: to.Ptr("00000000-0000-0000-7a1f-bc0828e801d7"), - // Rid: to.Ptr("tNc4AAAAAAAQkjzWAgAAAA=="), - // Ts: to.Ptr[float32](1626425552), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlStoredProcedureList.json -func ExampleSQLResourcesClient_NewListSQLStoredProceduresPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSQLResourcesClient().NewListSQLStoredProceduresPager("rgName", "ddb1", "databaseName", "containerName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SQLStoredProcedureListResult = armcosmos.SQLStoredProcedureListResult{ - // Value: []*armcosmos.SQLStoredProcedureGetResults{ - // { - // Name: to.Ptr("testctn"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers/sqlStoredProcedures"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/sqlContainers/containerName/sqlStoredProcedures/storedProcedureName"), - // Properties: &armcosmos.SQLStoredProcedureGetProperties{ - // Resource: &armcosmos.SQLStoredProcedureGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // Body: to.Ptr("body"), - // ID: to.Ptr("testctn"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlStoredProcedureGet.json -func ExampleSQLResourcesClient_GetSQLStoredProcedure() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSQLResourcesClient().GetSQLStoredProcedure(ctx, "rgName", "ddb1", "databaseName", "containerName", "storedProcedureName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SQLStoredProcedureGetResults = armcosmos.SQLStoredProcedureGetResults{ - // Name: to.Ptr("storedProcedureName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers/sqlStoredProcedures"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/sqlContainers/containerName/sqlStoredProcedures/storedProcedureName"), - // Properties: &armcosmos.SQLStoredProcedureGetProperties{ - // Resource: &armcosmos.SQLStoredProcedureGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // Body: to.Ptr("body"), - // ID: to.Ptr("storedProcedureName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlStoredProcedureCreateUpdate.json -func ExampleSQLResourcesClient_BeginCreateUpdateSQLStoredProcedure() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginCreateUpdateSQLStoredProcedure(ctx, "rg1", "ddb1", "databaseName", "containerName", "storedProcedureName", armcosmos.SQLStoredProcedureCreateUpdateParameters{ - Properties: &armcosmos.SQLStoredProcedureCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.SQLStoredProcedureResource{ - Body: to.Ptr("body"), - ID: to.Ptr("storedProcedureName"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SQLStoredProcedureGetResults = armcosmos.SQLStoredProcedureGetResults{ - // Name: to.Ptr("storedProcedureName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers/sqlStoredProcedures"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/sqlContainers/containerName/sqlStoredProcedures/storedProcedureName"), - // Properties: &armcosmos.SQLStoredProcedureGetProperties{ - // Resource: &armcosmos.SQLStoredProcedureGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // Body: to.Ptr("body"), - // ID: to.Ptr("storedProcedureName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlStoredProcedureDelete.json -func ExampleSQLResourcesClient_BeginDeleteSQLStoredProcedure() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginDeleteSQLStoredProcedure(ctx, "rg1", "ddb1", "databaseName", "containerName", "storedProcedureName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlUserDefinedFunctionList.json -func ExampleSQLResourcesClient_NewListSQLUserDefinedFunctionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSQLResourcesClient().NewListSQLUserDefinedFunctionsPager("rgName", "ddb1", "databaseName", "containerName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SQLUserDefinedFunctionListResult = armcosmos.SQLUserDefinedFunctionListResult{ - // Value: []*armcosmos.SQLUserDefinedFunctionGetResults{ - // { - // Name: to.Ptr("testctn"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers/sqlUserDefinedFunctions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/sqlContainers/containerName/sqlUserDefinedFunctions/userDefinedFunctionName"), - // Properties: &armcosmos.SQLUserDefinedFunctionGetProperties{ - // Resource: &armcosmos.SQLUserDefinedFunctionGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // Body: to.Ptr("body"), - // ID: to.Ptr("testctn"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlUserDefinedFunctionGet.json -func ExampleSQLResourcesClient_GetSQLUserDefinedFunction() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSQLResourcesClient().GetSQLUserDefinedFunction(ctx, "rgName", "ddb1", "databaseName", "containerName", "userDefinedFunctionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SQLUserDefinedFunctionGetResults = armcosmos.SQLUserDefinedFunctionGetResults{ - // Name: to.Ptr("userDefinedFunctionName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers/sqlUserDefinedFunctions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/sqlContainers/containerName/sqlUserDefinedFunctions/userDefinedFunctionName"), - // Properties: &armcosmos.SQLUserDefinedFunctionGetProperties{ - // Resource: &armcosmos.SQLUserDefinedFunctionGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // Body: to.Ptr("body"), - // ID: to.Ptr("userDefinedFunctionName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlUserDefinedFunctionCreateUpdate.json -func ExampleSQLResourcesClient_BeginCreateUpdateSQLUserDefinedFunction() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginCreateUpdateSQLUserDefinedFunction(ctx, "rg1", "ddb1", "databaseName", "containerName", "userDefinedFunctionName", armcosmos.SQLUserDefinedFunctionCreateUpdateParameters{ - Properties: &armcosmos.SQLUserDefinedFunctionCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.SQLUserDefinedFunctionResource{ - Body: to.Ptr("body"), - ID: to.Ptr("userDefinedFunctionName"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SQLUserDefinedFunctionGetResults = armcosmos.SQLUserDefinedFunctionGetResults{ - // Name: to.Ptr("userDefinedFunctionName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers/sqlUserDefinedFunctions"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/sqlContainers/containerName/sqlUserDefinedFunctions/userDefinedFunctionName"), - // Properties: &armcosmos.SQLUserDefinedFunctionGetProperties{ - // Resource: &armcosmos.SQLUserDefinedFunctionGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // Body: to.Ptr("body"), - // ID: to.Ptr("userDefinedFunctionName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlUserDefinedFunctionDelete.json -func ExampleSQLResourcesClient_BeginDeleteSQLUserDefinedFunction() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginDeleteSQLUserDefinedFunction(ctx, "rg1", "ddb1", "databaseName", "containerName", "userDefinedFunctionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlTriggerList.json -func ExampleSQLResourcesClient_NewListSQLTriggersPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSQLResourcesClient().NewListSQLTriggersPager("rgName", "ddb1", "databaseName", "containerName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SQLTriggerListResult = armcosmos.SQLTriggerListResult{ - // Value: []*armcosmos.SQLTriggerGetResults{ - // { - // Name: to.Ptr("testctn"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers/sqlTriggers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/sqlContainers/containerName/sqlTriggers/triggerName"), - // Properties: &armcosmos.SQLTriggerGetProperties{ - // Resource: &armcosmos.SQLTriggerGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // Body: to.Ptr("body"), - // ID: to.Ptr("testctn"), - // TriggerOperation: to.Ptr(armcosmos.TriggerOperation("triggerOperation")), - // TriggerType: to.Ptr(armcosmos.TriggerType("triggerType")), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlTriggerGet.json -func ExampleSQLResourcesClient_GetSQLTrigger() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSQLResourcesClient().GetSQLTrigger(ctx, "rgName", "ddb1", "databaseName", "containerName", "triggerName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SQLTriggerGetResults = armcosmos.SQLTriggerGetResults{ - // Name: to.Ptr("triggerName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers/sqlTriggers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/sqlContainers/containerName/sqlTriggers/triggerName"), - // Properties: &armcosmos.SQLTriggerGetProperties{ - // Resource: &armcosmos.SQLTriggerGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // Body: to.Ptr("body"), - // ID: to.Ptr("triggerName"), - // TriggerOperation: to.Ptr(armcosmos.TriggerOperation("triggerOperation")), - // TriggerType: to.Ptr(armcosmos.TriggerType("triggerType")), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlTriggerCreateUpdate.json -func ExampleSQLResourcesClient_BeginCreateUpdateSQLTrigger() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginCreateUpdateSQLTrigger(ctx, "rg1", "ddb1", "databaseName", "containerName", "triggerName", armcosmos.SQLTriggerCreateUpdateParameters{ - Properties: &armcosmos.SQLTriggerCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.SQLTriggerResource{ - Body: to.Ptr("body"), - ID: to.Ptr("triggerName"), - TriggerOperation: to.Ptr(armcosmos.TriggerOperation("triggerOperation")), - TriggerType: to.Ptr(armcosmos.TriggerType("triggerType")), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SQLTriggerGetResults = armcosmos.SQLTriggerGetResults{ - // Name: to.Ptr("triggerName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers/sqlTriggers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/sqlContainers/containerName/sqlTriggers/triggerName"), - // Properties: &armcosmos.SQLTriggerGetProperties{ - // Resource: &armcosmos.SQLTriggerGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // Body: to.Ptr("body"), - // ID: to.Ptr("triggerName"), - // TriggerOperation: to.Ptr(armcosmos.TriggerOperation("triggerOperation")), - // TriggerType: to.Ptr(armcosmos.TriggerType("triggerType")), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlTriggerDelete.json -func ExampleSQLResourcesClient_BeginDeleteSQLTrigger() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginDeleteSQLTrigger(ctx, "rg1", "ddb1", "databaseName", "containerName", "triggerName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlRoleDefinitionGet.json -func ExampleSQLResourcesClient_GetSQLRoleDefinition() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSQLResourcesClient().GetSQLRoleDefinition(ctx, "myRoleDefinitionId", "myResourceGroupName", "myAccountName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SQLRoleDefinitionGetResults = armcosmos.SQLRoleDefinitionGetResults{ - // Name: to.Ptr("myRoleDefinitionId"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions"), - // ID: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId"), - // Properties: &armcosmos.SQLRoleDefinitionResource{ - // Type: to.Ptr(armcosmos.RoleDefinitionTypeCustomRole), - // AssignableScopes: []*string{ - // to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/sales"), - // to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases")}, - // Permissions: []*armcosmos.Permission{ - // { - // DataActions: []*string{ - // to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/create"), - // to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read")}, - // NotDataActions: []*string{ - // }, - // }}, - // RoleName: to.Ptr("myRoleName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlRoleDefinitionCreateUpdate.json -func ExampleSQLResourcesClient_BeginCreateUpdateSQLRoleDefinition() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginCreateUpdateSQLRoleDefinition(ctx, "myRoleDefinitionId", "myResourceGroupName", "myAccountName", armcosmos.SQLRoleDefinitionCreateUpdateParameters{ - Properties: &armcosmos.SQLRoleDefinitionResource{ - Type: to.Ptr(armcosmos.RoleDefinitionTypeCustomRole), - AssignableScopes: []*string{ - to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/sales"), - to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases")}, - Permissions: []*armcosmos.Permission{ - { - DataActions: []*string{ - to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/create"), - to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read")}, - NotDataActions: []*string{}, - }}, - RoleName: to.Ptr("myRoleName"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SQLRoleDefinitionGetResults = armcosmos.SQLRoleDefinitionGetResults{ - // Name: to.Ptr("myRoleDefinitionId"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions"), - // ID: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId"), - // Properties: &armcosmos.SQLRoleDefinitionResource{ - // Type: to.Ptr(armcosmos.RoleDefinitionTypeCustomRole), - // AssignableScopes: []*string{ - // to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/sales"), - // to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases")}, - // Permissions: []*armcosmos.Permission{ - // { - // DataActions: []*string{ - // to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/create"), - // to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read")}, - // }}, - // RoleName: to.Ptr("myRoleName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlRoleDefinitionDelete.json -func ExampleSQLResourcesClient_BeginDeleteSQLRoleDefinition() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginDeleteSQLRoleDefinition(ctx, "myRoleDefinitionId", "myResourceGroupName", "myAccountName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlRoleDefinitionList.json -func ExampleSQLResourcesClient_NewListSQLRoleDefinitionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSQLResourcesClient().NewListSQLRoleDefinitionsPager("myResourceGroupName", "myAccountName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SQLRoleDefinitionListResult = armcosmos.SQLRoleDefinitionListResult{ - // Value: []*armcosmos.SQLRoleDefinitionGetResults{ - // { - // Name: to.Ptr("myRoleDefinitionId"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions"), - // ID: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId"), - // Properties: &armcosmos.SQLRoleDefinitionResource{ - // Type: to.Ptr(armcosmos.RoleDefinitionTypeCustomRole), - // AssignableScopes: []*string{ - // to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/sales"), - // to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases")}, - // Permissions: []*armcosmos.Permission{ - // { - // DataActions: []*string{ - // to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/create"), - // to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read")}, - // NotDataActions: []*string{ - // }, - // }}, - // RoleName: to.Ptr("myRoleName"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlRoleAssignmentGet.json -func ExampleSQLResourcesClient_GetSQLRoleAssignment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSQLResourcesClient().GetSQLRoleAssignment(ctx, "myRoleAssignmentId", "myResourceGroupName", "myAccountName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SQLRoleAssignmentGetResults = armcosmos.SQLRoleAssignmentGetResults{ - // Name: to.Ptr("myRoleAssignmentId"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlRoleAssignments"), - // ID: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleAssignments/myRoleAssignmentId"), - // Properties: &armcosmos.SQLRoleAssignmentResource{ - // PrincipalID: to.Ptr("myPrincipalId"), - // RoleDefinitionID: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId"), - // Scope: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases/colls/redmond-purchases"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlRoleAssignmentCreateUpdate.json -func ExampleSQLResourcesClient_BeginCreateUpdateSQLRoleAssignment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginCreateUpdateSQLRoleAssignment(ctx, "myRoleAssignmentId", "myResourceGroupName", "myAccountName", armcosmos.SQLRoleAssignmentCreateUpdateParameters{ - Properties: &armcosmos.SQLRoleAssignmentResource{ - PrincipalID: to.Ptr("myPrincipalId"), - RoleDefinitionID: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId"), - Scope: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases/colls/redmond-purchases"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SQLRoleAssignmentGetResults = armcosmos.SQLRoleAssignmentGetResults{ - // Name: to.Ptr("myRoleAssignmentId"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlRoleAssignments"), - // ID: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleAssignments/myRoleAssignmentId"), - // Properties: &armcosmos.SQLRoleAssignmentResource{ - // PrincipalID: to.Ptr("myPrincipalId"), - // RoleDefinitionID: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId"), - // Scope: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases/colls/redmond-purchases"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlRoleAssignmentDelete.json -func ExampleSQLResourcesClient_BeginDeleteSQLRoleAssignment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginDeleteSQLRoleAssignment(ctx, "myRoleAssignmentId", "myResourceGroupName", "myAccountName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlRoleAssignmentList.json -func ExampleSQLResourcesClient_NewListSQLRoleAssignmentsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSQLResourcesClient().NewListSQLRoleAssignmentsPager("myResourceGroupName", "myAccountName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SQLRoleAssignmentListResult = armcosmos.SQLRoleAssignmentListResult{ - // Value: []*armcosmos.SQLRoleAssignmentGetResults{ - // { - // Name: to.Ptr("myRoleAssignmentId"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlRoleAssignments"), - // ID: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleAssignments/myRoleAssignmentId"), - // Properties: &armcosmos.SQLRoleAssignmentResource{ - // PrincipalID: to.Ptr("myPrincipalId"), - // RoleDefinitionID: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId"), - // Scope: to.Ptr("/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases/colls/redmond-purchases"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBSqlContainerBackupInformation.json -func ExampleSQLResourcesClient_BeginRetrieveContinuousBackupInformation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSQLResourcesClient().BeginRetrieveContinuousBackupInformation(ctx, "rgName", "ddb1", "databaseName", "containerName", armcosmos.ContinuousBackupRestoreLocation{ - Location: to.Ptr("North Europe"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupInformation = armcosmos.BackupInformation{ - // ContinuousBackupInformation: &armcosmos.ContinuousBackupInformation{ - // LatestRestorableTimestamp: to.Ptr("2021-02-05T02:40:50Z"), - // }, - // } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/sqlresources_live_test.go b/sdk/resourcemanager/cosmos/armcosmos/sqlresources_live_test.go index 012fc47f62e9..5ce7f4f4d3a1 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/sqlresources_live_test.go +++ b/sdk/resourcemanager/cosmos/armcosmos/sqlresources_live_test.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/cosmos/armcosmos/tableresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/tableresources_client.go index d0271d2e13b9..b479f1e782cf 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/tableresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/tableresources_client.go @@ -46,7 +46,7 @@ func NewTableResourcesClient(subscriptionID string, credential azcore.TokenCrede // BeginCreateUpdateTable - Create or update an Azure Cosmos DB Table // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - tableName - Cosmos DB table name. @@ -73,7 +73,7 @@ func (client *TableResourcesClient) BeginCreateUpdateTable(ctx context.Context, // CreateUpdateTable - Create or update an Azure Cosmos DB Table // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *TableResourcesClient) createUpdateTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters TableCreateUpdateParameters, options *TableResourcesClientBeginCreateUpdateTableOptions) (*http.Response, error) { var err error const operationName = "TableResourcesClient.BeginCreateUpdateTable" @@ -119,7 +119,7 @@ func (client *TableResourcesClient) createUpdateTableCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, createUpdateTableParameters); err != nil { @@ -131,7 +131,7 @@ func (client *TableResourcesClient) createUpdateTableCreateRequest(ctx context.C // BeginDeleteTable - Deletes an existing Azure Cosmos DB Table. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - tableName - Cosmos DB table name. @@ -157,7 +157,7 @@ func (client *TableResourcesClient) BeginDeleteTable(ctx context.Context, resour // DeleteTable - Deletes an existing Azure Cosmos DB Table. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *TableResourcesClient) deleteTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableResourcesClientBeginDeleteTableOptions) (*http.Response, error) { var err error const operationName = "TableResourcesClient.BeginDeleteTable" @@ -203,7 +203,7 @@ func (client *TableResourcesClient) deleteTableCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -211,7 +211,7 @@ func (client *TableResourcesClient) deleteTableCreateRequest(ctx context.Context // GetTable - Gets the Tables under an existing Azure Cosmos DB database account with the provided name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - tableName - Cosmos DB table name. @@ -262,7 +262,7 @@ func (client *TableResourcesClient) getTableCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -281,7 +281,7 @@ func (client *TableResourcesClient) getTableHandleResponse(resp *http.Response) // name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - tableName - Cosmos DB table name. @@ -333,7 +333,7 @@ func (client *TableResourcesClient) getTableThroughputCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -350,7 +350,7 @@ func (client *TableResourcesClient) getTableThroughputHandleResponse(resp *http. // NewListTablesPager - Lists the Tables under an existing Azure Cosmos DB database account. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - options - TableResourcesClientListTablesOptions contains the optional parameters for the TableResourcesClient.NewListTablesPager @@ -399,7 +399,7 @@ func (client *TableResourcesClient) listTablesCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -417,7 +417,7 @@ func (client *TableResourcesClient) listTablesHandleResponse(resp *http.Response // BeginMigrateTableToAutoscale - Migrate an Azure Cosmos DB Table from manual throughput to autoscale // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - tableName - Cosmos DB table name. @@ -443,7 +443,7 @@ func (client *TableResourcesClient) BeginMigrateTableToAutoscale(ctx context.Con // MigrateTableToAutoscale - Migrate an Azure Cosmos DB Table from manual throughput to autoscale // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *TableResourcesClient) migrateTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableResourcesClientBeginMigrateTableToAutoscaleOptions) (*http.Response, error) { var err error const operationName = "TableResourcesClient.BeginMigrateTableToAutoscale" @@ -489,7 +489,7 @@ func (client *TableResourcesClient) migrateTableToAutoscaleCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -498,7 +498,7 @@ func (client *TableResourcesClient) migrateTableToAutoscaleCreateRequest(ctx con // BeginMigrateTableToManualThroughput - Migrate an Azure Cosmos DB Table from autoscale to manual throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - tableName - Cosmos DB table name. @@ -524,7 +524,7 @@ func (client *TableResourcesClient) BeginMigrateTableToManualThroughput(ctx cont // MigrateTableToManualThroughput - Migrate an Azure Cosmos DB Table from autoscale to manual throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *TableResourcesClient) migrateTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableResourcesClientBeginMigrateTableToManualThroughputOptions) (*http.Response, error) { var err error const operationName = "TableResourcesClient.BeginMigrateTableToManualThroughput" @@ -570,7 +570,7 @@ func (client *TableResourcesClient) migrateTableToManualThroughputCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -579,7 +579,7 @@ func (client *TableResourcesClient) migrateTableToManualThroughputCreateRequest( // BeginRetrieveContinuousBackupInformation - Retrieves continuous backup information for a table. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - tableName - Cosmos DB table name. @@ -607,7 +607,7 @@ func (client *TableResourcesClient) BeginRetrieveContinuousBackupInformation(ctx // RetrieveContinuousBackupInformation - Retrieves continuous backup information for a table. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *TableResourcesClient) retrieveContinuousBackupInformation(ctx context.Context, resourceGroupName string, accountName string, tableName string, location ContinuousBackupRestoreLocation, options *TableResourcesClientBeginRetrieveContinuousBackupInformationOptions) (*http.Response, error) { var err error const operationName = "TableResourcesClient.BeginRetrieveContinuousBackupInformation" @@ -653,7 +653,7 @@ func (client *TableResourcesClient) retrieveContinuousBackupInformationCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, location); err != nil { @@ -665,7 +665,7 @@ func (client *TableResourcesClient) retrieveContinuousBackupInformationCreateReq // BeginUpdateTableThroughput - Update RUs per second of an Azure Cosmos DB Table // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - tableName - Cosmos DB table name. @@ -692,7 +692,7 @@ func (client *TableResourcesClient) BeginUpdateTableThroughput(ctx context.Conte // UpdateTableThroughput - Update RUs per second of an Azure Cosmos DB Table // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-15 +// Generated from API version 2024-09-01-preview func (client *TableResourcesClient) updateTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *TableResourcesClientBeginUpdateTableThroughputOptions) (*http.Response, error) { var err error const operationName = "TableResourcesClient.BeginUpdateTableThroughput" @@ -738,7 +738,7 @@ func (client *TableResourcesClient) updateTableThroughputCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-15") + reqQP.Set("api-version", "2024-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { diff --git a/sdk/resourcemanager/cosmos/armcosmos/tableresources_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/tableresources_client_example_test.go deleted file mode 100644 index ddde8729ce89..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/tableresources_client_example_test.go +++ /dev/null @@ -1,357 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armcosmos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBTableList.json -func ExampleTableResourcesClient_NewListTablesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTableResourcesClient().NewListTablesPager("rgName", "ddb1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TableListResult = armcosmos.TableListResult{ - // Value: []*armcosmos.TableGetResults{ - // { - // Name: to.Ptr("tableName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/tables"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/tables/tableName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.TableGetProperties{ - // Resource: &armcosmos.TableGetPropertiesResource{ - // ID: to.Ptr("tableName"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBTableGet.json -func ExampleTableResourcesClient_GetTable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTableResourcesClient().GetTable(ctx, "rg1", "ddb1", "tableName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TableGetResults = armcosmos.TableGetResults{ - // Name: to.Ptr("tableName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/tables"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/tables/tableName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.TableGetProperties{ - // Resource: &armcosmos.TableGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // ID: to.Ptr("tableName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBTableCreateUpdate.json -func ExampleTableResourcesClient_BeginCreateUpdateTable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewTableResourcesClient().BeginCreateUpdateTable(ctx, "rg1", "ddb1", "tableName", armcosmos.TableCreateUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.TableCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.TableResource{ - ID: to.Ptr("tableName"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TableGetResults = armcosmos.TableGetResults{ - // Name: to.Ptr("tableName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/tables"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/tables/tableName"), - // Location: to.Ptr("West US"), - // Properties: &armcosmos.TableGetProperties{ - // Resource: &armcosmos.TableGetPropertiesResource{ - // ID: to.Ptr("tableName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBTableDelete.json -func ExampleTableResourcesClient_BeginDeleteTable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewTableResourcesClient().BeginDeleteTable(ctx, "rg1", "ddb1", "tableName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBTableThroughputGet.json -func ExampleTableResourcesClient_GetTableThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTableResourcesClient().GetTableThroughput(ctx, "rg1", "ddb1", "tableName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/tables/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/tables/tableName/throughputSettings/default"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // InstantMaximumThroughput: to.Ptr("10000"), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // SoftAllowedMaximumThroughput: to.Ptr("1000000"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBTableThroughputUpdate.json -func ExampleTableResourcesClient_BeginUpdateTableThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewTableResourcesClient().BeginUpdateTableThroughput(ctx, "rg1", "ddb1", "tableName", armcosmos.ThroughputSettingsUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.ThroughputSettingsUpdateProperties{ - Resource: &armcosmos.ThroughputSettingsResource{ - Throughput: to.Ptr[int32](400), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/tables/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/tables/tableName/throughputSettings/default"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBTableMigrateToAutoscale.json -func ExampleTableResourcesClient_BeginMigrateTableToAutoscale() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewTableResourcesClient().BeginMigrateTableToAutoscale(ctx, "rg1", "ddb1", "tableName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // AutoscaleSettings: &armcosmos.AutoscaleSettingsResource{ - // MaxThroughput: to.Ptr[int32](4000), - // }, - // MinimumThroughput: to.Ptr("4000"), - // OfferReplacePending: to.Ptr("false"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBTableMigrateToManualThroughput.json -func ExampleTableResourcesClient_BeginMigrateTableToManualThroughput() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewTableResourcesClient().BeginMigrateTableToManualThroughput(ctx, "rg1", "ddb1", "tableName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThroughputSettingsGetResults = armcosmos.ThroughputSettingsGetResults{ - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // Etag: to.Ptr("\"00005900-0000-0000-0000-56f9a2630000\""), - // Rid: to.Ptr("PD5DALigDgw="), - // Ts: to.Ptr[float32](1459200611), - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("true"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ec7ee8842bf615c2f0354bf8b5b8725fdac9454a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-05-15/examples/CosmosDBTableBackupInformation.json -func ExampleTableResourcesClient_BeginRetrieveContinuousBackupInformation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcosmos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewTableResourcesClient().BeginRetrieveContinuousBackupInformation(ctx, "rgName", "ddb1", "tableName1", armcosmos.ContinuousBackupRestoreLocation{ - Location: to.Ptr("North Europe"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupInformation = armcosmos.BackupInformation{ - // ContinuousBackupInformation: &armcosmos.ContinuousBackupInformation{ - // LatestRestorableTimestamp: to.Ptr("2021-02-05T02:40:50Z"), - // }, - // } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/tableresources_live_test.go b/sdk/resourcemanager/cosmos/armcosmos/tableresources_live_test.go index 2ce5c924b957..3026d6a73f2b 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/tableresources_live_test.go +++ b/sdk/resourcemanager/cosmos/armcosmos/tableresources_live_test.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v4" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/cosmos/armcosmos/throughputpool_client.go b/sdk/resourcemanager/cosmos/armcosmos/throughputpool_client.go new file mode 100644 index 000000000000..2d180c269404 --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/throughputpool_client.go @@ -0,0 +1,350 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcosmos + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ThroughputPoolClient contains the methods for the ThroughputPool group. +// Don't use this type directly, use NewThroughputPoolClient() instead. +type ThroughputPoolClient struct { + internal *arm.Client + subscriptionID string +} + +// NewThroughputPoolClient creates a new instance of ThroughputPoolClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewThroughputPoolClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ThroughputPoolClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ThroughputPoolClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates an Azure Cosmos DB ThroughputPool account. The "Update" method is preferred when +// performing updates on an account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - throughputPoolName - Cosmos DB Throughput Pool name. +// - body - The parameters to provide for the current ThroughputPool. +// - options - ThroughputPoolClientBeginCreateOrUpdateOptions contains the optional parameters for the ThroughputPoolClient.BeginCreateOrUpdate +// method. +func (client *ThroughputPoolClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, throughputPoolName string, body ThroughputPoolResource, options *ThroughputPoolClientBeginCreateOrUpdateOptions) (*runtime.Poller[ThroughputPoolClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, throughputPoolName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ThroughputPoolClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ThroughputPoolClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates an Azure Cosmos DB ThroughputPool account. The "Update" method is preferred when performing +// updates on an account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *ThroughputPoolClient) createOrUpdate(ctx context.Context, resourceGroupName string, throughputPoolName string, body ThroughputPoolResource, options *ThroughputPoolClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ThroughputPoolClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, throughputPoolName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ThroughputPoolClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, throughputPoolName string, body ThroughputPoolResource, options *ThroughputPoolClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if throughputPoolName == "" { + return nil, errors.New("parameter throughputPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{throughputPoolName}", url.PathEscape(throughputPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes an existing Azure Cosmos DB Throughput Pool. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - throughputPoolName - Cosmos DB Throughput Pool name. +// - options - ThroughputPoolClientBeginDeleteOptions contains the optional parameters for the ThroughputPoolClient.BeginDelete +// method. +func (client *ThroughputPoolClient) BeginDelete(ctx context.Context, resourceGroupName string, throughputPoolName string, options *ThroughputPoolClientBeginDeleteOptions) (*runtime.Poller[ThroughputPoolClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, throughputPoolName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ThroughputPoolClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ThroughputPoolClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes an existing Azure Cosmos DB Throughput Pool. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *ThroughputPoolClient) deleteOperation(ctx context.Context, resourceGroupName string, throughputPoolName string, options *ThroughputPoolClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ThroughputPoolClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, throughputPoolName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ThroughputPoolClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, throughputPoolName string, options *ThroughputPoolClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if throughputPoolName == "" { + return nil, errors.New("parameter throughputPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{throughputPoolName}", url.PathEscape(throughputPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the properties of an existing Azure Cosmos DB Throughput Pool +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - throughputPoolName - Cosmos DB Throughput Pool name. +// - options - ThroughputPoolClientGetOptions contains the optional parameters for the ThroughputPoolClient.Get method. +func (client *ThroughputPoolClient) Get(ctx context.Context, resourceGroupName string, throughputPoolName string, options *ThroughputPoolClientGetOptions) (ThroughputPoolClientGetResponse, error) { + var err error + const operationName = "ThroughputPoolClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, throughputPoolName, options) + if err != nil { + return ThroughputPoolClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ThroughputPoolClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ThroughputPoolClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ThroughputPoolClient) getCreateRequest(ctx context.Context, resourceGroupName string, throughputPoolName string, options *ThroughputPoolClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if throughputPoolName == "" { + return nil, errors.New("parameter throughputPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{throughputPoolName}", url.PathEscape(throughputPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ThroughputPoolClient) getHandleResponse(resp *http.Response) (ThroughputPoolClientGetResponse, error) { + result := ThroughputPoolClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ThroughputPoolResource); err != nil { + return ThroughputPoolClientGetResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates the properties of an existing Azure Cosmos DB Throughput Pool. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - throughputPoolName - Cosmos DB Throughput Pool name. +// - options - ThroughputPoolClientBeginUpdateOptions contains the optional parameters for the ThroughputPoolClient.BeginUpdate +// method. +func (client *ThroughputPoolClient) BeginUpdate(ctx context.Context, resourceGroupName string, throughputPoolName string, options *ThroughputPoolClientBeginUpdateOptions) (*runtime.Poller[ThroughputPoolClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, throughputPoolName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ThroughputPoolClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ThroughputPoolClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates the properties of an existing Azure Cosmos DB Throughput Pool. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *ThroughputPoolClient) update(ctx context.Context, resourceGroupName string, throughputPoolName string, options *ThroughputPoolClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ThroughputPoolClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, throughputPoolName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *ThroughputPoolClient) updateCreateRequest(ctx context.Context, resourceGroupName string, throughputPoolName string, options *ThroughputPoolClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if throughputPoolName == "" { + return nil, errors.New("parameter throughputPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{throughputPoolName}", url.PathEscape(throughputPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Body != nil { + if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/throughputpoolaccount_client.go b/sdk/resourcemanager/cosmos/armcosmos/throughputpoolaccount_client.go new file mode 100644 index 000000000000..7f84d6b5332a --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/throughputpoolaccount_client.go @@ -0,0 +1,283 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcosmos + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ThroughputPoolAccountClient contains the methods for the ThroughputPoolAccount group. +// Don't use this type directly, use NewThroughputPoolAccountClient() instead. +type ThroughputPoolAccountClient struct { + internal *arm.Client + subscriptionID string +} + +// NewThroughputPoolAccountClient creates a new instance of ThroughputPoolAccountClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewThroughputPoolAccountClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ThroughputPoolAccountClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ThroughputPoolAccountClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates or updates an Azure Cosmos DB ThroughputPool account. The "Update" method is preferred when performing +// updates on an account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - throughputPoolName - Cosmos DB Throughput Pool name. +// - throughputPoolAccountName - Cosmos DB global database account in a Throughput Pool +// - body - The parameters to provide for the current ThroughputPoolAccount. +// - options - ThroughputPoolAccountClientBeginCreateOptions contains the optional parameters for the ThroughputPoolAccountClient.BeginCreate +// method. +func (client *ThroughputPoolAccountClient) BeginCreate(ctx context.Context, resourceGroupName string, throughputPoolName string, throughputPoolAccountName string, body ThroughputPoolAccountResource, options *ThroughputPoolAccountClientBeginCreateOptions) (*runtime.Poller[ThroughputPoolAccountClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, throughputPoolName, throughputPoolAccountName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ThroughputPoolAccountClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ThroughputPoolAccountClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Creates or updates an Azure Cosmos DB ThroughputPool account. The "Update" method is preferred when performing +// updates on an account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *ThroughputPoolAccountClient) create(ctx context.Context, resourceGroupName string, throughputPoolName string, throughputPoolAccountName string, body ThroughputPoolAccountResource, options *ThroughputPoolAccountClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "ThroughputPoolAccountClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, throughputPoolName, throughputPoolAccountName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *ThroughputPoolAccountClient) createCreateRequest(ctx context.Context, resourceGroupName string, throughputPoolName string, throughputPoolAccountName string, body ThroughputPoolAccountResource, options *ThroughputPoolAccountClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}/throughputPoolAccounts/{throughputPoolAccountName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if throughputPoolName == "" { + return nil, errors.New("parameter throughputPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{throughputPoolName}", url.PathEscape(throughputPoolName)) + if throughputPoolAccountName == "" { + return nil, errors.New("parameter throughputPoolAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{throughputPoolAccountName}", url.PathEscape(throughputPoolAccountName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Removes an existing Azure Cosmos DB database account from a throughput pool. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - throughputPoolName - Cosmos DB Throughput Pool name. +// - throughputPoolAccountName - Cosmos DB global database account in a Throughput Pool +// - options - ThroughputPoolAccountClientBeginDeleteOptions contains the optional parameters for the ThroughputPoolAccountClient.BeginDelete +// method. +func (client *ThroughputPoolAccountClient) BeginDelete(ctx context.Context, resourceGroupName string, throughputPoolName string, throughputPoolAccountName string, options *ThroughputPoolAccountClientBeginDeleteOptions) (*runtime.Poller[ThroughputPoolAccountClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, throughputPoolName, throughputPoolAccountName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ThroughputPoolAccountClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ThroughputPoolAccountClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Removes an existing Azure Cosmos DB database account from a throughput pool. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +func (client *ThroughputPoolAccountClient) deleteOperation(ctx context.Context, resourceGroupName string, throughputPoolName string, throughputPoolAccountName string, options *ThroughputPoolAccountClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ThroughputPoolAccountClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, throughputPoolName, throughputPoolAccountName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ThroughputPoolAccountClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, throughputPoolName string, throughputPoolAccountName string, options *ThroughputPoolAccountClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}/throughputPoolAccounts/{throughputPoolAccountName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if throughputPoolName == "" { + return nil, errors.New("parameter throughputPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{throughputPoolName}", url.PathEscape(throughputPoolName)) + if throughputPoolAccountName == "" { + return nil, errors.New("parameter throughputPoolAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{throughputPoolAccountName}", url.PathEscape(throughputPoolAccountName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Retrieves the properties of an existing Azure Cosmos DB Throughput Pool +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - throughputPoolName - Cosmos DB Throughput Pool name. +// - throughputPoolAccountName - Cosmos DB global database account in a Throughput Pool +// - options - ThroughputPoolAccountClientGetOptions contains the optional parameters for the ThroughputPoolAccountClient.Get +// method. +func (client *ThroughputPoolAccountClient) Get(ctx context.Context, resourceGroupName string, throughputPoolName string, throughputPoolAccountName string, options *ThroughputPoolAccountClientGetOptions) (ThroughputPoolAccountClientGetResponse, error) { + var err error + const operationName = "ThroughputPoolAccountClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, throughputPoolName, throughputPoolAccountName, options) + if err != nil { + return ThroughputPoolAccountClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ThroughputPoolAccountClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ThroughputPoolAccountClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ThroughputPoolAccountClient) getCreateRequest(ctx context.Context, resourceGroupName string, throughputPoolName string, throughputPoolAccountName string, options *ThroughputPoolAccountClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}/throughputPoolAccounts/{throughputPoolAccountName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if throughputPoolName == "" { + return nil, errors.New("parameter throughputPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{throughputPoolName}", url.PathEscape(throughputPoolName)) + if throughputPoolAccountName == "" { + return nil, errors.New("parameter throughputPoolAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{throughputPoolAccountName}", url.PathEscape(throughputPoolAccountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ThroughputPoolAccountClient) getHandleResponse(resp *http.Response) (ThroughputPoolAccountClientGetResponse, error) { + result := ThroughputPoolAccountClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ThroughputPoolAccountResource); err != nil { + return ThroughputPoolAccountClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/throughputpoolaccounts_client.go b/sdk/resourcemanager/cosmos/armcosmos/throughputpoolaccounts_client.go new file mode 100644 index 000000000000..3556728b8e16 --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/throughputpoolaccounts_client.go @@ -0,0 +1,109 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcosmos + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ThroughputPoolAccountsClient contains the methods for the ThroughputPoolAccounts group. +// Don't use this type directly, use NewThroughputPoolAccountsClient() instead. +type ThroughputPoolAccountsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewThroughputPoolAccountsClient creates a new instance of ThroughputPoolAccountsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewThroughputPoolAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ThroughputPoolAccountsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ThroughputPoolAccountsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Lists all the Azure Cosmos DB accounts available under the subscription. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - throughputPoolName - Cosmos DB Throughput Pool name. +// - options - ThroughputPoolAccountsClientListOptions contains the optional parameters for the ThroughputPoolAccountsClient.NewListPager +// method. +func (client *ThroughputPoolAccountsClient) NewListPager(resourceGroupName string, throughputPoolName string, options *ThroughputPoolAccountsClientListOptions) *runtime.Pager[ThroughputPoolAccountsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ThroughputPoolAccountsClientListResponse]{ + More: func(page ThroughputPoolAccountsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ThroughputPoolAccountsClientListResponse) (ThroughputPoolAccountsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ThroughputPoolAccountsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, throughputPoolName, options) + }, nil) + if err != nil { + return ThroughputPoolAccountsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ThroughputPoolAccountsClient) listCreateRequest(ctx context.Context, resourceGroupName string, throughputPoolName string, options *ThroughputPoolAccountsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}/throughputPoolAccounts" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if throughputPoolName == "" { + return nil, errors.New("parameter throughputPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{throughputPoolName}", url.PathEscape(throughputPoolName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ThroughputPoolAccountsClient) listHandleResponse(resp *http.Response) (ThroughputPoolAccountsClientListResponse, error) { + result := ThroughputPoolAccountsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ThroughputPoolAccountsListResult); err != nil { + return ThroughputPoolAccountsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/throughputpools_client.go b/sdk/resourcemanager/cosmos/armcosmos/throughputpools_client.go new file mode 100644 index 000000000000..504956874bcd --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/throughputpools_client.go @@ -0,0 +1,159 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcosmos + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ThroughputPoolsClient contains the methods for the ThroughputPools group. +// Don't use this type directly, use NewThroughputPoolsClient() instead. +type ThroughputPoolsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewThroughputPoolsClient creates a new instance of ThroughputPoolsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewThroughputPoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ThroughputPoolsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ThroughputPoolsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Lists all the Azure Cosmos DB Throughput Pools available under the subscription. +// +// Generated from API version 2024-09-01-preview +// - options - ThroughputPoolsClientListOptions contains the optional parameters for the ThroughputPoolsClient.NewListPager +// method. +func (client *ThroughputPoolsClient) NewListPager(options *ThroughputPoolsClientListOptions) *runtime.Pager[ThroughputPoolsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ThroughputPoolsClientListResponse]{ + More: func(page ThroughputPoolsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ThroughputPoolsClientListResponse) (ThroughputPoolsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ThroughputPoolsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return ThroughputPoolsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ThroughputPoolsClient) listCreateRequest(ctx context.Context, options *ThroughputPoolsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/throughputPools" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ThroughputPoolsClient) listHandleResponse(resp *http.Response) (ThroughputPoolsClientListResponse, error) { + result := ThroughputPoolsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ThroughputPoolsListResult); err != nil { + return ThroughputPoolsClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List all the ThroughputPools in a given resource group. +// +// Generated from API version 2024-09-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ThroughputPoolsClientListByResourceGroupOptions contains the optional parameters for the ThroughputPoolsClient.NewListByResourceGroupPager +// method. +func (client *ThroughputPoolsClient) NewListByResourceGroupPager(resourceGroupName string, options *ThroughputPoolsClientListByResourceGroupOptions) *runtime.Pager[ThroughputPoolsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ThroughputPoolsClientListByResourceGroupResponse]{ + More: func(page ThroughputPoolsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ThroughputPoolsClientListByResourceGroupResponse) (ThroughputPoolsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ThroughputPoolsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return ThroughputPoolsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ThroughputPoolsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ThroughputPoolsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ThroughputPoolsClient) listByResourceGroupHandleResponse(resp *http.Response) (ThroughputPoolsClientListByResourceGroupResponse, error) { + result := ThroughputPoolsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ThroughputPoolsListResult); err != nil { + return ThroughputPoolsClientListByResourceGroupResponse{}, err + } + return result, nil +}