diff --git a/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md b/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md index d9e1222e8d83..1e1f90dd67b9 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md +++ b/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md @@ -1,5 +1,34 @@ # Release History +## 3.0.0-beta.2 (2023-09-14) +### Breaking Changes + +- Struct `BackupResourceProperties` has been removed +- Field `ID`, `Name`, `Properties`, `Type` of struct `BackupResource` has been removed + +### Features Added + +- New value `PublicNetworkAccessSecuredByPerimeter` added to enum type `PublicNetworkAccess` +- New enum type `BackupState` with values `BackupStateFailed`, `BackupStateInProgress`, `BackupStateInitiated`, `BackupStateSucceeded` +- New enum type `ClusterType` with values `ClusterTypeNonProduction`, `ClusterTypeProduction` +- New enum type `CustomerManagedKeyStatus` with values `CustomerManagedKeyStatusAccessToTheConfiguredCustomerManagedKeyConfirmed`, `CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheAccessRulesAreBlockingOutboundRequestsToTheAzureKeyVaultServiceForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuide4016`, `CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountHasAnUndefinedDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideInvalidAzureCosmosDbDefaultIdentity4015`, `CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountSKeyVaultKeyURIDoesNotFollowTheExpectedFormatForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideImproperSyntaxDetectedOnTheKeyVaultURIProperty4006`, `CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToObtainTheAADAuthenticationTokenForTheAccountSDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideAzureActiveDirectoryTokenAcquisitionError4000`, `CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToWrapOrUnwrapTheKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideInternalUnwrappingProcedureError4005`, `CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheAzureKeyVaultDNSNameSpecifiedByTheAccountSKeyvaultkeyuriPropertyCouldNotBeResolvedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideUnableToResolveTheKeyVaultsDns4009`, `CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentAzureKeyVaultWasNotFoundForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4017`, `CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentKeyIsNotFoundOnTheSpecifiedKeyVaultForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4003`, `CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheCurrentDefaultIdentityNoLongerHasPermissionToTheAssociatedKeyVaultKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideDefaultIdentityIsUnauthorizedToAccessTheAzureKeyVaultKey4002`, `CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuide` +- New enum type `DefaultPriorityLevel` with values `DefaultPriorityLevelHigh`, `DefaultPriorityLevelLow` +- New struct `BackupSchedule` +- New struct `BaseCosmosDataTransferDataSourceSink` +- New field `BackupExpiryTimestamp`, `BackupID`, `BackupStartTimestamp`, `BackupState`, `BackupStopTimestamp` in struct `BackupResource` +- New field `XMSForceDeallocate` in struct `CassandraClustersClientBeginDeallocateOptions` +- New field `RemoteAccountName` in struct `CassandraDataTransferDataSourceSink` +- New field `BackupSchedules`, `ClusterType`, `Extensions` in struct `ClusterResourceProperties` +- New field `IsLatestModel` in struct `ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems` +- New field `CustomerManagedKeyStatus`, `DefaultPriorityLevel`, `EnablePriorityBasedExecution` in struct `DatabaseAccountCreateUpdateProperties` +- New field `CustomerManagedKeyStatus`, `DefaultPriorityLevel`, `EnablePriorityBasedExecution` in struct `DatabaseAccountGetProperties` +- New field `CustomerManagedKeyStatus`, `DefaultPriorityLevel`, `EnablePriorityBasedExecution` in struct `DatabaseAccountUpdateProperties` +- New field `RemoteAccountName` in struct `MongoDataTransferDataSourceSink` +- New field `RemoteAccountName` in struct `SQLDataTransferDataSourceSink` +- New field `InstantMaximumThroughput`, `SoftAllowedMaximumThroughput` in struct `ThroughputSettingsGetPropertiesResource` +- New field `InstantMaximumThroughput`, `SoftAllowedMaximumThroughput` in struct `ThroughputSettingsResource` + + ## 3.0.0-beta.1 (2023-06-23) ### Breaking Changes diff --git a/sdk/resourcemanager/cosmos/armcosmos/autorest.md b/sdk/resourcemanager/cosmos/armcosmos/autorest.md index 0fd27e77ffcf..4bccd10adef1 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/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-beta.1 -tag: package-preview-2023-03-15 +module-version: 3.0.0-beta.2 ``` \ 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 d278c0271c80..e1fb9fe62c89 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/cassandraclusters_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/cassandraclusters_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -18,6 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) @@ -48,7 +48,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -60,7 +60,8 @@ func (client *CassandraClustersClient) BeginCreateUpdate(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller[CassandraClustersClientCreateUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraClustersClientCreateUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraClustersClientCreateUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +71,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraClustersClient) createUpdate(ctx context.Context, resourceGroupName string, clusterName string, body ClusterResource, options *CassandraClustersClientBeginCreateUpdateOptions) (*http.Response, error) { + var err error req, err := client.createUpdateCreateRequest(ctx, resourceGroupName, clusterName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateCreateRequest creates the CreateUpdate request. @@ -106,10 +109,13 @@ func (client *CassandraClustersClient) createUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // BeginDeallocate - Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the @@ -117,7 +123,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 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -128,7 +134,8 @@ func (client *CassandraClustersClient) BeginDeallocate(ctx context.Context, reso if err != nil { return nil, err } - return runtime.NewPoller[CassandraClustersClientDeallocateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraClustersClientDeallocateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraClustersClientDeallocateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -139,20 +146,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraClustersClient) deallocate(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersClientBeginDeallocateOptions) (*http.Response, error) { + var err error req, err := client.deallocateCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deallocateCreateRequest creates the Deallocate request. @@ -175,8 +184,11 @@ func (client *CassandraClustersClient) deallocateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.XMSForceDeallocate != nil { + req.Raw().Header["x-ms-force-deallocate"] = []string{strconv.FormatBool(*options.XMSForceDeallocate)} + } req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -184,7 +196,7 @@ func (client *CassandraClustersClient) deallocateCreateRequest(ctx context.Conte // BeginDelete - Deletes a managed Cassandra cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -195,7 +207,8 @@ func (client *CassandraClustersClient) BeginDelete(ctx context.Context, resource if err != nil { return nil, err } - return runtime.NewPoller[CassandraClustersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraClustersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraClustersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -204,20 +217,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -240,7 +255,7 @@ func (client *CassandraClustersClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,23 +264,26 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. func (client *CassandraClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersClientGetOptions) (CassandraClustersClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { return CassandraClustersClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CassandraClustersClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CassandraClustersClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CassandraClustersClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -288,7 +306,7 @@ func (client *CassandraClustersClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -306,25 +324,28 @@ func (client *CassandraClustersClient) getHandleResponse(resp *http.Response) (C // 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.getBackupCreateRequest(ctx, resourceGroupName, clusterName, backupID, options) if err != nil { return CassandraClustersClientGetBackupResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CassandraClustersClientGetBackupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CassandraClustersClientGetBackupResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CassandraClustersClientGetBackupResponse{}, err } - return client.getBackupHandleResponse(resp) + resp, err := client.getBackupHandleResponse(httpResp) + return resp, err } // getBackupCreateRequest creates the GetBackup request. @@ -351,7 +372,7 @@ func (client *CassandraClustersClient) getBackupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -369,7 +390,7 @@ func (client *CassandraClustersClient) getBackupHandleResponse(resp *http.Respon // BeginInvokeCommand - Invoke a command like nodetool for cassandra maintenance // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -381,7 +402,8 @@ func (client *CassandraClustersClient) BeginInvokeCommand(ctx context.Context, r if err != nil { return nil, err } - return runtime.NewPoller[CassandraClustersClientInvokeCommandResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraClustersClientInvokeCommandResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraClustersClientInvokeCommandResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -390,20 +412,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraClustersClient) invokeCommand(ctx context.Context, resourceGroupName string, clusterName string, body CommandPostBody, options *CassandraClustersClientBeginInvokeCommandOptions) (*http.Response, error) { + var err error req, err := client.invokeCommandCreateRequest(ctx, resourceGroupName, clusterName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // invokeCommandCreateRequest creates the InvokeCommand request. @@ -426,15 +450,18 @@ func (client *CassandraClustersClient) invokeCommandCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -481,7 +508,7 @@ func (client *CassandraClustersClient) listBackupsCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -498,7 +525,7 @@ func (client *CassandraClustersClient) listBackupsHandleResponse(resp *http.Resp // NewListByResourceGroupPager - List all managed Cassandra clusters in this resource group. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - CassandraClustersClientListByResourceGroupOptions contains the optional parameters for the CassandraClustersClient.NewListByResourceGroupPager // method. @@ -540,7 +567,7 @@ func (client *CassandraClustersClient) listByResourceGroupCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -557,7 +584,7 @@ func (client *CassandraClustersClient) listByResourceGroupHandleResponse(resp *h // NewListBySubscriptionPager - List all managed Cassandra clusters in this subscription. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - options - CassandraClustersClientListBySubscriptionOptions contains the optional parameters for the CassandraClustersClient.NewListBySubscriptionPager // method. func (client *CassandraClustersClient) NewListBySubscriptionPager(options *CassandraClustersClientListBySubscriptionOptions) *runtime.Pager[CassandraClustersClientListBySubscriptionResponse] { @@ -594,7 +621,7 @@ func (client *CassandraClustersClient) listBySubscriptionCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -614,7 +641,7 @@ func (client *CassandraClustersClient) listBySubscriptionHandleResponse(resp *ht // cluster. Use Deallocate to deallocate the cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -625,7 +652,8 @@ func (client *CassandraClustersClient) BeginStart(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller[CassandraClustersClientStartResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraClustersClientStartResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraClustersClientStartResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -636,20 +664,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraClustersClient) start(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersClientBeginStartOptions) (*http.Response, error) { + var err error req, err := client.startCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // startCreateRequest creates the Start request. @@ -672,7 +702,7 @@ func (client *CassandraClustersClient) startCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -681,24 +711,27 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 // method. func (client *CassandraClustersClient) Status(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersClientStatusOptions) (CassandraClustersClientStatusResponse, error) { + var err error req, err := client.statusCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { return CassandraClustersClientStatusResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CassandraClustersClientStatusResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CassandraClustersClientStatusResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CassandraClustersClientStatusResponse{}, err } - return client.statusHandleResponse(resp) + resp, err := client.statusHandleResponse(httpResp) + return resp, err } // statusCreateRequest creates the Status request. @@ -721,7 +754,7 @@ func (client *CassandraClustersClient) statusCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -739,7 +772,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -751,7 +784,8 @@ func (client *CassandraClustersClient) BeginUpdate(ctx context.Context, resource if err != nil { return nil, err } - return runtime.NewPoller[CassandraClustersClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraClustersClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraClustersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -760,20 +794,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraClustersClient) update(ctx context.Context, resourceGroupName string, clusterName string, body ClusterResource, options *CassandraClustersClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -796,8 +832,11 @@ func (client *CassandraClustersClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, 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 3e57b44f7073..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/cassandraclusters_client_example_test.go +++ /dev/null @@ -1,788 +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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/subid/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/subid/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/00000000-0000-0000-0000-000000000000/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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{ - Arguments: map[string]*string{ - "status": to.Ptr(""), - }, - Command: to.Ptr("nodetool"), - 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBManagedCassandraBackupsList.json -func ExampleCassandraClustersClient_NewListBackupsPager() { - 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().NewListBackupsPager("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.ListBackups = armcosmos.ListBackups{ - // Value: []*armcosmos.BackupResource{ - // { - // Name: to.Ptr("1611250348"), - // Type: to.Ptr("Microsoft.DocumentDB/cassandraClusters/backups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/cassandra-prod-rg/providers/Microsoft.DocumentDB/cassandraClusters/cassandra-prod/backups/1611250348"), - // Properties: &armcosmos.BackupResourceProperties{ - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-21T17:32:28Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("1611214220"), - // Type: to.Ptr("Microsoft.DocumentDB/cassandraClusters/backups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/cassandra-prod-rg/providers/Microsoft.DocumentDB/cassandraClusters/cassandra-prod/backups/1611214220"), - // Properties: &armcosmos.BackupResourceProperties{ - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-21T07:30:20Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBManagedCassandraBackup.json -func ExampleCassandraClustersClient_GetBackup() { - 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().GetBackup(ctx, "cassandra-prod-rg", "cassandra-prod", "1611250348", 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.BackupResource = armcosmos.BackupResource{ - // Name: to.Ptr("1611250348"), - // Type: to.Ptr("Microsoft.DocumentDB/cassandraClusters/backups"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/cassandra-prod-rg/providers/Microsoft.DocumentDB/cassandraClusters/cassandra-prod/backups/1611250348"), - // Properties: &armcosmos.BackupResourceProperties{ - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-21T17:32:28Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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 16f0f21d8cc7..11e1adeee7a4 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/cassandradatacenters_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/cassandradatacenters_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -48,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -61,7 +60,8 @@ func (client *CassandraDataCentersClient) BeginCreateUpdate(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[CassandraDataCentersClientCreateUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraDataCentersClientCreateUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraDataCentersClientCreateUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraDataCentersClient) createUpdate(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string, body DataCenterResource, options *CassandraDataCentersClientBeginCreateUpdateOptions) (*http.Response, error) { + var err error req, err := client.createUpdateCreateRequest(ctx, resourceGroupName, clusterName, dataCenterName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateCreateRequest creates the CreateUpdate request. @@ -111,16 +113,19 @@ func (client *CassandraDataCentersClient) createUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete a managed Cassandra data center. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -132,7 +137,8 @@ func (client *CassandraDataCentersClient) BeginDelete(ctx context.Context, resou if err != nil { return nil, err } - return runtime.NewPoller[CassandraDataCentersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraDataCentersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraDataCentersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -141,20 +147,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraDataCentersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string, options *CassandraDataCentersClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, dataCenterName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -181,7 +189,7 @@ func (client *CassandraDataCentersClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -190,25 +198,28 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. // - options - CassandraDataCentersClientGetOptions contains the optional parameters for the CassandraDataCentersClient.Get // method. func (client *CassandraDataCentersClient) Get(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string, options *CassandraDataCentersClientGetOptions) (CassandraDataCentersClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, dataCenterName, options) if err != nil { return CassandraDataCentersClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CassandraDataCentersClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CassandraDataCentersClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CassandraDataCentersClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -235,7 +246,7 @@ func (client *CassandraDataCentersClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,7 +263,7 @@ func (client *CassandraDataCentersClient) getHandleResponse(resp *http.Response) // NewListPager - List all data centers in a particular managed Cassandra cluster. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -299,7 +310,7 @@ func (client *CassandraDataCentersClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -317,7 +328,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -330,7 +341,8 @@ func (client *CassandraDataCentersClient) BeginUpdate(ctx context.Context, resou if err != nil { return nil, err } - return runtime.NewPoller[CassandraDataCentersClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraDataCentersClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraDataCentersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -339,20 +351,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraDataCentersClient) update(ctx context.Context, resourceGroupName string, clusterName string, dataCenterName string, body DataCenterResource, options *CassandraDataCentersClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, dataCenterName, body, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -379,8 +393,11 @@ func (client *CassandraDataCentersClient) updateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, 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 4585fc4689b7..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/subid/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/subid/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/subid/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/00000000-0000-0000-0000-000000000000/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 da4feb9f7f31..c77e87db7f2b 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/cassandraresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/cassandraresources_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -47,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -60,7 +59,8 @@ func (client *CassandraResourcesClient) BeginCreateUpdateCassandraKeyspace(ctx c if err != nil { return nil, err } - return runtime.NewPoller[CassandraResourcesClientCreateUpdateCassandraKeyspaceResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraResourcesClientCreateUpdateCassandraKeyspaceResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraResourcesClientCreateUpdateCassandraKeyspaceResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,20 +69,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraResourcesClient) createUpdateCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, createUpdateCassandraKeyspaceParameters CassandraKeyspaceCreateUpdateParameters, options *CassandraResourcesClientBeginCreateUpdateCassandraKeyspaceOptions) (*http.Response, error) { + var err error req, err := client.createUpdateCassandraKeyspaceCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateCassandraKeyspaceCreateRequest creates the CreateUpdateCassandraKeyspace request. @@ -109,16 +111,19 @@ func (client *CassandraResourcesClient) createUpdateCassandraKeyspaceCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateCassandraKeyspaceParameters) + if err := runtime.MarshalAsJSON(req, createUpdateCassandraKeyspaceParameters); err != nil { + return nil, err + } + return req, nil } // BeginCreateUpdateCassandraTable - Create or update an Azure Cosmos DB Cassandra Table // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -132,7 +137,8 @@ func (client *CassandraResourcesClient) BeginCreateUpdateCassandraTable(ctx cont if err != nil { return nil, err } - return runtime.NewPoller[CassandraResourcesClientCreateUpdateCassandraTableResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraResourcesClientCreateUpdateCassandraTableResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraResourcesClientCreateUpdateCassandraTableResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -141,20 +147,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.createUpdateCassandraTableCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateCassandraTableCreateRequest creates the CreateUpdateCassandraTable request. @@ -185,16 +193,19 @@ func (client *CassandraResourcesClient) createUpdateCassandraTableCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateCassandraTableParameters) + if err := runtime.MarshalAsJSON(req, createUpdateCassandraTableParameters); err != nil { + return nil, err + } + 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -208,7 +219,8 @@ func (client *CassandraResourcesClient) BeginCreateUpdateCassandraView(ctx conte if err != nil { return nil, err } - return runtime.NewPoller[CassandraResourcesClientCreateUpdateCassandraViewResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraResourcesClientCreateUpdateCassandraViewResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraResourcesClientCreateUpdateCassandraViewResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -217,20 +229,22 @@ func (client *CassandraResourcesClient) BeginCreateUpdateCassandraView(ctx conte // CreateUpdateCassandraView - Create or update an Azure Cosmos DB Cassandra View // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.createUpdateCassandraViewCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateCassandraViewCreateRequest creates the CreateUpdateCassandraView request. @@ -261,16 +275,19 @@ func (client *CassandraResourcesClient) createUpdateCassandraViewCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateCassandraViewParameters) + 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -282,7 +299,8 @@ func (client *CassandraResourcesClient) BeginDeleteCassandraKeyspace(ctx context if err != nil { return nil, err } - return runtime.NewPoller[CassandraResourcesClientDeleteCassandraKeyspaceResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraResourcesClientDeleteCassandraKeyspaceResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraResourcesClientDeleteCassandraKeyspaceResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -291,20 +309,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraResourcesClient) deleteCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, options *CassandraResourcesClientBeginDeleteCassandraKeyspaceOptions) (*http.Response, error) { + var err error req, err := client.deleteCassandraKeyspaceCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCassandraKeyspaceCreateRequest creates the DeleteCassandraKeyspace request. @@ -331,7 +351,7 @@ func (client *CassandraResourcesClient) deleteCassandraKeyspaceCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -339,7 +359,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -352,7 +372,8 @@ func (client *CassandraResourcesClient) BeginDeleteCassandraTable(ctx context.Co if err != nil { return nil, err } - return runtime.NewPoller[CassandraResourcesClientDeleteCassandraTableResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraResourcesClientDeleteCassandraTableResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraResourcesClientDeleteCassandraTableResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -361,20 +382,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraResourcesClient) deleteCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, options *CassandraResourcesClientBeginDeleteCassandraTableOptions) (*http.Response, error) { + var err error req, err := client.deleteCassandraTableCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, tableName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCassandraTableCreateRequest creates the DeleteCassandraTable request. @@ -405,7 +428,7 @@ func (client *CassandraResourcesClient) deleteCassandraTableCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -413,7 +436,7 @@ func (client *CassandraResourcesClient) deleteCassandraTableCreateRequest(ctx co // BeginDeleteCassandraView - Deletes an existing Azure Cosmos DB Cassandra view. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -426,7 +449,8 @@ func (client *CassandraResourcesClient) BeginDeleteCassandraView(ctx context.Con if err != nil { return nil, err } - return runtime.NewPoller[CassandraResourcesClientDeleteCassandraViewResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraResourcesClientDeleteCassandraViewResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraResourcesClientDeleteCassandraViewResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -435,20 +459,22 @@ func (client *CassandraResourcesClient) BeginDeleteCassandraView(ctx context.Con // DeleteCassandraView - Deletes an existing Azure Cosmos DB Cassandra view. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraResourcesClient) deleteCassandraView(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesClientBeginDeleteCassandraViewOptions) (*http.Response, error) { + var err error req, err := client.deleteCassandraViewCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCassandraViewCreateRequest creates the DeleteCassandraView request. @@ -479,7 +505,7 @@ func (client *CassandraResourcesClient) deleteCassandraViewCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -488,25 +514,28 @@ func (client *CassandraResourcesClient) deleteCassandraViewCreateRequest(ctx con // name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 - CassandraResourcesClientGetCassandraKeyspaceOptions contains the optional parameters for the CassandraResourcesClient.GetCassandraKeyspace // method. func (client *CassandraResourcesClient) GetCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, options *CassandraResourcesClientGetCassandraKeyspaceOptions) (CassandraResourcesClientGetCassandraKeyspaceResponse, error) { + var err error req, err := client.getCassandraKeyspaceCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, options) if err != nil { return CassandraResourcesClientGetCassandraKeyspaceResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CassandraResourcesClientGetCassandraKeyspaceResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CassandraResourcesClientGetCassandraKeyspaceResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CassandraResourcesClientGetCassandraKeyspaceResponse{}, err } - return client.getCassandraKeyspaceHandleResponse(resp) + resp, err := client.getCassandraKeyspaceHandleResponse(httpResp) + return resp, err } // getCassandraKeyspaceCreateRequest creates the GetCassandraKeyspace request. @@ -533,7 +562,7 @@ func (client *CassandraResourcesClient) getCassandraKeyspaceCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -552,25 +581,28 @@ func (client *CassandraResourcesClient) getCassandraKeyspaceHandleResponse(resp // account with the provided name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 - CassandraResourcesClientGetCassandraKeyspaceThroughputOptions contains the optional parameters for the CassandraResourcesClient.GetCassandraKeyspaceThroughput // method. func (client *CassandraResourcesClient) GetCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, options *CassandraResourcesClientGetCassandraKeyspaceThroughputOptions) (CassandraResourcesClientGetCassandraKeyspaceThroughputResponse, error) { + var err error req, err := client.getCassandraKeyspaceThroughputCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, options) if err != nil { return CassandraResourcesClientGetCassandraKeyspaceThroughputResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CassandraResourcesClientGetCassandraKeyspaceThroughputResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CassandraResourcesClientGetCassandraKeyspaceThroughputResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CassandraResourcesClientGetCassandraKeyspaceThroughputResponse{}, err } - return client.getCassandraKeyspaceThroughputHandleResponse(resp) + resp, err := client.getCassandraKeyspaceThroughputHandleResponse(httpResp) + return resp, err } // getCassandraKeyspaceThroughputCreateRequest creates the GetCassandraKeyspaceThroughput request. @@ -597,7 +629,7 @@ func (client *CassandraResourcesClient) getCassandraKeyspaceThroughputCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -615,7 +647,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -623,18 +655,21 @@ func (client *CassandraResourcesClient) getCassandraKeyspaceThroughputHandleResp // - options - CassandraResourcesClientGetCassandraTableOptions contains the optional parameters for the CassandraResourcesClient.GetCassandraTable // method. func (client *CassandraResourcesClient) GetCassandraTable(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, options *CassandraResourcesClientGetCassandraTableOptions) (CassandraResourcesClientGetCassandraTableResponse, error) { + var err error req, err := client.getCassandraTableCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, tableName, options) if err != nil { return CassandraResourcesClientGetCassandraTableResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CassandraResourcesClientGetCassandraTableResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CassandraResourcesClientGetCassandraTableResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CassandraResourcesClientGetCassandraTableResponse{}, err } - return client.getCassandraTableHandleResponse(resp) + resp, err := client.getCassandraTableHandleResponse(httpResp) + return resp, err } // getCassandraTableCreateRequest creates the GetCassandraTable request. @@ -665,7 +700,7 @@ func (client *CassandraResourcesClient) getCassandraTableCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -684,7 +719,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -692,18 +727,21 @@ func (client *CassandraResourcesClient) getCassandraTableHandleResponse(resp *ht // - options - CassandraResourcesClientGetCassandraTableThroughputOptions contains the optional parameters for the CassandraResourcesClient.GetCassandraTableThroughput // method. func (client *CassandraResourcesClient) GetCassandraTableThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, options *CassandraResourcesClientGetCassandraTableThroughputOptions) (CassandraResourcesClientGetCassandraTableThroughputResponse, error) { + var err error req, err := client.getCassandraTableThroughputCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, tableName, options) if err != nil { return CassandraResourcesClientGetCassandraTableThroughputResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CassandraResourcesClientGetCassandraTableThroughputResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CassandraResourcesClientGetCassandraTableThroughputResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CassandraResourcesClientGetCassandraTableThroughputResponse{}, err } - return client.getCassandraTableThroughputHandleResponse(resp) + resp, err := client.getCassandraTableThroughputHandleResponse(httpResp) + return resp, err } // getCassandraTableThroughputCreateRequest creates the GetCassandraTableThroughput request. @@ -734,7 +772,7 @@ func (client *CassandraResourcesClient) getCassandraTableThroughputCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -752,7 +790,7 @@ func (client *CassandraResourcesClient) getCassandraTableThroughputHandleRespons // 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -760,18 +798,21 @@ func (client *CassandraResourcesClient) getCassandraTableThroughputHandleRespons // - 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 req, err := client.getCassandraViewCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) if err != nil { return CassandraResourcesClientGetCassandraViewResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CassandraResourcesClientGetCassandraViewResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CassandraResourcesClientGetCassandraViewResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CassandraResourcesClientGetCassandraViewResponse{}, err } - return client.getCassandraViewHandleResponse(resp) + resp, err := client.getCassandraViewHandleResponse(httpResp) + return resp, err } // getCassandraViewCreateRequest creates the GetCassandraView request. @@ -802,7 +843,7 @@ func (client *CassandraResourcesClient) getCassandraViewCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -821,7 +862,7 @@ func (client *CassandraResourcesClient) getCassandraViewHandleResponse(resp *htt // with the provided name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -829,18 +870,21 @@ func (client *CassandraResourcesClient) getCassandraViewHandleResponse(resp *htt // - 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 req, err := client.getCassandraViewThroughputCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) if err != nil { return CassandraResourcesClientGetCassandraViewThroughputResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CassandraResourcesClientGetCassandraViewThroughputResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CassandraResourcesClientGetCassandraViewThroughputResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CassandraResourcesClientGetCassandraViewThroughputResponse{}, err } - return client.getCassandraViewThroughputHandleResponse(resp) + resp, err := client.getCassandraViewThroughputHandleResponse(httpResp) + return resp, err } // getCassandraViewThroughputCreateRequest creates the GetCassandraViewThroughput request. @@ -871,7 +915,7 @@ func (client *CassandraResourcesClient) getCassandraViewThroughputCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -888,7 +932,7 @@ func (client *CassandraResourcesClient) getCassandraViewThroughputHandleResponse // NewListCassandraKeyspacesPager - Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -935,7 +979,7 @@ func (client *CassandraResourcesClient) listCassandraKeyspacesCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -952,7 +996,7 @@ func (client *CassandraResourcesClient) listCassandraKeyspacesHandleResponse(res // NewListCassandraTablesPager - Lists the Cassandra table under an existing Azure Cosmos DB database account. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -1004,7 +1048,7 @@ func (client *CassandraResourcesClient) listCassandraTablesCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1021,7 +1065,7 @@ func (client *CassandraResourcesClient) listCassandraTablesHandleResponse(resp * // NewListCassandraViewsPager - Lists the Cassandra materialized views under an existing Azure Cosmos DB database account. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -1073,7 +1117,7 @@ func (client *CassandraResourcesClient) listCassandraViewsCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1091,7 +1135,7 @@ func (client *CassandraResourcesClient) listCassandraViewsHandleResponse(resp *h // 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -1103,7 +1147,8 @@ func (client *CassandraResourcesClient) BeginMigrateCassandraKeyspaceToAutoscale if err != nil { return nil, err } - return runtime.NewPoller[CassandraResourcesClientMigrateCassandraKeyspaceToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraResourcesClientMigrateCassandraKeyspaceToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraResourcesClientMigrateCassandraKeyspaceToAutoscaleResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1112,20 +1157,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraResourcesClient) migrateCassandraKeyspaceToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, options *CassandraResourcesClientBeginMigrateCassandraKeyspaceToAutoscaleOptions) (*http.Response, error) { + var err error req, err := client.migrateCassandraKeyspaceToAutoscaleCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateCassandraKeyspaceToAutoscaleCreateRequest creates the MigrateCassandraKeyspaceToAutoscale request. @@ -1152,7 +1199,7 @@ func (client *CassandraResourcesClient) migrateCassandraKeyspaceToAutoscaleCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1162,7 +1209,7 @@ func (client *CassandraResourcesClient) migrateCassandraKeyspaceToAutoscaleCreat // throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -1174,7 +1221,8 @@ func (client *CassandraResourcesClient) BeginMigrateCassandraKeyspaceToManualThr if err != nil { return nil, err } - return runtime.NewPoller[CassandraResourcesClientMigrateCassandraKeyspaceToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraResourcesClientMigrateCassandraKeyspaceToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraResourcesClientMigrateCassandraKeyspaceToManualThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1183,20 +1231,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraResourcesClient) migrateCassandraKeyspaceToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, options *CassandraResourcesClientBeginMigrateCassandraKeyspaceToManualThroughputOptions) (*http.Response, error) { + var err error req, err := client.migrateCassandraKeyspaceToManualThroughputCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateCassandraKeyspaceToManualThroughputCreateRequest creates the MigrateCassandraKeyspaceToManualThroughput request. @@ -1223,7 +1273,7 @@ func (client *CassandraResourcesClient) migrateCassandraKeyspaceToManualThroughp return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1232,7 +1282,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -1245,7 +1295,8 @@ func (client *CassandraResourcesClient) BeginMigrateCassandraTableToAutoscale(ct if err != nil { return nil, err } - return runtime.NewPoller[CassandraResourcesClientMigrateCassandraTableToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraResourcesClientMigrateCassandraTableToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraResourcesClientMigrateCassandraTableToAutoscaleResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1254,20 +1305,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraResourcesClient) migrateCassandraTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, options *CassandraResourcesClientBeginMigrateCassandraTableToAutoscaleOptions) (*http.Response, error) { + var err error req, err := client.migrateCassandraTableToAutoscaleCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, tableName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateCassandraTableToAutoscaleCreateRequest creates the MigrateCassandraTableToAutoscale request. @@ -1298,7 +1351,7 @@ func (client *CassandraResourcesClient) migrateCassandraTableToAutoscaleCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1307,7 +1360,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -1320,7 +1373,8 @@ func (client *CassandraResourcesClient) BeginMigrateCassandraTableToManualThroug if err != nil { return nil, err } - return runtime.NewPoller[CassandraResourcesClientMigrateCassandraTableToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraResourcesClientMigrateCassandraTableToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraResourcesClientMigrateCassandraTableToManualThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1329,20 +1383,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraResourcesClient) migrateCassandraTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, tableName string, options *CassandraResourcesClientBeginMigrateCassandraTableToManualThroughputOptions) (*http.Response, error) { + var err error req, err := client.migrateCassandraTableToManualThroughputCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, tableName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateCassandraTableToManualThroughputCreateRequest creates the MigrateCassandraTableToManualThroughput request. @@ -1373,7 +1429,7 @@ func (client *CassandraResourcesClient) migrateCassandraTableToManualThroughputC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1382,7 +1438,7 @@ func (client *CassandraResourcesClient) migrateCassandraTableToManualThroughputC // 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -1395,7 +1451,8 @@ func (client *CassandraResourcesClient) BeginMigrateCassandraViewToAutoscale(ctx if err != nil { return nil, err } - return runtime.NewPoller[CassandraResourcesClientMigrateCassandraViewToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraResourcesClientMigrateCassandraViewToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraResourcesClientMigrateCassandraViewToAutoscaleResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1404,20 +1461,22 @@ func (client *CassandraResourcesClient) BeginMigrateCassandraViewToAutoscale(ctx // 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraResourcesClient) migrateCassandraViewToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesClientBeginMigrateCassandraViewToAutoscaleOptions) (*http.Response, error) { + var err error req, err := client.migrateCassandraViewToAutoscaleCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateCassandraViewToAutoscaleCreateRequest creates the MigrateCassandraViewToAutoscale request. @@ -1448,7 +1507,7 @@ func (client *CassandraResourcesClient) migrateCassandraViewToAutoscaleCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1457,7 +1516,7 @@ func (client *CassandraResourcesClient) migrateCassandraViewToAutoscaleCreateReq // 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -1470,7 +1529,8 @@ func (client *CassandraResourcesClient) BeginMigrateCassandraViewToManualThrough if err != nil { return nil, err } - return runtime.NewPoller[CassandraResourcesClientMigrateCassandraViewToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraResourcesClientMigrateCassandraViewToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraResourcesClientMigrateCassandraViewToManualThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1479,20 +1539,22 @@ func (client *CassandraResourcesClient) BeginMigrateCassandraViewToManualThrough // 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraResourcesClient) migrateCassandraViewToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesClientBeginMigrateCassandraViewToManualThroughputOptions) (*http.Response, error) { + var err error req, err := client.migrateCassandraViewToManualThroughputCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateCassandraViewToManualThroughputCreateRequest creates the MigrateCassandraViewToManualThroughput request. @@ -1523,7 +1585,7 @@ func (client *CassandraResourcesClient) migrateCassandraViewToManualThroughputCr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1532,7 +1594,7 @@ func (client *CassandraResourcesClient) migrateCassandraViewToManualThroughputCr // 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -1545,7 +1607,8 @@ func (client *CassandraResourcesClient) BeginUpdateCassandraKeyspaceThroughput(c if err != nil { return nil, err } - return runtime.NewPoller[CassandraResourcesClientUpdateCassandraKeyspaceThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraResourcesClientUpdateCassandraKeyspaceThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraResourcesClientUpdateCassandraKeyspaceThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1554,20 +1617,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *CassandraResourcesClient) updateCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *CassandraResourcesClientBeginUpdateCassandraKeyspaceThroughputOptions) (*http.Response, error) { + var err error req, err := client.updateCassandraKeyspaceThroughputCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, updateThroughputParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCassandraKeyspaceThroughputCreateRequest creates the UpdateCassandraKeyspaceThroughput request. @@ -1594,16 +1659,19 @@ func (client *CassandraResourcesClient) updateCassandraKeyspaceThroughputCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, updateThroughputParameters) + if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { + return nil, err + } + return req, nil } // 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -1617,7 +1685,8 @@ func (client *CassandraResourcesClient) BeginUpdateCassandraTableThroughput(ctx if err != nil { return nil, err } - return runtime.NewPoller[CassandraResourcesClientUpdateCassandraTableThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraResourcesClientUpdateCassandraTableThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraResourcesClientUpdateCassandraTableThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1626,20 +1695,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.updateCassandraTableThroughputCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCassandraTableThroughputCreateRequest creates the UpdateCassandraTableThroughput request. @@ -1670,16 +1741,19 @@ func (client *CassandraResourcesClient) updateCassandraTableThroughputCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, updateThroughputParameters) + 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - keyspaceName - Cosmos DB keyspace name. @@ -1693,7 +1767,8 @@ func (client *CassandraResourcesClient) BeginUpdateCassandraViewThroughput(ctx c if err != nil { return nil, err } - return runtime.NewPoller[CassandraResourcesClientUpdateCassandraViewThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[CassandraResourcesClientUpdateCassandraViewThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[CassandraResourcesClientUpdateCassandraViewThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1702,20 +1777,22 @@ func (client *CassandraResourcesClient) BeginUpdateCassandraViewThroughput(ctx c // 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.updateCassandraViewThroughputCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCassandraViewThroughputCreateRequest creates the UpdateCassandraViewThroughput request. @@ -1746,8 +1823,11 @@ func (client *CassandraResourcesClient) updateCassandraViewThroughputCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, updateThroughputParameters) + if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { + return nil, err + } + return req, 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 84cef8803994..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/cassandraresources_client_example_test.go +++ /dev/null @@ -1,989 +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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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), - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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"), - // }}, - // }, - // AnalyticalStorageTTL: to.Ptr[int32](500), - // DefaultTTL: to.Ptr[int32](100), - // ID: to.Ptr("tableName"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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"), - // }}, - // }, - // AnalyticalStorageTTL: to.Ptr[int32](500), - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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"), - }}, - }, - AnalyticalStorageTTL: to.Ptr[int32](500), - 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"), - // }}, - // }, - // AnalyticalStorageTTL: to.Ptr[int32](500), - // DefaultTTL: to.Ptr[int32](100), - // ID: to.Ptr("tableName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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), - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBCassandraViewList.json -func ExampleCassandraResourcesClient_NewListCassandraViewsPager() { - 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().NewListCassandraViewsPager("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.CassandraViewListResult = armcosmos.CassandraViewListResult{ - // Value: []*armcosmos.CassandraViewGetResults{ - // { - // Name: to.Ptr("viewname"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/views"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/cassandraKeyspaces/keyspacename/views/viewname"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.CassandraViewGetProperties{ - // Resource: &armcosmos.CassandraViewGetPropertiesResource{ - // ID: to.Ptr("viewname"), - // ViewDefinition: to.Ptr("SELECT columna, columnb, columnc FROM keyspacename.srctablename WHERE columna IS NOT NULL AND columnc IS NOT NULL PRIMARY KEY (columnc, columna)"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBCassandraViewGet.json -func ExampleCassandraResourcesClient_GetCassandraView() { - 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().GetCassandraView(ctx, "rg1", "ddb1", "keyspacename", "viewname", 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.CassandraViewGetResults = armcosmos.CassandraViewGetResults{ - // Name: to.Ptr("viewname"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/views"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/cassandraKeyspaces/keyspacename/views/viewname"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.CassandraViewGetProperties{ - // Resource: &armcosmos.CassandraViewGetPropertiesResource{ - // ID: to.Ptr("viewname"), - // ViewDefinition: to.Ptr("SELECT columna, columnb, columnc FROM keyspacename.srctablename WHERE columna IS NOT NULL AND columnc IS NOT NULL PRIMARY KEY (columnc, columna)"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBCassandraViewCreateUpdate.json -func ExampleCassandraResourcesClient_BeginCreateUpdateCassandraView() { - 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().BeginCreateUpdateCassandraView(ctx, "rg1", "ddb1", "keyspacename", "viewname", armcosmos.CassandraViewCreateUpdateParameters{ - Tags: map[string]*string{}, - Properties: &armcosmos.CassandraViewCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.CassandraViewResource{ - ID: to.Ptr("viewname"), - ViewDefinition: to.Ptr("SELECT columna, columnb, columnc FROM keyspacename.srctablename WHERE columna IS NOT NULL AND columnc IS NOT NULL PRIMARY (columnc, columna)"), - }, - }, - }, 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.CassandraViewGetResults = armcosmos.CassandraViewGetResults{ - // Name: to.Ptr("viewname"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/cassandraKeyspaces/views"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/cassandraKeyspaces/keyspacename/views/viewname"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.CassandraViewGetProperties{ - // Resource: &armcosmos.CassandraViewGetPropertiesResource{ - // ID: to.Ptr("viewname"), - // ViewDefinition: to.Ptr("SELECT columna, columnb, columnc FROM keyspacename.srctablename WHERE columna IS NOT NULL AND columnc IS NOT NULL PRIMARY KEY (columnc, columna)"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBCassandraViewDelete.json -func ExampleCassandraResourcesClient_BeginDeleteCassandraView() { - 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().BeginDeleteCassandraView(ctx, "rg1", "ddb1", "keyspacename", "viewname", 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBCassandraViewThroughputGet.json -func ExampleCassandraResourcesClient_GetCassandraViewThroughput() { - 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().GetCassandraViewThroughput(ctx, "rg1", "ddb1", "keyspacename", "viewname", 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/views/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/cassandraKeyspaces/keyspaceName/views/viewName/throughputSettings/default"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBCassandraViewThroughputUpdate.json -func ExampleCassandraResourcesClient_BeginUpdateCassandraViewThroughput() { - 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().BeginUpdateCassandraViewThroughput(ctx, "rg1", "ddb1", "keyspacename", "viewname", armcosmos.ThroughputSettingsUpdateParameters{ - 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/views/throughputSettings"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/cassandraKeyspaces/keyspaceName/views/viewName/throughputSettings/default"), - // Properties: &armcosmos.ThroughputSettingsGetProperties{ - // Resource: &armcosmos.ThroughputSettingsGetPropertiesResource{ - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBCassandraViewMigrateToAutoscale.json -func ExampleCassandraResourcesClient_BeginMigrateCassandraViewToAutoscale() { - 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().BeginMigrateCassandraViewToAutoscale(ctx, "rg1", "ddb1", "keyspacename", "viewname", 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{ - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBCassandraViewMigrateToManualThroughput.json -func ExampleCassandraResourcesClient_BeginMigrateCassandraViewToManualThroughput() { - 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().BeginMigrateCassandraViewToManualThroughput(ctx, "rg1", "ddb1", "keyspacename", "viewname", 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{ - // MinimumThroughput: to.Ptr("400"), - // OfferReplacePending: to.Ptr("false"), - // Throughput: to.Ptr[int32](400), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/client_factory.go b/sdk/resourcemanager/cosmos/armcosmos/client_factory.go index 8cdea4355967..640ef04bce27 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/client_factory.go +++ b/sdk/resourcemanager/cosmos/armcosmos/client_factory.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -38,18 +37,18 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewDatabaseAccountsClient() *DatabaseAccountsClient { - subClient, _ := NewDatabaseAccountsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewCassandraClustersClient() *CassandraClustersClient { + subClient, _ := NewCassandraClustersClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewCassandraDataCentersClient() *CassandraDataCentersClient { + subClient, _ := NewCassandraDataCentersClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatabaseClient() *DatabaseClient { - subClient, _ := NewDatabaseClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewCassandraResourcesClient() *CassandraResourcesClient { + subClient, _ := NewCassandraResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -58,48 +57,38 @@ func (c *ClientFactory) NewCollectionClient() *CollectionClient { return subClient } -func (c *ClientFactory) NewCollectionRegionClient() *CollectionRegionClient { - subClient, _ := NewCollectionRegionClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -func (c *ClientFactory) NewDatabaseAccountRegionClient() *DatabaseAccountRegionClient { - subClient, _ := NewDatabaseAccountRegionClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -func (c *ClientFactory) NewPercentileSourceTargetClient() *PercentileSourceTargetClient { - subClient, _ := NewPercentileSourceTargetClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewCollectionPartitionClient() *CollectionPartitionClient { + subClient, _ := NewCollectionPartitionClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPercentileTargetClient() *PercentileTargetClient { - subClient, _ := NewPercentileTargetClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewCollectionPartitionRegionClient() *CollectionPartitionRegionClient { + subClient, _ := NewCollectionPartitionRegionClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPercentileClient() *PercentileClient { - subClient, _ := NewPercentileClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewCollectionRegionClient() *CollectionRegionClient { + subClient, _ := NewCollectionRegionClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewCollectionPartitionRegionClient() *CollectionPartitionRegionClient { - subClient, _ := NewCollectionPartitionRegionClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDataTransferJobsClient() *DataTransferJobsClient { + subClient, _ := NewDataTransferJobsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewCollectionPartitionClient() *CollectionPartitionClient { - subClient, _ := NewCollectionPartitionClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabaseAccountRegionClient() *DatabaseAccountRegionClient { + subClient, _ := NewDatabaseAccountRegionClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPartitionKeyRangeIDClient() *PartitionKeyRangeIDClient { - subClient, _ := NewPartitionKeyRangeIDClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabaseAccountsClient() *DatabaseAccountsClient { + subClient, _ := NewDatabaseAccountsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPartitionKeyRangeIDRegionClient() *PartitionKeyRangeIDRegionClient { - subClient, _ := NewPartitionKeyRangeIDRegionClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabaseClient() *DatabaseClient { + subClient, _ := NewDatabaseClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -108,58 +97,58 @@ func (c *ClientFactory) NewGraphResourcesClient() *GraphResourcesClient { return subClient } -func (c *ClientFactory) NewSQLResourcesClient() *SQLResourcesClient { - subClient, _ := NewSQLResourcesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewGremlinResourcesClient() *GremlinResourcesClient { + subClient, _ := NewGremlinResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewMongoDBResourcesClient() *MongoDBResourcesClient { - subClient, _ := NewMongoDBResourcesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewLocationsClient() *LocationsClient { + subClient, _ := NewLocationsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewTableResourcesClient() *TableResourcesClient { - subClient, _ := NewTableResourcesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewMongoClustersClient() *MongoClustersClient { + subClient, _ := NewMongoClustersClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewCassandraResourcesClient() *CassandraResourcesClient { - subClient, _ := NewCassandraResourcesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewMongoDBResourcesClient() *MongoDBResourcesClient { + subClient, _ := NewMongoDBResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewGremlinResourcesClient() *GremlinResourcesClient { - subClient, _ := NewGremlinResourcesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewNotebookWorkspacesClient() *NotebookWorkspacesClient { + subClient, _ := NewNotebookWorkspacesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewLocationsClient() *LocationsClient { - subClient, _ := NewLocationsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewDataTransferJobsClient() *DataTransferJobsClient { - subClient, _ := NewDataTransferJobsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPartitionKeyRangeIDClient() *PartitionKeyRangeIDClient { + subClient, _ := NewPartitionKeyRangeIDClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewCassandraClustersClient() *CassandraClustersClient { - subClient, _ := NewCassandraClustersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPartitionKeyRangeIDRegionClient() *PartitionKeyRangeIDRegionClient { + subClient, _ := NewPartitionKeyRangeIDRegionClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewCassandraDataCentersClient() *CassandraDataCentersClient { - subClient, _ := NewCassandraDataCentersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPercentileClient() *PercentileClient { + subClient, _ := NewPercentileClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewMongoClustersClient() *MongoClustersClient { - subClient, _ := NewMongoClustersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPercentileSourceTargetClient() *PercentileSourceTargetClient { + subClient, _ := NewPercentileSourceTargetClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewNotebookWorkspacesClient() *NotebookWorkspacesClient { - subClient, _ := NewNotebookWorkspacesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPercentileTargetClient() *PercentileTargetClient { + subClient, _ := NewPercentileTargetClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -178,28 +167,28 @@ func (c *ClientFactory) NewRestorableDatabaseAccountsClient() *RestorableDatabas return subClient } -func (c *ClientFactory) NewRestorableSQLDatabasesClient() *RestorableSQLDatabasesClient { - subClient, _ := NewRestorableSQLDatabasesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRestorableGremlinDatabasesClient() *RestorableGremlinDatabasesClient { + subClient, _ := NewRestorableGremlinDatabasesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRestorableSQLContainersClient() *RestorableSQLContainersClient { - subClient, _ := NewRestorableSQLContainersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRestorableGremlinGraphsClient() *RestorableGremlinGraphsClient { + subClient, _ := NewRestorableGremlinGraphsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRestorableSQLResourcesClient() *RestorableSQLResourcesClient { - subClient, _ := NewRestorableSQLResourcesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRestorableGremlinResourcesClient() *RestorableGremlinResourcesClient { + subClient, _ := NewRestorableGremlinResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRestorableMongodbDatabasesClient() *RestorableMongodbDatabasesClient { - subClient, _ := NewRestorableMongodbDatabasesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRestorableMongodbCollectionsClient() *RestorableMongodbCollectionsClient { + subClient, _ := NewRestorableMongodbCollectionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRestorableMongodbCollectionsClient() *RestorableMongodbCollectionsClient { - subClient, _ := NewRestorableMongodbCollectionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRestorableMongodbDatabasesClient() *RestorableMongodbDatabasesClient { + subClient, _ := NewRestorableMongodbDatabasesClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -208,18 +197,23 @@ func (c *ClientFactory) NewRestorableMongodbResourcesClient() *RestorableMongodb return subClient } -func (c *ClientFactory) NewRestorableGremlinDatabasesClient() *RestorableGremlinDatabasesClient { - subClient, _ := NewRestorableGremlinDatabasesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRestorableSQLContainersClient() *RestorableSQLContainersClient { + subClient, _ := NewRestorableSQLContainersClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRestorableGremlinGraphsClient() *RestorableGremlinGraphsClient { - subClient, _ := NewRestorableGremlinGraphsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRestorableSQLDatabasesClient() *RestorableSQLDatabasesClient { + subClient, _ := NewRestorableSQLDatabasesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRestorableGremlinResourcesClient() *RestorableGremlinResourcesClient { - subClient, _ := NewRestorableGremlinResourcesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRestorableSQLResourcesClient() *RestorableSQLResourcesClient { + subClient, _ := NewRestorableSQLResourcesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewRestorableTableResourcesClient() *RestorableTableResourcesClient { + subClient, _ := NewRestorableTableResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -228,8 +222,8 @@ func (c *ClientFactory) NewRestorableTablesClient() *RestorableTablesClient { return subClient } -func (c *ClientFactory) NewRestorableTableResourcesClient() *RestorableTableResourcesClient { - subClient, _ := NewRestorableTableResourcesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewSQLResourcesClient() *SQLResourcesClient { + subClient, _ := NewSQLResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -237,3 +231,8 @@ func (c *ClientFactory) NewServiceClient() *ServiceClient { subClient, _ := NewServiceClient(c.subscriptionID, c.credential, c.options) return subClient } + +func (c *ClientFactory) NewTableResourcesClient() *TableResourcesClient { + subClient, _ := NewTableResourcesClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/collection_client.go b/sdk/resourcemanager/cosmos/armcosmos/collection_client.go index 5bbe5ac835d1..d5a02c228a0e 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/collection_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/collection_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -46,7 +45,7 @@ func NewCollectionClient(subscriptionID string, credential azcore.TokenCredentia // NewListMetricDefinitionsPager - Retrieves metric definitions for the given collection. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseRid - Cosmos DB database rid. @@ -103,7 +102,7 @@ func (client *CollectionClient) listMetricDefinitionsCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -120,7 +119,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseRid - Cosmos DB database rid. @@ -180,7 +179,7 @@ func (client *CollectionClient) listMetricsCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} @@ -198,7 +197,7 @@ func (client *CollectionClient) listMetricsHandleResponse(resp *http.Response) ( // NewListUsagesPager - Retrieves the usages (most recent storage data) for the given collection. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseRid - Cosmos DB database rid. @@ -255,7 +254,7 @@ func (client *CollectionClient) listUsagesCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } 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 cd10cc3ac5db..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.2780000Z"); 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.2780000Z"); 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.2780000Z"); 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.2780000Z"); 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.2780000Z"); return t}()), - // Total: to.Ptr[float64](0), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.2780000Z"); return t}()), - // TimeGrain: to.Ptr("PT5M"), - // Unit: to.Ptr(armcosmos.UnitTypeCount), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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 0c57fe5c4b2c..9698d87133df 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/collectionpartition_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/collectionpartition_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -46,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseRid - Cosmos DB database rid. @@ -106,7 +105,7 @@ func (client *CollectionPartitionClient) listMetricsCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} @@ -124,7 +123,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseRid - Cosmos DB database rid. @@ -181,7 +180,7 @@ func (client *CollectionPartitionClient) listUsagesCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } 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 6ac9a19fce4c..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.2780000Z"); 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.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:54:55.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:55:55.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:56:55.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:57:55.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:58:55.2780000Z"); return t}()), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.2780000Z"); 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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 55d976e04159..a7541dc3f1a7 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/collectionpartitionregion_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/collectionpartitionregion_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -47,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -112,7 +111,7 @@ func (client *CollectionPartitionRegionClient) listMetricsCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} 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 b570f167e477..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.2780000Z"); 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.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:54:55.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:55:55.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:56:55.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:57:55.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:58:55.2780000Z"); return t}()), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.2780000Z"); 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 71ab2a2e23d5..4a35d372a3cc 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/collectionregion_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/collectionregion_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -47,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -112,7 +111,7 @@ func (client *CollectionRegionClient) listMetricsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} 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 a8fe54a7925e..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.2780000Z"); 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.2780000Z"); 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.2780000Z"); 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.2780000Z"); 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.2780000Z"); return t}()), - // Total: to.Ptr[float64](0), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.2780000Z"); 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 98dbe586fffc..3bba5e8e076a 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/constants.go +++ b/sdk/resourcemanager/cosmos/armcosmos/constants.go @@ -3,15 +3,14 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos const ( moduleName = "armcosmos" - moduleVersion = "v3.0.0-beta.1" + moduleVersion = "v3.0.0-beta.2" ) // APIType - Enum to indicate the API type of the restorable database account. @@ -110,6 +109,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 @@ -144,6 +163,22 @@ func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { } } +// 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, + } +} + // CompositePathSortOrder - Sort order for composite paths. type CompositePathSortOrder string @@ -268,6 +303,41 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +// CustomerManagedKeyStatus - Indicates the status of the Customer Managed Key feature on the account. In case there are errors, +// the property provides troubleshooting guidance. +type CustomerManagedKeyStatus string + +const ( + CustomerManagedKeyStatusAccessToTheConfiguredCustomerManagedKeyConfirmed CustomerManagedKeyStatus = "Access to the configured customer managed key confirmed." + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheAccessRulesAreBlockingOutboundRequestsToTheAzureKeyVaultServiceForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuide4016 CustomerManagedKeyStatus = "Access to your account is currently revoked because the access rules are blocking outbound requests to the Azure Key Vault service; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide (4016)." + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountHasAnUndefinedDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideInvalidAzureCosmosDbDefaultIdentity4015 CustomerManagedKeyStatus = "Access to your account is currently revoked because the Azure Cosmos DB account has an undefined default identity; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#invalid-azure-cosmos-db-default-identity (4015)." + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountSKeyVaultKeyURIDoesNotFollowTheExpectedFormatForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideImproperSyntaxDetectedOnTheKeyVaultURIProperty4006 CustomerManagedKeyStatus = "Access to your account is currently revoked because the Azure Cosmos DB account's key vault key URI does not follow the expected format; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#improper-syntax-detected-on-the-key-vault-uri-property (4006)." + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToObtainTheAADAuthenticationTokenForTheAccountSDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideAzureActiveDirectoryTokenAcquisitionError4000 CustomerManagedKeyStatus = "Access to your account is currently revoked because the Azure Cosmos DB service is unable to obtain the AAD authentication token for the account's default identity; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#azure-active-directory-token-acquisition-error (4000)." + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToWrapOrUnwrapTheKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideInternalUnwrappingProcedureError4005 CustomerManagedKeyStatus = "Access to your account is currently revoked because the Azure Cosmos DB service is unable to wrap or unwrap the key; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#internal-unwrapping-procedure-error (4005)." + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheAzureKeyVaultDNSNameSpecifiedByTheAccountSKeyvaultkeyuriPropertyCouldNotBeResolvedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideUnableToResolveTheKeyVaultsDns4009 CustomerManagedKeyStatus = "Access to your account is currently revoked because the Azure Key Vault DNS name specified by the account's keyvaultkeyuri property could not be resolved; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#unable-to-resolve-the-key-vaults-dns (4009)." + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentAzureKeyVaultWasNotFoundForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4017 CustomerManagedKeyStatus = "Access to your account is currently revoked because the correspondent Azure Key Vault was not found; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#azure-key-vault-resource-not-found (4017)." + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentKeyIsNotFoundOnTheSpecifiedKeyVaultForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4003 CustomerManagedKeyStatus = "Access to your account is currently revoked because the correspondent key is not found on the specified Key Vault; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#azure-key-vault-resource-not-found (4003)." + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheCurrentDefaultIdentityNoLongerHasPermissionToTheAssociatedKeyVaultKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideDefaultIdentityIsUnauthorizedToAccessTheAzureKeyVaultKey4002 CustomerManagedKeyStatus = "Access to your account is currently revoked because the current default identity no longer has permission to the associated Key Vault key; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide#default-identity-is-unauthorized-to-access-the-azure-key-vault-key (4002)." + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuide CustomerManagedKeyStatus = "Access to your account is currently revoked; for more details about this error and how to restore access to your account please visit https://learn.microsoft.com/en-us/azure/cosmos-db/cmk-troubleshooting-guide" +) + +// PossibleCustomerManagedKeyStatusValues returns the possible values for the CustomerManagedKeyStatus const type. +func PossibleCustomerManagedKeyStatusValues() []CustomerManagedKeyStatus { + return []CustomerManagedKeyStatus{ + CustomerManagedKeyStatusAccessToTheConfiguredCustomerManagedKeyConfirmed, + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheAccessRulesAreBlockingOutboundRequestsToTheAzureKeyVaultServiceForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuide4016, + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountHasAnUndefinedDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideInvalidAzureCosmosDbDefaultIdentity4015, + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBAccountSKeyVaultKeyURIDoesNotFollowTheExpectedFormatForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideImproperSyntaxDetectedOnTheKeyVaultURIProperty4006, + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToObtainTheAADAuthenticationTokenForTheAccountSDefaultIdentityForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideAzureActiveDirectoryTokenAcquisitionError4000, + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheAzureCosmosDBServiceIsUnableToWrapOrUnwrapTheKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideInternalUnwrappingProcedureError4005, + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheAzureKeyVaultDNSNameSpecifiedByTheAccountSKeyvaultkeyuriPropertyCouldNotBeResolvedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideUnableToResolveTheKeyVaultsDns4009, + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentAzureKeyVaultWasNotFoundForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4017, + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheCorrespondentKeyIsNotFoundOnTheSpecifiedKeyVaultForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideAzureKeyVaultResourceNotFound4003, + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedBecauseTheCurrentDefaultIdentityNoLongerHasPermissionToTheAssociatedKeyVaultKeyForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuideDefaultIdentityIsUnauthorizedToAccessTheAzureKeyVaultKey4002, + CustomerManagedKeyStatusAccessToYourAccountIsCurrentlyRevokedForMoreDetailsAboutThisErrorAndHowToRestoreAccessToYourAccountPleaseVisitHTTPSLearnMicrosoftComEnUsAzureCosmosDbCmkTroubleshootingGuide, + } +} + type DataTransferComponent string const ( @@ -333,21 +403,37 @@ func PossibleDatabaseAccountKindValues() []DatabaseAccountKind { type DefaultConsistencyLevel string const ( + DefaultConsistencyLevelBoundedStaleness DefaultConsistencyLevel = "BoundedStaleness" + DefaultConsistencyLevelConsistentPrefix DefaultConsistencyLevel = "ConsistentPrefix" DefaultConsistencyLevelEventual DefaultConsistencyLevel = "Eventual" DefaultConsistencyLevelSession DefaultConsistencyLevel = "Session" - DefaultConsistencyLevelBoundedStaleness DefaultConsistencyLevel = "BoundedStaleness" DefaultConsistencyLevelStrong DefaultConsistencyLevel = "Strong" - DefaultConsistencyLevelConsistentPrefix DefaultConsistencyLevel = "ConsistentPrefix" ) // PossibleDefaultConsistencyLevelValues returns the possible values for the DefaultConsistencyLevel const type. func PossibleDefaultConsistencyLevelValues() []DefaultConsistencyLevel { return []DefaultConsistencyLevel{ + DefaultConsistencyLevelBoundedStaleness, + DefaultConsistencyLevelConsistentPrefix, DefaultConsistencyLevelEventual, DefaultConsistencyLevelSession, - DefaultConsistencyLevelBoundedStaleness, DefaultConsistencyLevelStrong, - DefaultConsistencyLevelConsistentPrefix, + } +} + +// 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, } } @@ -355,17 +441,17 @@ func PossibleDefaultConsistencyLevelValues() []DefaultConsistencyLevel { type EnableFullTextQuery string const ( + EnableFullTextQueryFalse EnableFullTextQuery = "False" EnableFullTextQueryNone EnableFullTextQuery = "None" EnableFullTextQueryTrue EnableFullTextQuery = "True" - EnableFullTextQueryFalse EnableFullTextQuery = "False" ) // PossibleEnableFullTextQueryValues returns the possible values for the EnableFullTextQuery const type. func PossibleEnableFullTextQueryValues() []EnableFullTextQuery { return []EnableFullTextQuery{ + EnableFullTextQueryFalse, EnableFullTextQueryNone, EnableFullTextQueryTrue, - EnableFullTextQueryFalse, } } @@ -550,15 +636,15 @@ func PossibleMongoRoleDefinitionTypeValues() []MongoRoleDefinitionType { type NetworkACLBypass string const ( - NetworkACLBypassNone NetworkACLBypass = "None" NetworkACLBypassAzureServices NetworkACLBypass = "AzureServices" + NetworkACLBypassNone NetworkACLBypass = "None" ) // PossibleNetworkACLBypassValues returns the possible values for the NetworkACLBypass const type. func PossibleNetworkACLBypassValues() []NetworkACLBypass { return []NetworkACLBypass{ - NetworkACLBypassNone, NetworkACLBypassAzureServices, + NetworkACLBypassNone, } } @@ -720,8 +806,9 @@ func PossibleProvisioningStateValues() []ProvisioningState { type PublicNetworkAccess string const ( - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" + PublicNetworkAccessSecuredByPerimeter PublicNetworkAccess = "SecuredByPerimeter" ) // PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. @@ -729,6 +816,7 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { return []PublicNetworkAccess{ PublicNetworkAccessDisabled, PublicNetworkAccessEnabled, + PublicNetworkAccessSecuredByPerimeter, } } @@ -738,19 +826,19 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { type ResourceIdentityType string const ( + ResourceIdentityTypeNone ResourceIdentityType = "None" ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned,UserAssigned" - ResourceIdentityTypeNone ResourceIdentityType = "None" + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" ) // PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. func PossibleResourceIdentityTypeValues() []ResourceIdentityType { return []ResourceIdentityType{ + ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, - ResourceIdentityTypeUserAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, - ResourceIdentityTypeNone, + ResourceIdentityTypeUserAssigned, } } diff --git a/sdk/resourcemanager/cosmos/armcosmos/database_client.go b/sdk/resourcemanager/cosmos/armcosmos/database_client.go index b0bfd8c22f00..2359710bbcfb 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/database_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/database_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -46,7 +45,7 @@ func NewDatabaseClient(subscriptionID string, credential azcore.TokenCredential, // NewListMetricDefinitionsPager - Retrieves metric definitions for the given database. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseRid - Cosmos DB database rid. @@ -98,7 +97,7 @@ func (client *DatabaseClient) listMetricDefinitionsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -115,7 +114,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseRid - Cosmos DB database rid. @@ -170,7 +169,7 @@ func (client *DatabaseClient) listMetricsCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} @@ -188,7 +187,7 @@ func (client *DatabaseClient) listMetricsHandleResponse(resp *http.Response) (Da // NewListUsagesPager - Retrieves the usages (most recent data) for the given database. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseRid - Cosmos DB database rid. @@ -239,7 +238,7 @@ func (client *DatabaseClient) listUsagesCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } 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 dd18bdb86678..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.2780000Z"); 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.2780000Z"); 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.2780000Z"); 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.2780000Z"); 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.2780000Z"); return t}()), - // Total: to.Ptr[float64](0), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.2780000Z"); return t}()), - // TimeGrain: to.Ptr("PT5M"), - // Unit: to.Ptr(armcosmos.UnitTypeCount), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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 55a4676d79d3..0d00a5acec77 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/databaseaccountregion_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/databaseaccountregion_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -46,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -101,7 +100,7 @@ func (client *DatabaseAccountRegionClient) listMetricsCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} 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 c4aca6fa5bea..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.2780000Z"); 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.2780000Z"); 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.2780000Z"); 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.2780000Z"); 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.2780000Z"); return t}()), - // Total: to.Ptr[float64](0), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.2780000Z"); 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 1b624c4cbbb5..4d9a68e3e073 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/databaseaccounts_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/databaseaccounts_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -47,23 +46,25 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - accountName - Cosmos DB database account name. // - options - DatabaseAccountsClientCheckNameExistsOptions contains the optional parameters for the DatabaseAccountsClient.CheckNameExists // method. func (client *DatabaseAccountsClient) CheckNameExists(ctx context.Context, accountName string, options *DatabaseAccountsClientCheckNameExistsOptions) (DatabaseAccountsClientCheckNameExistsResponse, error) { + var err error req, err := client.checkNameExistsCreateRequest(ctx, accountName, options) if err != nil { return DatabaseAccountsClientCheckNameExistsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseAccountsClientCheckNameExistsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNotFound) { - return DatabaseAccountsClientCheckNameExistsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return DatabaseAccountsClientCheckNameExistsResponse{}, err } - return DatabaseAccountsClientCheckNameExistsResponse{Success: resp.StatusCode >= 200 && resp.StatusCode < 300}, nil + return DatabaseAccountsClientCheckNameExistsResponse{Success: httpResp.StatusCode >= 200 && httpResp.StatusCode < 300}, nil } // checkNameExistsCreateRequest creates the CheckNameExists request. @@ -78,7 +79,7 @@ func (client *DatabaseAccountsClient) checkNameExistsCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -87,7 +88,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -99,7 +100,8 @@ func (client *DatabaseAccountsClient) BeginCreateOrUpdate(ctx context.Context, r if err != nil { return nil, err } - return runtime.NewPoller[DatabaseAccountsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabaseAccountsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabaseAccountsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -109,20 +111,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *DatabaseAccountsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, createUpdateParameters DatabaseAccountCreateUpdateParameters, options *DatabaseAccountsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, createUpdateParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -145,16 +149,19 @@ func (client *DatabaseAccountsClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateParameters) + if err := runtime.MarshalAsJSON(req, createUpdateParameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes an existing Azure Cosmos DB database account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -165,7 +172,8 @@ func (client *DatabaseAccountsClient) BeginDelete(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller[DatabaseAccountsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabaseAccountsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabaseAccountsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -174,20 +182,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *DatabaseAccountsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, options *DatabaseAccountsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -210,7 +220,7 @@ func (client *DatabaseAccountsClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -220,7 +230,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -232,7 +242,8 @@ func (client *DatabaseAccountsClient) BeginFailoverPriorityChange(ctx context.Co if err != nil { return nil, err } - return runtime.NewPoller[DatabaseAccountsClientFailoverPriorityChangeResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabaseAccountsClientFailoverPriorityChangeResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabaseAccountsClientFailoverPriorityChangeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -243,20 +254,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *DatabaseAccountsClient) failoverPriorityChange(ctx context.Context, resourceGroupName string, accountName string, failoverParameters FailoverPolicies, options *DatabaseAccountsClientBeginFailoverPriorityChangeOptions) (*http.Response, error) { + var err error req, err := client.failoverPriorityChangeCreateRequest(ctx, resourceGroupName, accountName, failoverParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // failoverPriorityChangeCreateRequest creates the FailoverPriorityChange request. @@ -279,31 +292,37 @@ func (client *DatabaseAccountsClient) failoverPriorityChangeCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - return req, runtime.MarshalAsJSON(req, failoverParameters) + if err := runtime.MarshalAsJSON(req, failoverParameters); err != nil { + return nil, err + } + return req, nil } // 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. func (client *DatabaseAccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string, options *DatabaseAccountsClientGetOptions) (DatabaseAccountsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return DatabaseAccountsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseAccountsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseAccountsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseAccountsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -326,7 +345,7 @@ func (client *DatabaseAccountsClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -344,24 +363,27 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 // method. func (client *DatabaseAccountsClient) GetReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string, options *DatabaseAccountsClientGetReadOnlyKeysOptions) (DatabaseAccountsClientGetReadOnlyKeysResponse, error) { + var err error req, err := client.getReadOnlyKeysCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return DatabaseAccountsClientGetReadOnlyKeysResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseAccountsClientGetReadOnlyKeysResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseAccountsClientGetReadOnlyKeysResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseAccountsClientGetReadOnlyKeysResponse{}, err } - return client.getReadOnlyKeysHandleResponse(resp) + resp, err := client.getReadOnlyKeysHandleResponse(httpResp) + return resp, err } // getReadOnlyKeysCreateRequest creates the GetReadOnlyKeys request. @@ -384,7 +406,7 @@ func (client *DatabaseAccountsClient) getReadOnlyKeysCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -401,7 +423,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - options - DatabaseAccountsClientListOptions contains the optional parameters for the DatabaseAccountsClient.NewListPager // method. func (client *DatabaseAccountsClient) NewListPager(options *DatabaseAccountsClientListOptions) *runtime.Pager[DatabaseAccountsClientListResponse] { @@ -438,7 +460,7 @@ func (client *DatabaseAccountsClient) listCreateRequest(ctx context.Context, opt return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -455,7 +477,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - DatabaseAccountsClientListByResourceGroupOptions contains the optional parameters for the DatabaseAccountsClient.NewListByResourceGroupPager // method. @@ -497,7 +519,7 @@ func (client *DatabaseAccountsClient) listByResourceGroupCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -515,24 +537,27 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 // method. func (client *DatabaseAccountsClient) ListConnectionStrings(ctx context.Context, resourceGroupName string, accountName string, options *DatabaseAccountsClientListConnectionStringsOptions) (DatabaseAccountsClientListConnectionStringsResponse, error) { + var err error req, err := client.listConnectionStringsCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return DatabaseAccountsClientListConnectionStringsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseAccountsClientListConnectionStringsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseAccountsClientListConnectionStringsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseAccountsClientListConnectionStringsResponse{}, err } - return client.listConnectionStringsHandleResponse(resp) + resp, err := client.listConnectionStringsHandleResponse(httpResp) + return resp, err } // listConnectionStringsCreateRequest creates the ListConnectionStrings request. @@ -555,7 +580,7 @@ func (client *DatabaseAccountsClient) listConnectionStringsCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -573,24 +598,27 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 // method. func (client *DatabaseAccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string, options *DatabaseAccountsClientListKeysOptions) (DatabaseAccountsClientListKeysResponse, error) { + var err error req, err := client.listKeysCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return DatabaseAccountsClientListKeysResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseAccountsClientListKeysResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseAccountsClientListKeysResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseAccountsClientListKeysResponse{}, err } - return client.listKeysHandleResponse(resp) + resp, err := client.listKeysHandleResponse(httpResp) + return resp, err } // listKeysCreateRequest creates the ListKeys request. @@ -613,7 +641,7 @@ func (client *DatabaseAccountsClient) listKeysCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -630,7 +658,7 @@ func (client *DatabaseAccountsClient) listKeysHandleResponse(resp *http.Response // NewListMetricDefinitionsPager - Retrieves metric definitions for the given database account. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -677,7 +705,7 @@ func (client *DatabaseAccountsClient) listMetricDefinitionsCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -694,7 +722,7 @@ func (client *DatabaseAccountsClient) listMetricDefinitionsHandleResponse(resp * // NewListMetricsPager - Retrieves the metrics determined by the given filter for the given database account. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -744,7 +772,7 @@ func (client *DatabaseAccountsClient) listMetricsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} @@ -763,24 +791,27 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 // method. func (client *DatabaseAccountsClient) ListReadOnlyKeys(ctx context.Context, resourceGroupName string, accountName string, options *DatabaseAccountsClientListReadOnlyKeysOptions) (DatabaseAccountsClientListReadOnlyKeysResponse, error) { + var err error req, err := client.listReadOnlyKeysCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return DatabaseAccountsClientListReadOnlyKeysResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseAccountsClientListReadOnlyKeysResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseAccountsClientListReadOnlyKeysResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseAccountsClientListReadOnlyKeysResponse{}, err } - return client.listReadOnlyKeysHandleResponse(resp) + resp, err := client.listReadOnlyKeysHandleResponse(httpResp) + return resp, err } // listReadOnlyKeysCreateRequest creates the ListReadOnlyKeys request. @@ -803,7 +834,7 @@ func (client *DatabaseAccountsClient) listReadOnlyKeysCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -820,7 +851,7 @@ func (client *DatabaseAccountsClient) listReadOnlyKeysHandleResponse(resp *http. // NewListUsagesPager - Retrieves the usages (most recent data) for the given database account. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -867,7 +898,7 @@ func (client *DatabaseAccountsClient) listUsagesCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -888,7 +919,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -900,7 +931,8 @@ func (client *DatabaseAccountsClient) BeginOfflineRegion(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller[DatabaseAccountsClientOfflineRegionResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabaseAccountsClientOfflineRegionResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabaseAccountsClientOfflineRegionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -909,20 +941,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *DatabaseAccountsClient) offlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOffline RegionForOnlineOffline, options *DatabaseAccountsClientBeginOfflineRegionOptions) (*http.Response, error) { + var err error req, err := client.offlineRegionCreateRequest(ctx, resourceGroupName, accountName, regionParameterForOffline, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // offlineRegionCreateRequest creates the OfflineRegion request. @@ -945,16 +979,19 @@ func (client *DatabaseAccountsClient) offlineRegionCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, regionParameterForOffline) + if err := runtime.MarshalAsJSON(req, regionParameterForOffline); err != nil { + return nil, err + } + return req, nil } // 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -966,7 +1003,8 @@ func (client *DatabaseAccountsClient) BeginOnlineRegion(ctx context.Context, res if err != nil { return nil, err } - return runtime.NewPoller[DatabaseAccountsClientOnlineRegionResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabaseAccountsClientOnlineRegionResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabaseAccountsClientOnlineRegionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -975,20 +1013,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *DatabaseAccountsClient) onlineRegion(ctx context.Context, resourceGroupName string, accountName string, regionParameterForOnline RegionForOnlineOffline, options *DatabaseAccountsClientBeginOnlineRegionOptions) (*http.Response, error) { + var err error req, err := client.onlineRegionCreateRequest(ctx, resourceGroupName, accountName, regionParameterForOnline, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // onlineRegionCreateRequest creates the OnlineRegion request. @@ -1011,16 +1051,19 @@ func (client *DatabaseAccountsClient) onlineRegionCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, regionParameterForOnline) + if err := runtime.MarshalAsJSON(req, regionParameterForOnline); err != nil { + return nil, err + } + return req, nil } // 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -1032,7 +1075,8 @@ func (client *DatabaseAccountsClient) BeginRegenerateKey(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller[DatabaseAccountsClientRegenerateKeyResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabaseAccountsClientRegenerateKeyResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabaseAccountsClientRegenerateKeyResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1041,20 +1085,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *DatabaseAccountsClient) regenerateKey(ctx context.Context, resourceGroupName string, accountName string, keyToRegenerate DatabaseAccountRegenerateKeyParameters, options *DatabaseAccountsClientBeginRegenerateKeyOptions) (*http.Response, error) { + var err error req, err := client.regenerateKeyCreateRequest(ctx, resourceGroupName, accountName, keyToRegenerate, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // regenerateKeyCreateRequest creates the RegenerateKey request. @@ -1077,15 +1123,18 @@ func (client *DatabaseAccountsClient) regenerateKeyCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() - return req, runtime.MarshalAsJSON(req, keyToRegenerate) + if err := runtime.MarshalAsJSON(req, keyToRegenerate); err != nil { + return nil, err + } + return req, nil } // 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -1097,7 +1146,8 @@ func (client *DatabaseAccountsClient) BeginUpdate(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller[DatabaseAccountsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabaseAccountsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabaseAccountsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1106,20 +1156,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *DatabaseAccountsClient) update(ctx context.Context, resourceGroupName string, accountName string, updateParameters DatabaseAccountUpdateParameters, options *DatabaseAccountsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, updateParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -1142,8 +1194,11 @@ func (client *DatabaseAccountsClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, updateParameters) + if err := runtime.MarshalAsJSON(req, updateParameters); err != nil { + return nil, err + } + return req, 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 46fd902cf09a..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/databaseaccounts_client_example_test.go +++ /dev/null @@ -1,1580 +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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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"), - // 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"), - // }, - // }, - // }, - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // 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:16Z"); 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"), - // DiagnosticLogSettings: &armcosmos.DiagnosticLogSettings{ - // EnableFullTextQuery: to.Ptr(armcosmos.EnableFullTextQueryFalse), - // }, - // 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), - // EnableMaterializedViews: 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:11Z"); return t}()), - // }, - // PrimaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); return t}()), - // }, - // SecondaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); return t}()), - // }, - // SecondaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.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), - }, - DefaultIdentity: to.Ptr("FirstPartyIdentity"), - DiagnosticLogSettings: &armcosmos.DiagnosticLogSettings{ - EnableFullTextQuery: to.Ptr(armcosmos.EnableFullTextQueryTrue), - }, - 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"), - // 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("075a0ca6-43f6-4434-9abf-c9b1b79f9219"), - // }, - // }, - // }, - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "dept": to.Ptr("finance"), - // }, - // 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), - // }, - // }, - // 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{ - // }, - // CreateMode: to.Ptr(armcosmos.CreateModeDefault), - // DatabaseAccountOfferType: to.Ptr("Standard"), - // DefaultIdentity: to.Ptr("FirstPartyIdentity"), - // DiagnosticLogSettings: &armcosmos.DiagnosticLogSettings{ - // EnableFullTextQuery: to.Ptr(armcosmos.EnableFullTextQueryTrue), - // }, - // 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), - // EnableMaterializedViews: to.Ptr(false), - // 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{ - // { - // 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:11Z"); return t}()), - // }, - // PrimaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); return t}()), - // }, - // SecondaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); return t}()), - // }, - // SecondaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); 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"), - // }}, - // }, - // SystemData: &armcosmos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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{ - 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"), - Tags: map[string]*string{}, - 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), - EnableMaterializedViews: 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"), - // 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("075a0ca6-43f6-4434-9abf-c9b1b79f9219"), - // }, - // }, - // }, - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // 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), - // EnableMaterializedViews: 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, "2022-02-25T20:30:11Z"); return t}()), - // }, - // PrimaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); return t}()), - // }, - // SecondaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); return t}()), - // }, - // SecondaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); 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:09Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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), - // EnableMaterializedViews: 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:11Z"); return t}()), - // }, - // PrimaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); return t}()), - // }, - // SecondaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); return t}()), - // }, - // SecondaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); 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:09Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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), - EnableMaterializedViews: 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:09Z"); 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), - SourceBackupLocation: to.Ptr("westus"), - }, - }, - }, 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), - // EnableMaterializedViews: 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:11Z"); return t}()), - // }, - // PrimaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); return t}()), - // }, - // SecondaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); return t}()), - // }, - // SecondaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); 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:09Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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"), - // 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"), - // }, - // }, - // }, - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // 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), - // EnableMaterializedViews: 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:11Z"); return t}()), - // }, - // PrimaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); return t}()), - // }, - // SecondaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); return t}()), - // }, - // SecondaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); 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:09Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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"), - // 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"), - // }, - // }, - // }, - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Kind: to.Ptr(armcosmos.DatabaseAccountKindGlobalDocumentDB), - // Properties: &armcosmos.DatabaseAccountGetProperties{ - // 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/"), - // EnableFreeTier: to.Ptr(false), - // EnableMaterializedViews: to.Ptr(false), - // 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:11Z"); return t}()), - // }, - // PrimaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); return t}()), - // }, - // SecondaryMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); return t}()), - // }, - // SecondaryReadonlyMasterKey: &armcosmos.AccountKeyMetadata{ - // GenerationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-02-25T20:30:11Z"); 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"), - // }}, - // }, - // SystemData: &armcosmos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.2780000Z"); 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.2780000Z"); 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.2780000Z"); 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.2780000Z"); 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.2780000Z"); return t}()), - // Total: to.Ptr[float64](0), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.2780000Z"); return t}()), - // TimeGrain: to.Ptr("PT5M"), - // Unit: to.Ptr(armcosmos.UnitTypeCount), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/datatransferjobs_client.go b/sdk/resourcemanager/cosmos/armcosmos/datatransferjobs_client.go index f26fa07902d7..c1f165475a91 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/datatransferjobs_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/datatransferjobs_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -47,24 +46,27 @@ func NewDataTransferJobsClient(subscriptionID string, credential azcore.TokenCre // Cancel - Cancels a Data Transfer Job. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.cancelCreateRequest(ctx, resourceGroupName, accountName, jobName, options) if err != nil { return DataTransferJobsClientCancelResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DataTransferJobsClientCancelResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DataTransferJobsClientCancelResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DataTransferJobsClientCancelResponse{}, err } - return client.cancelHandleResponse(resp) + resp, err := client.cancelHandleResponse(httpResp) + return resp, err } // cancelCreateRequest creates the Cancel request. @@ -91,7 +93,7 @@ func (client *DataTransferJobsClient) cancelCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,24 +111,27 @@ func (client *DataTransferJobsClient) cancelHandleResponse(resp *http.Response) // Create - Creates a Data Transfer Job. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, jobName, jobCreateParameters, options) if err != nil { return DataTransferJobsClientCreateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DataTransferJobsClientCreateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DataTransferJobsClientCreateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DataTransferJobsClientCreateResponse{}, err } - return client.createHandleResponse(resp) + resp, err := client.createHandleResponse(httpResp) + return resp, err } // createCreateRequest creates the Create request. @@ -153,10 +158,13 @@ func (client *DataTransferJobsClient) createCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, jobCreateParameters) + if err := runtime.MarshalAsJSON(req, jobCreateParameters); err != nil { + return nil, err + } + return req, nil } // createHandleResponse handles the Create response. @@ -171,24 +179,27 @@ func (client *DataTransferJobsClient) createHandleResponse(resp *http.Response) // Get - Get a Data Transfer Job. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, jobName, options) if err != nil { return DataTransferJobsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DataTransferJobsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DataTransferJobsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DataTransferJobsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -215,7 +226,7 @@ func (client *DataTransferJobsClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -232,7 +243,7 @@ func (client *DataTransferJobsClient) getHandleResponse(resp *http.Response) (Da // NewListByDatabaseAccountPager - Get a list of Data Transfer jobs. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -285,7 +296,7 @@ func (client *DataTransferJobsClient) listByDatabaseAccountCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -303,24 +314,27 @@ func (client *DataTransferJobsClient) listByDatabaseAccountHandleResponse(resp * // Pause - Pause a Data Transfer Job. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.pauseCreateRequest(ctx, resourceGroupName, accountName, jobName, options) if err != nil { return DataTransferJobsClientPauseResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DataTransferJobsClientPauseResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DataTransferJobsClientPauseResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DataTransferJobsClientPauseResponse{}, err } - return client.pauseHandleResponse(resp) + resp, err := client.pauseHandleResponse(httpResp) + return resp, err } // pauseCreateRequest creates the Pause request. @@ -347,7 +361,7 @@ func (client *DataTransferJobsClient) pauseCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -365,24 +379,27 @@ func (client *DataTransferJobsClient) pauseHandleResponse(resp *http.Response) ( // Resume - Resumes a Data Transfer Job. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.resumeCreateRequest(ctx, resourceGroupName, accountName, jobName, options) if err != nil { return DataTransferJobsClientResumeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DataTransferJobsClientResumeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DataTransferJobsClientResumeResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DataTransferJobsClientResumeResponse{}, err } - return client.resumeHandleResponse(resp) + resp, err := client.resumeHandleResponse(httpResp) + return resp, err } // resumeCreateRequest creates the Resume request. @@ -409,7 +426,7 @@ func (client *DataTransferJobsClient) resumeCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/datatransferjobs_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/datatransferjobs_client_example_test.go deleted file mode 100644 index d8622fa9ad0d..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/datatransferjobs_client_example_test.go +++ /dev/null @@ -1,286 +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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobCreate.json -func ExampleDataTransferJobsClient_Create() { - 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.NewDataTransferJobsClient().Create(ctx, "rg1", "ddb1", "j1", armcosmos.CreateJobRequest{ - Properties: &armcosmos.DataTransferJobProperties{ - Destination: &armcosmos.AzureBlobDataTransferDataSourceSink{ - Component: to.Ptr(armcosmos.DataTransferComponentAzureBlobStorage), - ContainerName: to.Ptr("blob_container"), - EndpointURL: to.Ptr("https://blob.windows.net"), - }, - Source: &armcosmos.CassandraDataTransferDataSourceSink{ - Component: to.Ptr(armcosmos.DataTransferComponentCosmosDBCassandra), - KeyspaceName: to.Ptr("keyspace"), - TableName: to.Ptr("table"), - }, - }, - }, 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.DataTransferJobGetResults = armcosmos.DataTransferJobGetResults{ - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/dataTransferJobs"), - // ID: to.Ptr("ab1b6f34-b33c-46b1-98c7-3a0a63fd0d16"), - // Properties: &armcosmos.DataTransferJobProperties{ - // Destination: &armcosmos.AzureBlobDataTransferDataSourceSink{ - // Component: to.Ptr(armcosmos.DataTransferComponentAzureBlobStorage), - // ContainerName: to.Ptr("blob_container"), - // EndpointURL: to.Ptr("https://blob.windows.net"), - // }, - // JobName: to.Ptr("j1"), - // LastUpdatedUTCTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-12T11:10:55.2780000Z"); return t}()), - // ProcessedCount: to.Ptr[int64](0), - // Source: &armcosmos.CassandraDataTransferDataSourceSink{ - // Component: to.Ptr(armcosmos.DataTransferComponentCosmosDBCassandra), - // KeyspaceName: to.Ptr("keyspace"), - // TableName: to.Ptr("table"), - // }, - // Status: to.Ptr("Running"), - // TotalCount: to.Ptr[int64](0), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobGet.json -func ExampleDataTransferJobsClient_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.NewDataTransferJobsClient().Get(ctx, "rg1", "ddb1", "j1", 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.DataTransferJobGetResults = armcosmos.DataTransferJobGetResults{ - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/dataTransferJobs"), - // ID: to.Ptr("ab1b6f34-b33c-46b1-98c7-3a0a63fd0d16"), - // Properties: &armcosmos.DataTransferJobProperties{ - // Destination: &armcosmos.AzureBlobDataTransferDataSourceSink{ - // Component: to.Ptr(armcosmos.DataTransferComponentAzureBlobStorage), - // ContainerName: to.Ptr("blob_container"), - // EndpointURL: to.Ptr("https://blob.windows.net"), - // }, - // JobName: to.Ptr("j1"), - // LastUpdatedUTCTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-12T12:04:23.1530000Z"); return t}()), - // ProcessedCount: to.Ptr[int64](50), - // Source: &armcosmos.CassandraDataTransferDataSourceSink{ - // Component: to.Ptr(armcosmos.DataTransferComponentCosmosDBCassandra), - // KeyspaceName: to.Ptr("keyspace"), - // TableName: to.Ptr("table"), - // }, - // Status: to.Ptr("Completed"), - // TotalCount: to.Ptr[int64](50), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobPause.json -func ExampleDataTransferJobsClient_Pause() { - 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.NewDataTransferJobsClient().Pause(ctx, "rg1", "ddb1", "j1", 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.DataTransferJobGetResults = armcosmos.DataTransferJobGetResults{ - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/dataTransferJobs"), - // ID: to.Ptr("ab1b6f34-b33c-46b1-98c7-3a0a63fd0d16"), - // Properties: &armcosmos.DataTransferJobProperties{ - // Destination: &armcosmos.AzureBlobDataTransferDataSourceSink{ - // Component: to.Ptr(armcosmos.DataTransferComponentAzureBlobStorage), - // ContainerName: to.Ptr("blob_container"), - // EndpointURL: to.Ptr("https://blob.windows.net"), - // }, - // JobName: to.Ptr("j1"), - // LastUpdatedUTCTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-12T11:10:55.2780000Z"); return t}()), - // ProcessedCount: to.Ptr[int64](20), - // Source: &armcosmos.CassandraDataTransferDataSourceSink{ - // Component: to.Ptr(armcosmos.DataTransferComponentCosmosDBCassandra), - // KeyspaceName: to.Ptr("keyspace"), - // TableName: to.Ptr("table"), - // }, - // Status: to.Ptr("Paused"), - // TotalCount: to.Ptr[int64](100), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobResume.json -func ExampleDataTransferJobsClient_Resume() { - 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.NewDataTransferJobsClient().Resume(ctx, "rg1", "ddb1", "j1", 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.DataTransferJobGetResults = armcosmos.DataTransferJobGetResults{ - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/dataTransferJobs"), - // ID: to.Ptr("ab1b6f34-b33c-46b1-98c7-3a0a63fd0d16"), - // Properties: &armcosmos.DataTransferJobProperties{ - // Destination: &armcosmos.AzureBlobDataTransferDataSourceSink{ - // Component: to.Ptr(armcosmos.DataTransferComponentAzureBlobStorage), - // ContainerName: to.Ptr("blob_container"), - // EndpointURL: to.Ptr("https://blob.windows.net"), - // }, - // JobName: to.Ptr("j1"), - // LastUpdatedUTCTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-12T11:10:55.2780000Z"); return t}()), - // ProcessedCount: to.Ptr[int64](20), - // Source: &armcosmos.CassandraDataTransferDataSourceSink{ - // Component: to.Ptr(armcosmos.DataTransferComponentCosmosDBCassandra), - // KeyspaceName: to.Ptr("keyspace"), - // TableName: to.Ptr("table"), - // }, - // Status: to.Ptr("Pending"), - // TotalCount: to.Ptr[int64](100), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobCancel.json -func ExampleDataTransferJobsClient_Cancel() { - 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.NewDataTransferJobsClient().Cancel(ctx, "rg1", "ddb1", "j1", 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.DataTransferJobGetResults = armcosmos.DataTransferJobGetResults{ - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/dataTransferJobs"), - // ID: to.Ptr("ab1b6f34-b33c-46b1-98c7-3a0a63fd0d16"), - // Properties: &armcosmos.DataTransferJobProperties{ - // Destination: &armcosmos.AzureBlobDataTransferDataSourceSink{ - // Component: to.Ptr(armcosmos.DataTransferComponentAzureBlobStorage), - // ContainerName: to.Ptr("blob_container"), - // EndpointURL: to.Ptr("https://blob.windows.net"), - // }, - // JobName: to.Ptr("j1"), - // LastUpdatedUTCTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-12T11:10:55.2780000Z"); return t}()), - // ProcessedCount: to.Ptr[int64](20), - // Source: &armcosmos.CassandraDataTransferDataSourceSink{ - // Component: to.Ptr(armcosmos.DataTransferComponentCosmosDBCassandra), - // KeyspaceName: to.Ptr("keyspace"), - // TableName: to.Ptr("table"), - // }, - // Status: to.Ptr("Cancelled"), - // TotalCount: to.Ptr[int64](100), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/data-transfer-service/CosmosDBDataTransferJobFeed.json -func ExampleDataTransferJobsClient_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.NewDataTransferJobsClient().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.DataTransferJobFeedResults = armcosmos.DataTransferJobFeedResults{ - // Value: []*armcosmos.DataTransferJobGetResults{ - // { - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/dataTransferJobs"), - // ID: to.Ptr("ab1b6f34-b33c-46b1-98c7-3a0a63fd0d16"), - // Properties: &armcosmos.DataTransferJobProperties{ - // Destination: &armcosmos.AzureBlobDataTransferDataSourceSink{ - // Component: to.Ptr(armcosmos.DataTransferComponentAzureBlobStorage), - // ContainerName: to.Ptr("blob_container"), - // EndpointURL: to.Ptr("https://blob.windows.net"), - // }, - // JobName: to.Ptr("j1"), - // LastUpdatedUTCTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-12T12:04:23.1530000Z"); return t}()), - // ProcessedCount: to.Ptr[int64](100), - // Source: &armcosmos.CassandraDataTransferDataSourceSink{ - // Component: to.Ptr(armcosmos.DataTransferComponentCosmosDBCassandra), - // KeyspaceName: to.Ptr("keyspace"), - // TableName: to.Ptr("table"), - // }, - // Status: to.Ptr("Completed"), - // TotalCount: to.Ptr[int64](100), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/go.mod b/sdk/resourcemanager/cosmos/armcosmos/go.mod index 62edc615ddb8..b7c9e83cd5cc 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/go.mod +++ b/sdk/resourcemanager/cosmos/armcosmos/go.mod @@ -3,8 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3 go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.5.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v2 v2.5.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 @@ -13,6 +12,7 @@ require ( ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dnaeon/go-vcr v1.1.0 // indirect diff --git a/sdk/resourcemanager/cosmos/armcosmos/go.sum b/sdk/resourcemanager/cosmos/armcosmos/go.sum index 8785733f6416..bc661e4d8080 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/go.sum +++ b/sdk/resourcemanager/cosmos/armcosmos/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.5.0 h1:xGLAFFd9D3iLGxYiUGPdITSzsFmU1K8VtfuUHWAoN7M= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.5.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= diff --git a/sdk/resourcemanager/cosmos/armcosmos/graphresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/graphresources_client.go index 56bab58b2dbc..da061426dad7 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/graphresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/graphresources_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -47,7 +46,7 @@ func NewGraphResourcesClient(subscriptionID string, credential azcore.TokenCrede // BeginCreateUpdateGraph - Create or update an Azure Cosmos DB Graph. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -60,7 +59,8 @@ func (client *GraphResourcesClient) BeginCreateUpdateGraph(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[GraphResourcesClientCreateUpdateGraphResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[GraphResourcesClientCreateUpdateGraphResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[GraphResourcesClientCreateUpdateGraphResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,20 +69,22 @@ func (client *GraphResourcesClient) BeginCreateUpdateGraph(ctx context.Context, // CreateUpdateGraph - Create or update an Azure Cosmos DB Graph. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *GraphResourcesClient) createUpdateGraph(ctx context.Context, resourceGroupName string, accountName string, graphName string, createUpdateGraphParameters GraphResourceCreateUpdateParameters, options *GraphResourcesClientBeginCreateUpdateGraphOptions) (*http.Response, error) { + var err error req, err := client.createUpdateGraphCreateRequest(ctx, resourceGroupName, accountName, graphName, createUpdateGraphParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateGraphCreateRequest creates the CreateUpdateGraph request. @@ -109,16 +111,19 @@ func (client *GraphResourcesClient) createUpdateGraphCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateGraphParameters) + 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -130,7 +135,8 @@ func (client *GraphResourcesClient) BeginDeleteGraphResource(ctx context.Context if err != nil { return nil, err } - return runtime.NewPoller[GraphResourcesClientDeleteGraphResourceResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[GraphResourcesClientDeleteGraphResourceResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[GraphResourcesClientDeleteGraphResourceResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -139,20 +145,22 @@ func (client *GraphResourcesClient) BeginDeleteGraphResource(ctx context.Context // DeleteGraphResource - Deletes an existing Azure Cosmos DB Graph Resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *GraphResourcesClient) deleteGraphResource(ctx context.Context, resourceGroupName string, accountName string, graphName string, options *GraphResourcesClientBeginDeleteGraphResourceOptions) (*http.Response, error) { + var err error req, err := client.deleteGraphResourceCreateRequest(ctx, resourceGroupName, accountName, graphName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteGraphResourceCreateRequest creates the DeleteGraphResource request. @@ -179,7 +187,7 @@ func (client *GraphResourcesClient) deleteGraphResourceCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -187,24 +195,27 @@ func (client *GraphResourcesClient) deleteGraphResourceCreateRequest(ctx context // 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.getGraphCreateRequest(ctx, resourceGroupName, accountName, graphName, options) if err != nil { return GraphResourcesClientGetGraphResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return GraphResourcesClientGetGraphResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GraphResourcesClientGetGraphResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GraphResourcesClientGetGraphResponse{}, err } - return client.getGraphHandleResponse(resp) + resp, err := client.getGraphHandleResponse(httpResp) + return resp, err } // getGraphCreateRequest creates the GetGraph request. @@ -231,7 +242,7 @@ func (client *GraphResourcesClient) getGraphCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,7 +259,7 @@ func (client *GraphResourcesClient) getGraphHandleResponse(resp *http.Response) // NewListGraphsPager - Lists the graphs under an existing Azure Cosmos DB database account. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -295,7 +306,7 @@ func (client *GraphResourcesClient) listGraphsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/graphresources_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/graphresources_client_example_test.go deleted file mode 100644 index 33749ce58720..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/graphresources_client_example_test.go +++ /dev/null @@ -1,160 +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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBGraphResourceList.json -func ExampleGraphResourcesClient_NewListGraphsPager() { - 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.NewGraphResourcesClient().NewListGraphsPager("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.GraphResourcesListResult = armcosmos.GraphResourcesListResult{ - // Value: []*armcosmos.GraphResourceGetResults{ - // { - // Name: to.Ptr("graphName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/graphs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/graphs/graphName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.GraphResourceGetProperties{ - // Resource: &armcosmos.GraphResourceGetPropertiesResource{ - // ID: to.Ptr("graphName"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBGraphResourceGet.json -func ExampleGraphResourcesClient_GetGraph() { - 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.NewGraphResourcesClient().GetGraph(ctx, "rg1", "ddb1", "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.GraphResourceGetResults = armcosmos.GraphResourceGetResults{ - // Name: to.Ptr("graphName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/graphs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/graphs/graphName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.GraphResourceGetProperties{ - // Resource: &armcosmos.GraphResourceGetPropertiesResource{ - // ID: to.Ptr("graphName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBGraphResourceCreateUpdate.json -func ExampleGraphResourcesClient_BeginCreateUpdateGraph() { - 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.NewGraphResourcesClient().BeginCreateUpdateGraph(ctx, "rg1", "ddb1", "graphName", armcosmos.GraphResourceCreateUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.GraphResourceCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.GraphResource{ - ID: to.Ptr("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.GraphResourceGetResults = armcosmos.GraphResourceGetResults{ - // Name: to.Ptr("graphName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/graphs"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/graphs/graphName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.GraphResourceGetProperties{ - // Resource: &armcosmos.GraphResourceGetPropertiesResource{ - // ID: to.Ptr("graphName"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBGraphResourceDelete.json -func ExampleGraphResourcesClient_BeginDeleteGraphResource() { - 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.NewGraphResourcesClient().BeginDeleteGraphResource(ctx, "rg1", "ddb1", "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) - } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/gremlinresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/gremlinresources_client.go index ad054508efaf..6db79891d9fa 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/gremlinresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/gremlinresources_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -47,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -60,7 +59,8 @@ func (client *GremlinResourcesClient) BeginCreateUpdateGremlinDatabase(ctx conte if err != nil { return nil, err } - return runtime.NewPoller[GremlinResourcesClientCreateUpdateGremlinDatabaseResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[GremlinResourcesClientCreateUpdateGremlinDatabaseResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[GremlinResourcesClientCreateUpdateGremlinDatabaseResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,20 +69,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *GremlinResourcesClient) createUpdateGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateGremlinDatabaseParameters GremlinDatabaseCreateUpdateParameters, options *GremlinResourcesClientBeginCreateUpdateGremlinDatabaseOptions) (*http.Response, error) { + var err error req, err := client.createUpdateGremlinDatabaseCreateRequest(ctx, resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateGremlinDatabaseCreateRequest creates the CreateUpdateGremlinDatabase request. @@ -109,16 +111,19 @@ func (client *GremlinResourcesClient) createUpdateGremlinDatabaseCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateGremlinDatabaseParameters) + if err := runtime.MarshalAsJSON(req, createUpdateGremlinDatabaseParameters); err != nil { + return nil, err + } + return req, nil } // BeginCreateUpdateGremlinGraph - Create or update an Azure Cosmos DB Gremlin graph // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -132,7 +137,8 @@ func (client *GremlinResourcesClient) BeginCreateUpdateGremlinGraph(ctx context. if err != nil { return nil, err } - return runtime.NewPoller[GremlinResourcesClientCreateUpdateGremlinGraphResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[GremlinResourcesClientCreateUpdateGremlinGraphResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[GremlinResourcesClientCreateUpdateGremlinGraphResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -141,20 +147,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.createUpdateGremlinGraphCreateRequest(ctx, resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateGremlinGraphCreateRequest creates the CreateUpdateGremlinGraph request. @@ -185,16 +193,19 @@ func (client *GremlinResourcesClient) createUpdateGremlinGraphCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateGremlinGraphParameters) + if err := runtime.MarshalAsJSON(req, createUpdateGremlinGraphParameters); err != nil { + return nil, err + } + return req, nil } // BeginDeleteGremlinDatabase - Deletes an existing Azure Cosmos DB Gremlin database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -206,7 +217,8 @@ func (client *GremlinResourcesClient) BeginDeleteGremlinDatabase(ctx context.Con if err != nil { return nil, err } - return runtime.NewPoller[GremlinResourcesClientDeleteGremlinDatabaseResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[GremlinResourcesClientDeleteGremlinDatabaseResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[GremlinResourcesClientDeleteGremlinDatabaseResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -215,20 +227,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *GremlinResourcesClient) deleteGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *GremlinResourcesClientBeginDeleteGremlinDatabaseOptions) (*http.Response, error) { + var err error req, err := client.deleteGremlinDatabaseCreateRequest(ctx, resourceGroupName, accountName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteGremlinDatabaseCreateRequest creates the DeleteGremlinDatabase request. @@ -255,7 +269,7 @@ func (client *GremlinResourcesClient) deleteGremlinDatabaseCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -263,7 +277,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -276,7 +290,8 @@ func (client *GremlinResourcesClient) BeginDeleteGremlinGraph(ctx context.Contex if err != nil { return nil, err } - return runtime.NewPoller[GremlinResourcesClientDeleteGremlinGraphResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[GremlinResourcesClientDeleteGremlinGraphResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[GremlinResourcesClientDeleteGremlinGraphResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -285,20 +300,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *GremlinResourcesClient) deleteGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, options *GremlinResourcesClientBeginDeleteGremlinGraphOptions) (*http.Response, error) { + var err error req, err := client.deleteGremlinGraphCreateRequest(ctx, resourceGroupName, accountName, databaseName, graphName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteGremlinGraphCreateRequest creates the DeleteGremlinGraph request. @@ -329,7 +346,7 @@ func (client *GremlinResourcesClient) deleteGremlinGraphCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -337,25 +354,28 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. // - options - GremlinResourcesClientGetGremlinDatabaseOptions contains the optional parameters for the GremlinResourcesClient.GetGremlinDatabase // method. func (client *GremlinResourcesClient) GetGremlinDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *GremlinResourcesClientGetGremlinDatabaseOptions) (GremlinResourcesClientGetGremlinDatabaseResponse, error) { + var err error req, err := client.getGremlinDatabaseCreateRequest(ctx, resourceGroupName, accountName, databaseName, options) if err != nil { return GremlinResourcesClientGetGremlinDatabaseResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return GremlinResourcesClientGetGremlinDatabaseResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GremlinResourcesClientGetGremlinDatabaseResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GremlinResourcesClientGetGremlinDatabaseResponse{}, err } - return client.getGremlinDatabaseHandleResponse(resp) + resp, err := client.getGremlinDatabaseHandleResponse(httpResp) + return resp, err } // getGremlinDatabaseCreateRequest creates the GetGremlinDatabase request. @@ -382,7 +402,7 @@ func (client *GremlinResourcesClient) getGremlinDatabaseCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -401,25 +421,28 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. // - options - GremlinResourcesClientGetGremlinDatabaseThroughputOptions contains the optional parameters for the GremlinResourcesClient.GetGremlinDatabaseThroughput // method. func (client *GremlinResourcesClient) GetGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *GremlinResourcesClientGetGremlinDatabaseThroughputOptions) (GremlinResourcesClientGetGremlinDatabaseThroughputResponse, error) { + var err error req, err := client.getGremlinDatabaseThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, options) if err != nil { return GremlinResourcesClientGetGremlinDatabaseThroughputResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return GremlinResourcesClientGetGremlinDatabaseThroughputResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GremlinResourcesClientGetGremlinDatabaseThroughputResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GremlinResourcesClientGetGremlinDatabaseThroughputResponse{}, err } - return client.getGremlinDatabaseThroughputHandleResponse(resp) + resp, err := client.getGremlinDatabaseThroughputHandleResponse(httpResp) + return resp, err } // getGremlinDatabaseThroughputCreateRequest creates the GetGremlinDatabaseThroughput request. @@ -446,7 +469,7 @@ func (client *GremlinResourcesClient) getGremlinDatabaseThroughputCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -464,7 +487,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -472,18 +495,21 @@ func (client *GremlinResourcesClient) getGremlinDatabaseThroughputHandleResponse // - options - GremlinResourcesClientGetGremlinGraphOptions contains the optional parameters for the GremlinResourcesClient.GetGremlinGraph // method. func (client *GremlinResourcesClient) GetGremlinGraph(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, options *GremlinResourcesClientGetGremlinGraphOptions) (GremlinResourcesClientGetGremlinGraphResponse, error) { + var err error req, err := client.getGremlinGraphCreateRequest(ctx, resourceGroupName, accountName, databaseName, graphName, options) if err != nil { return GremlinResourcesClientGetGremlinGraphResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return GremlinResourcesClientGetGremlinGraphResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GremlinResourcesClientGetGremlinGraphResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GremlinResourcesClientGetGremlinGraphResponse{}, err } - return client.getGremlinGraphHandleResponse(resp) + resp, err := client.getGremlinGraphHandleResponse(httpResp) + return resp, err } // getGremlinGraphCreateRequest creates the GetGremlinGraph request. @@ -514,7 +540,7 @@ func (client *GremlinResourcesClient) getGremlinGraphCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -533,7 +559,7 @@ func (client *GremlinResourcesClient) getGremlinGraphHandleResponse(resp *http.R // provided name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -541,18 +567,21 @@ func (client *GremlinResourcesClient) getGremlinGraphHandleResponse(resp *http.R // - options - GremlinResourcesClientGetGremlinGraphThroughputOptions contains the optional parameters for the GremlinResourcesClient.GetGremlinGraphThroughput // method. func (client *GremlinResourcesClient) GetGremlinGraphThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, options *GremlinResourcesClientGetGremlinGraphThroughputOptions) (GremlinResourcesClientGetGremlinGraphThroughputResponse, error) { + var err error req, err := client.getGremlinGraphThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, graphName, options) if err != nil { return GremlinResourcesClientGetGremlinGraphThroughputResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return GremlinResourcesClientGetGremlinGraphThroughputResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GremlinResourcesClientGetGremlinGraphThroughputResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GremlinResourcesClientGetGremlinGraphThroughputResponse{}, err } - return client.getGremlinGraphThroughputHandleResponse(resp) + resp, err := client.getGremlinGraphThroughputHandleResponse(httpResp) + return resp, err } // getGremlinGraphThroughputCreateRequest creates the GetGremlinGraphThroughput request. @@ -583,7 +612,7 @@ func (client *GremlinResourcesClient) getGremlinGraphThroughputCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -600,7 +629,7 @@ func (client *GremlinResourcesClient) getGremlinGraphThroughputHandleResponse(re // NewListGremlinDatabasesPager - Lists the Gremlin databases under an existing Azure Cosmos DB database account. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -647,7 +676,7 @@ func (client *GremlinResourcesClient) listGremlinDatabasesCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -664,7 +693,7 @@ func (client *GremlinResourcesClient) listGremlinDatabasesHandleResponse(resp *h // NewListGremlinGraphsPager - Lists the Gremlin graph under an existing Azure Cosmos DB database account. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -716,7 +745,7 @@ func (client *GremlinResourcesClient) listGremlinGraphsCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -734,7 +763,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -746,7 +775,8 @@ func (client *GremlinResourcesClient) BeginMigrateGremlinDatabaseToAutoscale(ctx if err != nil { return nil, err } - return runtime.NewPoller[GremlinResourcesClientMigrateGremlinDatabaseToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[GremlinResourcesClientMigrateGremlinDatabaseToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[GremlinResourcesClientMigrateGremlinDatabaseToAutoscaleResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -755,20 +785,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *GremlinResourcesClient) migrateGremlinDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *GremlinResourcesClientBeginMigrateGremlinDatabaseToAutoscaleOptions) (*http.Response, error) { + var err error req, err := client.migrateGremlinDatabaseToAutoscaleCreateRequest(ctx, resourceGroupName, accountName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateGremlinDatabaseToAutoscaleCreateRequest creates the MigrateGremlinDatabaseToAutoscale request. @@ -795,7 +827,7 @@ func (client *GremlinResourcesClient) migrateGremlinDatabaseToAutoscaleCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -804,7 +836,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -816,7 +848,8 @@ func (client *GremlinResourcesClient) BeginMigrateGremlinDatabaseToManualThrough if err != nil { return nil, err } - return runtime.NewPoller[GremlinResourcesClientMigrateGremlinDatabaseToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[GremlinResourcesClientMigrateGremlinDatabaseToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[GremlinResourcesClientMigrateGremlinDatabaseToManualThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -825,20 +858,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *GremlinResourcesClient) migrateGremlinDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *GremlinResourcesClientBeginMigrateGremlinDatabaseToManualThroughputOptions) (*http.Response, error) { + var err error req, err := client.migrateGremlinDatabaseToManualThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateGremlinDatabaseToManualThroughputCreateRequest creates the MigrateGremlinDatabaseToManualThroughput request. @@ -865,7 +900,7 @@ func (client *GremlinResourcesClient) migrateGremlinDatabaseToManualThroughputCr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -874,7 +909,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -887,7 +922,8 @@ func (client *GremlinResourcesClient) BeginMigrateGremlinGraphToAutoscale(ctx co if err != nil { return nil, err } - return runtime.NewPoller[GremlinResourcesClientMigrateGremlinGraphToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[GremlinResourcesClientMigrateGremlinGraphToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[GremlinResourcesClientMigrateGremlinGraphToAutoscaleResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -896,20 +932,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *GremlinResourcesClient) migrateGremlinGraphToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, options *GremlinResourcesClientBeginMigrateGremlinGraphToAutoscaleOptions) (*http.Response, error) { + var err error req, err := client.migrateGremlinGraphToAutoscaleCreateRequest(ctx, resourceGroupName, accountName, databaseName, graphName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateGremlinGraphToAutoscaleCreateRequest creates the MigrateGremlinGraphToAutoscale request. @@ -940,7 +978,7 @@ func (client *GremlinResourcesClient) migrateGremlinGraphToAutoscaleCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -949,7 +987,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -962,7 +1000,8 @@ func (client *GremlinResourcesClient) BeginMigrateGremlinGraphToManualThroughput if err != nil { return nil, err } - return runtime.NewPoller[GremlinResourcesClientMigrateGremlinGraphToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[GremlinResourcesClientMigrateGremlinGraphToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[GremlinResourcesClientMigrateGremlinGraphToManualThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -971,20 +1010,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *GremlinResourcesClient) migrateGremlinGraphToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, graphName string, options *GremlinResourcesClientBeginMigrateGremlinGraphToManualThroughputOptions) (*http.Response, error) { + var err error req, err := client.migrateGremlinGraphToManualThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, graphName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateGremlinGraphToManualThroughputCreateRequest creates the MigrateGremlinGraphToManualThroughput request. @@ -1015,7 +1056,7 @@ func (client *GremlinResourcesClient) migrateGremlinGraphToManualThroughputCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1024,7 +1065,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1038,9 +1079,10 @@ func (client *GremlinResourcesClient) BeginRetrieveContinuousBackupInformation(c if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GremlinResourcesClientRetrieveContinuousBackupInformationResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GremlinResourcesClientRetrieveContinuousBackupInformationResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[GremlinResourcesClientRetrieveContinuousBackupInformationResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1049,20 +1091,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.retrieveContinuousBackupInformationCreateRequest(ctx, resourceGroupName, accountName, databaseName, graphName, location, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // retrieveContinuousBackupInformationCreateRequest creates the RetrieveContinuousBackupInformation request. @@ -1093,16 +1137,19 @@ func (client *GremlinResourcesClient) retrieveContinuousBackupInformationCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, location) + if err := runtime.MarshalAsJSON(req, location); err != nil { + return nil, err + } + return req, nil } // 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1115,7 +1162,8 @@ func (client *GremlinResourcesClient) BeginUpdateGremlinDatabaseThroughput(ctx c if err != nil { return nil, err } - return runtime.NewPoller[GremlinResourcesClientUpdateGremlinDatabaseThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[GremlinResourcesClientUpdateGremlinDatabaseThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[GremlinResourcesClientUpdateGremlinDatabaseThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1124,20 +1172,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *GremlinResourcesClient) updateGremlinDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *GremlinResourcesClientBeginUpdateGremlinDatabaseThroughputOptions) (*http.Response, error) { + var err error req, err := client.updateGremlinDatabaseThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateGremlinDatabaseThroughputCreateRequest creates the UpdateGremlinDatabaseThroughput request. @@ -1164,16 +1214,19 @@ func (client *GremlinResourcesClient) updateGremlinDatabaseThroughputCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, updateThroughputParameters) + if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { + return nil, err + } + return req, nil } // 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1187,7 +1240,8 @@ func (client *GremlinResourcesClient) BeginUpdateGremlinGraphThroughput(ctx cont if err != nil { return nil, err } - return runtime.NewPoller[GremlinResourcesClientUpdateGremlinGraphThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[GremlinResourcesClientUpdateGremlinGraphThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[GremlinResourcesClientUpdateGremlinGraphThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1196,20 +1250,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.updateGremlinGraphThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateGremlinGraphThroughputCreateRequest creates the UpdateGremlinGraphThroughput request. @@ -1240,8 +1296,11 @@ func (client *GremlinResourcesClient) updateGremlinGraphThroughputCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, updateThroughputParameters) + if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { + return nil, err + } + return req, 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 f17f4a23cb50..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/gremlinresources_client_example_test.go +++ /dev/null @@ -1,821 +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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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), - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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), - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/interfaces.go b/sdk/resourcemanager/cosmos/armcosmos/interfaces.go new file mode 100644 index 000000000000..2754b4b31d22 --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/interfaces.go @@ -0,0 +1,38 @@ +//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 + +// BackupPolicyClassification provides polymorphic access to related types. +// Call the interface's GetBackupPolicy() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *BackupPolicy, *ContinuousModeBackupPolicy, *PeriodicModeBackupPolicy +type BackupPolicyClassification interface { + // GetBackupPolicy returns the BackupPolicy content of the underlying type. + GetBackupPolicy() *BackupPolicy +} + +// 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, *CassandraDataTransferDataSourceSink, *DataTransferDataSourceSink, *MongoDataTransferDataSourceSink, +// - *SQLDataTransferDataSourceSink +type DataTransferDataSourceSinkClassification interface { + // GetDataTransferDataSourceSink returns the DataTransferDataSourceSink content of the underlying type. + GetDataTransferDataSourceSink() *DataTransferDataSourceSink +} + +// ServiceResourcePropertiesClassification provides polymorphic access to related types. +// Call the interface's GetServiceResourceProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *DataTransferServiceResourceProperties, *GraphAPIComputeServiceResourceProperties, *MaterializedViewsBuilderServiceResourceProperties, +// - *SQLDedicatedGatewayServiceResourceProperties, *ServiceResourceProperties +type ServiceResourcePropertiesClassification interface { + // GetServiceResourceProperties returns the ServiceResourceProperties content of the underlying type. + GetServiceResourceProperties() *ServiceResourceProperties +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/locations_client.go b/sdk/resourcemanager/cosmos/armcosmos/locations_client.go index 49c48ed51fc4..71d1f7334433 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/locations_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/locations_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -47,22 +46,25 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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) { + var err error req, err := client.getCreateRequest(ctx, location, options) if err != nil { return LocationsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return LocationsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return LocationsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LocationsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -81,7 +83,7 @@ func (client *LocationsClient) getCreateRequest(ctx context.Context, location st return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -98,7 +100,7 @@ func (client *LocationsClient) getHandleResponse(resp *http.Response) (Locations // NewListPager - List Cosmos DB locations and their properties // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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]{ @@ -134,7 +136,7 @@ func (client *LocationsClient) listCreateRequest(ctx context.Context, options *L return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-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 06ae1560d9f5..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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 8ca654fd3dfc..70e727262beb 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/models.go +++ b/sdk/resourcemanager/cosmos/armcosmos/models.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -138,15 +137,6 @@ type BackupInformation struct { ContinuousBackupInformation *ContinuousBackupInformation } -// BackupPolicyClassification provides polymorphic access to related types. -// Call the interface's GetBackupPolicy() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *BackupPolicy, *ContinuousModeBackupPolicy, *PeriodicModeBackupPolicy -type BackupPolicyClassification interface { - // GetBackupPolicy returns the BackupPolicy content of the underlying type. - GetBackupPolicy() *BackupPolicy -} - // BackupPolicy - The object representing the policy for taking backups on an account. type BackupPolicy struct { // REQUIRED; Describes the mode of backups. @@ -173,21 +163,36 @@ type BackupPolicyMigrationState struct { // BackupResource - A restorable backup of a Cassandra cluster. type BackupResource struct { - Properties *BackupResourceProperties + // The time at which the backup will expire. + BackupExpiryTimestamp *time.Time - // READ-ONLY; The unique resource identifier of the database account. - ID *string + // The unique identifier of backup. + BackupID *string - // READ-ONLY; The name of the database account. - Name *string + // The time at which the backup process begins. + BackupStartTimestamp *time.Time - // READ-ONLY; The type of Azure resource. - Type *string + // The current state of the backup. + BackupState *BackupState + + // The time at which the backup process ends. + BackupStopTimestamp *time.Time } -type BackupResourceProperties struct { - // The time this backup was taken, formatted like 2021-01-21T17:35:21 - Timestamp *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 { + RemoteAccountName *string } // Capability - Cosmos DB capability object @@ -228,112 +233,6 @@ type CassandraClusterPublicStatusDataCentersItem struct { SeedNodes []*string } -// CassandraClustersClientBeginCreateUpdateOptions contains the optional parameters for the CassandraClustersClient.BeginCreateUpdate -// method. -type CassandraClustersClientBeginCreateUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CassandraClustersClientBeginDeallocateOptions contains the optional parameters for the CassandraClustersClient.BeginDeallocate -// method. -type CassandraClustersClientBeginDeallocateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CassandraClustersClientBeginDeleteOptions contains the optional parameters for the CassandraClustersClient.BeginDelete -// method. -type CassandraClustersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CassandraClustersClientBeginInvokeCommandOptions contains the optional parameters for the CassandraClustersClient.BeginInvokeCommand -// method. -type CassandraClustersClientBeginInvokeCommandOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CassandraClustersClientBeginStartOptions contains the optional parameters for the CassandraClustersClient.BeginStart method. -type CassandraClustersClientBeginStartOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CassandraClustersClientBeginUpdateOptions contains the optional parameters for the CassandraClustersClient.BeginUpdate -// method. -type CassandraClustersClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CassandraClustersClientGetBackupOptions contains the optional parameters for the CassandraClustersClient.GetBackup method. -type CassandraClustersClientGetBackupOptions 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 { - // placeholder for future optional parameters -} - -// CassandraClustersClientListBySubscriptionOptions contains the optional parameters for the CassandraClustersClient.NewListBySubscriptionPager -// method. -type CassandraClustersClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// CassandraClustersClientStatusOptions contains the optional parameters for the CassandraClustersClient.Status method. -type CassandraClustersClientStatusOptions struct { - // placeholder for future optional parameters -} - -// CassandraDataCentersClientBeginCreateUpdateOptions contains the optional parameters for the CassandraDataCentersClient.BeginCreateUpdate -// method. -type CassandraDataCentersClientBeginCreateUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CassandraDataCentersClientBeginDeleteOptions contains the optional parameters for the CassandraDataCentersClient.BeginDelete -// method. -type CassandraDataCentersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CassandraDataCentersClientBeginUpdateOptions contains the optional parameters for the CassandraDataCentersClient.BeginUpdate -// method. -type CassandraDataCentersClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CassandraDataCentersClientGetOptions contains the optional parameters for the CassandraDataCentersClient.Get method. -type CassandraDataCentersClientGetOptions struct { - // placeholder for future optional parameters -} - -// CassandraDataCentersClientListOptions contains the optional parameters for the CassandraDataCentersClient.NewListPager -// method. -type CassandraDataCentersClientListOptions struct { - // placeholder for future optional parameters -} - // CassandraDataTransferDataSourceSink - A CosmosDB Cassandra API data source/sink type CassandraDataTransferDataSourceSink struct { // REQUIRED @@ -343,7 +242,8 @@ type CassandraDataTransferDataSourceSink struct { KeyspaceName *string // REQUIRED - TableName *string + TableName *string + RemoteAccountName *string } // GetDataTransferDataSourceSink implements the DataTransferDataSourceSinkClassification interface for type CassandraDataTransferDataSourceSink. @@ -479,165 +379,6 @@ type CassandraPartitionKey struct { Name *string } -// CassandraResourcesClientBeginCreateUpdateCassandraKeyspaceOptions contains the optional parameters for the CassandraResourcesClient.BeginCreateUpdateCassandraKeyspace -// method. -type CassandraResourcesClientBeginCreateUpdateCassandraKeyspaceOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CassandraResourcesClientBeginCreateUpdateCassandraTableOptions contains the optional parameters for the CassandraResourcesClient.BeginCreateUpdateCassandraTable -// method. -type CassandraResourcesClientBeginCreateUpdateCassandraTableOptions struct { - // Resumes the LRO from the provided token. - 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 { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CassandraResourcesClientBeginDeleteCassandraTableOptions contains the optional parameters for the CassandraResourcesClient.BeginDeleteCassandraTable -// method. -type CassandraResourcesClientBeginDeleteCassandraTableOptions struct { - // Resumes the LRO from the provided token. - 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 { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CassandraResourcesClientBeginMigrateCassandraKeyspaceToManualThroughputOptions contains the optional parameters for the -// CassandraResourcesClient.BeginMigrateCassandraKeyspaceToManualThroughput method. -type CassandraResourcesClientBeginMigrateCassandraKeyspaceToManualThroughputOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CassandraResourcesClientBeginMigrateCassandraTableToAutoscaleOptions contains the optional parameters for the CassandraResourcesClient.BeginMigrateCassandraTableToAutoscale -// method. -type CassandraResourcesClientBeginMigrateCassandraTableToAutoscaleOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CassandraResourcesClientBeginMigrateCassandraTableToManualThroughputOptions contains the optional parameters for the CassandraResourcesClient.BeginMigrateCassandraTableToManualThroughput -// method. -type CassandraResourcesClientBeginMigrateCassandraTableToManualThroughputOptions struct { - // Resumes the LRO from the provided token. - 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 { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CassandraResourcesClientBeginUpdateCassandraTableThroughputOptions contains the optional parameters for the CassandraResourcesClient.BeginUpdateCassandraTableThroughput -// method. -type CassandraResourcesClientBeginUpdateCassandraTableThroughputOptions struct { - // Resumes the LRO from the provided token. - 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 { - // placeholder for future optional parameters -} - -// CassandraResourcesClientGetCassandraKeyspaceThroughputOptions contains the optional parameters for the CassandraResourcesClient.GetCassandraKeyspaceThroughput -// method. -type CassandraResourcesClientGetCassandraKeyspaceThroughputOptions struct { - // placeholder for future optional parameters -} - -// CassandraResourcesClientGetCassandraTableOptions contains the optional parameters for the CassandraResourcesClient.GetCassandraTable -// method. -type CassandraResourcesClientGetCassandraTableOptions struct { - // placeholder for future optional parameters -} - -// CassandraResourcesClientGetCassandraTableThroughputOptions contains the optional parameters for the CassandraResourcesClient.GetCassandraTableThroughput -// method. -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 { - // placeholder for future optional parameters -} - -// CassandraResourcesClientListCassandraTablesOptions contains the optional parameters for the CassandraResourcesClient.NewListCassandraTablesPager -// method. -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 -} - // CassandraSchema - Cosmos DB Cassandra table schema type CassandraSchema struct { // List of cluster key. @@ -1057,6 +798,9 @@ type ClusterResourceProperties struct { // authentication. The default is 'Cassandra'. AuthenticationMethod *AuthenticationMethod + // List of backup schedules that define when you want to back up your data. + BackupSchedules []*BackupSchedule + // Whether Cassandra audit logging is enabled CassandraAuditLoggingEnabled *bool @@ -1074,6 +818,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 @@ -1082,6 +829,9 @@ 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 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. @@ -1126,50 +876,6 @@ type ClusterResourceProperties struct { SeedNodes []*SeedNode } -// CollectionClientListMetricDefinitionsOptions contains the optional parameters for the CollectionClient.NewListMetricDefinitionsPager -// method. -type CollectionClientListMetricDefinitionsOptions struct { - // placeholder for future optional parameters -} - -// CollectionClientListMetricsOptions contains the optional parameters for the CollectionClient.NewListMetricsPager method. -type CollectionClientListMetricsOptions struct { - // placeholder for future optional parameters -} - -// CollectionClientListUsagesOptions contains the optional parameters for the CollectionClient.NewListUsagesPager method. -type CollectionClientListUsagesOptions struct { - // An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of - // the metric, can have an or of multiple names). - Filter *string -} - -// CollectionPartitionClientListMetricsOptions contains the optional parameters for the CollectionPartitionClient.NewListMetricsPager -// method. -type CollectionPartitionClientListMetricsOptions struct { - // placeholder for future optional parameters -} - -// CollectionPartitionClientListUsagesOptions contains the optional parameters for the CollectionPartitionClient.NewListUsagesPager -// method. -type CollectionPartitionClientListUsagesOptions struct { - // An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of - // the metric, can have an or of multiple names). - Filter *string -} - -// CollectionPartitionRegionClientListMetricsOptions contains the optional parameters for the CollectionPartitionRegionClient.NewListMetricsPager -// method. -type CollectionPartitionRegionClientListMetricsOptions struct { - // placeholder for future optional parameters -} - -// CollectionRegionClientListMetricsOptions contains the optional parameters for the CollectionRegionClient.NewListMetricsPager -// method. -type CollectionRegionClientListMetricsOptions struct { - // placeholder for future optional parameters -} - // Column - Cosmos DB Cassandra table column type Column struct { // Name of the Cosmos DB Cassandra table column @@ -1230,6 +936,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. @@ -1368,8 +1077,8 @@ type ContinuousModeBackupPolicy struct { // GetBackupPolicy implements the BackupPolicyClassification interface for type ContinuousModeBackupPolicy. func (c *ContinuousModeBackupPolicy) GetBackupPolicy() *BackupPolicy { return &BackupPolicy{ - Type: c.Type, MigrationState: c.MigrationState, + Type: c.Type, } } @@ -1415,7 +1124,7 @@ type CreateJobRequest struct { // 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 { - // Specifies the Autoscale settings. + // Specifies the Autoscale settings. Note: Either throughput or autoscaleSettings is required, but not both. AutoscaleSettings *AutoscaleSettings // Request Units per second. For example, "throughput": 10000. @@ -1496,16 +1205,6 @@ type DataCenterResourceProperties struct { SeedNodes []*SeedNode } -// 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, *CassandraDataTransferDataSourceSink, *DataTransferDataSourceSink, *MongoDataTransferDataSourceSink, -// - *SQLDataTransferDataSourceSink -type DataTransferDataSourceSinkClassification interface { - // GetDataTransferDataSourceSink returns the DataTransferDataSourceSink content of the underlying type. - GetDataTransferDataSourceSink() *DataTransferDataSourceSink -} - // DataTransferDataSourceSink - Base class for all DataTransfer source/sink type DataTransferDataSourceSink struct { // REQUIRED @@ -1571,37 +1270,6 @@ type DataTransferJobProperties struct { TotalCount *int64 } -// DataTransferJobsClientCancelOptions contains the optional parameters for the DataTransferJobsClient.Cancel method. -type DataTransferJobsClientCancelOptions 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 -} - // DataTransferRegionalServiceResource - Resource for a regional service location. type DataTransferRegionalServiceResource struct { // READ-ONLY; The location name. @@ -1647,12 +1315,12 @@ type DataTransferServiceResourceProperties struct { // GetServiceResourceProperties implements the ServiceResourcePropertiesClassification interface for type DataTransferServiceResourceProperties. func (d *DataTransferServiceResourceProperties) GetServiceResourceProperties() *ServiceResourceProperties { return &ServiceResourceProperties{ + AdditionalProperties: d.AdditionalProperties, CreationTime: d.CreationTime, - InstanceSize: d.InstanceSize, InstanceCount: d.InstanceCount, + InstanceSize: d.InstanceSize, ServiceType: d.ServiceType, Status: d.Status, - AdditionalProperties: d.AdditionalProperties, } } @@ -1738,11 +1406,18 @@ type DatabaseAccountCreateUpdateProperties struct { // Enum to indicate the mode of account creation. CreateMode *CreateMode + // Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides + // troubleshooting guidance. + CustomerManagedKeyStatus *CustomerManagedKeyStatus + // The default identity for accessing key vault used in features like customer managed keys. The default identity needs to // be explicitly set by the users. It can be "FirstPartyIdentity", // "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 @@ -1778,6 +1453,9 @@ type DatabaseAccountCreateUpdateProperties struct { // Flag to indicate enabling/disabling of Partition Merge feature on the account EnablePartitionMerge *bool + // Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account + EnablePriorityBasedExecution *bool + // List of IpRules. IPRules []*IPAddressOrRange @@ -1840,11 +1518,18 @@ type DatabaseAccountGetProperties struct { // Enum to indicate the mode of account creation. CreateMode *CreateMode + // Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides + // troubleshooting guidance. + CustomerManagedKeyStatus *CustomerManagedKeyStatus + // The default identity for accessing key vault used in features like customer managed keys. The default identity needs to // be explicitly set by the users. It can be "FirstPartyIdentity", // "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 @@ -1880,6 +1565,9 @@ type DatabaseAccountGetProperties struct { // Flag to indicate enabling/disabling of Partition Merge feature on the account EnablePartitionMerge *bool + // Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account + EnablePriorityBasedExecution *bool + // List of IpRules. IPRules []*IPAddressOrRange @@ -2029,12 +1717,6 @@ type DatabaseAccountRegenerateKeyParameters struct { KeyKind *KeyKind } -// DatabaseAccountRegionClientListMetricsOptions contains the optional parameters for the DatabaseAccountRegionClient.NewListMetricsPager -// method. -type DatabaseAccountRegionClientListMetricsOptions struct { - // placeholder for future optional parameters -} - // DatabaseAccountUpdateParameters - Parameters for patching Azure Cosmos DB database account properties. type DatabaseAccountUpdateParameters struct { // Identity for the resource. @@ -2080,11 +1762,18 @@ type DatabaseAccountUpdateProperties struct { // The CORS policy for the Cosmos DB database account. Cors []*CorsPolicy + // Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides + // troubleshooting guidance. + CustomerManagedKeyStatus *CustomerManagedKeyStatus + // The default identity for accessing key vault used in features like customer managed keys. The default identity needs to // be explicitly set by the users. It can be "FirstPartyIdentity", // "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 @@ -2120,6 +1809,9 @@ type DatabaseAccountUpdateProperties struct { // Flag to indicate enabling/disabling of Partition Merge feature on the account EnablePartitionMerge *bool + // Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account + EnablePriorityBasedExecution *bool + // List of IpRules. IPRules []*IPAddressOrRange @@ -2153,142 +1845,12 @@ type DatabaseAccountUpdateProperties struct { KeysMetadata *DatabaseAccountKeysMetadata } -// DatabaseAccountsClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabaseAccountsClient.BeginCreateOrUpdate -// method. -type DatabaseAccountsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabaseAccountsClientBeginDeleteOptions contains the optional parameters for the DatabaseAccountsClient.BeginDelete method. -type DatabaseAccountsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabaseAccountsClientBeginFailoverPriorityChangeOptions contains the optional parameters for the DatabaseAccountsClient.BeginFailoverPriorityChange -// method. -type DatabaseAccountsClientBeginFailoverPriorityChangeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabaseAccountsClientBeginOfflineRegionOptions contains the optional parameters for the DatabaseAccountsClient.BeginOfflineRegion -// method. -type DatabaseAccountsClientBeginOfflineRegionOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabaseAccountsClientBeginOnlineRegionOptions contains the optional parameters for the DatabaseAccountsClient.BeginOnlineRegion -// method. -type DatabaseAccountsClientBeginOnlineRegionOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabaseAccountsClientBeginRegenerateKeyOptions contains the optional parameters for the DatabaseAccountsClient.BeginRegenerateKey -// method. -type DatabaseAccountsClientBeginRegenerateKeyOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabaseAccountsClientBeginUpdateOptions contains the optional parameters for the DatabaseAccountsClient.BeginUpdate method. -type DatabaseAccountsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabaseAccountsClientCheckNameExistsOptions contains the optional parameters for the DatabaseAccountsClient.CheckNameExists -// method. -type DatabaseAccountsClientCheckNameExistsOptions struct { - // placeholder for future optional parameters -} - -// DatabaseAccountsClientGetOptions contains the optional parameters for the DatabaseAccountsClient.Get method. -type DatabaseAccountsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DatabaseAccountsClientGetReadOnlyKeysOptions contains the optional parameters for the DatabaseAccountsClient.GetReadOnlyKeys -// method. -type DatabaseAccountsClientGetReadOnlyKeysOptions struct { - // placeholder for future optional parameters -} - -// DatabaseAccountsClientListByResourceGroupOptions contains the optional parameters for the DatabaseAccountsClient.NewListByResourceGroupPager -// method. -type DatabaseAccountsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// DatabaseAccountsClientListConnectionStringsOptions contains the optional parameters for the DatabaseAccountsClient.ListConnectionStrings -// method. -type DatabaseAccountsClientListConnectionStringsOptions struct { - // placeholder for future optional parameters -} - -// DatabaseAccountsClientListKeysOptions contains the optional parameters for the DatabaseAccountsClient.ListKeys method. -type DatabaseAccountsClientListKeysOptions struct { - // placeholder for future optional parameters -} - -// DatabaseAccountsClientListMetricDefinitionsOptions contains the optional parameters for the DatabaseAccountsClient.NewListMetricDefinitionsPager -// method. -type DatabaseAccountsClientListMetricDefinitionsOptions struct { - // placeholder for future optional parameters -} - -// DatabaseAccountsClientListMetricsOptions contains the optional parameters for the DatabaseAccountsClient.NewListMetricsPager -// method. -type DatabaseAccountsClientListMetricsOptions struct { - // placeholder for future optional parameters -} - -// DatabaseAccountsClientListOptions contains the optional parameters for the DatabaseAccountsClient.NewListPager method. -type DatabaseAccountsClientListOptions struct { - // placeholder for future optional parameters -} - -// DatabaseAccountsClientListReadOnlyKeysOptions contains the optional parameters for the DatabaseAccountsClient.ListReadOnlyKeys -// method. -type DatabaseAccountsClientListReadOnlyKeysOptions struct { - // placeholder for future optional parameters -} - -// DatabaseAccountsClientListUsagesOptions contains the optional parameters for the DatabaseAccountsClient.NewListUsagesPager -// method. -type DatabaseAccountsClientListUsagesOptions struct { - // An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of - // the metric, can have an or of multiple names). - Filter *string -} - // DatabaseAccountsListResult - The List operation response, that contains the database accounts and their properties. type DatabaseAccountsListResult struct { // READ-ONLY; List of database account and their properties. Value []*DatabaseAccountGetResults } -// DatabaseClientListMetricDefinitionsOptions contains the optional parameters for the DatabaseClient.NewListMetricDefinitionsPager -// method. -type DatabaseClientListMetricDefinitionsOptions struct { - // placeholder for future optional parameters -} - -// DatabaseClientListMetricsOptions contains the optional parameters for the DatabaseClient.NewListMetricsPager method. -type DatabaseClientListMetricsOptions struct { - // placeholder for future optional parameters -} - -// DatabaseClientListUsagesOptions contains the optional parameters for the DatabaseClient.NewListUsagesPager method. -type DatabaseClientListUsagesOptions struct { - // An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of - // the metric, can have an or of multiple names). - Filter *string -} - // DatabaseRestoreResource - Specific Databases to restore. type DatabaseRestoreResource struct { // The names of the collections available for restore. @@ -2475,12 +2037,12 @@ type GraphAPIComputeServiceResourceProperties struct { // GetServiceResourceProperties implements the ServiceResourcePropertiesClassification interface for type GraphAPIComputeServiceResourceProperties. func (g *GraphAPIComputeServiceResourceProperties) GetServiceResourceProperties() *ServiceResourceProperties { return &ServiceResourceProperties{ + AdditionalProperties: g.AdditionalProperties, CreationTime: g.CreationTime, - InstanceSize: g.InstanceSize, InstanceCount: g.InstanceCount, + InstanceSize: g.InstanceSize, ServiceType: g.ServiceType, Status: g.Status, - AdditionalProperties: g.AdditionalProperties, } } @@ -2575,31 +2137,6 @@ type GraphResourceGetResults struct { Type *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 -} - // 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. @@ -2889,119 +2426,6 @@ type GremlinGraphResource struct { UniqueKeyPolicy *UniqueKeyPolicy } -// GremlinResourcesClientBeginCreateUpdateGremlinDatabaseOptions contains the optional parameters for the GremlinResourcesClient.BeginCreateUpdateGremlinDatabase -// method. -type GremlinResourcesClientBeginCreateUpdateGremlinDatabaseOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GremlinResourcesClientBeginCreateUpdateGremlinGraphOptions contains the optional parameters for the GremlinResourcesClient.BeginCreateUpdateGremlinGraph -// method. -type GremlinResourcesClientBeginCreateUpdateGremlinGraphOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GremlinResourcesClientBeginDeleteGremlinDatabaseOptions contains the optional parameters for the GremlinResourcesClient.BeginDeleteGremlinDatabase -// method. -type GremlinResourcesClientBeginDeleteGremlinDatabaseOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GremlinResourcesClientBeginDeleteGremlinGraphOptions contains the optional parameters for the GremlinResourcesClient.BeginDeleteGremlinGraph -// method. -type GremlinResourcesClientBeginDeleteGremlinGraphOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GremlinResourcesClientBeginMigrateGremlinDatabaseToAutoscaleOptions contains the optional parameters for the GremlinResourcesClient.BeginMigrateGremlinDatabaseToAutoscale -// method. -type GremlinResourcesClientBeginMigrateGremlinDatabaseToAutoscaleOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GremlinResourcesClientBeginMigrateGremlinDatabaseToManualThroughputOptions contains the optional parameters for the GremlinResourcesClient.BeginMigrateGremlinDatabaseToManualThroughput -// method. -type GremlinResourcesClientBeginMigrateGremlinDatabaseToManualThroughputOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GremlinResourcesClientBeginMigrateGremlinGraphToAutoscaleOptions contains the optional parameters for the GremlinResourcesClient.BeginMigrateGremlinGraphToAutoscale -// method. -type GremlinResourcesClientBeginMigrateGremlinGraphToAutoscaleOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GremlinResourcesClientBeginMigrateGremlinGraphToManualThroughputOptions contains the optional parameters for the GremlinResourcesClient.BeginMigrateGremlinGraphToManualThroughput -// method. -type GremlinResourcesClientBeginMigrateGremlinGraphToManualThroughputOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GremlinResourcesClientBeginRetrieveContinuousBackupInformationOptions contains the optional parameters for the GremlinResourcesClient.BeginRetrieveContinuousBackupInformation -// method. -type GremlinResourcesClientBeginRetrieveContinuousBackupInformationOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GremlinResourcesClientBeginUpdateGremlinDatabaseThroughputOptions contains the optional parameters for the GremlinResourcesClient.BeginUpdateGremlinDatabaseThroughput -// method. -type GremlinResourcesClientBeginUpdateGremlinDatabaseThroughputOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GremlinResourcesClientBeginUpdateGremlinGraphThroughputOptions contains the optional parameters for the GremlinResourcesClient.BeginUpdateGremlinGraphThroughput -// method. -type GremlinResourcesClientBeginUpdateGremlinGraphThroughputOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// GremlinResourcesClientGetGremlinDatabaseOptions contains the optional parameters for the GremlinResourcesClient.GetGremlinDatabase -// method. -type GremlinResourcesClientGetGremlinDatabaseOptions struct { - // placeholder for future optional parameters -} - -// GremlinResourcesClientGetGremlinDatabaseThroughputOptions contains the optional parameters for the GremlinResourcesClient.GetGremlinDatabaseThroughput -// method. -type GremlinResourcesClientGetGremlinDatabaseThroughputOptions struct { - // placeholder for future optional parameters -} - -// GremlinResourcesClientGetGremlinGraphOptions contains the optional parameters for the GremlinResourcesClient.GetGremlinGraph -// method. -type GremlinResourcesClientGetGremlinGraphOptions struct { - // placeholder for future optional parameters -} - -// GremlinResourcesClientGetGremlinGraphThroughputOptions contains the optional parameters for the GremlinResourcesClient.GetGremlinGraphThroughput -// method. -type GremlinResourcesClientGetGremlinGraphThroughputOptions struct { - // placeholder for future optional parameters -} - -// GremlinResourcesClientListGremlinDatabasesOptions contains the optional parameters for the GremlinResourcesClient.NewListGremlinDatabasesPager -// method. -type GremlinResourcesClientListGremlinDatabasesOptions struct { - // placeholder for future optional parameters -} - -// GremlinResourcesClientListGremlinGraphsOptions contains the optional parameters for the GremlinResourcesClient.NewListGremlinGraphsPager -// method. -type GremlinResourcesClientListGremlinGraphsOptions struct { - // placeholder for future optional parameters -} - // IPAddressOrRange - IpAddressOrRange object type IPAddressOrRange struct { // A single IPv4 address or a single IPv4 address range in CIDR format. Provided IPs must be well-formatted and cannot be @@ -3163,16 +2587,6 @@ type LocationProperties struct { SupportsAvailabilityZone *bool } -// LocationsClientGetOptions contains the optional parameters for the LocationsClient.Get method. -type LocationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// LocationsClientListOptions contains the optional parameters for the LocationsClient.NewListPager method. -type LocationsClientListOptions struct { - // placeholder for future optional parameters -} - // ManagedCassandraARMResourceProperties - The core properties of ARM resources. type ManagedCassandraARMResourceProperties struct { // Identity for the resource. @@ -3298,12 +2712,12 @@ type MaterializedViewsBuilderServiceResourceProperties struct { // GetServiceResourceProperties implements the ServiceResourcePropertiesClassification interface for type MaterializedViewsBuilderServiceResourceProperties. func (m *MaterializedViewsBuilderServiceResourceProperties) GetServiceResourceProperties() *ServiceResourceProperties { return &ServiceResourceProperties{ + AdditionalProperties: m.AdditionalProperties, CreationTime: m.CreationTime, - InstanceSize: m.InstanceSize, InstanceCount: m.InstanceCount, + InstanceSize: m.InstanceSize, ServiceType: m.ServiceType, Status: m.Status, - AdditionalProperties: m.AdditionalProperties, } } @@ -3487,89 +2901,16 @@ type MongoClusterUpdate struct { Tags map[string]*string } -// MongoClustersClientBeginCreateOrUpdateFirewallRuleOptions contains the optional parameters for the MongoClustersClient.BeginCreateOrUpdateFirewallRule -// method. -type MongoClustersClientBeginCreateOrUpdateFirewallRuleOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MongoClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the MongoClustersClient.BeginCreateOrUpdate -// method. -type MongoClustersClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} +// MongoDBCollectionCreateUpdateParameters - Parameters to create and update Cosmos DB MongoDB collection. +type MongoDBCollectionCreateUpdateParameters struct { + // REQUIRED; Properties to create and update Azure Cosmos DB MongoDB collection. + Properties *MongoDBCollectionCreateUpdateProperties -// MongoClustersClientBeginDeleteFirewallRuleOptions contains the optional parameters for the MongoClustersClient.BeginDeleteFirewallRule -// method. -type MongoClustersClientBeginDeleteFirewallRuleOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} + // Identity for the resource. + Identity *ManagedServiceIdentity -// MongoClustersClientBeginDeleteOptions contains the optional parameters for the MongoClustersClient.BeginDelete method. -type MongoClustersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MongoClustersClientBeginUpdateOptions contains the optional parameters for the MongoClustersClient.BeginUpdate method. -type MongoClustersClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MongoClustersClientCheckNameAvailabilityOptions contains the optional parameters for the MongoClustersClient.CheckNameAvailability -// method. -type MongoClustersClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// MongoClustersClientGetFirewallRuleOptions contains the optional parameters for the MongoClustersClient.GetFirewallRule -// method. -type MongoClustersClientGetFirewallRuleOptions struct { - // placeholder for future optional parameters -} - -// MongoClustersClientGetOptions contains the optional parameters for the MongoClustersClient.Get method. -type MongoClustersClientGetOptions struct { - // placeholder for future optional parameters -} - -// MongoClustersClientListByResourceGroupOptions contains the optional parameters for the MongoClustersClient.NewListByResourceGroupPager -// method. -type MongoClustersClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// MongoClustersClientListConnectionStringsOptions contains the optional parameters for the MongoClustersClient.ListConnectionStrings -// method. -type MongoClustersClientListConnectionStringsOptions struct { - // placeholder for future optional parameters -} - -// MongoClustersClientListFirewallRulesOptions contains the optional parameters for the MongoClustersClient.NewListFirewallRulesPager -// method. -type MongoClustersClientListFirewallRulesOptions struct { - // placeholder for future optional parameters -} - -// MongoClustersClientListOptions contains the optional parameters for the MongoClustersClient.NewListPager method. -type MongoClustersClientListOptions struct { - // placeholder for future optional parameters -} - -// MongoDBCollectionCreateUpdateParameters - Parameters to create and update Cosmos DB MongoDB collection. -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 + // 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 @@ -3814,214 +3155,7 @@ type MongoDBDatabaseResource struct { RestoreParameters *ResourceRestoreParameters } -// MongoDBResourcesClientBeginCreateUpdateMongoDBCollectionOptions contains the optional parameters for the MongoDBResourcesClient.BeginCreateUpdateMongoDBCollection -// method. -type MongoDBResourcesClientBeginCreateUpdateMongoDBCollectionOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MongoDBResourcesClientBeginCreateUpdateMongoDBDatabaseOptions contains the optional parameters for the MongoDBResourcesClient.BeginCreateUpdateMongoDBDatabase -// method. -type MongoDBResourcesClientBeginCreateUpdateMongoDBDatabaseOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MongoDBResourcesClientBeginCreateUpdateMongoRoleDefinitionOptions contains the optional parameters for the MongoDBResourcesClient.BeginCreateUpdateMongoRoleDefinition -// method. -type MongoDBResourcesClientBeginCreateUpdateMongoRoleDefinitionOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MongoDBResourcesClientBeginCreateUpdateMongoUserDefinitionOptions contains the optional parameters for the MongoDBResourcesClient.BeginCreateUpdateMongoUserDefinition -// method. -type MongoDBResourcesClientBeginCreateUpdateMongoUserDefinitionOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MongoDBResourcesClientBeginDeleteMongoDBCollectionOptions contains the optional parameters for the MongoDBResourcesClient.BeginDeleteMongoDBCollection -// method. -type MongoDBResourcesClientBeginDeleteMongoDBCollectionOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MongoDBResourcesClientBeginDeleteMongoDBDatabaseOptions contains the optional parameters for the MongoDBResourcesClient.BeginDeleteMongoDBDatabase -// method. -type MongoDBResourcesClientBeginDeleteMongoDBDatabaseOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MongoDBResourcesClientBeginDeleteMongoRoleDefinitionOptions contains the optional parameters for the MongoDBResourcesClient.BeginDeleteMongoRoleDefinition -// method. -type MongoDBResourcesClientBeginDeleteMongoRoleDefinitionOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MongoDBResourcesClientBeginDeleteMongoUserDefinitionOptions contains the optional parameters for the MongoDBResourcesClient.BeginDeleteMongoUserDefinition -// method. -type MongoDBResourcesClientBeginDeleteMongoUserDefinitionOptions struct { - // Resumes the LRO from the provided token. - 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 { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MongoDBResourcesClientBeginMigrateMongoDBCollectionToManualThroughputOptions contains the optional parameters for the MongoDBResourcesClient.BeginMigrateMongoDBCollectionToManualThroughput -// method. -type MongoDBResourcesClientBeginMigrateMongoDBCollectionToManualThroughputOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MongoDBResourcesClientBeginMigrateMongoDBDatabaseToAutoscaleOptions contains the optional parameters for the MongoDBResourcesClient.BeginMigrateMongoDBDatabaseToAutoscale -// method. -type MongoDBResourcesClientBeginMigrateMongoDBDatabaseToAutoscaleOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MongoDBResourcesClientBeginMigrateMongoDBDatabaseToManualThroughputOptions contains the optional parameters for the MongoDBResourcesClient.BeginMigrateMongoDBDatabaseToManualThroughput -// method. -type MongoDBResourcesClientBeginMigrateMongoDBDatabaseToManualThroughputOptions struct { - // Resumes the LRO from the provided token. - 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 { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MongoDBResourcesClientBeginUpdateMongoDBCollectionThroughputOptions contains the optional parameters for the MongoDBResourcesClient.BeginUpdateMongoDBCollectionThroughput -// method. -type MongoDBResourcesClientBeginUpdateMongoDBCollectionThroughputOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MongoDBResourcesClientBeginUpdateMongoDBDatabaseThroughputOptions contains the optional parameters for the MongoDBResourcesClient.BeginUpdateMongoDBDatabaseThroughput -// method. -type MongoDBResourcesClientBeginUpdateMongoDBDatabaseThroughputOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// MongoDBResourcesClientGetMongoDBCollectionOptions contains the optional parameters for the MongoDBResourcesClient.GetMongoDBCollection -// method. -type MongoDBResourcesClientGetMongoDBCollectionOptions struct { - // placeholder for future optional parameters -} - -// MongoDBResourcesClientGetMongoDBCollectionThroughputOptions contains the optional parameters for the MongoDBResourcesClient.GetMongoDBCollectionThroughput -// method. -type MongoDBResourcesClientGetMongoDBCollectionThroughputOptions struct { - // placeholder for future optional parameters -} - -// MongoDBResourcesClientGetMongoDBDatabaseOptions contains the optional parameters for the MongoDBResourcesClient.GetMongoDBDatabase -// method. -type MongoDBResourcesClientGetMongoDBDatabaseOptions struct { - // placeholder for future optional parameters -} - -// MongoDBResourcesClientGetMongoDBDatabaseThroughputOptions contains the optional parameters for the MongoDBResourcesClient.GetMongoDBDatabaseThroughput -// method. -type MongoDBResourcesClientGetMongoDBDatabaseThroughputOptions struct { - // placeholder for future optional parameters -} - -// MongoDBResourcesClientGetMongoRoleDefinitionOptions contains the optional parameters for the MongoDBResourcesClient.GetMongoRoleDefinition -// method. -type MongoDBResourcesClientGetMongoRoleDefinitionOptions struct { - // placeholder for future optional parameters -} - -// MongoDBResourcesClientGetMongoUserDefinitionOptions contains the optional parameters for the MongoDBResourcesClient.GetMongoUserDefinition -// method. -type MongoDBResourcesClientGetMongoUserDefinitionOptions struct { - // placeholder for future optional parameters -} - -// MongoDBResourcesClientListMongoDBCollectionsOptions contains the optional parameters for the MongoDBResourcesClient.NewListMongoDBCollectionsPager -// method. -type MongoDBResourcesClientListMongoDBCollectionsOptions struct { - // placeholder for future optional parameters -} - -// MongoDBResourcesClientListMongoDBDatabasesOptions contains the optional parameters for the MongoDBResourcesClient.NewListMongoDBDatabasesPager -// method. -type MongoDBResourcesClientListMongoDBDatabasesOptions struct { - // placeholder for future optional parameters -} - -// MongoDBResourcesClientListMongoRoleDefinitionsOptions contains the optional parameters for the MongoDBResourcesClient.NewListMongoRoleDefinitionsPager -// method. -type MongoDBResourcesClientListMongoRoleDefinitionsOptions struct { - // placeholder for future optional parameters -} - -// MongoDBResourcesClientListMongoUserDefinitionsOptions contains the optional parameters for the MongoDBResourcesClient.NewListMongoUserDefinitionsPager -// method. -type MongoDBResourcesClientListMongoUserDefinitionsOptions struct { - // placeholder for future optional parameters -} - -// MongoDataTransferDataSourceSink - A CosmosDB Cassandra API data source/sink +// MongoDataTransferDataSourceSink - A CosmosDB Mongo API data source/sink type MongoDataTransferDataSourceSink struct { // REQUIRED CollectionName *string @@ -4030,7 +3164,8 @@ type MongoDataTransferDataSourceSink struct { Component *DataTransferComponent // REQUIRED - DatabaseName *string + DatabaseName *string + RemoteAccountName *string } // GetDataTransferDataSourceSink implements the DataTransferDataSourceSinkClassification interface for type MongoDataTransferDataSourceSink. @@ -4242,51 +3377,6 @@ type NotebookWorkspaceProperties struct { Status *string } -// NotebookWorkspacesClientBeginCreateOrUpdateOptions contains the optional parameters for the NotebookWorkspacesClient.BeginCreateOrUpdate -// method. -type NotebookWorkspacesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// NotebookWorkspacesClientBeginDeleteOptions contains the optional parameters for the NotebookWorkspacesClient.BeginDelete -// method. -type NotebookWorkspacesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// NotebookWorkspacesClientBeginRegenerateAuthTokenOptions contains the optional parameters for the NotebookWorkspacesClient.BeginRegenerateAuthToken -// method. -type NotebookWorkspacesClientBeginRegenerateAuthTokenOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// NotebookWorkspacesClientBeginStartOptions contains the optional parameters for the NotebookWorkspacesClient.BeginStart -// method. -type NotebookWorkspacesClientBeginStartOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// NotebookWorkspacesClientGetOptions contains the optional parameters for the NotebookWorkspacesClient.Get method. -type NotebookWorkspacesClientGetOptions struct { - // placeholder for future optional parameters -} - -// NotebookWorkspacesClientListByDatabaseAccountOptions contains the optional parameters for the NotebookWorkspacesClient.NewListByDatabaseAccountPager -// method. -type NotebookWorkspacesClientListByDatabaseAccountOptions struct { - // placeholder for future optional parameters -} - -// NotebookWorkspacesClientListConnectionInfoOptions contains the optional parameters for the NotebookWorkspacesClient.ListConnectionInfo -// method. -type NotebookWorkspacesClientListConnectionInfoOptions struct { - // placeholder for future optional parameters -} - // Operation - REST API operation type Operation struct { // The object that represents the operation. @@ -4321,11 +3411,6 @@ type OperationListResult struct { Value []*Operation } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // OptionsResource - Cosmos DB options resource object type OptionsResource struct { // Specifies the Autoscale settings. @@ -4336,18 +3421,6 @@ type OptionsResource struct { Throughput *int32 } -// PartitionKeyRangeIDClientListMetricsOptions contains the optional parameters for the PartitionKeyRangeIDClient.NewListMetricsPager -// method. -type PartitionKeyRangeIDClientListMetricsOptions struct { - // placeholder for future optional parameters -} - -// PartitionKeyRangeIDRegionClientListMetricsOptions contains the optional parameters for the PartitionKeyRangeIDRegionClient.NewListMetricsPager -// method. -type PartitionKeyRangeIDRegionClientListMetricsOptions struct { - // placeholder for future optional parameters -} - // PartitionMetric - The metric values for a single partition. type PartitionMetric struct { // READ-ONLY; The end time for the metric (ISO-8601 format). @@ -4411,11 +3484,6 @@ type PartitionUsagesResult struct { Value []*PartitionUsage } -// PercentileClientListMetricsOptions contains the optional parameters for the PercentileClient.NewListMetricsPager method. -type PercentileClientListMetricsOptions struct { - // placeholder for future optional parameters -} - // PercentileMetric - Percentile Metric data type PercentileMetric struct { // READ-ONLY; The end time for the metric (ISO-8601 format). @@ -4485,18 +3553,6 @@ type PercentileMetricValue struct { Total *float64 } -// PercentileSourceTargetClientListMetricsOptions contains the optional parameters for the PercentileSourceTargetClient.NewListMetricsPager -// method. -type PercentileSourceTargetClientListMetricsOptions struct { - // placeholder for future optional parameters -} - -// PercentileTargetClientListMetricsOptions contains the optional parameters for the PercentileTargetClient.NewListMetricsPager -// method. -type PercentileTargetClientListMetricsOptions struct { - // placeholder for future optional parameters -} - // PeriodicModeBackupPolicy - The object representing periodic mode backup policy. type PeriodicModeBackupPolicy struct { // REQUIRED; Describes the mode of backups. @@ -4512,8 +3568,8 @@ type PeriodicModeBackupPolicy struct { // GetBackupPolicy implements the BackupPolicyClassification interface for type PeriodicModeBackupPolicy. func (p *PeriodicModeBackupPolicy) GetBackupPolicy() *BackupPolicy { return &BackupPolicy{ - Type: p.Type, MigrationState: p.MigrationState, + Type: p.Type, } } @@ -4652,32 +3708,6 @@ type PrivateEndpointConnectionProperties struct { ProvisioningState *string } -// PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate -// method. -type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. -type PrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. -type PrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientListByDatabaseAccountOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByDatabaseAccountPager -// method. -type PrivateEndpointConnectionsClientListByDatabaseAccountOptions struct { - // placeholder for future optional parameters -} - // PrivateEndpointProperty - Private endpoint which the connection belongs to. type PrivateEndpointProperty struct { // Resource id of the private endpoint. @@ -4717,17 +3747,6 @@ type PrivateLinkResourceProperties struct { RequiredZoneNames []*string } -// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. -type PrivateLinkResourcesClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkResourcesClientListByDatabaseAccountOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByDatabaseAccountPager -// method. -type PrivateLinkResourcesClientListByDatabaseAccountOptions struct { - // placeholder for future optional parameters -} - // PrivateLinkServiceConnectionStateProperty - Connection State of the Private Endpoint Connection. type PrivateLinkServiceConnectionStateProperty struct { // The private link service connection description. @@ -4927,24 +3946,6 @@ type RestorableDatabaseAccountProperties struct { RestorableLocations []*RestorableLocationResource } -// RestorableDatabaseAccountsClientGetByLocationOptions contains the optional parameters for the RestorableDatabaseAccountsClient.GetByLocation -// method. -type RestorableDatabaseAccountsClientGetByLocationOptions struct { - // placeholder for future optional parameters -} - -// RestorableDatabaseAccountsClientListByLocationOptions contains the optional parameters for the RestorableDatabaseAccountsClient.NewListByLocationPager -// method. -type RestorableDatabaseAccountsClientListByLocationOptions struct { - // placeholder for future optional parameters -} - -// RestorableDatabaseAccountsClientListOptions contains the optional parameters for the RestorableDatabaseAccountsClient.NewListPager -// method. -type RestorableDatabaseAccountsClientListOptions struct { - // placeholder for future optional parameters -} - // RestorableDatabaseAccountsListResult - The List operation response, that contains the restorable database accounts and // their properties. type RestorableDatabaseAccountsListResult struct { @@ -4991,12 +3992,6 @@ type RestorableGremlinDatabasePropertiesResource struct { Rid *string } -// RestorableGremlinDatabasesClientListOptions contains the optional parameters for the RestorableGremlinDatabasesClient.NewListPager -// method. -type RestorableGremlinDatabasesClientListOptions struct { - // placeholder for future optional parameters -} - // RestorableGremlinDatabasesListResult - The List operation response, that contains the Gremlin database events and their // properties. type RestorableGremlinDatabasesListResult struct { @@ -5043,32 +4038,12 @@ type RestorableGremlinGraphPropertiesResource struct { Rid *string } -// RestorableGremlinGraphsClientListOptions contains the optional parameters for the RestorableGremlinGraphsClient.NewListPager -// method. -type RestorableGremlinGraphsClientListOptions struct { - // Restorable Gremlin graphs event feed end time. - EndTime *string - // The resource ID of the Gremlin database. - RestorableGremlinDatabaseRid *string - // Restorable Gremlin graphs event feed start time. - StartTime *string -} - // RestorableGremlinGraphsListResult - The List operation response, that contains the Gremlin graph events and their properties. type RestorableGremlinGraphsListResult struct { // READ-ONLY; List of Gremlin graph events and their properties. Value []*RestorableGremlinGraphGetResult } -// RestorableGremlinResourcesClientListOptions contains the optional parameters for the RestorableGremlinResourcesClient.NewListPager -// method. -type RestorableGremlinResourcesClientListOptions struct { - // The location where the restorable resources are located. - RestoreLocation *string - // The timestamp when the restorable resources existed. - RestoreTimestampInUTC *string -} - // RestorableGremlinResourcesGetResult - Specific Databases to restore. type RestorableGremlinResourcesGetResult struct { // The name of the gremlin database available for restore. @@ -5147,17 +4122,6 @@ type RestorableMongodbCollectionPropertiesResource struct { Rid *string } -// RestorableMongodbCollectionsClientListOptions contains the optional parameters for the RestorableMongodbCollectionsClient.NewListPager -// method. -type RestorableMongodbCollectionsClientListOptions struct { - // Restorable MongoDB collections event feed end time. - EndTime *string - // The resource ID of the MongoDB database. - RestorableMongodbDatabaseRid *string - // Restorable MongoDB collections event feed start time. - StartTime *string -} - // RestorableMongodbCollectionsListResult - The List operation response, that contains the MongoDB collection events and their // properties. type RestorableMongodbCollectionsListResult struct { @@ -5204,12 +4168,6 @@ type RestorableMongodbDatabasePropertiesResource struct { Rid *string } -// RestorableMongodbDatabasesClientListOptions contains the optional parameters for the RestorableMongodbDatabasesClient.NewListPager -// method. -type RestorableMongodbDatabasesClientListOptions struct { - // placeholder for future optional parameters -} - // RestorableMongodbDatabasesListResult - The List operation response, that contains the MongoDB database events and their // properties. type RestorableMongodbDatabasesListResult struct { @@ -5217,15 +4175,6 @@ type RestorableMongodbDatabasesListResult struct { Value []*RestorableMongodbDatabaseGetResult } -// RestorableMongodbResourcesClientListOptions contains the optional parameters for the RestorableMongodbResourcesClient.NewListPager -// method. -type RestorableMongodbResourcesClientListOptions struct { - // The location where the restorable resources are located. - RestoreLocation *string - // The timestamp when the restorable resources existed. - RestoreTimestampInUTC *string -} - // RestorableMongodbResourcesGetResult - Specific Databases to restore. type RestorableMongodbResourcesGetResult struct { // The names of the collections available for restore. @@ -5341,17 +4290,6 @@ type RestorableSQLContainerPropertiesResourceContainer struct { Ts *float32 } -// RestorableSQLContainersClientListOptions contains the optional parameters for the RestorableSQLContainersClient.NewListPager -// method. -type RestorableSQLContainersClientListOptions struct { - // Restorable Sql containers event feed end time. - EndTime *string - // The resource ID of the SQL database. - RestorableSQLDatabaseRid *string - // Restorable Sql containers event feed start time. - StartTime *string -} - // RestorableSQLContainersListResult - The List operation response, that contains the SQL container events and their properties. type RestorableSQLContainersListResult struct { // READ-ONLY; List of SQL container events and their properties. @@ -5430,27 +4368,12 @@ type RestorableSQLDatabasePropertiesResourceDatabase struct { Users *string } -// RestorableSQLDatabasesClientListOptions contains the optional parameters for the RestorableSQLDatabasesClient.NewListPager -// method. -type RestorableSQLDatabasesClientListOptions struct { - // placeholder for future optional parameters -} - // RestorableSQLDatabasesListResult - The List operation response, that contains the SQL database events and their properties. type RestorableSQLDatabasesListResult struct { // READ-ONLY; List of SQL database events and their properties. Value []*RestorableSQLDatabaseGetResult } -// RestorableSQLResourcesClientListOptions contains the optional parameters for the RestorableSQLResourcesClient.NewListPager -// method. -type RestorableSQLResourcesClientListOptions struct { - // The location where the restorable resources are located. - RestoreLocation *string - // The timestamp when the restorable resources existed. - RestoreTimestampInUTC *string -} - // RestorableSQLResourcesGetResult - Specific Databases to restore. type RestorableSQLResourcesGetResult struct { // The names of the collections available for restore. @@ -5514,15 +4437,6 @@ type RestorableTablePropertiesResource struct { Rid *string } -// RestorableTableResourcesClientListOptions contains the optional parameters for the RestorableTableResourcesClient.NewListPager -// method. -type RestorableTableResourcesClientListOptions struct { - // The location where the restorable resources are located. - RestoreLocation *string - // The timestamp when the restorable resources existed. - RestoreTimestampInUTC *string -} - // RestorableTableResourcesGetResult - Specific Databases to restore. type RestorableTableResourcesGetResult struct { // READ-ONLY; The unique resource identifier of the ARM resource. @@ -5541,14 +4455,6 @@ type RestorableTableResourcesListResult struct { Value []*RestorableTableResourcesGetResult } -// RestorableTablesClientListOptions contains the optional parameters for the RestorableTablesClient.NewListPager method. -type RestorableTablesClientListOptions struct { - // Restorable Tables event feed end time. - EndTime *string - // Restorable Tables event feed start time. - StartTime *string -} - // RestorableTablesListResult - The List operation response, that contains the Table events and their properties. type RestorableTablesListResult struct { // READ-ONLY; List of Table events and their properties. @@ -5807,7 +4713,7 @@ type SQLContainerResource struct { UniqueKeyPolicy *UniqueKeyPolicy } -// SQLDataTransferDataSourceSink - A CosmosDB Cassandra API data source/sink +// SQLDataTransferDataSourceSink - A CosmosDB No Sql API data source/sink type SQLDataTransferDataSourceSink struct { // REQUIRED Component *DataTransferComponent @@ -5816,7 +4722,8 @@ type SQLDataTransferDataSourceSink struct { ContainerName *string // REQUIRED - DatabaseName *string + DatabaseName *string + RemoteAccountName *string } // GetDataTransferDataSourceSink implements the DataTransferDataSourceSinkClassification interface for type SQLDataTransferDataSourceSink. @@ -6001,316 +4908,15 @@ type SQLDedicatedGatewayServiceResourceProperties struct { // GetServiceResourceProperties implements the ServiceResourcePropertiesClassification interface for type SQLDedicatedGatewayServiceResourceProperties. func (s *SQLDedicatedGatewayServiceResourceProperties) GetServiceResourceProperties() *ServiceResourceProperties { return &ServiceResourceProperties{ + AdditionalProperties: s.AdditionalProperties, CreationTime: s.CreationTime, - InstanceSize: s.InstanceSize, InstanceCount: s.InstanceCount, + InstanceSize: s.InstanceSize, ServiceType: s.ServiceType, Status: s.Status, - AdditionalProperties: s.AdditionalProperties, } } -// SQLResourcesClientBeginCreateUpdateClientEncryptionKeyOptions contains the optional parameters for the SQLResourcesClient.BeginCreateUpdateClientEncryptionKey -// method. -type SQLResourcesClientBeginCreateUpdateClientEncryptionKeyOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginCreateUpdateSQLContainerOptions contains the optional parameters for the SQLResourcesClient.BeginCreateUpdateSQLContainer -// method. -type SQLResourcesClientBeginCreateUpdateSQLContainerOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginCreateUpdateSQLDatabaseOptions contains the optional parameters for the SQLResourcesClient.BeginCreateUpdateSQLDatabase -// method. -type SQLResourcesClientBeginCreateUpdateSQLDatabaseOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginCreateUpdateSQLRoleAssignmentOptions contains the optional parameters for the SQLResourcesClient.BeginCreateUpdateSQLRoleAssignment -// method. -type SQLResourcesClientBeginCreateUpdateSQLRoleAssignmentOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginCreateUpdateSQLRoleDefinitionOptions contains the optional parameters for the SQLResourcesClient.BeginCreateUpdateSQLRoleDefinition -// method. -type SQLResourcesClientBeginCreateUpdateSQLRoleDefinitionOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginCreateUpdateSQLStoredProcedureOptions contains the optional parameters for the SQLResourcesClient.BeginCreateUpdateSQLStoredProcedure -// method. -type SQLResourcesClientBeginCreateUpdateSQLStoredProcedureOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginCreateUpdateSQLTriggerOptions contains the optional parameters for the SQLResourcesClient.BeginCreateUpdateSQLTrigger -// method. -type SQLResourcesClientBeginCreateUpdateSQLTriggerOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginCreateUpdateSQLUserDefinedFunctionOptions contains the optional parameters for the SQLResourcesClient.BeginCreateUpdateSQLUserDefinedFunction -// method. -type SQLResourcesClientBeginCreateUpdateSQLUserDefinedFunctionOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginDeleteSQLContainerOptions contains the optional parameters for the SQLResourcesClient.BeginDeleteSQLContainer -// method. -type SQLResourcesClientBeginDeleteSQLContainerOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginDeleteSQLDatabaseOptions contains the optional parameters for the SQLResourcesClient.BeginDeleteSQLDatabase -// method. -type SQLResourcesClientBeginDeleteSQLDatabaseOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginDeleteSQLRoleAssignmentOptions contains the optional parameters for the SQLResourcesClient.BeginDeleteSQLRoleAssignment -// method. -type SQLResourcesClientBeginDeleteSQLRoleAssignmentOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginDeleteSQLRoleDefinitionOptions contains the optional parameters for the SQLResourcesClient.BeginDeleteSQLRoleDefinition -// method. -type SQLResourcesClientBeginDeleteSQLRoleDefinitionOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginDeleteSQLStoredProcedureOptions contains the optional parameters for the SQLResourcesClient.BeginDeleteSQLStoredProcedure -// method. -type SQLResourcesClientBeginDeleteSQLStoredProcedureOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginDeleteSQLTriggerOptions contains the optional parameters for the SQLResourcesClient.BeginDeleteSQLTrigger -// method. -type SQLResourcesClientBeginDeleteSQLTriggerOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginDeleteSQLUserDefinedFunctionOptions contains the optional parameters for the SQLResourcesClient.BeginDeleteSQLUserDefinedFunction -// method. -type SQLResourcesClientBeginDeleteSQLUserDefinedFunctionOptions struct { - // Resumes the LRO from the provided token. - 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 { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginMigrateSQLContainerToManualThroughputOptions contains the optional parameters for the SQLResourcesClient.BeginMigrateSQLContainerToManualThroughput -// method. -type SQLResourcesClientBeginMigrateSQLContainerToManualThroughputOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginMigrateSQLDatabaseToAutoscaleOptions contains the optional parameters for the SQLResourcesClient.BeginMigrateSQLDatabaseToAutoscale -// method. -type SQLResourcesClientBeginMigrateSQLDatabaseToAutoscaleOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginMigrateSQLDatabaseToManualThroughputOptions contains the optional parameters for the SQLResourcesClient.BeginMigrateSQLDatabaseToManualThroughput -// method. -type SQLResourcesClientBeginMigrateSQLDatabaseToManualThroughputOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginRetrieveContinuousBackupInformationOptions contains the optional parameters for the SQLResourcesClient.BeginRetrieveContinuousBackupInformation -// method. -type SQLResourcesClientBeginRetrieveContinuousBackupInformationOptions struct { - // Resumes the LRO from the provided token. - 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 { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientBeginUpdateSQLDatabaseThroughputOptions contains the optional parameters for the SQLResourcesClient.BeginUpdateSQLDatabaseThroughput -// method. -type SQLResourcesClientBeginUpdateSQLDatabaseThroughputOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SQLResourcesClientGetClientEncryptionKeyOptions contains the optional parameters for the SQLResourcesClient.GetClientEncryptionKey -// method. -type SQLResourcesClientGetClientEncryptionKeyOptions struct { - // placeholder for future optional parameters -} - -// SQLResourcesClientGetSQLContainerOptions contains the optional parameters for the SQLResourcesClient.GetSQLContainer method. -type SQLResourcesClientGetSQLContainerOptions struct { - // placeholder for future optional parameters -} - -// SQLResourcesClientGetSQLContainerThroughputOptions contains the optional parameters for the SQLResourcesClient.GetSQLContainerThroughput -// method. -type SQLResourcesClientGetSQLContainerThroughputOptions struct { - // placeholder for future optional parameters -} - -// SQLResourcesClientGetSQLDatabaseOptions contains the optional parameters for the SQLResourcesClient.GetSQLDatabase method. -type SQLResourcesClientGetSQLDatabaseOptions struct { - // placeholder for future optional parameters -} - -// SQLResourcesClientGetSQLDatabaseThroughputOptions contains the optional parameters for the SQLResourcesClient.GetSQLDatabaseThroughput -// method. -type SQLResourcesClientGetSQLDatabaseThroughputOptions struct { - // placeholder for future optional parameters -} - -// SQLResourcesClientGetSQLRoleAssignmentOptions contains the optional parameters for the SQLResourcesClient.GetSQLRoleAssignment -// method. -type SQLResourcesClientGetSQLRoleAssignmentOptions struct { - // placeholder for future optional parameters -} - -// SQLResourcesClientGetSQLRoleDefinitionOptions contains the optional parameters for the SQLResourcesClient.GetSQLRoleDefinition -// method. -type SQLResourcesClientGetSQLRoleDefinitionOptions struct { - // placeholder for future optional parameters -} - -// SQLResourcesClientGetSQLStoredProcedureOptions contains the optional parameters for the SQLResourcesClient.GetSQLStoredProcedure -// method. -type SQLResourcesClientGetSQLStoredProcedureOptions struct { - // placeholder for future optional parameters -} - -// SQLResourcesClientGetSQLTriggerOptions contains the optional parameters for the SQLResourcesClient.GetSQLTrigger method. -type SQLResourcesClientGetSQLTriggerOptions struct { - // placeholder for future optional parameters -} - -// SQLResourcesClientGetSQLUserDefinedFunctionOptions contains the optional parameters for the SQLResourcesClient.GetSQLUserDefinedFunction -// method. -type SQLResourcesClientGetSQLUserDefinedFunctionOptions struct { - // placeholder for future optional parameters -} - -// SQLResourcesClientListClientEncryptionKeysOptions contains the optional parameters for the SQLResourcesClient.NewListClientEncryptionKeysPager -// method. -type SQLResourcesClientListClientEncryptionKeysOptions struct { - // placeholder for future optional parameters -} - -// SQLResourcesClientListSQLContainersOptions contains the optional parameters for the SQLResourcesClient.NewListSQLContainersPager -// method. -type SQLResourcesClientListSQLContainersOptions struct { - // placeholder for future optional parameters -} - -// SQLResourcesClientListSQLDatabasesOptions contains the optional parameters for the SQLResourcesClient.NewListSQLDatabasesPager -// method. -type SQLResourcesClientListSQLDatabasesOptions struct { - // placeholder for future optional parameters -} - -// SQLResourcesClientListSQLRoleAssignmentsOptions contains the optional parameters for the SQLResourcesClient.NewListSQLRoleAssignmentsPager -// method. -type SQLResourcesClientListSQLRoleAssignmentsOptions struct { - // placeholder for future optional parameters -} - -// SQLResourcesClientListSQLRoleDefinitionsOptions contains the optional parameters for the SQLResourcesClient.NewListSQLRoleDefinitionsPager -// method. -type SQLResourcesClientListSQLRoleDefinitionsOptions struct { - // placeholder for future optional parameters -} - -// SQLResourcesClientListSQLStoredProceduresOptions contains the optional parameters for the SQLResourcesClient.NewListSQLStoredProceduresPager -// method. -type SQLResourcesClientListSQLStoredProceduresOptions struct { - // placeholder for future optional parameters -} - -// SQLResourcesClientListSQLTriggersOptions contains the optional parameters for the SQLResourcesClient.NewListSQLTriggersPager -// method. -type SQLResourcesClientListSQLTriggersOptions struct { - // placeholder for future optional parameters -} - -// SQLResourcesClientListSQLUserDefinedFunctionsOptions contains the optional parameters for the SQLResourcesClient.NewListSQLUserDefinedFunctionsPager -// method. -type SQLResourcesClientListSQLUserDefinedFunctionsOptions struct { - // placeholder for future optional parameters -} - // SQLRoleAssignmentCreateUpdateParameters - Parameters to create and update an Azure Cosmos DB SQL Role Assignment. type SQLRoleAssignmentCreateUpdateParameters struct { // Properties to create and update an Azure Cosmos DB SQL Role Assignment. @@ -6721,28 +5327,6 @@ type SeedNode struct { IPAddress *string } -// ServiceClientBeginCreateOptions contains the optional parameters for the ServiceClient.BeginCreate method. -type ServiceClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServiceClientBeginDeleteOptions contains the optional parameters for the ServiceClient.BeginDelete method. -type ServiceClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServiceClientGetOptions contains the optional parameters for the ServiceClient.Get method. -type ServiceClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServiceClientListOptions contains the optional parameters for the ServiceClient.NewListPager method. -type ServiceClientListOptions struct { - // placeholder for future optional parameters -} - // ServiceResource - Properties for the database account. type ServiceResource struct { // Services response resource. @@ -6782,16 +5366,6 @@ type ServiceResourceListResult struct { Value []*ServiceResource } -// ServiceResourcePropertiesClassification provides polymorphic access to related types. -// Call the interface's GetServiceResourceProperties() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *DataTransferServiceResourceProperties, *GraphAPIComputeServiceResourceProperties, *MaterializedViewsBuilderServiceResourceProperties, -// - *SQLDedicatedGatewayServiceResourceProperties, *ServiceResourceProperties -type ServiceResourcePropertiesClassification interface { - // GetServiceResourceProperties returns the ServiceResourceProperties content of the underlying type. - GetServiceResourceProperties() *ServiceResourceProperties -} - // ServiceResourceProperties - Services response resource. type ServiceResourceProperties struct { // REQUIRED; ServiceType for the service. @@ -6965,65 +5539,6 @@ type TableResource struct { RestoreParameters *ResourceRestoreParameters } -// TableResourcesClientBeginCreateUpdateTableOptions contains the optional parameters for the TableResourcesClient.BeginCreateUpdateTable -// method. -type TableResourcesClientBeginCreateUpdateTableOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// TableResourcesClientBeginDeleteTableOptions contains the optional parameters for the TableResourcesClient.BeginDeleteTable -// method. -type TableResourcesClientBeginDeleteTableOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// TableResourcesClientBeginMigrateTableToAutoscaleOptions contains the optional parameters for the TableResourcesClient.BeginMigrateTableToAutoscale -// method. -type TableResourcesClientBeginMigrateTableToAutoscaleOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// TableResourcesClientBeginMigrateTableToManualThroughputOptions contains the optional parameters for the TableResourcesClient.BeginMigrateTableToManualThroughput -// method. -type TableResourcesClientBeginMigrateTableToManualThroughputOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// TableResourcesClientBeginRetrieveContinuousBackupInformationOptions contains the optional parameters for the TableResourcesClient.BeginRetrieveContinuousBackupInformation -// method. -type TableResourcesClientBeginRetrieveContinuousBackupInformationOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// TableResourcesClientBeginUpdateTableThroughputOptions contains the optional parameters for the TableResourcesClient.BeginUpdateTableThroughput -// method. -type TableResourcesClientBeginUpdateTableThroughputOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// TableResourcesClientGetTableOptions contains the optional parameters for the TableResourcesClient.GetTable method. -type TableResourcesClientGetTableOptions struct { - // placeholder for future optional parameters -} - -// TableResourcesClientGetTableThroughputOptions contains the optional parameters for the TableResourcesClient.GetTableThroughput -// method. -type TableResourcesClientGetTableThroughputOptions struct { - // placeholder for future optional parameters -} - -// TableResourcesClientListTablesOptions contains the optional parameters for the TableResourcesClient.NewListTablesPager -// method. -type TableResourcesClientListTablesOptions struct { - // placeholder for future optional parameters -} - // ThroughputPolicyResource - Cosmos DB resource throughput policy type ThroughputPolicyResource struct { // Represents the percentage by which throughput can increase every time throughput policy kicks in. @@ -7048,6 +5563,9 @@ type ThroughputSettingsGetPropertiesResource struct { // READ-ONLY; A system generated property representing the resource etag required for optimistic concurrency control. Etag *string + // READ-ONLY; The offer throughput value to instantly scale up without triggering splits + InstantMaximumThroughput *string + // READ-ONLY; The minimum throughput of the resource MinimumThroughput *string @@ -7057,6 +5575,9 @@ type ThroughputSettingsGetPropertiesResource struct { // READ-ONLY; A system generated property. A unique identifier. Rid *string + // READ-ONLY; The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified + SoftAllowedMaximumThroughput *string + // READ-ONLY; A system generated property that denotes the last updated timestamp of the resource. Ts *float32 } @@ -7098,11 +5619,17 @@ type ThroughputSettingsResource struct { // Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. Throughput *int32 + // READ-ONLY; The offer throughput value to instantly scale up without triggering splits + InstantMaximumThroughput *string + // READ-ONLY; The minimum throughput of the resource MinimumThroughput *string // READ-ONLY; The throughput replace is pending OfferReplacePending *string + + // READ-ONLY; The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified + SoftAllowedMaximumThroughput *string } // ThroughputSettingsUpdateParameters - Parameters to update Cosmos DB resource throughput. diff --git a/sdk/resourcemanager/cosmos/armcosmos/models_serde.go b/sdk/resourcemanager/cosmos/armcosmos/models_serde.go index 3e922ee5468b..9a1e1c28396c 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/models_serde.go +++ b/sdk/resourcemanager/cosmos/armcosmos/models_serde.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -455,10 +454,11 @@ func (b *BackupPolicyMigrationState) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BackupResource. func (b BackupResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", b.ID) - populate(objectMap, "name", b.Name) - populate(objectMap, "properties", b.Properties) - populate(objectMap, "type", b.Type) + populateTimeRFC3339(objectMap, "backupExpiryTimestamp", b.BackupExpiryTimestamp) + populate(objectMap, "backupId", b.BackupID) + populateTimeRFC3339(objectMap, "backupStartTimestamp", b.BackupStartTimestamp) + populate(objectMap, "backupState", b.BackupState) + populateTimeRFC3339(objectMap, "backupStopTimestamp", b.BackupStopTimestamp) return json.Marshal(objectMap) } @@ -471,17 +471,20 @@ func (b *BackupResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &b.ID) + case "backupExpiryTimestamp": + err = unpopulateTimeRFC3339(val, "BackupExpiryTimestamp", &b.BackupExpiryTimestamp) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &b.Name) + case "backupId": + err = unpopulate(val, "BackupID", &b.BackupID) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &b.Properties) + case "backupStartTimestamp": + err = unpopulateTimeRFC3339(val, "BackupStartTimestamp", &b.BackupStartTimestamp) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &b.Type) + case "backupState": + err = unpopulate(val, "BackupState", &b.BackupState) + delete(rawMsg, key) + case "backupStopTimestamp": + err = unpopulateTimeRFC3339(val, "BackupStopTimestamp", &b.BackupStopTimestamp) delete(rawMsg, key) } if err != nil { @@ -491,15 +494,17 @@ func (b *BackupResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type BackupResourceProperties. -func (b BackupResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BackupSchedule. +func (b BackupSchedule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "timestamp", b.Timestamp) + 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 BackupResourceProperties. -func (b *BackupResourceProperties) UnmarshalJSON(data []byte) error { +// 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) @@ -507,8 +512,41 @@ func (b *BackupResourceProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &b.Timestamp) + 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) + 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 "remoteAccountName": + err = unpopulate(val, "RemoteAccountName", &b.RemoteAccountName) delete(rawMsg, key) } if err != nil { @@ -655,6 +693,7 @@ 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) } @@ -674,6 +713,9 @@ func (c *CassandraDataTransferDataSourceSink) UnmarshalJSON(data []byte) error { 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) @@ -2168,12 +2210,15 @@ func (c *ClusterResource) UnmarshalJSON(data []byte) error { func (c ClusterResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "authenticationMethod", c.AuthenticationMethod) + 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, "externalGossipCertificates", c.ExternalGossipCertificates) populate(objectMap, "externalSeedNodes", c.ExternalSeedNodes) populate(objectMap, "gossipCertificates", c.GossipCertificates) @@ -2200,6 +2245,9 @@ func (c *ClusterResourceProperties) UnmarshalJSON(data []byte) error { case "authenticationMethod": err = unpopulate(val, "AuthenticationMethod", &c.AuthenticationMethod) delete(rawMsg, key) + case "backupSchedules": + err = unpopulate(val, "BackupSchedules", &c.BackupSchedules) + delete(rawMsg, key) case "cassandraAuditLoggingEnabled": err = unpopulate(val, "CassandraAuditLoggingEnabled", &c.CassandraAuditLoggingEnabled) delete(rawMsg, key) @@ -2212,12 +2260,18 @@ func (c *ClusterResourceProperties) UnmarshalJSON(data []byte) error { 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 "externalGossipCertificates": err = unpopulate(val, "ExternalGossipCertificates", &c.ExternalGossipCertificates) delete(rawMsg, key) @@ -2400,6 +2454,7 @@ func (c ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacenters 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) @@ -2441,6 +2496,9 @@ func (c *ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacenter 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) @@ -3433,8 +3491,10 @@ func (d DatabaseAccountCreateUpdateProperties) MarshalJSON() ([]byte, error) { 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) @@ -3446,6 +3506,7 @@ func (d DatabaseAccountCreateUpdateProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "enableMaterializedViews", d.EnableMaterializedViews) populate(objectMap, "enableMultipleWriteLocations", d.EnableMultipleWriteLocations) populate(objectMap, "enablePartitionMerge", d.EnablePartitionMerge) + populate(objectMap, "enablePriorityBasedExecution", d.EnablePriorityBasedExecution) populate(objectMap, "ipRules", d.IPRules) populate(objectMap, "isVirtualNetworkFilterEnabled", d.IsVirtualNetworkFilterEnabled) populate(objectMap, "keyVaultKeyUri", d.KeyVaultKeyURI) @@ -3496,12 +3557,18 @@ func (d *DatabaseAccountCreateUpdateProperties) UnmarshalJSON(data []byte) error 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) @@ -3535,6 +3602,9 @@ func (d *DatabaseAccountCreateUpdateProperties) UnmarshalJSON(data []byte) error case "enablePartitionMerge": err = unpopulate(val, "EnablePartitionMerge", &d.EnablePartitionMerge) 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) @@ -3588,8 +3658,10 @@ func (d DatabaseAccountGetProperties) MarshalJSON() ([]byte, error) { 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) @@ -3602,6 +3674,7 @@ func (d DatabaseAccountGetProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "enableMaterializedViews", d.EnableMaterializedViews) populate(objectMap, "enableMultipleWriteLocations", d.EnableMultipleWriteLocations) populate(objectMap, "enablePartitionMerge", d.EnablePartitionMerge) + populate(objectMap, "enablePriorityBasedExecution", d.EnablePriorityBasedExecution) populate(objectMap, "failoverPolicies", d.FailoverPolicies) populate(objectMap, "ipRules", d.IPRules) populate(objectMap, "instanceId", d.InstanceID) @@ -3658,12 +3731,18 @@ func (d *DatabaseAccountGetProperties) UnmarshalJSON(data []byte) error { 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) @@ -3700,6 +3779,9 @@ func (d *DatabaseAccountGetProperties) UnmarshalJSON(data []byte) error { case "enablePartitionMerge": err = unpopulate(val, "EnablePartitionMerge", &d.EnablePartitionMerge) 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) @@ -4031,7 +4113,9 @@ func (d DatabaseAccountUpdateProperties) MarshalJSON() ([]byte, error) { 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, "defaultPriorityLevel", d.DefaultPriorityLevel) populate(objectMap, "diagnosticLogSettings", d.DiagnosticLogSettings) populate(objectMap, "disableKeyBasedMetadataWriteAccess", d.DisableKeyBasedMetadataWriteAccess) populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) @@ -4043,6 +4127,7 @@ func (d DatabaseAccountUpdateProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "enableMaterializedViews", d.EnableMaterializedViews) populate(objectMap, "enableMultipleWriteLocations", d.EnableMultipleWriteLocations) populate(objectMap, "enablePartitionMerge", d.EnablePartitionMerge) + populate(objectMap, "enablePriorityBasedExecution", d.EnablePriorityBasedExecution) populate(objectMap, "ipRules", d.IPRules) populate(objectMap, "isVirtualNetworkFilterEnabled", d.IsVirtualNetworkFilterEnabled) populate(objectMap, "keyVaultKeyUri", d.KeyVaultKeyURI) @@ -4089,9 +4174,15 @@ func (d *DatabaseAccountUpdateProperties) UnmarshalJSON(data []byte) error { 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 "defaultPriorityLevel": + err = unpopulate(val, "DefaultPriorityLevel", &d.DefaultPriorityLevel) + delete(rawMsg, key) case "diagnosticLogSettings": err = unpopulate(val, "DiagnosticLogSettings", &d.DiagnosticLogSettings) delete(rawMsg, key) @@ -4125,6 +4216,9 @@ func (d *DatabaseAccountUpdateProperties) UnmarshalJSON(data []byte) error { case "enablePartitionMerge": err = unpopulate(val, "EnablePartitionMerge", &d.EnablePartitionMerge) 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) @@ -7595,6 +7689,7 @@ func (m MongoDataTransferDataSourceSink) MarshalJSON() ([]byte, error) { populate(objectMap, "collectionName", m.CollectionName) objectMap["component"] = DataTransferComponentCosmosDBMongo populate(objectMap, "databaseName", m.DatabaseName) + populate(objectMap, "remoteAccountName", m.RemoteAccountName) return json.Marshal(objectMap) } @@ -7616,6 +7711,9 @@ func (m *MongoDataTransferDataSourceSink) UnmarshalJSON(data []byte) error { 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) @@ -11826,6 +11924,7 @@ func (s SQLDataTransferDataSourceSink) MarshalJSON() ([]byte, error) { objectMap["component"] = DataTransferComponentCosmosDBSQL populate(objectMap, "containerName", s.ContainerName) populate(objectMap, "databaseName", s.DatabaseName) + populate(objectMap, "remoteAccountName", s.RemoteAccountName) return json.Marshal(objectMap) } @@ -11847,6 +11946,9 @@ func (s *SQLDataTransferDataSourceSink) UnmarshalJSON(data []byte) error { case "databaseName": err = unpopulate(val, "DatabaseName", &s.DatabaseName) delete(rawMsg, key) + case "remoteAccountName": + err = unpopulate(val, "RemoteAccountName", &s.RemoteAccountName) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -14016,9 +14118,11 @@ func (t ThroughputSettingsGetPropertiesResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "autoscaleSettings", t.AutoscaleSettings) populate(objectMap, "_etag", t.Etag) + populate(objectMap, "instantMaximumThroughput", t.InstantMaximumThroughput) populate(objectMap, "minimumThroughput", t.MinimumThroughput) populate(objectMap, "offerReplacePending", t.OfferReplacePending) populate(objectMap, "_rid", t.Rid) + populate(objectMap, "softAllowedMaximumThroughput", t.SoftAllowedMaximumThroughput) populate(objectMap, "throughput", t.Throughput) populate(objectMap, "_ts", t.Ts) return json.Marshal(objectMap) @@ -14039,6 +14143,9 @@ func (t *ThroughputSettingsGetPropertiesResource) UnmarshalJSON(data []byte) err case "_etag": err = unpopulate(val, "Etag", &t.Etag) delete(rawMsg, key) + case "instantMaximumThroughput": + err = unpopulate(val, "InstantMaximumThroughput", &t.InstantMaximumThroughput) + delete(rawMsg, key) case "minimumThroughput": err = unpopulate(val, "MinimumThroughput", &t.MinimumThroughput) delete(rawMsg, key) @@ -14048,6 +14155,9 @@ func (t *ThroughputSettingsGetPropertiesResource) UnmarshalJSON(data []byte) err case "_rid": err = unpopulate(val, "Rid", &t.Rid) delete(rawMsg, key) + case "softAllowedMaximumThroughput": + err = unpopulate(val, "SoftAllowedMaximumThroughput", &t.SoftAllowedMaximumThroughput) + delete(rawMsg, key) case "throughput": err = unpopulate(val, "Throughput", &t.Throughput) delete(rawMsg, key) @@ -14117,8 +14227,10 @@ func (t *ThroughputSettingsGetResults) UnmarshalJSON(data []byte) error { func (t ThroughputSettingsResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "autoscaleSettings", t.AutoscaleSettings) + populate(objectMap, "instantMaximumThroughput", t.InstantMaximumThroughput) populate(objectMap, "minimumThroughput", t.MinimumThroughput) populate(objectMap, "offerReplacePending", t.OfferReplacePending) + populate(objectMap, "softAllowedMaximumThroughput", t.SoftAllowedMaximumThroughput) populate(objectMap, "throughput", t.Throughput) return json.Marshal(objectMap) } @@ -14135,12 +14247,18 @@ func (t *ThroughputSettingsResource) UnmarshalJSON(data []byte) error { case "autoscaleSettings": err = unpopulate(val, "AutoscaleSettings", &t.AutoscaleSettings) delete(rawMsg, key) + case "instantMaximumThroughput": + err = unpopulate(val, "InstantMaximumThroughput", &t.InstantMaximumThroughput) + delete(rawMsg, key) case "minimumThroughput": err = unpopulate(val, "MinimumThroughput", &t.MinimumThroughput) delete(rawMsg, key) case "offerReplacePending": err = unpopulate(val, "OfferReplacePending", &t.OfferReplacePending) delete(rawMsg, key) + case "softAllowedMaximumThroughput": + err = unpopulate(val, "SoftAllowedMaximumThroughput", &t.SoftAllowedMaximumThroughput) + delete(rawMsg, key) case "throughput": err = unpopulate(val, "Throughput", &t.Throughput) delete(rawMsg, key) diff --git a/sdk/resourcemanager/cosmos/armcosmos/mongoclusters_client.go b/sdk/resourcemanager/cosmos/armcosmos/mongoclusters_client.go index 3c3323bebc9c..ac0497314431 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/mongoclusters_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/mongoclusters_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -47,24 +46,27 @@ func NewMongoClustersClient(subscriptionID string, credential azcore.TokenCreden // CheckNameAvailability - Check the availability of name for resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - location - The name of the Azure region. // - parameters - The required parameters for checking if resource name is available. // - options - MongoClustersClientCheckNameAvailabilityOptions contains the optional parameters for the MongoClustersClient.CheckNameAvailability // method. func (client *MongoClustersClient) CheckNameAvailability(ctx context.Context, location string, parameters CheckNameAvailabilityRequest, options *MongoClustersClientCheckNameAvailabilityOptions) (MongoClustersClientCheckNameAvailabilityResponse, error) { + var err error req, err := client.checkNameAvailabilityCreateRequest(ctx, location, parameters, options) if err != nil { return MongoClustersClientCheckNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MongoClustersClientCheckNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MongoClustersClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MongoClustersClientCheckNameAvailabilityResponse{}, err } - return client.checkNameAvailabilityHandleResponse(resp) + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. @@ -83,10 +85,13 @@ func (client *MongoClustersClient) checkNameAvailabilityCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. @@ -102,7 +107,7 @@ func (client *MongoClustersClient) checkNameAvailabilityHandleResponse(resp *htt // some of the properties, use PATCH. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - parameters - The required parameters for creating or updating a mongo cluster. @@ -114,9 +119,10 @@ func (client *MongoClustersClient) BeginCreateOrUpdate(ctx context.Context, reso if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoClustersClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoClustersClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoClustersClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -126,20 +132,22 @@ func (client *MongoClustersClient) BeginCreateOrUpdate(ctx context.Context, reso // of the properties, use PATCH. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, mongoClusterName string, parameters MongoCluster, options *MongoClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, mongoClusterName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -162,16 +170,19 @@ func (client *MongoClustersClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginCreateOrUpdateFirewallRule - Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - firewallRuleName - The name of the mongo cluster firewall rule. @@ -184,9 +195,10 @@ func (client *MongoClustersClient) BeginCreateOrUpdateFirewallRule(ctx context.C if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoClustersClientCreateOrUpdateFirewallRuleResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoClustersClientCreateOrUpdateFirewallRuleResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoClustersClientCreateOrUpdateFirewallRuleResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -195,20 +207,22 @@ func (client *MongoClustersClient) BeginCreateOrUpdateFirewallRule(ctx context.C // CreateOrUpdateFirewallRule - Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoClustersClient) createOrUpdateFirewallRule(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, parameters FirewallRule, options *MongoClustersClientBeginCreateOrUpdateFirewallRuleOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateFirewallRuleCreateRequest(ctx, resourceGroupName, mongoClusterName, firewallRuleName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateFirewallRuleCreateRequest creates the CreateOrUpdateFirewallRule request. @@ -235,16 +249,19 @@ func (client *MongoClustersClient) createOrUpdateFirewallRuleCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a mongo cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - options - MongoClustersClientBeginDeleteOptions contains the optional parameters for the MongoClustersClient.BeginDelete @@ -255,9 +272,10 @@ func (client *MongoClustersClient) BeginDelete(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoClustersClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoClustersClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoClustersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -266,20 +284,22 @@ func (client *MongoClustersClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Deletes a mongo cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, mongoClusterName string, options *MongoClustersClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, mongoClusterName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -302,7 +322,7 @@ func (client *MongoClustersClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -311,7 +331,7 @@ func (client *MongoClustersClient) deleteCreateRequest(ctx context.Context, reso // BeginDeleteFirewallRule - Deletes a mongo cluster firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - firewallRuleName - The name of the mongo cluster firewall rule. @@ -323,9 +343,10 @@ func (client *MongoClustersClient) BeginDeleteFirewallRule(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoClustersClientDeleteFirewallRuleResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoClustersClientDeleteFirewallRuleResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoClustersClientDeleteFirewallRuleResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -334,20 +355,22 @@ func (client *MongoClustersClient) BeginDeleteFirewallRule(ctx context.Context, // DeleteFirewallRule - Deletes a mongo cluster firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoClustersClient) deleteFirewallRule(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, options *MongoClustersClientBeginDeleteFirewallRuleOptions) (*http.Response, error) { + var err error req, err := client.deleteFirewallRuleCreateRequest(ctx, resourceGroupName, mongoClusterName, firewallRuleName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteFirewallRuleCreateRequest creates the DeleteFirewallRule request. @@ -374,7 +397,7 @@ func (client *MongoClustersClient) deleteFirewallRuleCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -383,23 +406,26 @@ func (client *MongoClustersClient) deleteFirewallRuleCreateRequest(ctx context.C // Get - Gets information about a mongo cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - options - MongoClustersClientGetOptions contains the optional parameters for the MongoClustersClient.Get method. func (client *MongoClustersClient) Get(ctx context.Context, resourceGroupName string, mongoClusterName string, options *MongoClustersClientGetOptions) (MongoClustersClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, mongoClusterName, options) if err != nil { return MongoClustersClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MongoClustersClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MongoClustersClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MongoClustersClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -422,7 +448,7 @@ func (client *MongoClustersClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -440,25 +466,28 @@ func (client *MongoClustersClient) getHandleResponse(resp *http.Response) (Mongo // GetFirewallRule - Gets information about a mongo cluster firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - firewallRuleName - The name of the mongo cluster firewall rule. // - options - MongoClustersClientGetFirewallRuleOptions contains the optional parameters for the MongoClustersClient.GetFirewallRule // method. func (client *MongoClustersClient) GetFirewallRule(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, options *MongoClustersClientGetFirewallRuleOptions) (MongoClustersClientGetFirewallRuleResponse, error) { + var err error req, err := client.getFirewallRuleCreateRequest(ctx, resourceGroupName, mongoClusterName, firewallRuleName, options) if err != nil { return MongoClustersClientGetFirewallRuleResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MongoClustersClientGetFirewallRuleResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MongoClustersClientGetFirewallRuleResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MongoClustersClientGetFirewallRuleResponse{}, err } - return client.getFirewallRuleHandleResponse(resp) + resp, err := client.getFirewallRuleHandleResponse(httpResp) + return resp, err } // getFirewallRuleCreateRequest creates the GetFirewallRule request. @@ -485,7 +514,7 @@ func (client *MongoClustersClient) getFirewallRuleCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -502,7 +531,7 @@ func (client *MongoClustersClient) getFirewallRuleHandleResponse(resp *http.Resp // NewListPager - List all the mongo clusters in a given subscription. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - options - MongoClustersClientListOptions contains the optional parameters for the MongoClustersClient.NewListPager method. func (client *MongoClustersClient) NewListPager(options *MongoClustersClientListOptions) *runtime.Pager[MongoClustersClientListResponse] { return runtime.NewPager(runtime.PagingHandler[MongoClustersClientListResponse]{ @@ -544,7 +573,7 @@ func (client *MongoClustersClient) listCreateRequest(ctx context.Context, option return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -561,7 +590,7 @@ func (client *MongoClustersClient) listHandleResponse(resp *http.Response) (Mong // NewListByResourceGroupPager - List all the mongo clusters in a given resource group. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - MongoClustersClientListByResourceGroupOptions contains the optional parameters for the MongoClustersClient.NewListByResourceGroupPager // method. @@ -609,7 +638,7 @@ func (client *MongoClustersClient) listByResourceGroupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -628,24 +657,27 @@ func (client *MongoClustersClient) listByResourceGroupHandleResponse(resp *http. // as well as other connection strings supported by the cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - options - MongoClustersClientListConnectionStringsOptions contains the optional parameters for the MongoClustersClient.ListConnectionStrings // method. func (client *MongoClustersClient) ListConnectionStrings(ctx context.Context, resourceGroupName string, mongoClusterName string, options *MongoClustersClientListConnectionStringsOptions) (MongoClustersClientListConnectionStringsResponse, error) { + var err error req, err := client.listConnectionStringsCreateRequest(ctx, resourceGroupName, mongoClusterName, options) if err != nil { return MongoClustersClientListConnectionStringsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MongoClustersClientListConnectionStringsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MongoClustersClientListConnectionStringsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MongoClustersClientListConnectionStringsResponse{}, err } - return client.listConnectionStringsHandleResponse(resp) + resp, err := client.listConnectionStringsHandleResponse(httpResp) + return resp, err } // listConnectionStringsCreateRequest creates the ListConnectionStrings request. @@ -668,7 +700,7 @@ func (client *MongoClustersClient) listConnectionStringsCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -685,7 +717,7 @@ func (client *MongoClustersClient) listConnectionStringsHandleResponse(resp *htt // NewListFirewallRulesPager - List all the firewall rules in a given mongo cluster. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - options - MongoClustersClientListFirewallRulesOptions contains the optional parameters for the MongoClustersClient.NewListFirewallRulesPager @@ -738,7 +770,7 @@ func (client *MongoClustersClient) listFirewallRulesCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -757,7 +789,7 @@ func (client *MongoClustersClient) listFirewallRulesHandleResponse(resp *http.Re // the normal mongo cluster definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - parameters - The parameters for updating a mongo cluster. @@ -769,9 +801,10 @@ func (client *MongoClustersClient) BeginUpdate(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoClustersClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoClustersClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoClustersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -781,20 +814,22 @@ func (client *MongoClustersClient) BeginUpdate(ctx context.Context, resourceGrou // mongo cluster definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoClustersClient) update(ctx context.Context, resourceGroupName string, mongoClusterName string, parameters MongoClusterUpdate, options *MongoClustersClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, mongoClusterName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -817,8 +852,11 @@ func (client *MongoClustersClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/mongoclusters_client_example_test.go b/sdk/resourcemanager/cosmos/armcosmos/mongoclusters_client_example_test.go deleted file mode 100644 index a24d86ea0c90..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/mongoclusters_client_example_test.go +++ /dev/null @@ -1,784 +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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/mongo-cluster/CosmosDBMongoClusterList.json -func ExampleMongoClustersClient_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.NewMongoClustersClient().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.MongoClusterListResult = armcosmos.MongoClusterListResult{ - // Value: []*armcosmos.MongoCluster{ - // { - // Name: to.Ptr("myMongoCluster"), - // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"), - // SystemData: &armcosmos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "additionalProp1": to.Ptr("string"), - // "additionalProp2": to.Ptr("string"), - // "additionalProp3": to.Ptr("string"), - // }, - // Properties: &armcosmos.MongoClusterProperties{ - // AdministratorLogin: to.Ptr("mongoAdmin"), - // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), - // EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"), - // NodeGroupSpecs: []*armcosmos.NodeGroupSpec{ - // { - // DiskSizeGB: to.Ptr[int64](128), - // EnableHa: to.Ptr(true), - // SKU: to.Ptr("M30"), - // Kind: to.Ptr(armcosmos.NodeKindShard), - // NodeCount: to.Ptr[int32](4), - // }}, - // ProvisioningState: to.Ptr(armcosmos.ProvisioningStateSucceeded), - // ServerVersion: to.Ptr("5.0"), - // }, - // }, - // { - // Name: to.Ptr("myMongoCluster2"), - // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster2"), - // SystemData: &armcosmos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user2"), - // CreatedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "additionalProp1": to.Ptr("string"), - // }, - // Properties: &armcosmos.MongoClusterProperties{ - // AdministratorLogin: to.Ptr("mongoAdmin"), - // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), - // EarliestRestoreTime: to.Ptr("2023-01-10T20:07:35Z"), - // NodeGroupSpecs: []*armcosmos.NodeGroupSpec{ - // { - // DiskSizeGB: to.Ptr[int64](256), - // EnableHa: to.Ptr(true), - // SKU: to.Ptr("M40"), - // Kind: to.Ptr(armcosmos.NodeKindShard), - // NodeCount: to.Ptr[int32](2), - // }}, - // ProvisioningState: to.Ptr(armcosmos.ProvisioningStateSucceeded), - // ServerVersion: to.Ptr("5.0"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/mongo-cluster/CosmosDBMongoClusterListByResourceGroup.json -func ExampleMongoClustersClient_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.NewMongoClustersClient().NewListByResourceGroupPager("TestResourceGroup", 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.MongoClusterListResult = armcosmos.MongoClusterListResult{ - // Value: []*armcosmos.MongoCluster{ - // { - // Name: to.Ptr("myMongoCluster"), - // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"), - // SystemData: &armcosmos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "additionalProp1": to.Ptr("string"), - // "additionalProp2": to.Ptr("string"), - // "additionalProp3": to.Ptr("string"), - // }, - // Properties: &armcosmos.MongoClusterProperties{ - // AdministratorLogin: to.Ptr("mongoAdmin"), - // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), - // EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"), - // NodeGroupSpecs: []*armcosmos.NodeGroupSpec{ - // { - // DiskSizeGB: to.Ptr[int64](128), - // EnableHa: to.Ptr(true), - // SKU: to.Ptr("M30"), - // Kind: to.Ptr(armcosmos.NodeKindShard), - // NodeCount: to.Ptr[int32](4), - // }}, - // ProvisioningState: to.Ptr(armcosmos.ProvisioningStateSucceeded), - // ServerVersion: to.Ptr("5.0"), - // }, - // }, - // { - // Name: to.Ptr("myMongoCluster2"), - // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster2"), - // SystemData: &armcosmos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user2"), - // CreatedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-02-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "additionalProp1": to.Ptr("string"), - // }, - // Properties: &armcosmos.MongoClusterProperties{ - // AdministratorLogin: to.Ptr("mongoAdmin"), - // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster2.mongocluster.cosmos.azure.com"), - // EarliestRestoreTime: to.Ptr("2023-01-10T20:07:35Z"), - // NodeGroupSpecs: []*armcosmos.NodeGroupSpec{ - // { - // DiskSizeGB: to.Ptr[int64](256), - // EnableHa: to.Ptr(true), - // SKU: to.Ptr("M40"), - // Kind: to.Ptr(armcosmos.NodeKindShard), - // NodeCount: to.Ptr[int32](2), - // }}, - // ProvisioningState: to.Ptr(armcosmos.ProvisioningStateSucceeded), - // ServerVersion: to.Ptr("5.0"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/mongo-cluster/CosmosDBMongoClusterCreate.json -func ExampleMongoClustersClient_BeginCreateOrUpdate_createANewMongoCluster() { - 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.NewMongoClustersClient().BeginCreateOrUpdate(ctx, "TestResourceGroup", "myMongoCluster", armcosmos.MongoCluster{ - Location: to.Ptr("westus2"), - Properties: &armcosmos.MongoClusterProperties{ - AdministratorLogin: to.Ptr("mongoAdmin"), - AdministratorLoginPassword: to.Ptr("password"), - NodeGroupSpecs: []*armcosmos.NodeGroupSpec{ - { - DiskSizeGB: to.Ptr[int64](128), - EnableHa: to.Ptr(true), - SKU: to.Ptr("M30"), - Kind: to.Ptr(armcosmos.NodeKindShard), - NodeCount: to.Ptr[int32](3), - }}, - ServerVersion: to.Ptr("5.0"), - }, - }, 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.MongoCluster = armcosmos.MongoCluster{ - // Name: to.Ptr("myMongoCluster"), - // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"), - // SystemData: &armcosmos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Properties: &armcosmos.MongoClusterProperties{ - // AdministratorLogin: to.Ptr("mongoAdmin"), - // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), - // EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"), - // NodeGroupSpecs: []*armcosmos.NodeGroupSpec{ - // { - // DiskSizeGB: to.Ptr[int64](128), - // EnableHa: to.Ptr(true), - // SKU: to.Ptr("M30"), - // Kind: to.Ptr(armcosmos.NodeKindShard), - // NodeCount: to.Ptr[int32](3), - // }}, - // ProvisioningState: to.Ptr(armcosmos.ProvisioningStateSucceeded), - // ServerVersion: to.Ptr("5.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/mongo-cluster/CosmosDBMongoClusterCreatePITR.json -func ExampleMongoClustersClient_BeginCreateOrUpdate_createANewMongoClusterWithPointInTimeRestore() { - 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.NewMongoClustersClient().BeginCreateOrUpdate(ctx, "TestResourceGroup", "myMongoCluster", armcosmos.MongoCluster{ - Location: to.Ptr("westus2"), - Properties: &armcosmos.MongoClusterProperties{ - CreateMode: to.Ptr(armcosmos.CreateModePointInTimeRestore), - RestoreParameters: &armcosmos.MongoClusterRestoreParameters{ - PointInTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-13T20:07:35Z"); return t }()), - SourceResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myOtherMongoCluster"), - }, - }, - }, 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.MongoCluster = armcosmos.MongoCluster{ - // Name: to.Ptr("myMongoCluster"), - // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"), - // Location: to.Ptr("westus2"), - // Properties: &armcosmos.MongoClusterProperties{ - // AdministratorLogin: to.Ptr("mongoAdmin"), - // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), - // EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"), - // NodeGroupSpecs: []*armcosmos.NodeGroupSpec{ - // { - // DiskSizeGB: to.Ptr[int64](128), - // EnableHa: to.Ptr(true), - // SKU: to.Ptr("M30"), - // Kind: to.Ptr(armcosmos.NodeKindShard), - // NodeCount: to.Ptr[int32](3), - // }}, - // ProvisioningState: to.Ptr(armcosmos.ProvisioningStateSucceeded), - // ServerVersion: to.Ptr("5.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/mongo-cluster/CosmosDBMongoClusterGet.json -func ExampleMongoClustersClient_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.NewMongoClustersClient().Get(ctx, "TestResourceGroup", "myMongoCluster", 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.MongoCluster = armcosmos.MongoCluster{ - // Name: to.Ptr("myMongoCluster"), - // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"), - // SystemData: &armcosmos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Tags: map[string]*string{ - // "additionalProp1": to.Ptr("string"), - // "additionalProp2": to.Ptr("string"), - // "additionalProp3": to.Ptr("string"), - // }, - // Properties: &armcosmos.MongoClusterProperties{ - // AdministratorLogin: to.Ptr("mongoAdmin"), - // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), - // EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"), - // NodeGroupSpecs: []*armcosmos.NodeGroupSpec{ - // { - // DiskSizeGB: to.Ptr[int64](128), - // EnableHa: to.Ptr(true), - // SKU: to.Ptr("M30"), - // Kind: to.Ptr(armcosmos.NodeKindShard), - // NodeCount: to.Ptr[int32](4), - // }}, - // ProvisioningState: to.Ptr(armcosmos.ProvisioningStateSucceeded), - // ServerVersion: to.Ptr("5.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/mongo-cluster/CosmosDBMongoClusterDelete.json -func ExampleMongoClustersClient_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.NewMongoClustersClient().BeginDelete(ctx, "TestResourceGroup", "myMongoCluster", 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/mongo-cluster/CosmosDBMongoClusterAddNode.json -func ExampleMongoClustersClient_BeginUpdate_addNewShardNodes() { - 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.NewMongoClustersClient().BeginUpdate(ctx, "TestResourceGroup", "myMongoCluster", armcosmos.MongoClusterUpdate{ - Properties: &armcosmos.MongoClusterProperties{ - NodeGroupSpecs: []*armcosmos.NodeGroupSpec{ - { - Kind: to.Ptr(armcosmos.NodeKindShard), - NodeCount: to.Ptr[int32](4), - }}, - }, - }, 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.MongoCluster = armcosmos.MongoCluster{ - // Name: to.Ptr("myMongoCluster"), - // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"), - // SystemData: &armcosmos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Properties: &armcosmos.MongoClusterProperties{ - // AdministratorLogin: to.Ptr("mongoAdmin"), - // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), - // EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"), - // NodeGroupSpecs: []*armcosmos.NodeGroupSpec{ - // { - // DiskSizeGB: to.Ptr[int64](128), - // EnableHa: to.Ptr(true), - // SKU: to.Ptr("M30"), - // Kind: to.Ptr(armcosmos.NodeKindShard), - // NodeCount: to.Ptr[int32](4), - // }}, - // ServerVersion: to.Ptr("5.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/mongo-cluster/CosmosDBMongoClusterUpdate.json -func ExampleMongoClustersClient_BeginUpdate_updateTheMongoCluster() { - 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.NewMongoClustersClient().BeginUpdate(ctx, "TestResourceGroup", "myMongoCluster", armcosmos.MongoClusterUpdate{ - Properties: &armcosmos.MongoClusterProperties{ - AdministratorLogin: to.Ptr("mongoAdmin"), - AdministratorLoginPassword: to.Ptr("password"), - NodeGroupSpecs: []*armcosmos.NodeGroupSpec{ - { - DiskSizeGB: to.Ptr[int64](256), - EnableHa: to.Ptr(true), - SKU: to.Ptr("M50"), - Kind: to.Ptr(armcosmos.NodeKindShard), - NodeCount: to.Ptr[int32](4), - }}, - ServerVersion: to.Ptr("5.0"), - }, - }, 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.MongoCluster = armcosmos.MongoCluster{ - // Name: to.Ptr("myMongoCluster"), - // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"), - // SystemData: &armcosmos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus2"), - // Properties: &armcosmos.MongoClusterProperties{ - // AdministratorLogin: to.Ptr("mongoAdmin"), - // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), - // EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"), - // NodeGroupSpecs: []*armcosmos.NodeGroupSpec{ - // { - // DiskSizeGB: to.Ptr[int64](256), - // EnableHa: to.Ptr(true), - // SKU: to.Ptr("M50"), - // Kind: to.Ptr(armcosmos.NodeKindShard), - // NodeCount: to.Ptr[int32](4), - // }}, - // ProvisioningState: to.Ptr(armcosmos.ProvisioningStateSucceeded), - // ServerVersion: to.Ptr("5.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleCreate.json -func ExampleMongoClustersClient_BeginCreateOrUpdateFirewallRule() { - 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.NewMongoClustersClient().BeginCreateOrUpdateFirewallRule(ctx, "TestGroup", "myMongoCluster", "rule1", armcosmos.FirewallRule{ - Properties: &armcosmos.FirewallRuleProperties{ - EndIPAddress: to.Ptr("255.255.255.255"), - StartIPAddress: to.Ptr("0.0.0.0"), - }, - }, 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.FirewallRule = armcosmos.FirewallRule{ - // Name: to.Ptr("rule1"), - // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters/firewallRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/firewallRules/rule1"), - // SystemData: &armcosmos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // }, - // Properties: &armcosmos.FirewallRuleProperties{ - // EndIPAddress: to.Ptr("255.255.255.255"), - // ProvisioningState: to.Ptr(armcosmos.ProvisioningStateSucceeded), - // StartIPAddress: to.Ptr("0.0.0.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleDelete.json -func ExampleMongoClustersClient_BeginDeleteFirewallRule() { - 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.NewMongoClustersClient().BeginDeleteFirewallRule(ctx, "TestGroup", "myMongoCluster", "rule1", 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleGet.json -func ExampleMongoClustersClient_GetFirewallRule() { - 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.NewMongoClustersClient().GetFirewallRule(ctx, "TestGroup", "myMongoCluster", "rule1", 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.FirewallRule = armcosmos.FirewallRule{ - // Name: to.Ptr("rule1"), - // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters/firewallRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/firewallRules/rule1"), - // SystemData: &armcosmos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // }, - // Properties: &armcosmos.FirewallRuleProperties{ - // EndIPAddress: to.Ptr("255.255.255.255"), - // ProvisioningState: to.Ptr(armcosmos.ProvisioningStateSucceeded), - // StartIPAddress: to.Ptr("0.0.0.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/mongo-cluster/CosmosDBMongoClusterFirewallRuleList.json -func ExampleMongoClustersClient_NewListFirewallRulesPager() { - 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.NewMongoClustersClient().NewListFirewallRulesPager("TestGroup", "myMongoCluster", 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.FirewallRuleListResult = armcosmos.FirewallRuleListResult{ - // Value: []*armcosmos.FirewallRule{ - // { - // Name: to.Ptr("rule1"), - // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters/firewallRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/firewallRules/rule1"), - // SystemData: &armcosmos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // }, - // Properties: &armcosmos.FirewallRuleProperties{ - // EndIPAddress: to.Ptr("255.255.255.255"), - // ProvisioningState: to.Ptr(armcosmos.ProvisioningStateSucceeded), - // StartIPAddress: to.Ptr("0.0.0.0"), - // }, - // }, - // { - // Name: to.Ptr("rule2"), - // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters/firewallRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/firewallRules/rule2"), - // SystemData: &armcosmos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armcosmos.CreatedByTypeUser), - // }, - // Properties: &armcosmos.FirewallRuleProperties{ - // EndIPAddress: to.Ptr("255.0.0.0"), - // ProvisioningState: to.Ptr(armcosmos.ProvisioningStateSucceeded), - // StartIPAddress: to.Ptr("1.0.0.0"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/mongo-cluster/CosmosDBMongoClusterNameAvailability.json -func ExampleMongoClustersClient_CheckNameAvailability_checkNameAvailability() { - 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.NewMongoClustersClient().CheckNameAvailability(ctx, "westus2", armcosmos.CheckNameAvailabilityRequest{ - Name: to.Ptr("newmongocluster"), - Type: to.Ptr("Microsoft.DocumentDB/mongoClusters"), - }, 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.CheckNameAvailabilityResponse = armcosmos.CheckNameAvailabilityResponse{ - // NameAvailable: to.Ptr(true), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/mongo-cluster/CosmosDBMongoClusterNameAvailability_AlreadyExists.json -func ExampleMongoClustersClient_CheckNameAvailability_checkNameAvailabilityAlreadyExistsResult() { - 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.NewMongoClustersClient().CheckNameAvailability(ctx, "westus2", armcosmos.CheckNameAvailabilityRequest{ - Name: to.Ptr("existingmongocluster"), - Type: to.Ptr("Microsoft.DocumentDB/mongoClusters"), - }, 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.CheckNameAvailabilityResponse = armcosmos.CheckNameAvailabilityResponse{ - // Message: to.Ptr("Cluster name 'existingmongocluster' is already in use."), - // NameAvailable: to.Ptr(false), - // Reason: to.Ptr(armcosmos.CheckNameAvailabilityReasonAlreadyExists), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/mongo-cluster/CosmosDBMongoClusterListConnectionStrings.json -func ExampleMongoClustersClient_ListConnectionStrings() { - 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.NewMongoClustersClient().ListConnectionStrings(ctx, "TestGroup", "myMongoCluster", 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.ListConnectionStringsResult = armcosmos.ListConnectionStringsResult{ - // ConnectionStrings: []*armcosmos.ConnectionString{ - // { - // Description: to.Ptr("default connection string"), - // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), - // }}, - // } -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/mongodbresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/mongodbresources_client.go index 1bedbd83aadd..18f97fb608ea 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/mongodbresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/mongodbresources_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -47,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -61,7 +60,8 @@ func (client *MongoDBResourcesClient) BeginCreateUpdateMongoDBCollection(ctx con if err != nil { return nil, err } - return runtime.NewPoller[MongoDBResourcesClientCreateUpdateMongoDBCollectionResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[MongoDBResourcesClientCreateUpdateMongoDBCollectionResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientCreateUpdateMongoDBCollectionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.createUpdateMongoDBCollectionCreateRequest(ctx, resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateMongoDBCollectionCreateRequest creates the CreateUpdateMongoDBCollection request. @@ -114,16 +116,19 @@ func (client *MongoDBResourcesClient) createUpdateMongoDBCollectionCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateMongoDBCollectionParameters) + if err := runtime.MarshalAsJSON(req, createUpdateMongoDBCollectionParameters); err != nil { + return nil, err + } + return req, nil } // BeginCreateUpdateMongoDBDatabase - Create or updates Azure Cosmos DB MongoDB database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -136,7 +141,8 @@ func (client *MongoDBResourcesClient) BeginCreateUpdateMongoDBDatabase(ctx conte if err != nil { return nil, err } - return runtime.NewPoller[MongoDBResourcesClientCreateUpdateMongoDBDatabaseResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[MongoDBResourcesClientCreateUpdateMongoDBDatabaseResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientCreateUpdateMongoDBDatabaseResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -145,20 +151,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoDBResourcesClient) createUpdateMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateMongoDBDatabaseParameters MongoDBDatabaseCreateUpdateParameters, options *MongoDBResourcesClientBeginCreateUpdateMongoDBDatabaseOptions) (*http.Response, error) { + var err error req, err := client.createUpdateMongoDBDatabaseCreateRequest(ctx, resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateMongoDBDatabaseCreateRequest creates the CreateUpdateMongoDBDatabase request. @@ -185,16 +193,19 @@ func (client *MongoDBResourcesClient) createUpdateMongoDBDatabaseCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateMongoDBDatabaseParameters) + if err := runtime.MarshalAsJSON(req, createUpdateMongoDBDatabaseParameters); err != nil { + return nil, err + } + return req, nil } // 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -207,7 +218,8 @@ func (client *MongoDBResourcesClient) BeginCreateUpdateMongoRoleDefinition(ctx c if err != nil { return nil, err } - return runtime.NewPoller[MongoDBResourcesClientCreateUpdateMongoRoleDefinitionResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[MongoDBResourcesClientCreateUpdateMongoRoleDefinitionResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientCreateUpdateMongoRoleDefinitionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -216,20 +228,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoDBResourcesClient) createUpdateMongoRoleDefinition(ctx context.Context, mongoRoleDefinitionID string, resourceGroupName string, accountName string, createUpdateMongoRoleDefinitionParameters MongoRoleDefinitionCreateUpdateParameters, options *MongoDBResourcesClientBeginCreateUpdateMongoRoleDefinitionOptions) (*http.Response, error) { + var err error req, err := client.createUpdateMongoRoleDefinitionCreateRequest(ctx, mongoRoleDefinitionID, resourceGroupName, accountName, createUpdateMongoRoleDefinitionParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateMongoRoleDefinitionCreateRequest creates the CreateUpdateMongoRoleDefinition request. @@ -256,16 +270,19 @@ func (client *MongoDBResourcesClient) createUpdateMongoRoleDefinitionCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateMongoRoleDefinitionParameters) + if err := runtime.MarshalAsJSON(req, createUpdateMongoRoleDefinitionParameters); err != nil { + return nil, err + } + return req, nil } // 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -278,7 +295,8 @@ func (client *MongoDBResourcesClient) BeginCreateUpdateMongoUserDefinition(ctx c if err != nil { return nil, err } - return runtime.NewPoller[MongoDBResourcesClientCreateUpdateMongoUserDefinitionResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[MongoDBResourcesClientCreateUpdateMongoUserDefinitionResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientCreateUpdateMongoUserDefinitionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -287,20 +305,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoDBResourcesClient) createUpdateMongoUserDefinition(ctx context.Context, mongoUserDefinitionID string, resourceGroupName string, accountName string, createUpdateMongoUserDefinitionParameters MongoUserDefinitionCreateUpdateParameters, options *MongoDBResourcesClientBeginCreateUpdateMongoUserDefinitionOptions) (*http.Response, error) { + var err error req, err := client.createUpdateMongoUserDefinitionCreateRequest(ctx, mongoUserDefinitionID, resourceGroupName, accountName, createUpdateMongoUserDefinitionParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateMongoUserDefinitionCreateRequest creates the CreateUpdateMongoUserDefinition request. @@ -327,16 +347,19 @@ func (client *MongoDBResourcesClient) createUpdateMongoUserDefinitionCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateMongoUserDefinitionParameters) + if err := runtime.MarshalAsJSON(req, createUpdateMongoUserDefinitionParameters); err != nil { + return nil, err + } + return req, nil } // BeginDeleteMongoDBCollection - Deletes an existing Azure Cosmos DB MongoDB Collection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -349,7 +372,8 @@ func (client *MongoDBResourcesClient) BeginDeleteMongoDBCollection(ctx context.C if err != nil { return nil, err } - return runtime.NewPoller[MongoDBResourcesClientDeleteMongoDBCollectionResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[MongoDBResourcesClientDeleteMongoDBCollectionResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientDeleteMongoDBCollectionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -358,20 +382,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoDBResourcesClient) deleteMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, options *MongoDBResourcesClientBeginDeleteMongoDBCollectionOptions) (*http.Response, error) { + var err error req, err := client.deleteMongoDBCollectionCreateRequest(ctx, resourceGroupName, accountName, databaseName, collectionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteMongoDBCollectionCreateRequest creates the DeleteMongoDBCollection request. @@ -402,7 +428,7 @@ func (client *MongoDBResourcesClient) deleteMongoDBCollectionCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -410,7 +436,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -422,7 +448,8 @@ func (client *MongoDBResourcesClient) BeginDeleteMongoDBDatabase(ctx context.Con if err != nil { return nil, err } - return runtime.NewPoller[MongoDBResourcesClientDeleteMongoDBDatabaseResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[MongoDBResourcesClientDeleteMongoDBDatabaseResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientDeleteMongoDBDatabaseResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -431,20 +458,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoDBResourcesClient) deleteMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *MongoDBResourcesClientBeginDeleteMongoDBDatabaseOptions) (*http.Response, error) { + var err error req, err := client.deleteMongoDBDatabaseCreateRequest(ctx, resourceGroupName, accountName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteMongoDBDatabaseCreateRequest creates the DeleteMongoDBDatabase request. @@ -471,7 +500,7 @@ func (client *MongoDBResourcesClient) deleteMongoDBDatabaseCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -479,7 +508,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -491,7 +520,8 @@ func (client *MongoDBResourcesClient) BeginDeleteMongoRoleDefinition(ctx context if err != nil { return nil, err } - return runtime.NewPoller[MongoDBResourcesClientDeleteMongoRoleDefinitionResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[MongoDBResourcesClientDeleteMongoRoleDefinitionResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientDeleteMongoRoleDefinitionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -500,20 +530,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoDBResourcesClient) deleteMongoRoleDefinition(ctx context.Context, mongoRoleDefinitionID string, resourceGroupName string, accountName string, options *MongoDBResourcesClientBeginDeleteMongoRoleDefinitionOptions) (*http.Response, error) { + var err error req, err := client.deleteMongoRoleDefinitionCreateRequest(ctx, mongoRoleDefinitionID, resourceGroupName, accountName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteMongoRoleDefinitionCreateRequest creates the DeleteMongoRoleDefinition request. @@ -540,7 +572,7 @@ func (client *MongoDBResourcesClient) deleteMongoRoleDefinitionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -549,7 +581,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -561,7 +593,8 @@ func (client *MongoDBResourcesClient) BeginDeleteMongoUserDefinition(ctx context if err != nil { return nil, err } - return runtime.NewPoller[MongoDBResourcesClientDeleteMongoUserDefinitionResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[MongoDBResourcesClientDeleteMongoUserDefinitionResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientDeleteMongoUserDefinitionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -570,20 +603,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoDBResourcesClient) deleteMongoUserDefinition(ctx context.Context, mongoUserDefinitionID string, resourceGroupName string, accountName string, options *MongoDBResourcesClientBeginDeleteMongoUserDefinitionOptions) (*http.Response, error) { + var err error req, err := client.deleteMongoUserDefinitionCreateRequest(ctx, mongoUserDefinitionID, resourceGroupName, accountName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteMongoUserDefinitionCreateRequest creates the DeleteMongoUserDefinition request. @@ -610,7 +645,7 @@ func (client *MongoDBResourcesClient) deleteMongoUserDefinitionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -619,7 +654,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -627,18 +662,21 @@ func (client *MongoDBResourcesClient) deleteMongoUserDefinitionCreateRequest(ctx // - options - MongoDBResourcesClientGetMongoDBCollectionOptions contains the optional parameters for the MongoDBResourcesClient.GetMongoDBCollection // method. func (client *MongoDBResourcesClient) GetMongoDBCollection(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, options *MongoDBResourcesClientGetMongoDBCollectionOptions) (MongoDBResourcesClientGetMongoDBCollectionResponse, error) { + var err error req, err := client.getMongoDBCollectionCreateRequest(ctx, resourceGroupName, accountName, databaseName, collectionName, options) if err != nil { return MongoDBResourcesClientGetMongoDBCollectionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MongoDBResourcesClientGetMongoDBCollectionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MongoDBResourcesClientGetMongoDBCollectionResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MongoDBResourcesClientGetMongoDBCollectionResponse{}, err } - return client.getMongoDBCollectionHandleResponse(resp) + resp, err := client.getMongoDBCollectionHandleResponse(httpResp) + return resp, err } // getMongoDBCollectionCreateRequest creates the GetMongoDBCollection request. @@ -669,7 +707,7 @@ func (client *MongoDBResourcesClient) getMongoDBCollectionCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -688,7 +726,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -696,18 +734,21 @@ func (client *MongoDBResourcesClient) getMongoDBCollectionHandleResponse(resp *h // - options - MongoDBResourcesClientGetMongoDBCollectionThroughputOptions contains the optional parameters for the MongoDBResourcesClient.GetMongoDBCollectionThroughput // method. func (client *MongoDBResourcesClient) GetMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, options *MongoDBResourcesClientGetMongoDBCollectionThroughputOptions) (MongoDBResourcesClientGetMongoDBCollectionThroughputResponse, error) { + var err error req, err := client.getMongoDBCollectionThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, collectionName, options) if err != nil { return MongoDBResourcesClientGetMongoDBCollectionThroughputResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MongoDBResourcesClientGetMongoDBCollectionThroughputResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MongoDBResourcesClientGetMongoDBCollectionThroughputResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MongoDBResourcesClientGetMongoDBCollectionThroughputResponse{}, err } - return client.getMongoDBCollectionThroughputHandleResponse(resp) + resp, err := client.getMongoDBCollectionThroughputHandleResponse(httpResp) + return resp, err } // getMongoDBCollectionThroughputCreateRequest creates the GetMongoDBCollectionThroughput request. @@ -738,7 +779,7 @@ func (client *MongoDBResourcesClient) getMongoDBCollectionThroughputCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -756,25 +797,28 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. // - options - MongoDBResourcesClientGetMongoDBDatabaseOptions contains the optional parameters for the MongoDBResourcesClient.GetMongoDBDatabase // method. func (client *MongoDBResourcesClient) GetMongoDBDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *MongoDBResourcesClientGetMongoDBDatabaseOptions) (MongoDBResourcesClientGetMongoDBDatabaseResponse, error) { + var err error req, err := client.getMongoDBDatabaseCreateRequest(ctx, resourceGroupName, accountName, databaseName, options) if err != nil { return MongoDBResourcesClientGetMongoDBDatabaseResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MongoDBResourcesClientGetMongoDBDatabaseResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MongoDBResourcesClientGetMongoDBDatabaseResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MongoDBResourcesClientGetMongoDBDatabaseResponse{}, err } - return client.getMongoDBDatabaseHandleResponse(resp) + resp, err := client.getMongoDBDatabaseHandleResponse(httpResp) + return resp, err } // getMongoDBDatabaseCreateRequest creates the GetMongoDBDatabase request. @@ -801,7 +845,7 @@ func (client *MongoDBResourcesClient) getMongoDBDatabaseCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -820,25 +864,28 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. // - options - MongoDBResourcesClientGetMongoDBDatabaseThroughputOptions contains the optional parameters for the MongoDBResourcesClient.GetMongoDBDatabaseThroughput // method. func (client *MongoDBResourcesClient) GetMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *MongoDBResourcesClientGetMongoDBDatabaseThroughputOptions) (MongoDBResourcesClientGetMongoDBDatabaseThroughputResponse, error) { + var err error req, err := client.getMongoDBDatabaseThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, options) if err != nil { return MongoDBResourcesClientGetMongoDBDatabaseThroughputResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MongoDBResourcesClientGetMongoDBDatabaseThroughputResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MongoDBResourcesClientGetMongoDBDatabaseThroughputResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MongoDBResourcesClientGetMongoDBDatabaseThroughputResponse{}, err } - return client.getMongoDBDatabaseThroughputHandleResponse(resp) + resp, err := client.getMongoDBDatabaseThroughputHandleResponse(httpResp) + return resp, err } // getMongoDBDatabaseThroughputCreateRequest creates the GetMongoDBDatabaseThroughput request. @@ -865,7 +912,7 @@ func (client *MongoDBResourcesClient) getMongoDBDatabaseThroughputCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -883,25 +930,28 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. // - options - MongoDBResourcesClientGetMongoRoleDefinitionOptions contains the optional parameters for the MongoDBResourcesClient.GetMongoRoleDefinition // method. func (client *MongoDBResourcesClient) GetMongoRoleDefinition(ctx context.Context, mongoRoleDefinitionID string, resourceGroupName string, accountName string, options *MongoDBResourcesClientGetMongoRoleDefinitionOptions) (MongoDBResourcesClientGetMongoRoleDefinitionResponse, error) { + var err error req, err := client.getMongoRoleDefinitionCreateRequest(ctx, mongoRoleDefinitionID, resourceGroupName, accountName, options) if err != nil { return MongoDBResourcesClientGetMongoRoleDefinitionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MongoDBResourcesClientGetMongoRoleDefinitionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MongoDBResourcesClientGetMongoRoleDefinitionResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MongoDBResourcesClientGetMongoRoleDefinitionResponse{}, err } - return client.getMongoRoleDefinitionHandleResponse(resp) + resp, err := client.getMongoRoleDefinitionHandleResponse(httpResp) + return resp, err } // getMongoRoleDefinitionCreateRequest creates the GetMongoRoleDefinition request. @@ -928,7 +978,7 @@ func (client *MongoDBResourcesClient) getMongoRoleDefinitionCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -946,25 +996,28 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. // - options - MongoDBResourcesClientGetMongoUserDefinitionOptions contains the optional parameters for the MongoDBResourcesClient.GetMongoUserDefinition // method. func (client *MongoDBResourcesClient) GetMongoUserDefinition(ctx context.Context, mongoUserDefinitionID string, resourceGroupName string, accountName string, options *MongoDBResourcesClientGetMongoUserDefinitionOptions) (MongoDBResourcesClientGetMongoUserDefinitionResponse, error) { + var err error req, err := client.getMongoUserDefinitionCreateRequest(ctx, mongoUserDefinitionID, resourceGroupName, accountName, options) if err != nil { return MongoDBResourcesClientGetMongoUserDefinitionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return MongoDBResourcesClientGetMongoUserDefinitionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MongoDBResourcesClientGetMongoUserDefinitionResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MongoDBResourcesClientGetMongoUserDefinitionResponse{}, err } - return client.getMongoUserDefinitionHandleResponse(resp) + resp, err := client.getMongoUserDefinitionHandleResponse(httpResp) + return resp, err } // getMongoUserDefinitionCreateRequest creates the GetMongoUserDefinition request. @@ -991,7 +1044,7 @@ func (client *MongoDBResourcesClient) getMongoUserDefinitionCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1009,7 +1062,7 @@ func (client *MongoDBResourcesClient) getMongoUserDefinitionHandleResponse(resp // BeginListMongoDBCollectionPartitionMerge - Merges the partitions of a MongoDB Collection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1023,9 +1076,10 @@ func (client *MongoDBResourcesClient) BeginListMongoDBCollectionPartitionMerge(c if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientListMongoDBCollectionPartitionMergeResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientListMongoDBCollectionPartitionMergeResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientListMongoDBCollectionPartitionMergeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1034,20 +1088,22 @@ func (client *MongoDBResourcesClient) BeginListMongoDBCollectionPartitionMerge(c // ListMongoDBCollectionPartitionMerge - Merges the partitions of a MongoDB Collection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.listMongoDBCollectionPartitionMergeCreateRequest(ctx, resourceGroupName, accountName, databaseName, collectionName, mergeParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // listMongoDBCollectionPartitionMergeCreateRequest creates the ListMongoDBCollectionPartitionMerge request. @@ -1078,15 +1134,18 @@ func (client *MongoDBResourcesClient) listMongoDBCollectionPartitionMergeCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, mergeParameters) + 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1138,7 +1197,7 @@ func (client *MongoDBResourcesClient) listMongoDBCollectionsCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1155,7 +1214,7 @@ func (client *MongoDBResourcesClient) listMongoDBCollectionsHandleResponse(resp // NewListMongoDBDatabasesPager - Lists the MongoDB databases under an existing Azure Cosmos DB database account. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -1202,7 +1261,7 @@ func (client *MongoDBResourcesClient) listMongoDBDatabasesCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1219,7 +1278,7 @@ func (client *MongoDBResourcesClient) listMongoDBDatabasesHandleResponse(resp *h // NewListMongoRoleDefinitionsPager - Retrieves the list of all Azure Cosmos DB Mongo Role Definitions. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -1266,7 +1325,7 @@ func (client *MongoDBResourcesClient) listMongoRoleDefinitionsCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1283,7 +1342,7 @@ func (client *MongoDBResourcesClient) listMongoRoleDefinitionsHandleResponse(res // NewListMongoUserDefinitionsPager - Retrieves the list of all Azure Cosmos DB Mongo User Definition. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -1330,7 +1389,7 @@ func (client *MongoDBResourcesClient) listMongoUserDefinitionsCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1348,7 +1407,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1361,7 +1420,8 @@ func (client *MongoDBResourcesClient) BeginMigrateMongoDBCollectionToAutoscale(c if err != nil { return nil, err } - return runtime.NewPoller[MongoDBResourcesClientMigrateMongoDBCollectionToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[MongoDBResourcesClientMigrateMongoDBCollectionToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientMigrateMongoDBCollectionToAutoscaleResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1370,20 +1430,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoDBResourcesClient) migrateMongoDBCollectionToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, options *MongoDBResourcesClientBeginMigrateMongoDBCollectionToAutoscaleOptions) (*http.Response, error) { + var err error req, err := client.migrateMongoDBCollectionToAutoscaleCreateRequest(ctx, resourceGroupName, accountName, databaseName, collectionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateMongoDBCollectionToAutoscaleCreateRequest creates the MigrateMongoDBCollectionToAutoscale request. @@ -1414,7 +1476,7 @@ func (client *MongoDBResourcesClient) migrateMongoDBCollectionToAutoscaleCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1424,7 +1486,7 @@ func (client *MongoDBResourcesClient) migrateMongoDBCollectionToAutoscaleCreateR // throughput // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1437,7 +1499,8 @@ func (client *MongoDBResourcesClient) BeginMigrateMongoDBCollectionToManualThrou if err != nil { return nil, err } - return runtime.NewPoller[MongoDBResourcesClientMigrateMongoDBCollectionToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[MongoDBResourcesClientMigrateMongoDBCollectionToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientMigrateMongoDBCollectionToManualThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1446,20 +1509,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoDBResourcesClient) migrateMongoDBCollectionToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, options *MongoDBResourcesClientBeginMigrateMongoDBCollectionToManualThroughputOptions) (*http.Response, error) { + var err error req, err := client.migrateMongoDBCollectionToManualThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, collectionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateMongoDBCollectionToManualThroughputCreateRequest creates the MigrateMongoDBCollectionToManualThroughput request. @@ -1490,7 +1555,7 @@ func (client *MongoDBResourcesClient) migrateMongoDBCollectionToManualThroughput return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1499,7 +1564,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1511,7 +1576,8 @@ func (client *MongoDBResourcesClient) BeginMigrateMongoDBDatabaseToAutoscale(ctx if err != nil { return nil, err } - return runtime.NewPoller[MongoDBResourcesClientMigrateMongoDBDatabaseToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[MongoDBResourcesClientMigrateMongoDBDatabaseToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientMigrateMongoDBDatabaseToAutoscaleResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1520,20 +1586,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoDBResourcesClient) migrateMongoDBDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *MongoDBResourcesClientBeginMigrateMongoDBDatabaseToAutoscaleOptions) (*http.Response, error) { + var err error req, err := client.migrateMongoDBDatabaseToAutoscaleCreateRequest(ctx, resourceGroupName, accountName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateMongoDBDatabaseToAutoscaleCreateRequest creates the MigrateMongoDBDatabaseToAutoscale request. @@ -1560,7 +1628,7 @@ func (client *MongoDBResourcesClient) migrateMongoDBDatabaseToAutoscaleCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1569,7 +1637,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1581,7 +1649,8 @@ func (client *MongoDBResourcesClient) BeginMigrateMongoDBDatabaseToManualThrough if err != nil { return nil, err } - return runtime.NewPoller[MongoDBResourcesClientMigrateMongoDBDatabaseToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[MongoDBResourcesClientMigrateMongoDBDatabaseToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientMigrateMongoDBDatabaseToManualThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1590,20 +1659,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoDBResourcesClient) migrateMongoDBDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *MongoDBResourcesClientBeginMigrateMongoDBDatabaseToManualThroughputOptions) (*http.Response, error) { + var err error req, err := client.migrateMongoDBDatabaseToManualThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateMongoDBDatabaseToManualThroughputCreateRequest creates the MigrateMongoDBDatabaseToManualThroughput request. @@ -1630,7 +1701,7 @@ func (client *MongoDBResourcesClient) migrateMongoDBDatabaseToManualThroughputCr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1639,7 +1710,7 @@ func (client *MongoDBResourcesClient) migrateMongoDBDatabaseToManualThroughputCr // BeginMongoDBContainerRedistributeThroughput - Redistribute throughput for an Azure Cosmos DB MongoDB container // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1653,9 +1724,10 @@ func (client *MongoDBResourcesClient) BeginMongoDBContainerRedistributeThroughpu if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientMongoDBContainerRedistributeThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1664,20 +1736,22 @@ func (client *MongoDBResourcesClient) BeginMongoDBContainerRedistributeThroughpu // MongoDBContainerRedistributeThroughput - Redistribute throughput for an Azure Cosmos DB MongoDB container // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.mongoDBContainerRedistributeThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, collectionName, redistributeThroughputParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // mongoDBContainerRedistributeThroughputCreateRequest creates the MongoDBContainerRedistributeThroughput request. @@ -1708,16 +1782,19 @@ func (client *MongoDBResourcesClient) mongoDBContainerRedistributeThroughputCrea return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, redistributeThroughputParameters) + 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1732,9 +1809,10 @@ func (client *MongoDBResourcesClient) BeginMongoDBContainerRetrieveThroughputDis if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientMongoDBContainerRetrieveThroughputDistributionResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientMongoDBContainerRetrieveThroughputDistributionResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientMongoDBContainerRetrieveThroughputDistributionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1743,20 +1821,22 @@ func (client *MongoDBResourcesClient) BeginMongoDBContainerRetrieveThroughputDis // 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.mongoDBContainerRetrieveThroughputDistributionCreateRequest(ctx, resourceGroupName, accountName, databaseName, collectionName, retrieveThroughputParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // mongoDBContainerRetrieveThroughputDistributionCreateRequest creates the MongoDBContainerRetrieveThroughputDistribution request. @@ -1787,16 +1867,19 @@ func (client *MongoDBResourcesClient) mongoDBContainerRetrieveThroughputDistribu return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, retrieveThroughputParameters) + 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1809,9 +1892,10 @@ func (client *MongoDBResourcesClient) BeginMongoDBDatabasePartitionMerge(ctx con if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientMongoDBDatabasePartitionMergeResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientMongoDBDatabasePartitionMergeResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientMongoDBDatabasePartitionMergeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1820,20 +1904,22 @@ func (client *MongoDBResourcesClient) BeginMongoDBDatabasePartitionMerge(ctx con // MongoDBDatabasePartitionMerge - Merges the partitions of a MongoDB database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoDBResourcesClient) mongoDBDatabasePartitionMerge(ctx context.Context, resourceGroupName string, accountName string, databaseName string, mergeParameters MergeParameters, options *MongoDBResourcesClientBeginMongoDBDatabasePartitionMergeOptions) (*http.Response, error) { + var err error req, err := client.mongoDBDatabasePartitionMergeCreateRequest(ctx, resourceGroupName, accountName, databaseName, mergeParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // mongoDBDatabasePartitionMergeCreateRequest creates the MongoDBDatabasePartitionMerge request. @@ -1860,16 +1946,19 @@ func (client *MongoDBResourcesClient) mongoDBDatabasePartitionMergeCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, mergeParameters) + 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1882,9 +1971,10 @@ func (client *MongoDBResourcesClient) BeginMongoDBDatabaseRedistributeThroughput if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientMongoDBDatabaseRedistributeThroughputResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientMongoDBDatabaseRedistributeThroughputResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientMongoDBDatabaseRedistributeThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1893,20 +1983,22 @@ func (client *MongoDBResourcesClient) BeginMongoDBDatabaseRedistributeThroughput // MongoDBDatabaseRedistributeThroughput - Redistribute throughput for an Azure Cosmos DB MongoDB database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoDBResourcesClient) mongoDBDatabaseRedistributeThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, redistributeThroughputParameters RedistributeThroughputParameters, options *MongoDBResourcesClientBeginMongoDBDatabaseRedistributeThroughputOptions) (*http.Response, error) { + var err error req, err := client.mongoDBDatabaseRedistributeThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, redistributeThroughputParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // mongoDBDatabaseRedistributeThroughputCreateRequest creates the MongoDBDatabaseRedistributeThroughput request. @@ -1933,16 +2025,19 @@ func (client *MongoDBResourcesClient) mongoDBDatabaseRedistributeThroughputCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, redistributeThroughputParameters) + 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1956,9 +2051,10 @@ func (client *MongoDBResourcesClient) BeginMongoDBDatabaseRetrieveThroughputDist if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientMongoDBDatabaseRetrieveThroughputDistributionResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientMongoDBDatabaseRetrieveThroughputDistributionResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientMongoDBDatabaseRetrieveThroughputDistributionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1967,20 +2063,22 @@ func (client *MongoDBResourcesClient) BeginMongoDBDatabaseRetrieveThroughputDist // 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoDBResourcesClient) mongoDBDatabaseRetrieveThroughputDistribution(ctx context.Context, resourceGroupName string, accountName string, databaseName string, retrieveThroughputParameters RetrieveThroughputParameters, options *MongoDBResourcesClientBeginMongoDBDatabaseRetrieveThroughputDistributionOptions) (*http.Response, error) { + var err error req, err := client.mongoDBDatabaseRetrieveThroughputDistributionCreateRequest(ctx, resourceGroupName, accountName, databaseName, retrieveThroughputParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // mongoDBDatabaseRetrieveThroughputDistributionCreateRequest creates the MongoDBDatabaseRetrieveThroughputDistribution request. @@ -2007,16 +2105,19 @@ func (client *MongoDBResourcesClient) mongoDBDatabaseRetrieveThroughputDistribut return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, retrieveThroughputParameters) + 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2030,9 +2131,10 @@ func (client *MongoDBResourcesClient) BeginRetrieveContinuousBackupInformation(c if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientRetrieveContinuousBackupInformationResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDBResourcesClientRetrieveContinuousBackupInformationResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientRetrieveContinuousBackupInformationResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -2041,20 +2143,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.retrieveContinuousBackupInformationCreateRequest(ctx, resourceGroupName, accountName, databaseName, collectionName, location, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // retrieveContinuousBackupInformationCreateRequest creates the RetrieveContinuousBackupInformation request. @@ -2085,16 +2189,19 @@ func (client *MongoDBResourcesClient) retrieveContinuousBackupInformationCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, location) + if err := runtime.MarshalAsJSON(req, location); err != nil { + return nil, err + } + return req, nil } // 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2108,7 +2215,8 @@ func (client *MongoDBResourcesClient) BeginUpdateMongoDBCollectionThroughput(ctx if err != nil { return nil, err } - return runtime.NewPoller[MongoDBResourcesClientUpdateMongoDBCollectionThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[MongoDBResourcesClientUpdateMongoDBCollectionThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientUpdateMongoDBCollectionThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -2117,20 +2225,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.updateMongoDBCollectionThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateMongoDBCollectionThroughputCreateRequest creates the UpdateMongoDBCollectionThroughput request. @@ -2161,16 +2271,19 @@ func (client *MongoDBResourcesClient) updateMongoDBCollectionThroughputCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, updateThroughputParameters) + if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { + return nil, err + } + return req, nil } // 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2183,7 +2296,8 @@ func (client *MongoDBResourcesClient) BeginUpdateMongoDBDatabaseThroughput(ctx c if err != nil { return nil, err } - return runtime.NewPoller[MongoDBResourcesClientUpdateMongoDBDatabaseThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[MongoDBResourcesClientUpdateMongoDBDatabaseThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[MongoDBResourcesClientUpdateMongoDBDatabaseThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -2192,20 +2306,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *MongoDBResourcesClient) updateMongoDBDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *MongoDBResourcesClientBeginUpdateMongoDBDatabaseThroughputOptions) (*http.Response, error) { + var err error req, err := client.updateMongoDBDatabaseThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateMongoDBDatabaseThroughputCreateRequest creates the UpdateMongoDBDatabaseThroughput request. @@ -2232,8 +2348,11 @@ func (client *MongoDBResourcesClient) updateMongoDBDatabaseThroughputCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, updateThroughputParameters) + if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { + return nil, err + } + return req, 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 e16dbf891be7..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/mongodbresources_client_example_test.go +++ /dev/null @@ -1,1567 +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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBMongoDBDatabaseCreateUpdate.json -func ExampleMongoDBResourcesClient_BeginCreateUpdateMongoDBDatabase_cosmosDbMongoDbDatabaseCreateUpdate() { - 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBMongoDBDatabaseRestore.json -func ExampleMongoDBResourcesClient_BeginCreateUpdateMongoDBDatabase_cosmosDbMongoDbDatabaseRestore() { - 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{ - CreateMode: to.Ptr(armcosmos.CreateModeRestore), - ID: to.Ptr("databaseName"), - RestoreParameters: &armcosmos.ResourceRestoreParameters{ - RestoreSource: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId"), - RestoreTimestampInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-20T18:28:00Z"); return t }()), - }, - }, - }, - }, 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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), - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBMongoDBDatabaseRetrieveThroughputDistribution.json -func ExampleMongoDBResourcesClient_BeginMongoDBDatabaseRetrieveThroughputDistribution() { - 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().BeginMongoDBDatabaseRetrieveThroughputDistribution(ctx, "rg1", "ddb1", "databaseName", armcosmos.RetrieveThroughputParameters{ - Properties: &armcosmos.RetrieveThroughputProperties{ - Resource: &armcosmos.RetrieveThroughputPropertiesResource{ - PhysicalPartitionIDs: []*armcosmos.PhysicalPartitionID{ - { - ID: to.Ptr("0"), - }, - { - ID: to.Ptr("1"), - }}, - }, - }, - }, 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.PhysicalPartitionThroughputInfoResult = armcosmos.PhysicalPartitionThroughputInfoResult{ - // Properties: &armcosmos.PhysicalPartitionThroughputInfoResultProperties{ - // Resource: &armcosmos.PhysicalPartitionThroughputInfoResultPropertiesResource{ - // PhysicalPartitionThroughputInfo: []*armcosmos.PhysicalPartitionThroughputInfoResource{ - // { - // ID: to.Ptr("0"), - // Throughput: to.Ptr[float64](5000), - // }, - // { - // ID: to.Ptr("1"), - // Throughput: to.Ptr[float64](5000), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBMongoDBDatabaseRedistributeThroughput.json -func ExampleMongoDBResourcesClient_BeginMongoDBDatabaseRedistributeThroughput() { - 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().BeginMongoDBDatabaseRedistributeThroughput(ctx, "rg1", "ddb1", "databaseName", armcosmos.RedistributeThroughputParameters{ - Properties: &armcosmos.RedistributeThroughputProperties{ - Resource: &armcosmos.RedistributeThroughputPropertiesResource{ - SourcePhysicalPartitionThroughputInfo: []*armcosmos.PhysicalPartitionThroughputInfoResource{ - { - ID: to.Ptr("2"), - Throughput: to.Ptr[float64](5000), - }, - { - ID: to.Ptr("3"), - }}, - TargetPhysicalPartitionThroughputInfo: []*armcosmos.PhysicalPartitionThroughputInfoResource{ - { - ID: to.Ptr("0"), - Throughput: to.Ptr[float64](5000), - }, - { - ID: to.Ptr("1"), - Throughput: to.Ptr[float64](5000), - }}, - ThroughputPolicy: to.Ptr(armcosmos.ThroughputPolicyTypeCustom), - }, - }, - }, 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.PhysicalPartitionThroughputInfoResult = armcosmos.PhysicalPartitionThroughputInfoResult{ - // Properties: &armcosmos.PhysicalPartitionThroughputInfoResultProperties{ - // Resource: &armcosmos.PhysicalPartitionThroughputInfoResultPropertiesResource{ - // PhysicalPartitionThroughputInfo: []*armcosmos.PhysicalPartitionThroughputInfoResource{ - // { - // ID: to.Ptr("0"), - // Throughput: to.Ptr[float64](5000), - // }, - // { - // ID: to.Ptr("1"), - // Throughput: to.Ptr[float64](5000), - // }, - // { - // ID: to.Ptr("2"), - // Throughput: to.Ptr[float64](5000), - // }, - // { - // ID: to.Ptr("3"), - // Throughput: to.Ptr[float64](3000), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBMongoDBCollectionRetrieveThroughputDistribution.json -func ExampleMongoDBResourcesClient_BeginMongoDBContainerRetrieveThroughputDistribution() { - 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().BeginMongoDBContainerRetrieveThroughputDistribution(ctx, "rg1", "ddb1", "databaseName", "collectionName", armcosmos.RetrieveThroughputParameters{ - Properties: &armcosmos.RetrieveThroughputProperties{ - Resource: &armcosmos.RetrieveThroughputPropertiesResource{ - PhysicalPartitionIDs: []*armcosmos.PhysicalPartitionID{ - { - ID: to.Ptr("0"), - }, - { - ID: to.Ptr("1"), - }}, - }, - }, - }, 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.PhysicalPartitionThroughputInfoResult = armcosmos.PhysicalPartitionThroughputInfoResult{ - // Properties: &armcosmos.PhysicalPartitionThroughputInfoResultProperties{ - // Resource: &armcosmos.PhysicalPartitionThroughputInfoResultPropertiesResource{ - // PhysicalPartitionThroughputInfo: []*armcosmos.PhysicalPartitionThroughputInfoResource{ - // { - // ID: to.Ptr("0"), - // Throughput: to.Ptr[float64](5000), - // }, - // { - // ID: to.Ptr("1"), - // Throughput: to.Ptr[float64](5000), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBMongoDBCollectionRedistributeThroughput.json -func ExampleMongoDBResourcesClient_BeginMongoDBContainerRedistributeThroughput() { - 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().BeginMongoDBContainerRedistributeThroughput(ctx, "rg1", "ddb1", "databaseName", "collectionName", armcosmos.RedistributeThroughputParameters{ - Properties: &armcosmos.RedistributeThroughputProperties{ - Resource: &armcosmos.RedistributeThroughputPropertiesResource{ - SourcePhysicalPartitionThroughputInfo: []*armcosmos.PhysicalPartitionThroughputInfoResource{ - { - ID: to.Ptr("2"), - Throughput: to.Ptr[float64](5000), - }, - { - ID: to.Ptr("3"), - }}, - TargetPhysicalPartitionThroughputInfo: []*armcosmos.PhysicalPartitionThroughputInfoResource{ - { - ID: to.Ptr("0"), - Throughput: to.Ptr[float64](5000), - }, - { - ID: to.Ptr("1"), - Throughput: to.Ptr[float64](5000), - }}, - ThroughputPolicy: to.Ptr(armcosmos.ThroughputPolicyTypeCustom), - }, - }, - }, 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.PhysicalPartitionThroughputInfoResult = armcosmos.PhysicalPartitionThroughputInfoResult{ - // Properties: &armcosmos.PhysicalPartitionThroughputInfoResultProperties{ - // Resource: &armcosmos.PhysicalPartitionThroughputInfoResultPropertiesResource{ - // PhysicalPartitionThroughputInfo: []*armcosmos.PhysicalPartitionThroughputInfoResource{ - // { - // ID: to.Ptr("0"), - // Throughput: to.Ptr[float64](5000), - // }, - // { - // ID: to.Ptr("1"), - // Throughput: to.Ptr[float64](5000), - // }, - // { - // ID: to.Ptr("2"), - // Throughput: to.Ptr[float64](5000), - // }, - // { - // ID: to.Ptr("3"), - // Throughput: to.Ptr[float64](3000), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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{ - // AnalyticalStorageTTL: to.Ptr[int32](500), - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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), - // AnalyticalStorageTTL: to.Ptr[int32](500), - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBMongoDBCollectionCreateUpdate.json -func ExampleMongoDBResourcesClient_BeginCreateUpdateMongoDBCollection_cosmosDbMongoDbCollectionCreateUpdate() { - 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{ - AnalyticalStorageTTL: to.Ptr[int32](500), - 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{ - // AnalyticalStorageTTL: to.Ptr[int32](500), - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBMongoDBCollectionRestore.json -func ExampleMongoDBResourcesClient_BeginCreateUpdateMongoDBCollection_cosmosDbMongoDbCollectionRestore() { - 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{ - CreateMode: to.Ptr(armcosmos.CreateModeRestore), - ID: to.Ptr("collectionName"), - RestoreParameters: &armcosmos.ResourceRestoreParameters{ - RestoreSource: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId"), - RestoreTimestampInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-20T18:28:00Z"); return t }()), - }, - }, - }, - }, 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{ - // AnalyticalStorageTTL: to.Ptr[int32](500), - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBMongoDBDatabasePartitionMerge.json -func ExampleMongoDBResourcesClient_BeginMongoDBDatabasePartitionMerge() { - 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().BeginMongoDBDatabasePartitionMerge(ctx, "rgName", "ddb1", "databaseName", armcosmos.MergeParameters{ - IsDryRun: 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.PhysicalPartitionStorageInfoCollection = armcosmos.PhysicalPartitionStorageInfoCollection{ - // PhysicalPartitionStorageInfoCollection: []*armcosmos.PhysicalPartitionStorageInfo{ - // { - // ID: to.Ptr("0"), - // StorageInKB: to.Ptr[float64](333), - // }, - // { - // ID: to.Ptr("1"), - // StorageInKB: to.Ptr[float64](305), - // }, - // { - // ID: to.Ptr("177"), - // StorageInKB: to.Ptr[float64](368), - // }, - // { - // ID: to.Ptr("178"), - // StorageInKB: to.Ptr[float64](96313), - // }, - // { - // ID: to.Ptr("5"), - // StorageInKB: to.Ptr[float64](194), - // }, - // { - // ID: to.Ptr("6"), - // StorageInKB: to.Ptr[float64](331), - // }, - // { - // ID: to.Ptr("7"), - // StorageInKB: to.Ptr[float64](384), - // }, - // { - // ID: to.Ptr("8"), - // StorageInKB: to.Ptr[float64](246), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBMongoDBCollectionPartitionMerge.json -func ExampleMongoDBResourcesClient_BeginListMongoDBCollectionPartitionMerge() { - 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().BeginListMongoDBCollectionPartitionMerge(ctx, "rgName", "ddb1", "databaseName", "collectionName", armcosmos.MergeParameters{ - IsDryRun: 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.PhysicalPartitionStorageInfoCollection = armcosmos.PhysicalPartitionStorageInfoCollection{ - // PhysicalPartitionStorageInfoCollection: []*armcosmos.PhysicalPartitionStorageInfo{ - // { - // ID: to.Ptr("0"), - // StorageInKB: to.Ptr[float64](333), - // }, - // { - // ID: to.Ptr("1"), - // StorageInKB: to.Ptr[float64](305), - // }, - // { - // ID: to.Ptr("177"), - // StorageInKB: to.Ptr[float64](368), - // }, - // { - // ID: to.Ptr("178"), - // StorageInKB: to.Ptr[float64](96313), - // }, - // { - // ID: to.Ptr("5"), - // StorageInKB: to.Ptr[float64](194), - // }, - // { - // ID: to.Ptr("6"), - // StorageInKB: to.Ptr[float64](331), - // }, - // { - // ID: to.Ptr("7"), - // StorageInKB: to.Ptr[float64](384), - // }, - // { - // ID: to.Ptr("8"), - // StorageInKB: to.Ptr[float64](246), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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), - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/notebookworkspaces_client.go b/sdk/resourcemanager/cosmos/armcosmos/notebookworkspaces_client.go index 17e499bfba49..3c936076dd1b 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/notebookworkspaces_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/notebookworkspaces_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -47,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -60,7 +59,8 @@ func (client *NotebookWorkspacesClient) BeginCreateOrUpdate(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[NotebookWorkspacesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[NotebookWorkspacesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[NotebookWorkspacesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,20 +69,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *NotebookWorkspacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, notebookWorkspaceName NotebookWorkspaceName, notebookCreateUpdateParameters NotebookWorkspaceCreateUpdateParameters, options *NotebookWorkspacesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, notebookWorkspaceName, notebookCreateUpdateParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -109,16 +111,19 @@ func (client *NotebookWorkspacesClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, notebookCreateUpdateParameters) + if err := runtime.MarshalAsJSON(req, notebookCreateUpdateParameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes the notebook workspace for a Cosmos DB account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -130,7 +135,8 @@ func (client *NotebookWorkspacesClient) BeginDelete(ctx context.Context, resourc if err != nil { return nil, err } - return runtime.NewPoller[NotebookWorkspacesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[NotebookWorkspacesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[NotebookWorkspacesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -139,20 +145,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *NotebookWorkspacesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, notebookWorkspaceName NotebookWorkspaceName, options *NotebookWorkspacesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, notebookWorkspaceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -179,7 +187,7 @@ func (client *NotebookWorkspacesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,24 +196,27 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. // - options - NotebookWorkspacesClientGetOptions contains the optional parameters for the NotebookWorkspacesClient.Get method. func (client *NotebookWorkspacesClient) Get(ctx context.Context, resourceGroupName string, accountName string, notebookWorkspaceName NotebookWorkspaceName, options *NotebookWorkspacesClientGetOptions) (NotebookWorkspacesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, notebookWorkspaceName, options) if err != nil { return NotebookWorkspacesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return NotebookWorkspacesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return NotebookWorkspacesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NotebookWorkspacesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -232,7 +243,7 @@ func (client *NotebookWorkspacesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +260,7 @@ func (client *NotebookWorkspacesClient) getHandleResponse(resp *http.Response) ( // NewListByDatabaseAccountPager - Gets the notebook workspace resources of an existing Cosmos DB account. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -296,7 +307,7 @@ func (client *NotebookWorkspacesClient) listByDatabaseAccountCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -314,25 +325,28 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. // - options - NotebookWorkspacesClientListConnectionInfoOptions contains the optional parameters for the NotebookWorkspacesClient.ListConnectionInfo // method. func (client *NotebookWorkspacesClient) ListConnectionInfo(ctx context.Context, resourceGroupName string, accountName string, notebookWorkspaceName NotebookWorkspaceName, options *NotebookWorkspacesClientListConnectionInfoOptions) (NotebookWorkspacesClientListConnectionInfoResponse, error) { + var err error req, err := client.listConnectionInfoCreateRequest(ctx, resourceGroupName, accountName, notebookWorkspaceName, options) if err != nil { return NotebookWorkspacesClientListConnectionInfoResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return NotebookWorkspacesClientListConnectionInfoResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return NotebookWorkspacesClientListConnectionInfoResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return NotebookWorkspacesClientListConnectionInfoResponse{}, err } - return client.listConnectionInfoHandleResponse(resp) + resp, err := client.listConnectionInfoHandleResponse(httpResp) + return resp, err } // listConnectionInfoCreateRequest creates the ListConnectionInfo request. @@ -359,7 +373,7 @@ func (client *NotebookWorkspacesClient) listConnectionInfoCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -377,7 +391,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -389,7 +403,8 @@ func (client *NotebookWorkspacesClient) BeginRegenerateAuthToken(ctx context.Con if err != nil { return nil, err } - return runtime.NewPoller[NotebookWorkspacesClientRegenerateAuthTokenResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[NotebookWorkspacesClientRegenerateAuthTokenResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[NotebookWorkspacesClientRegenerateAuthTokenResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -398,20 +413,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *NotebookWorkspacesClient) regenerateAuthToken(ctx context.Context, resourceGroupName string, accountName string, notebookWorkspaceName NotebookWorkspaceName, options *NotebookWorkspacesClientBeginRegenerateAuthTokenOptions) (*http.Response, error) { + var err error req, err := client.regenerateAuthTokenCreateRequest(ctx, resourceGroupName, accountName, notebookWorkspaceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // regenerateAuthTokenCreateRequest creates the RegenerateAuthToken request. @@ -438,7 +455,7 @@ func (client *NotebookWorkspacesClient) regenerateAuthTokenCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -447,7 +464,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -459,7 +476,8 @@ func (client *NotebookWorkspacesClient) BeginStart(ctx context.Context, resource if err != nil { return nil, err } - return runtime.NewPoller[NotebookWorkspacesClientStartResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[NotebookWorkspacesClientStartResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[NotebookWorkspacesClientStartResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -468,20 +486,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *NotebookWorkspacesClient) start(ctx context.Context, resourceGroupName string, accountName string, notebookWorkspaceName NotebookWorkspaceName, options *NotebookWorkspacesClientBeginStartOptions) (*http.Response, error) { + var err error req, err := client.startCreateRequest(ctx, resourceGroupName, accountName, notebookWorkspaceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // startCreateRequest creates the Start request. @@ -508,7 +528,7 @@ func (client *NotebookWorkspacesClient) startCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-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 daedee935d21..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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 042c257dffba..119c080c6ffc 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/operations_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/operations_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -40,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 2023-03-15-preview +// Generated from API version 2023-09-15-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]{ @@ -78,7 +77,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-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 070c7d1a7150..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/options.go b/sdk/resourcemanager/cosmos/armcosmos/options.go new file mode 100644 index 000000000000..bdd67ab022c2 --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/options.go @@ -0,0 +1,1539 @@ +//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 + +// CassandraClustersClientBeginCreateUpdateOptions contains the optional parameters for the CassandraClustersClient.BeginCreateUpdate +// method. +type CassandraClustersClientBeginCreateUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CassandraClustersClientBeginDeallocateOptions contains the optional parameters for the CassandraClustersClient.BeginDeallocate +// method. +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 *bool +} + +// CassandraClustersClientBeginDeleteOptions contains the optional parameters for the CassandraClustersClient.BeginDelete +// method. +type CassandraClustersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CassandraClustersClientBeginInvokeCommandOptions contains the optional parameters for the CassandraClustersClient.BeginInvokeCommand +// method. +type CassandraClustersClientBeginInvokeCommandOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CassandraClustersClientBeginStartOptions contains the optional parameters for the CassandraClustersClient.BeginStart method. +type CassandraClustersClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CassandraClustersClientBeginUpdateOptions contains the optional parameters for the CassandraClustersClient.BeginUpdate +// method. +type CassandraClustersClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CassandraClustersClientGetBackupOptions contains the optional parameters for the CassandraClustersClient.GetBackup method. +type CassandraClustersClientGetBackupOptions 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 { + // placeholder for future optional parameters +} + +// CassandraClustersClientListBySubscriptionOptions contains the optional parameters for the CassandraClustersClient.NewListBySubscriptionPager +// method. +type CassandraClustersClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// CassandraClustersClientStatusOptions contains the optional parameters for the CassandraClustersClient.Status method. +type CassandraClustersClientStatusOptions struct { + // placeholder for future optional parameters +} + +// CassandraDataCentersClientBeginCreateUpdateOptions contains the optional parameters for the CassandraDataCentersClient.BeginCreateUpdate +// method. +type CassandraDataCentersClientBeginCreateUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CassandraDataCentersClientBeginDeleteOptions contains the optional parameters for the CassandraDataCentersClient.BeginDelete +// method. +type CassandraDataCentersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CassandraDataCentersClientBeginUpdateOptions contains the optional parameters for the CassandraDataCentersClient.BeginUpdate +// method. +type CassandraDataCentersClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CassandraDataCentersClientGetOptions contains the optional parameters for the CassandraDataCentersClient.Get method. +type CassandraDataCentersClientGetOptions struct { + // placeholder for future optional parameters +} + +// CassandraDataCentersClientListOptions contains the optional parameters for the CassandraDataCentersClient.NewListPager +// method. +type CassandraDataCentersClientListOptions struct { + // placeholder for future optional parameters +} + +// CassandraResourcesClientBeginCreateUpdateCassandraKeyspaceOptions contains the optional parameters for the CassandraResourcesClient.BeginCreateUpdateCassandraKeyspace +// method. +type CassandraResourcesClientBeginCreateUpdateCassandraKeyspaceOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CassandraResourcesClientBeginCreateUpdateCassandraTableOptions contains the optional parameters for the CassandraResourcesClient.BeginCreateUpdateCassandraTable +// method. +type CassandraResourcesClientBeginCreateUpdateCassandraTableOptions struct { + // Resumes the LRO from the provided token. + 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 { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CassandraResourcesClientBeginDeleteCassandraTableOptions contains the optional parameters for the CassandraResourcesClient.BeginDeleteCassandraTable +// method. +type CassandraResourcesClientBeginDeleteCassandraTableOptions struct { + // Resumes the LRO from the provided token. + 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 { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CassandraResourcesClientBeginMigrateCassandraKeyspaceToManualThroughputOptions contains the optional parameters for the +// CassandraResourcesClient.BeginMigrateCassandraKeyspaceToManualThroughput method. +type CassandraResourcesClientBeginMigrateCassandraKeyspaceToManualThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CassandraResourcesClientBeginMigrateCassandraTableToAutoscaleOptions contains the optional parameters for the CassandraResourcesClient.BeginMigrateCassandraTableToAutoscale +// method. +type CassandraResourcesClientBeginMigrateCassandraTableToAutoscaleOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CassandraResourcesClientBeginMigrateCassandraTableToManualThroughputOptions contains the optional parameters for the CassandraResourcesClient.BeginMigrateCassandraTableToManualThroughput +// method. +type CassandraResourcesClientBeginMigrateCassandraTableToManualThroughputOptions struct { + // Resumes the LRO from the provided token. + 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 { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CassandraResourcesClientBeginUpdateCassandraTableThroughputOptions contains the optional parameters for the CassandraResourcesClient.BeginUpdateCassandraTableThroughput +// method. +type CassandraResourcesClientBeginUpdateCassandraTableThroughputOptions struct { + // Resumes the LRO from the provided token. + 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 { + // placeholder for future optional parameters +} + +// CassandraResourcesClientGetCassandraKeyspaceThroughputOptions contains the optional parameters for the CassandraResourcesClient.GetCassandraKeyspaceThroughput +// method. +type CassandraResourcesClientGetCassandraKeyspaceThroughputOptions struct { + // placeholder for future optional parameters +} + +// CassandraResourcesClientGetCassandraTableOptions contains the optional parameters for the CassandraResourcesClient.GetCassandraTable +// method. +type CassandraResourcesClientGetCassandraTableOptions struct { + // placeholder for future optional parameters +} + +// CassandraResourcesClientGetCassandraTableThroughputOptions contains the optional parameters for the CassandraResourcesClient.GetCassandraTableThroughput +// method. +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 { + // placeholder for future optional parameters +} + +// CassandraResourcesClientListCassandraTablesOptions contains the optional parameters for the CassandraResourcesClient.NewListCassandraTablesPager +// method. +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 +} + +// CollectionClientListMetricDefinitionsOptions contains the optional parameters for the CollectionClient.NewListMetricDefinitionsPager +// method. +type CollectionClientListMetricDefinitionsOptions struct { + // placeholder for future optional parameters +} + +// CollectionClientListMetricsOptions contains the optional parameters for the CollectionClient.NewListMetricsPager method. +type CollectionClientListMetricsOptions struct { + // placeholder for future optional parameters +} + +// CollectionClientListUsagesOptions contains the optional parameters for the CollectionClient.NewListUsagesPager method. +type CollectionClientListUsagesOptions struct { + // An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of + // the metric, can have an or of multiple names). + Filter *string +} + +// CollectionPartitionClientListMetricsOptions contains the optional parameters for the CollectionPartitionClient.NewListMetricsPager +// method. +type CollectionPartitionClientListMetricsOptions struct { + // placeholder for future optional parameters +} + +// CollectionPartitionClientListUsagesOptions contains the optional parameters for the CollectionPartitionClient.NewListUsagesPager +// method. +type CollectionPartitionClientListUsagesOptions struct { + // An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of + // the metric, can have an or of multiple names). + Filter *string +} + +// CollectionPartitionRegionClientListMetricsOptions contains the optional parameters for the CollectionPartitionRegionClient.NewListMetricsPager +// method. +type CollectionPartitionRegionClientListMetricsOptions struct { + // placeholder for future optional parameters +} + +// CollectionRegionClientListMetricsOptions contains the optional parameters for the CollectionRegionClient.NewListMetricsPager +// method. +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 +} + +// 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 { + // placeholder for future optional parameters +} + +// DatabaseAccountsClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabaseAccountsClient.BeginCreateOrUpdate +// method. +type DatabaseAccountsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabaseAccountsClientBeginDeleteOptions contains the optional parameters for the DatabaseAccountsClient.BeginDelete method. +type DatabaseAccountsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabaseAccountsClientBeginFailoverPriorityChangeOptions contains the optional parameters for the DatabaseAccountsClient.BeginFailoverPriorityChange +// method. +type DatabaseAccountsClientBeginFailoverPriorityChangeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabaseAccountsClientBeginOfflineRegionOptions contains the optional parameters for the DatabaseAccountsClient.BeginOfflineRegion +// method. +type DatabaseAccountsClientBeginOfflineRegionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabaseAccountsClientBeginOnlineRegionOptions contains the optional parameters for the DatabaseAccountsClient.BeginOnlineRegion +// method. +type DatabaseAccountsClientBeginOnlineRegionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabaseAccountsClientBeginRegenerateKeyOptions contains the optional parameters for the DatabaseAccountsClient.BeginRegenerateKey +// method. +type DatabaseAccountsClientBeginRegenerateKeyOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabaseAccountsClientBeginUpdateOptions contains the optional parameters for the DatabaseAccountsClient.BeginUpdate method. +type DatabaseAccountsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabaseAccountsClientCheckNameExistsOptions contains the optional parameters for the DatabaseAccountsClient.CheckNameExists +// method. +type DatabaseAccountsClientCheckNameExistsOptions struct { + // placeholder for future optional parameters +} + +// DatabaseAccountsClientGetOptions contains the optional parameters for the DatabaseAccountsClient.Get method. +type DatabaseAccountsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabaseAccountsClientGetReadOnlyKeysOptions contains the optional parameters for the DatabaseAccountsClient.GetReadOnlyKeys +// method. +type DatabaseAccountsClientGetReadOnlyKeysOptions struct { + // placeholder for future optional parameters +} + +// DatabaseAccountsClientListByResourceGroupOptions contains the optional parameters for the DatabaseAccountsClient.NewListByResourceGroupPager +// method. +type DatabaseAccountsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// DatabaseAccountsClientListConnectionStringsOptions contains the optional parameters for the DatabaseAccountsClient.ListConnectionStrings +// method. +type DatabaseAccountsClientListConnectionStringsOptions struct { + // placeholder for future optional parameters +} + +// DatabaseAccountsClientListKeysOptions contains the optional parameters for the DatabaseAccountsClient.ListKeys method. +type DatabaseAccountsClientListKeysOptions struct { + // placeholder for future optional parameters +} + +// DatabaseAccountsClientListMetricDefinitionsOptions contains the optional parameters for the DatabaseAccountsClient.NewListMetricDefinitionsPager +// method. +type DatabaseAccountsClientListMetricDefinitionsOptions struct { + // placeholder for future optional parameters +} + +// DatabaseAccountsClientListMetricsOptions contains the optional parameters for the DatabaseAccountsClient.NewListMetricsPager +// method. +type DatabaseAccountsClientListMetricsOptions struct { + // placeholder for future optional parameters +} + +// DatabaseAccountsClientListOptions contains the optional parameters for the DatabaseAccountsClient.NewListPager method. +type DatabaseAccountsClientListOptions struct { + // placeholder for future optional parameters +} + +// DatabaseAccountsClientListReadOnlyKeysOptions contains the optional parameters for the DatabaseAccountsClient.ListReadOnlyKeys +// method. +type DatabaseAccountsClientListReadOnlyKeysOptions struct { + // placeholder for future optional parameters +} + +// DatabaseAccountsClientListUsagesOptions contains the optional parameters for the DatabaseAccountsClient.NewListUsagesPager +// method. +type DatabaseAccountsClientListUsagesOptions struct { + // An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of + // the metric, can have an or of multiple names). + Filter *string +} + +// DatabaseClientListMetricDefinitionsOptions contains the optional parameters for the DatabaseClient.NewListMetricDefinitionsPager +// method. +type DatabaseClientListMetricDefinitionsOptions struct { + // placeholder for future optional parameters +} + +// DatabaseClientListMetricsOptions contains the optional parameters for the DatabaseClient.NewListMetricsPager method. +type DatabaseClientListMetricsOptions struct { + // placeholder for future optional parameters +} + +// DatabaseClientListUsagesOptions contains the optional parameters for the DatabaseClient.NewListUsagesPager method. +type DatabaseClientListUsagesOptions struct { + // An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of + // the metric, can have an or of multiple names). + 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 { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GremlinResourcesClientBeginCreateUpdateGremlinGraphOptions contains the optional parameters for the GremlinResourcesClient.BeginCreateUpdateGremlinGraph +// method. +type GremlinResourcesClientBeginCreateUpdateGremlinGraphOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GremlinResourcesClientBeginDeleteGremlinDatabaseOptions contains the optional parameters for the GremlinResourcesClient.BeginDeleteGremlinDatabase +// method. +type GremlinResourcesClientBeginDeleteGremlinDatabaseOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GremlinResourcesClientBeginDeleteGremlinGraphOptions contains the optional parameters for the GremlinResourcesClient.BeginDeleteGremlinGraph +// method. +type GremlinResourcesClientBeginDeleteGremlinGraphOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GremlinResourcesClientBeginMigrateGremlinDatabaseToAutoscaleOptions contains the optional parameters for the GremlinResourcesClient.BeginMigrateGremlinDatabaseToAutoscale +// method. +type GremlinResourcesClientBeginMigrateGremlinDatabaseToAutoscaleOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GremlinResourcesClientBeginMigrateGremlinDatabaseToManualThroughputOptions contains the optional parameters for the GremlinResourcesClient.BeginMigrateGremlinDatabaseToManualThroughput +// method. +type GremlinResourcesClientBeginMigrateGremlinDatabaseToManualThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GremlinResourcesClientBeginMigrateGremlinGraphToAutoscaleOptions contains the optional parameters for the GremlinResourcesClient.BeginMigrateGremlinGraphToAutoscale +// method. +type GremlinResourcesClientBeginMigrateGremlinGraphToAutoscaleOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GremlinResourcesClientBeginMigrateGremlinGraphToManualThroughputOptions contains the optional parameters for the GremlinResourcesClient.BeginMigrateGremlinGraphToManualThroughput +// method. +type GremlinResourcesClientBeginMigrateGremlinGraphToManualThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GremlinResourcesClientBeginRetrieveContinuousBackupInformationOptions contains the optional parameters for the GremlinResourcesClient.BeginRetrieveContinuousBackupInformation +// method. +type GremlinResourcesClientBeginRetrieveContinuousBackupInformationOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GremlinResourcesClientBeginUpdateGremlinDatabaseThroughputOptions contains the optional parameters for the GremlinResourcesClient.BeginUpdateGremlinDatabaseThroughput +// method. +type GremlinResourcesClientBeginUpdateGremlinDatabaseThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GremlinResourcesClientBeginUpdateGremlinGraphThroughputOptions contains the optional parameters for the GremlinResourcesClient.BeginUpdateGremlinGraphThroughput +// method. +type GremlinResourcesClientBeginUpdateGremlinGraphThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GremlinResourcesClientGetGremlinDatabaseOptions contains the optional parameters for the GremlinResourcesClient.GetGremlinDatabase +// method. +type GremlinResourcesClientGetGremlinDatabaseOptions struct { + // placeholder for future optional parameters +} + +// GremlinResourcesClientGetGremlinDatabaseThroughputOptions contains the optional parameters for the GremlinResourcesClient.GetGremlinDatabaseThroughput +// method. +type GremlinResourcesClientGetGremlinDatabaseThroughputOptions struct { + // placeholder for future optional parameters +} + +// GremlinResourcesClientGetGremlinGraphOptions contains the optional parameters for the GremlinResourcesClient.GetGremlinGraph +// method. +type GremlinResourcesClientGetGremlinGraphOptions struct { + // placeholder for future optional parameters +} + +// GremlinResourcesClientGetGremlinGraphThroughputOptions contains the optional parameters for the GremlinResourcesClient.GetGremlinGraphThroughput +// method. +type GremlinResourcesClientGetGremlinGraphThroughputOptions struct { + // placeholder for future optional parameters +} + +// GremlinResourcesClientListGremlinDatabasesOptions contains the optional parameters for the GremlinResourcesClient.NewListGremlinDatabasesPager +// method. +type GremlinResourcesClientListGremlinDatabasesOptions struct { + // placeholder for future optional parameters +} + +// GremlinResourcesClientListGremlinGraphsOptions contains the optional parameters for the GremlinResourcesClient.NewListGremlinGraphsPager +// method. +type GremlinResourcesClientListGremlinGraphsOptions struct { + // placeholder for future optional parameters +} + +// LocationsClientGetOptions contains the optional parameters for the LocationsClient.Get method. +type LocationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// LocationsClientListOptions contains the optional parameters for the LocationsClient.NewListPager method. +type LocationsClientListOptions struct { + // placeholder for future optional parameters +} + +// MongoClustersClientBeginCreateOrUpdateFirewallRuleOptions contains the optional parameters for the MongoClustersClient.BeginCreateOrUpdateFirewallRule +// method. +type MongoClustersClientBeginCreateOrUpdateFirewallRuleOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the MongoClustersClient.BeginCreateOrUpdate +// method. +type MongoClustersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoClustersClientBeginDeleteFirewallRuleOptions contains the optional parameters for the MongoClustersClient.BeginDeleteFirewallRule +// method. +type MongoClustersClientBeginDeleteFirewallRuleOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoClustersClientBeginDeleteOptions contains the optional parameters for the MongoClustersClient.BeginDelete method. +type MongoClustersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoClustersClientBeginUpdateOptions contains the optional parameters for the MongoClustersClient.BeginUpdate method. +type MongoClustersClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoClustersClientCheckNameAvailabilityOptions contains the optional parameters for the MongoClustersClient.CheckNameAvailability +// method. +type MongoClustersClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// MongoClustersClientGetFirewallRuleOptions contains the optional parameters for the MongoClustersClient.GetFirewallRule +// method. +type MongoClustersClientGetFirewallRuleOptions struct { + // placeholder for future optional parameters +} + +// MongoClustersClientGetOptions contains the optional parameters for the MongoClustersClient.Get method. +type MongoClustersClientGetOptions struct { + // placeholder for future optional parameters +} + +// MongoClustersClientListByResourceGroupOptions contains the optional parameters for the MongoClustersClient.NewListByResourceGroupPager +// method. +type MongoClustersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// MongoClustersClientListConnectionStringsOptions contains the optional parameters for the MongoClustersClient.ListConnectionStrings +// method. +type MongoClustersClientListConnectionStringsOptions struct { + // placeholder for future optional parameters +} + +// MongoClustersClientListFirewallRulesOptions contains the optional parameters for the MongoClustersClient.NewListFirewallRulesPager +// method. +type MongoClustersClientListFirewallRulesOptions struct { + // placeholder for future optional parameters +} + +// MongoClustersClientListOptions contains the optional parameters for the MongoClustersClient.NewListPager method. +type MongoClustersClientListOptions struct { + // placeholder for future optional parameters +} + +// MongoDBResourcesClientBeginCreateUpdateMongoDBCollectionOptions contains the optional parameters for the MongoDBResourcesClient.BeginCreateUpdateMongoDBCollection +// method. +type MongoDBResourcesClientBeginCreateUpdateMongoDBCollectionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoDBResourcesClientBeginCreateUpdateMongoDBDatabaseOptions contains the optional parameters for the MongoDBResourcesClient.BeginCreateUpdateMongoDBDatabase +// method. +type MongoDBResourcesClientBeginCreateUpdateMongoDBDatabaseOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoDBResourcesClientBeginCreateUpdateMongoRoleDefinitionOptions contains the optional parameters for the MongoDBResourcesClient.BeginCreateUpdateMongoRoleDefinition +// method. +type MongoDBResourcesClientBeginCreateUpdateMongoRoleDefinitionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoDBResourcesClientBeginCreateUpdateMongoUserDefinitionOptions contains the optional parameters for the MongoDBResourcesClient.BeginCreateUpdateMongoUserDefinition +// method. +type MongoDBResourcesClientBeginCreateUpdateMongoUserDefinitionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoDBResourcesClientBeginDeleteMongoDBCollectionOptions contains the optional parameters for the MongoDBResourcesClient.BeginDeleteMongoDBCollection +// method. +type MongoDBResourcesClientBeginDeleteMongoDBCollectionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoDBResourcesClientBeginDeleteMongoDBDatabaseOptions contains the optional parameters for the MongoDBResourcesClient.BeginDeleteMongoDBDatabase +// method. +type MongoDBResourcesClientBeginDeleteMongoDBDatabaseOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoDBResourcesClientBeginDeleteMongoRoleDefinitionOptions contains the optional parameters for the MongoDBResourcesClient.BeginDeleteMongoRoleDefinition +// method. +type MongoDBResourcesClientBeginDeleteMongoRoleDefinitionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoDBResourcesClientBeginDeleteMongoUserDefinitionOptions contains the optional parameters for the MongoDBResourcesClient.BeginDeleteMongoUserDefinition +// method. +type MongoDBResourcesClientBeginDeleteMongoUserDefinitionOptions struct { + // Resumes the LRO from the provided token. + 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 { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoDBResourcesClientBeginMigrateMongoDBCollectionToManualThroughputOptions contains the optional parameters for the MongoDBResourcesClient.BeginMigrateMongoDBCollectionToManualThroughput +// method. +type MongoDBResourcesClientBeginMigrateMongoDBCollectionToManualThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoDBResourcesClientBeginMigrateMongoDBDatabaseToAutoscaleOptions contains the optional parameters for the MongoDBResourcesClient.BeginMigrateMongoDBDatabaseToAutoscale +// method. +type MongoDBResourcesClientBeginMigrateMongoDBDatabaseToAutoscaleOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoDBResourcesClientBeginMigrateMongoDBDatabaseToManualThroughputOptions contains the optional parameters for the MongoDBResourcesClient.BeginMigrateMongoDBDatabaseToManualThroughput +// method. +type MongoDBResourcesClientBeginMigrateMongoDBDatabaseToManualThroughputOptions struct { + // Resumes the LRO from the provided token. + 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 { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoDBResourcesClientBeginUpdateMongoDBCollectionThroughputOptions contains the optional parameters for the MongoDBResourcesClient.BeginUpdateMongoDBCollectionThroughput +// method. +type MongoDBResourcesClientBeginUpdateMongoDBCollectionThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoDBResourcesClientBeginUpdateMongoDBDatabaseThroughputOptions contains the optional parameters for the MongoDBResourcesClient.BeginUpdateMongoDBDatabaseThroughput +// method. +type MongoDBResourcesClientBeginUpdateMongoDBDatabaseThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// MongoDBResourcesClientGetMongoDBCollectionOptions contains the optional parameters for the MongoDBResourcesClient.GetMongoDBCollection +// method. +type MongoDBResourcesClientGetMongoDBCollectionOptions struct { + // placeholder for future optional parameters +} + +// MongoDBResourcesClientGetMongoDBCollectionThroughputOptions contains the optional parameters for the MongoDBResourcesClient.GetMongoDBCollectionThroughput +// method. +type MongoDBResourcesClientGetMongoDBCollectionThroughputOptions struct { + // placeholder for future optional parameters +} + +// MongoDBResourcesClientGetMongoDBDatabaseOptions contains the optional parameters for the MongoDBResourcesClient.GetMongoDBDatabase +// method. +type MongoDBResourcesClientGetMongoDBDatabaseOptions struct { + // placeholder for future optional parameters +} + +// MongoDBResourcesClientGetMongoDBDatabaseThroughputOptions contains the optional parameters for the MongoDBResourcesClient.GetMongoDBDatabaseThroughput +// method. +type MongoDBResourcesClientGetMongoDBDatabaseThroughputOptions struct { + // placeholder for future optional parameters +} + +// MongoDBResourcesClientGetMongoRoleDefinitionOptions contains the optional parameters for the MongoDBResourcesClient.GetMongoRoleDefinition +// method. +type MongoDBResourcesClientGetMongoRoleDefinitionOptions struct { + // placeholder for future optional parameters +} + +// MongoDBResourcesClientGetMongoUserDefinitionOptions contains the optional parameters for the MongoDBResourcesClient.GetMongoUserDefinition +// method. +type MongoDBResourcesClientGetMongoUserDefinitionOptions struct { + // placeholder for future optional parameters +} + +// MongoDBResourcesClientListMongoDBCollectionsOptions contains the optional parameters for the MongoDBResourcesClient.NewListMongoDBCollectionsPager +// method. +type MongoDBResourcesClientListMongoDBCollectionsOptions struct { + // placeholder for future optional parameters +} + +// MongoDBResourcesClientListMongoDBDatabasesOptions contains the optional parameters for the MongoDBResourcesClient.NewListMongoDBDatabasesPager +// method. +type MongoDBResourcesClientListMongoDBDatabasesOptions struct { + // placeholder for future optional parameters +} + +// MongoDBResourcesClientListMongoRoleDefinitionsOptions contains the optional parameters for the MongoDBResourcesClient.NewListMongoRoleDefinitionsPager +// method. +type MongoDBResourcesClientListMongoRoleDefinitionsOptions struct { + // placeholder for future optional parameters +} + +// MongoDBResourcesClientListMongoUserDefinitionsOptions contains the optional parameters for the MongoDBResourcesClient.NewListMongoUserDefinitionsPager +// method. +type MongoDBResourcesClientListMongoUserDefinitionsOptions struct { + // placeholder for future optional parameters +} + +// NotebookWorkspacesClientBeginCreateOrUpdateOptions contains the optional parameters for the NotebookWorkspacesClient.BeginCreateOrUpdate +// method. +type NotebookWorkspacesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NotebookWorkspacesClientBeginDeleteOptions contains the optional parameters for the NotebookWorkspacesClient.BeginDelete +// method. +type NotebookWorkspacesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NotebookWorkspacesClientBeginRegenerateAuthTokenOptions contains the optional parameters for the NotebookWorkspacesClient.BeginRegenerateAuthToken +// method. +type NotebookWorkspacesClientBeginRegenerateAuthTokenOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NotebookWorkspacesClientBeginStartOptions contains the optional parameters for the NotebookWorkspacesClient.BeginStart +// method. +type NotebookWorkspacesClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// NotebookWorkspacesClientGetOptions contains the optional parameters for the NotebookWorkspacesClient.Get method. +type NotebookWorkspacesClientGetOptions struct { + // placeholder for future optional parameters +} + +// NotebookWorkspacesClientListByDatabaseAccountOptions contains the optional parameters for the NotebookWorkspacesClient.NewListByDatabaseAccountPager +// method. +type NotebookWorkspacesClientListByDatabaseAccountOptions struct { + // placeholder for future optional parameters +} + +// NotebookWorkspacesClientListConnectionInfoOptions contains the optional parameters for the NotebookWorkspacesClient.ListConnectionInfo +// method. +type NotebookWorkspacesClientListConnectionInfoOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PartitionKeyRangeIDClientListMetricsOptions contains the optional parameters for the PartitionKeyRangeIDClient.NewListMetricsPager +// method. +type PartitionKeyRangeIDClientListMetricsOptions struct { + // placeholder for future optional parameters +} + +// PartitionKeyRangeIDRegionClientListMetricsOptions contains the optional parameters for the PartitionKeyRangeIDRegionClient.NewListMetricsPager +// method. +type PartitionKeyRangeIDRegionClientListMetricsOptions struct { + // placeholder for future optional parameters +} + +// PercentileClientListMetricsOptions contains the optional parameters for the PercentileClient.NewListMetricsPager method. +type PercentileClientListMetricsOptions struct { + // placeholder for future optional parameters +} + +// PercentileSourceTargetClientListMetricsOptions contains the optional parameters for the PercentileSourceTargetClient.NewListMetricsPager +// method. +type PercentileSourceTargetClientListMetricsOptions struct { + // placeholder for future optional parameters +} + +// PercentileTargetClientListMetricsOptions contains the optional parameters for the PercentileTargetClient.NewListMetricsPager +// method. +type PercentileTargetClientListMetricsOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate +// method. +type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListByDatabaseAccountOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByDatabaseAccountPager +// method. +type PrivateEndpointConnectionsClientListByDatabaseAccountOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. +type PrivateLinkResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListByDatabaseAccountOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByDatabaseAccountPager +// method. +type PrivateLinkResourcesClientListByDatabaseAccountOptions struct { + // placeholder for future optional parameters +} + +// RestorableDatabaseAccountsClientGetByLocationOptions contains the optional parameters for the RestorableDatabaseAccountsClient.GetByLocation +// method. +type RestorableDatabaseAccountsClientGetByLocationOptions struct { + // placeholder for future optional parameters +} + +// RestorableDatabaseAccountsClientListByLocationOptions contains the optional parameters for the RestorableDatabaseAccountsClient.NewListByLocationPager +// method. +type RestorableDatabaseAccountsClientListByLocationOptions struct { + // placeholder for future optional parameters +} + +// RestorableDatabaseAccountsClientListOptions contains the optional parameters for the RestorableDatabaseAccountsClient.NewListPager +// method. +type RestorableDatabaseAccountsClientListOptions struct { + // placeholder for future optional parameters +} + +// RestorableGremlinDatabasesClientListOptions contains the optional parameters for the RestorableGremlinDatabasesClient.NewListPager +// method. +type RestorableGremlinDatabasesClientListOptions struct { + // placeholder for future optional parameters +} + +// RestorableGremlinGraphsClientListOptions contains the optional parameters for the RestorableGremlinGraphsClient.NewListPager +// method. +type RestorableGremlinGraphsClientListOptions struct { + // Restorable Gremlin graphs event feed end time. + EndTime *string + + // The resource ID of the Gremlin database. + RestorableGremlinDatabaseRid *string + + // Restorable Gremlin graphs event feed start time. + StartTime *string +} + +// RestorableGremlinResourcesClientListOptions contains the optional parameters for the RestorableGremlinResourcesClient.NewListPager +// method. +type RestorableGremlinResourcesClientListOptions struct { + // The location where the restorable resources are located. + RestoreLocation *string + + // The timestamp when the restorable resources existed. + RestoreTimestampInUTC *string +} + +// RestorableMongodbCollectionsClientListOptions contains the optional parameters for the RestorableMongodbCollectionsClient.NewListPager +// method. +type RestorableMongodbCollectionsClientListOptions struct { + // Restorable MongoDB collections event feed end time. + EndTime *string + + // The resource ID of the MongoDB database. + RestorableMongodbDatabaseRid *string + + // Restorable MongoDB collections event feed start time. + StartTime *string +} + +// RestorableMongodbDatabasesClientListOptions contains the optional parameters for the RestorableMongodbDatabasesClient.NewListPager +// method. +type RestorableMongodbDatabasesClientListOptions struct { + // placeholder for future optional parameters +} + +// RestorableMongodbResourcesClientListOptions contains the optional parameters for the RestorableMongodbResourcesClient.NewListPager +// method. +type RestorableMongodbResourcesClientListOptions struct { + // The location where the restorable resources are located. + RestoreLocation *string + + // The timestamp when the restorable resources existed. + RestoreTimestampInUTC *string +} + +// RestorableSQLContainersClientListOptions contains the optional parameters for the RestorableSQLContainersClient.NewListPager +// method. +type RestorableSQLContainersClientListOptions struct { + // Restorable Sql containers event feed end time. + EndTime *string + + // The resource ID of the SQL database. + RestorableSQLDatabaseRid *string + + // Restorable Sql containers event feed start time. + StartTime *string +} + +// RestorableSQLDatabasesClientListOptions contains the optional parameters for the RestorableSQLDatabasesClient.NewListPager +// method. +type RestorableSQLDatabasesClientListOptions struct { + // placeholder for future optional parameters +} + +// RestorableSQLResourcesClientListOptions contains the optional parameters for the RestorableSQLResourcesClient.NewListPager +// method. +type RestorableSQLResourcesClientListOptions struct { + // The location where the restorable resources are located. + RestoreLocation *string + + // The timestamp when the restorable resources existed. + RestoreTimestampInUTC *string +} + +// RestorableTableResourcesClientListOptions contains the optional parameters for the RestorableTableResourcesClient.NewListPager +// method. +type RestorableTableResourcesClientListOptions struct { + // The location where the restorable resources are located. + RestoreLocation *string + + // The timestamp when the restorable resources existed. + RestoreTimestampInUTC *string +} + +// RestorableTablesClientListOptions contains the optional parameters for the RestorableTablesClient.NewListPager method. +type RestorableTablesClientListOptions struct { + // Restorable Tables event feed end time. + EndTime *string + + // Restorable Tables event feed start time. + StartTime *string +} + +// SQLResourcesClientBeginCreateUpdateClientEncryptionKeyOptions contains the optional parameters for the SQLResourcesClient.BeginCreateUpdateClientEncryptionKey +// method. +type SQLResourcesClientBeginCreateUpdateClientEncryptionKeyOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginCreateUpdateSQLContainerOptions contains the optional parameters for the SQLResourcesClient.BeginCreateUpdateSQLContainer +// method. +type SQLResourcesClientBeginCreateUpdateSQLContainerOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginCreateUpdateSQLDatabaseOptions contains the optional parameters for the SQLResourcesClient.BeginCreateUpdateSQLDatabase +// method. +type SQLResourcesClientBeginCreateUpdateSQLDatabaseOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginCreateUpdateSQLRoleAssignmentOptions contains the optional parameters for the SQLResourcesClient.BeginCreateUpdateSQLRoleAssignment +// method. +type SQLResourcesClientBeginCreateUpdateSQLRoleAssignmentOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginCreateUpdateSQLRoleDefinitionOptions contains the optional parameters for the SQLResourcesClient.BeginCreateUpdateSQLRoleDefinition +// method. +type SQLResourcesClientBeginCreateUpdateSQLRoleDefinitionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginCreateUpdateSQLStoredProcedureOptions contains the optional parameters for the SQLResourcesClient.BeginCreateUpdateSQLStoredProcedure +// method. +type SQLResourcesClientBeginCreateUpdateSQLStoredProcedureOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginCreateUpdateSQLTriggerOptions contains the optional parameters for the SQLResourcesClient.BeginCreateUpdateSQLTrigger +// method. +type SQLResourcesClientBeginCreateUpdateSQLTriggerOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginCreateUpdateSQLUserDefinedFunctionOptions contains the optional parameters for the SQLResourcesClient.BeginCreateUpdateSQLUserDefinedFunction +// method. +type SQLResourcesClientBeginCreateUpdateSQLUserDefinedFunctionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginDeleteSQLContainerOptions contains the optional parameters for the SQLResourcesClient.BeginDeleteSQLContainer +// method. +type SQLResourcesClientBeginDeleteSQLContainerOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginDeleteSQLDatabaseOptions contains the optional parameters for the SQLResourcesClient.BeginDeleteSQLDatabase +// method. +type SQLResourcesClientBeginDeleteSQLDatabaseOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginDeleteSQLRoleAssignmentOptions contains the optional parameters for the SQLResourcesClient.BeginDeleteSQLRoleAssignment +// method. +type SQLResourcesClientBeginDeleteSQLRoleAssignmentOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginDeleteSQLRoleDefinitionOptions contains the optional parameters for the SQLResourcesClient.BeginDeleteSQLRoleDefinition +// method. +type SQLResourcesClientBeginDeleteSQLRoleDefinitionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginDeleteSQLStoredProcedureOptions contains the optional parameters for the SQLResourcesClient.BeginDeleteSQLStoredProcedure +// method. +type SQLResourcesClientBeginDeleteSQLStoredProcedureOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginDeleteSQLTriggerOptions contains the optional parameters for the SQLResourcesClient.BeginDeleteSQLTrigger +// method. +type SQLResourcesClientBeginDeleteSQLTriggerOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginDeleteSQLUserDefinedFunctionOptions contains the optional parameters for the SQLResourcesClient.BeginDeleteSQLUserDefinedFunction +// method. +type SQLResourcesClientBeginDeleteSQLUserDefinedFunctionOptions struct { + // Resumes the LRO from the provided token. + 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 { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginMigrateSQLContainerToManualThroughputOptions contains the optional parameters for the SQLResourcesClient.BeginMigrateSQLContainerToManualThroughput +// method. +type SQLResourcesClientBeginMigrateSQLContainerToManualThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginMigrateSQLDatabaseToAutoscaleOptions contains the optional parameters for the SQLResourcesClient.BeginMigrateSQLDatabaseToAutoscale +// method. +type SQLResourcesClientBeginMigrateSQLDatabaseToAutoscaleOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginMigrateSQLDatabaseToManualThroughputOptions contains the optional parameters for the SQLResourcesClient.BeginMigrateSQLDatabaseToManualThroughput +// method. +type SQLResourcesClientBeginMigrateSQLDatabaseToManualThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginRetrieveContinuousBackupInformationOptions contains the optional parameters for the SQLResourcesClient.BeginRetrieveContinuousBackupInformation +// method. +type SQLResourcesClientBeginRetrieveContinuousBackupInformationOptions struct { + // Resumes the LRO from the provided token. + 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 { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientBeginUpdateSQLDatabaseThroughputOptions contains the optional parameters for the SQLResourcesClient.BeginUpdateSQLDatabaseThroughput +// method. +type SQLResourcesClientBeginUpdateSQLDatabaseThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SQLResourcesClientGetClientEncryptionKeyOptions contains the optional parameters for the SQLResourcesClient.GetClientEncryptionKey +// method. +type SQLResourcesClientGetClientEncryptionKeyOptions struct { + // placeholder for future optional parameters +} + +// SQLResourcesClientGetSQLContainerOptions contains the optional parameters for the SQLResourcesClient.GetSQLContainer method. +type SQLResourcesClientGetSQLContainerOptions struct { + // placeholder for future optional parameters +} + +// SQLResourcesClientGetSQLContainerThroughputOptions contains the optional parameters for the SQLResourcesClient.GetSQLContainerThroughput +// method. +type SQLResourcesClientGetSQLContainerThroughputOptions struct { + // placeholder for future optional parameters +} + +// SQLResourcesClientGetSQLDatabaseOptions contains the optional parameters for the SQLResourcesClient.GetSQLDatabase method. +type SQLResourcesClientGetSQLDatabaseOptions struct { + // placeholder for future optional parameters +} + +// SQLResourcesClientGetSQLDatabaseThroughputOptions contains the optional parameters for the SQLResourcesClient.GetSQLDatabaseThroughput +// method. +type SQLResourcesClientGetSQLDatabaseThroughputOptions struct { + // placeholder for future optional parameters +} + +// SQLResourcesClientGetSQLRoleAssignmentOptions contains the optional parameters for the SQLResourcesClient.GetSQLRoleAssignment +// method. +type SQLResourcesClientGetSQLRoleAssignmentOptions struct { + // placeholder for future optional parameters +} + +// SQLResourcesClientGetSQLRoleDefinitionOptions contains the optional parameters for the SQLResourcesClient.GetSQLRoleDefinition +// method. +type SQLResourcesClientGetSQLRoleDefinitionOptions struct { + // placeholder for future optional parameters +} + +// SQLResourcesClientGetSQLStoredProcedureOptions contains the optional parameters for the SQLResourcesClient.GetSQLStoredProcedure +// method. +type SQLResourcesClientGetSQLStoredProcedureOptions struct { + // placeholder for future optional parameters +} + +// SQLResourcesClientGetSQLTriggerOptions contains the optional parameters for the SQLResourcesClient.GetSQLTrigger method. +type SQLResourcesClientGetSQLTriggerOptions struct { + // placeholder for future optional parameters +} + +// SQLResourcesClientGetSQLUserDefinedFunctionOptions contains the optional parameters for the SQLResourcesClient.GetSQLUserDefinedFunction +// method. +type SQLResourcesClientGetSQLUserDefinedFunctionOptions struct { + // placeholder for future optional parameters +} + +// SQLResourcesClientListClientEncryptionKeysOptions contains the optional parameters for the SQLResourcesClient.NewListClientEncryptionKeysPager +// method. +type SQLResourcesClientListClientEncryptionKeysOptions struct { + // placeholder for future optional parameters +} + +// SQLResourcesClientListSQLContainersOptions contains the optional parameters for the SQLResourcesClient.NewListSQLContainersPager +// method. +type SQLResourcesClientListSQLContainersOptions struct { + // placeholder for future optional parameters +} + +// SQLResourcesClientListSQLDatabasesOptions contains the optional parameters for the SQLResourcesClient.NewListSQLDatabasesPager +// method. +type SQLResourcesClientListSQLDatabasesOptions struct { + // placeholder for future optional parameters +} + +// SQLResourcesClientListSQLRoleAssignmentsOptions contains the optional parameters for the SQLResourcesClient.NewListSQLRoleAssignmentsPager +// method. +type SQLResourcesClientListSQLRoleAssignmentsOptions struct { + // placeholder for future optional parameters +} + +// SQLResourcesClientListSQLRoleDefinitionsOptions contains the optional parameters for the SQLResourcesClient.NewListSQLRoleDefinitionsPager +// method. +type SQLResourcesClientListSQLRoleDefinitionsOptions struct { + // placeholder for future optional parameters +} + +// SQLResourcesClientListSQLStoredProceduresOptions contains the optional parameters for the SQLResourcesClient.NewListSQLStoredProceduresPager +// method. +type SQLResourcesClientListSQLStoredProceduresOptions struct { + // placeholder for future optional parameters +} + +// SQLResourcesClientListSQLTriggersOptions contains the optional parameters for the SQLResourcesClient.NewListSQLTriggersPager +// method. +type SQLResourcesClientListSQLTriggersOptions struct { + // placeholder for future optional parameters +} + +// SQLResourcesClientListSQLUserDefinedFunctionsOptions contains the optional parameters for the SQLResourcesClient.NewListSQLUserDefinedFunctionsPager +// method. +type SQLResourcesClientListSQLUserDefinedFunctionsOptions struct { + // placeholder for future optional parameters +} + +// ServiceClientBeginCreateOptions contains the optional parameters for the ServiceClient.BeginCreate method. +type ServiceClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServiceClientBeginDeleteOptions contains the optional parameters for the ServiceClient.BeginDelete method. +type ServiceClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServiceClientGetOptions contains the optional parameters for the ServiceClient.Get method. +type ServiceClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServiceClientListOptions contains the optional parameters for the ServiceClient.NewListPager method. +type ServiceClientListOptions struct { + // placeholder for future optional parameters +} + +// TableResourcesClientBeginCreateUpdateTableOptions contains the optional parameters for the TableResourcesClient.BeginCreateUpdateTable +// method. +type TableResourcesClientBeginCreateUpdateTableOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TableResourcesClientBeginDeleteTableOptions contains the optional parameters for the TableResourcesClient.BeginDeleteTable +// method. +type TableResourcesClientBeginDeleteTableOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TableResourcesClientBeginMigrateTableToAutoscaleOptions contains the optional parameters for the TableResourcesClient.BeginMigrateTableToAutoscale +// method. +type TableResourcesClientBeginMigrateTableToAutoscaleOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TableResourcesClientBeginMigrateTableToManualThroughputOptions contains the optional parameters for the TableResourcesClient.BeginMigrateTableToManualThroughput +// method. +type TableResourcesClientBeginMigrateTableToManualThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TableResourcesClientBeginRetrieveContinuousBackupInformationOptions contains the optional parameters for the TableResourcesClient.BeginRetrieveContinuousBackupInformation +// method. +type TableResourcesClientBeginRetrieveContinuousBackupInformationOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TableResourcesClientBeginUpdateTableThroughputOptions contains the optional parameters for the TableResourcesClient.BeginUpdateTableThroughput +// method. +type TableResourcesClientBeginUpdateTableThroughputOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TableResourcesClientGetTableOptions contains the optional parameters for the TableResourcesClient.GetTable method. +type TableResourcesClientGetTableOptions struct { + // placeholder for future optional parameters +} + +// TableResourcesClientGetTableThroughputOptions contains the optional parameters for the TableResourcesClient.GetTableThroughput +// method. +type TableResourcesClientGetTableThroughputOptions struct { + // placeholder for future optional parameters +} + +// TableResourcesClientListTablesOptions contains the optional parameters for the TableResourcesClient.NewListTablesPager +// method. +type TableResourcesClientListTablesOptions 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 abec4d83858e..2e2773ef84a0 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/partitionkeyrangeid_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/partitionkeyrangeid_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -46,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseRid - Cosmos DB database rid. @@ -111,7 +110,7 @@ func (client *PartitionKeyRangeIDClient) listMetricsCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} 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 c2e9e95a5d91..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.2780000Z"); 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.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:54:55.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:55:55.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:56:55.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:57:55.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:58:55.2780000Z"); return t}()), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.2780000Z"); 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 8bad5ad1716b..ba94b090550a 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/partitionkeyrangeidregion_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/partitionkeyrangeidregion_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -46,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -116,7 +115,7 @@ func (client *PartitionKeyRangeIDRegionClient) listMetricsCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} 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 9a5a865f4d56..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.2780000Z"); 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.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:54:55.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:55:55.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:56:55.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:57:55.2780000Z"); return t}()), - // }, - // { - // Maximum: to.Ptr[float64](5), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:58:55.2780000Z"); return t}()), - // }}, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.2780000Z"); 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 9615700ef582..8f18feeccc3a 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/percentile_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/percentile_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -47,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 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -97,7 +96,7 @@ func (client *PercentileClient) listMetricsCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} 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 11e7dd1c1534..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.2780000Z"); return t}()), - // MetricValues: []*armcosmos.PercentileMetricValue{ - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.2780000Z"); 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.2780000Z"); 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.2780000Z"); return t}()), - // MetricValues: []*armcosmos.PercentileMetricValue{ - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.2780000Z"); 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.2780000Z"); 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 2af46e3f0f18..b315ce20014b 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/percentilesourcetarget_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/percentilesourcetarget_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -47,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -107,7 +106,7 @@ func (client *PercentileSourceTargetClient) listMetricsCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} 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 cb79a0789e7b..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.2780000Z"); return t}()), - // MetricValues: []*armcosmos.PercentileMetricValue{ - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.2780000Z"); 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.2780000Z"); 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 ac7ff3de41d8..0acc9e8853ac 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/percentiletarget_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/percentiletarget_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -47,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -102,7 +101,7 @@ func (client *PercentileTargetClient) listMetricsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} 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 cbc8a2b6771e..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.2780000Z"); return t}()), - // MetricValues: []*armcosmos.PercentileMetricValue{ - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.2780000Z"); 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.2780000Z"); 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.2780000Z"); return t}()), - // MetricValues: []*armcosmos.PercentileMetricValue{ - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-19T23:53:55.2780000Z"); 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.2780000Z"); 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 94eee391b428..60ec26fd4ff1 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/polymorphic_helpers.go +++ b/sdk/resourcemanager/cosmos/armcosmos/polymorphic_helpers.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -28,7 +27,10 @@ func unmarshalBackupPolicyClassification(rawMsg json.RawMessage) (BackupPolicyCl default: b = &BackupPolicy{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalDataTransferDataSourceSinkClassification(rawMsg json.RawMessage) (DataTransferDataSourceSinkClassification, error) { @@ -52,7 +54,10 @@ func unmarshalDataTransferDataSourceSinkClassification(rawMsg json.RawMessage) ( default: b = &DataTransferDataSourceSink{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalServiceResourcePropertiesClassification(rawMsg json.RawMessage) (ServiceResourcePropertiesClassification, error) { @@ -76,5 +81,8 @@ func unmarshalServiceResourcePropertiesClassification(rawMsg json.RawMessage) (S default: b = &ServiceResourceProperties{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/privateendpointconnections_client.go b/sdk/resourcemanager/cosmos/armcosmos/privateendpointconnections_client.go index 1372e21fe76c..e26cd35d1259 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/privateendpointconnections_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/privateendpointconnections_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -47,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -59,7 +58,8 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[PrivateEndpointConnectionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -68,20 +68,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -108,16 +110,19 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -129,7 +134,8 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -138,20 +144,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -178,7 +186,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -187,25 +195,28 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. // - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get // method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -232,7 +243,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +260,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListByDatabaseAccountPager - List all private endpoint connections on a Cosmos DB account. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -296,7 +307,7 @@ func (client *PrivateEndpointConnectionsClient) listByDatabaseAccountCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-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 cc8414045fb8..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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 aedde574ad03..7afa22f30239 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/privatelinkresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/privatelinkresources_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -47,25 +46,28 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. // - options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get // method. func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, accountName string, groupName string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, groupName, options) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkResourcesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkResourcesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -92,7 +94,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,7 +111,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 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -156,7 +158,7 @@ func (client *PrivateLinkResourcesClient) listByDatabaseAccountCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-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 05ff7e0d8dee..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/response_types.go b/sdk/resourcemanager/cosmos/armcosmos/response_types.go index eb588cf13085..9b3860a6e71e 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/response_types.go +++ b/sdk/resourcemanager/cosmos/armcosmos/response_types.go @@ -3,14 +3,14 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos // CassandraClustersClientCreateUpdateResponse contains the response from method CassandraClustersClient.BeginCreateUpdate. type CassandraClustersClientCreateUpdateResponse struct { + // Representation of a managed Cassandra cluster. ClusterResource } @@ -26,31 +26,37 @@ type CassandraClustersClientDeleteResponse struct { // CassandraClustersClientGetBackupResponse contains the response from method CassandraClustersClient.GetBackup. type CassandraClustersClientGetBackupResponse struct { + // A restorable backup of a Cassandra cluster. BackupResource } // CassandraClustersClientGetResponse contains the response from method CassandraClustersClient.Get. type CassandraClustersClientGetResponse struct { + // Representation of a managed Cassandra cluster. ClusterResource } // 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. ListClusters } // CassandraClustersClientListBySubscriptionResponse contains the response from method CassandraClustersClient.NewListBySubscriptionPager. type CassandraClustersClientListBySubscriptionResponse struct { + // List of managed Cassandra clusters. ListClusters } @@ -61,16 +67,19 @@ type CassandraClustersClientStartResponse struct { // CassandraClustersClientStatusResponse contains the response from method CassandraClustersClient.Status. type CassandraClustersClientStatusResponse struct { + // Properties of a managed Cassandra cluster public status. CassandraClusterPublicStatus } // CassandraClustersClientUpdateResponse contains the response from method CassandraClustersClient.BeginUpdate. type CassandraClustersClientUpdateResponse struct { + // Representation of a managed Cassandra cluster. ClusterResource } // CassandraDataCentersClientCreateUpdateResponse contains the response from method CassandraDataCentersClient.BeginCreateUpdate. type CassandraDataCentersClientCreateUpdateResponse struct { + // A managed Cassandra data center. DataCenterResource } @@ -81,31 +90,37 @@ type CassandraDataCentersClientDeleteResponse struct { // CassandraDataCentersClientGetResponse contains the response from method CassandraDataCentersClient.Get. type CassandraDataCentersClientGetResponse struct { + // A managed Cassandra data center. DataCenterResource } // CassandraDataCentersClientListResponse contains the response from method CassandraDataCentersClient.NewListPager. type CassandraDataCentersClientListResponse struct { + // List of managed Cassandra data centers and their properties. ListDataCenters } // CassandraDataCentersClientUpdateResponse contains the response from method CassandraDataCentersClient.BeginUpdate. type CassandraDataCentersClientUpdateResponse struct { + // A managed Cassandra data center. DataCenterResource } // CassandraResourcesClientCreateUpdateCassandraKeyspaceResponse contains the response from method CassandraResourcesClient.BeginCreateUpdateCassandraKeyspace. type CassandraResourcesClientCreateUpdateCassandraKeyspaceResponse struct { + // An Azure Cosmos DB Cassandra keyspace. CassandraKeyspaceGetResults } // CassandraResourcesClientCreateUpdateCassandraTableResponse contains the response from method CassandraResourcesClient.BeginCreateUpdateCassandraTable. type CassandraResourcesClientCreateUpdateCassandraTableResponse struct { + // An Azure Cosmos DB Cassandra table. CassandraTableGetResults } // CassandraResourcesClientCreateUpdateCassandraViewResponse contains the response from method CassandraResourcesClient.BeginCreateUpdateCassandraView. type CassandraResourcesClientCreateUpdateCassandraViewResponse struct { + // An Azure Cosmos DB Cassandra view. CassandraViewGetResults } @@ -126,161 +141,193 @@ type CassandraResourcesClientDeleteCassandraViewResponse struct { // CassandraResourcesClientGetCassandraKeyspaceResponse contains the response from method CassandraResourcesClient.GetCassandraKeyspace. type CassandraResourcesClientGetCassandraKeyspaceResponse struct { + // An Azure Cosmos DB Cassandra keyspace. CassandraKeyspaceGetResults } // CassandraResourcesClientGetCassandraKeyspaceThroughputResponse contains the response from method CassandraResourcesClient.GetCassandraKeyspaceThroughput. type CassandraResourcesClientGetCassandraKeyspaceThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // CassandraResourcesClientGetCassandraTableResponse contains the response from method CassandraResourcesClient.GetCassandraTable. type CassandraResourcesClientGetCassandraTableResponse struct { + // An Azure Cosmos DB Cassandra table. CassandraTableGetResults } // CassandraResourcesClientGetCassandraTableThroughputResponse contains the response from method CassandraResourcesClient.GetCassandraTableThroughput. type CassandraResourcesClientGetCassandraTableThroughputResponse struct { + // An Azure Cosmos DB resource throughput. 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. CassandraKeyspaceListResult } // CassandraResourcesClientListCassandraTablesResponse contains the response from method CassandraResourcesClient.NewListCassandraTablesPager. type CassandraResourcesClientListCassandraTablesResponse struct { + // The List operation response, that contains the Cassandra tables and their properties. 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. ThroughputSettingsGetResults } // CassandraResourcesClientMigrateCassandraKeyspaceToManualThroughputResponse contains the response from method CassandraResourcesClient.BeginMigrateCassandraKeyspaceToManualThroughput. type CassandraResourcesClientMigrateCassandraKeyspaceToManualThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // CassandraResourcesClientMigrateCassandraTableToAutoscaleResponse contains the response from method CassandraResourcesClient.BeginMigrateCassandraTableToAutoscale. type CassandraResourcesClientMigrateCassandraTableToAutoscaleResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // CassandraResourcesClientMigrateCassandraTableToManualThroughputResponse contains the response from method CassandraResourcesClient.BeginMigrateCassandraTableToManualThroughput. type CassandraResourcesClientMigrateCassandraTableToManualThroughputResponse struct { + // An Azure Cosmos DB resource throughput. 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. ThroughputSettingsGetResults } // CassandraResourcesClientUpdateCassandraTableThroughputResponse contains the response from method CassandraResourcesClient.BeginUpdateCassandraTableThroughput. type CassandraResourcesClientUpdateCassandraTableThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // CassandraResourcesClientUpdateCassandraViewThroughputResponse contains the response from method CassandraResourcesClient.BeginUpdateCassandraViewThroughput. type CassandraResourcesClientUpdateCassandraViewThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // CollectionClientListMetricDefinitionsResponse contains the response from method CollectionClient.NewListMetricDefinitionsPager. type CollectionClientListMetricDefinitionsResponse struct { + // The response to a list metric definitions request. MetricDefinitionsListResult } // CollectionClientListMetricsResponse contains the response from method CollectionClient.NewListMetricsPager. type CollectionClientListMetricsResponse struct { + // The response to a list metrics request. MetricListResult } // CollectionClientListUsagesResponse contains the response from method CollectionClient.NewListUsagesPager. type CollectionClientListUsagesResponse struct { + // The response to a list usage request. UsagesResult } // CollectionPartitionClientListMetricsResponse contains the response from method CollectionPartitionClient.NewListMetricsPager. type CollectionPartitionClientListMetricsResponse struct { + // The response to a list partition metrics request. PartitionMetricListResult } // CollectionPartitionClientListUsagesResponse contains the response from method CollectionPartitionClient.NewListUsagesPager. type CollectionPartitionClientListUsagesResponse struct { + // The response to a list partition level usage request. PartitionUsagesResult } // CollectionPartitionRegionClientListMetricsResponse contains the response from method CollectionPartitionRegionClient.NewListMetricsPager. type CollectionPartitionRegionClientListMetricsResponse struct { + // The response to a list partition metrics request. PartitionMetricListResult } // CollectionRegionClientListMetricsResponse contains the response from method CollectionRegionClient.NewListMetricsPager. type CollectionRegionClientListMetricsResponse struct { + // The response to a list metrics request. MetricListResult } // DataTransferJobsClientCancelResponse contains the response from method DataTransferJobsClient.Cancel. type DataTransferJobsClientCancelResponse 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. MetricListResult } @@ -292,6 +339,7 @@ type DatabaseAccountsClientCheckNameExistsResponse struct { // DatabaseAccountsClientCreateOrUpdateResponse contains the response from method DatabaseAccountsClient.BeginCreateOrUpdate. type DatabaseAccountsClientCreateOrUpdateResponse struct { + // An Azure Cosmos DB database account. DatabaseAccountGetResults } @@ -307,51 +355,61 @@ type DatabaseAccountsClientFailoverPriorityChangeResponse struct { // DatabaseAccountsClientGetReadOnlyKeysResponse contains the response from method DatabaseAccountsClient.GetReadOnlyKeys. type DatabaseAccountsClientGetReadOnlyKeysResponse struct { + // The read-only access keys for the given database account. DatabaseAccountListReadOnlyKeysResult } // DatabaseAccountsClientGetResponse contains the response from method DatabaseAccountsClient.Get. type DatabaseAccountsClientGetResponse struct { + // An Azure Cosmos DB database account. DatabaseAccountGetResults } // DatabaseAccountsClientListByResourceGroupResponse contains the response from method DatabaseAccountsClient.NewListByResourceGroupPager. type DatabaseAccountsClientListByResourceGroupResponse struct { + // The List operation response, that contains the database accounts and their properties. DatabaseAccountsListResult } // DatabaseAccountsClientListConnectionStringsResponse contains the response from method DatabaseAccountsClient.ListConnectionStrings. type DatabaseAccountsClientListConnectionStringsResponse struct { + // The connection strings for the given database account. DatabaseAccountListConnectionStringsResult } // DatabaseAccountsClientListKeysResponse contains the response from method DatabaseAccountsClient.ListKeys. type DatabaseAccountsClientListKeysResponse struct { + // The access keys for the given database account. DatabaseAccountListKeysResult } // DatabaseAccountsClientListMetricDefinitionsResponse contains the response from method DatabaseAccountsClient.NewListMetricDefinitionsPager. type DatabaseAccountsClientListMetricDefinitionsResponse struct { + // The response to a list metric definitions request. MetricDefinitionsListResult } // DatabaseAccountsClientListMetricsResponse contains the response from method DatabaseAccountsClient.NewListMetricsPager. type DatabaseAccountsClientListMetricsResponse struct { + // The response to a list metrics request. MetricListResult } // DatabaseAccountsClientListReadOnlyKeysResponse contains the response from method DatabaseAccountsClient.ListReadOnlyKeys. type DatabaseAccountsClientListReadOnlyKeysResponse struct { + // The read-only access keys for the given database account. DatabaseAccountListReadOnlyKeysResult } // DatabaseAccountsClientListResponse contains the response from method DatabaseAccountsClient.NewListPager. type DatabaseAccountsClientListResponse struct { + // The List operation response, that contains the database accounts and their properties. DatabaseAccountsListResult } // DatabaseAccountsClientListUsagesResponse contains the response from method DatabaseAccountsClient.NewListUsagesPager. type DatabaseAccountsClientListUsagesResponse struct { + // The response to a list usage request. UsagesResult } @@ -372,26 +430,31 @@ type DatabaseAccountsClientRegenerateKeyResponse struct { // DatabaseAccountsClientUpdateResponse contains the response from method DatabaseAccountsClient.BeginUpdate. type DatabaseAccountsClientUpdateResponse struct { + // An Azure Cosmos DB database account. DatabaseAccountGetResults } // DatabaseClientListMetricDefinitionsResponse contains the response from method DatabaseClient.NewListMetricDefinitionsPager. type DatabaseClientListMetricDefinitionsResponse struct { + // The response to a list metric definitions request. MetricDefinitionsListResult } // DatabaseClientListMetricsResponse contains the response from method DatabaseClient.NewListMetricsPager. type DatabaseClientListMetricsResponse struct { + // The response to a list metrics request. MetricListResult } // DatabaseClientListUsagesResponse contains the response from method DatabaseClient.NewListUsagesPager. type DatabaseClientListUsagesResponse struct { + // The response to a list usage request. UsagesResult } // GraphResourcesClientCreateUpdateGraphResponse contains the response from method GraphResourcesClient.BeginCreateUpdateGraph. type GraphResourcesClientCreateUpdateGraphResponse struct { + // An Azure Cosmos DB Graph resource. GraphResourceGetResults } @@ -402,21 +465,25 @@ type GraphResourcesClientDeleteGraphResourceResponse struct { // 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. GremlinDatabaseGetResults } // GremlinResourcesClientCreateUpdateGremlinGraphResponse contains the response from method GremlinResourcesClient.BeginCreateUpdateGremlinGraph. type GremlinResourcesClientCreateUpdateGremlinGraphResponse struct { + // An Azure Cosmos DB Gremlin graph. GremlinGraphGetResults } @@ -432,91 +499,109 @@ type GremlinResourcesClientDeleteGremlinGraphResponse struct { // GremlinResourcesClientGetGremlinDatabaseResponse contains the response from method GremlinResourcesClient.GetGremlinDatabase. type GremlinResourcesClientGetGremlinDatabaseResponse struct { + // An Azure Cosmos DB Gremlin database. GremlinDatabaseGetResults } // GremlinResourcesClientGetGremlinDatabaseThroughputResponse contains the response from method GremlinResourcesClient.GetGremlinDatabaseThroughput. type GremlinResourcesClientGetGremlinDatabaseThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // GremlinResourcesClientGetGremlinGraphResponse contains the response from method GremlinResourcesClient.GetGremlinGraph. type GremlinResourcesClientGetGremlinGraphResponse struct { + // An Azure Cosmos DB Gremlin graph. GremlinGraphGetResults } // GremlinResourcesClientGetGremlinGraphThroughputResponse contains the response from method GremlinResourcesClient.GetGremlinGraphThroughput. type GremlinResourcesClientGetGremlinGraphThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // GremlinResourcesClientListGremlinDatabasesResponse contains the response from method GremlinResourcesClient.NewListGremlinDatabasesPager. type GremlinResourcesClientListGremlinDatabasesResponse struct { + // The List operation response, that contains the Gremlin databases and their properties. GremlinDatabaseListResult } // GremlinResourcesClientListGremlinGraphsResponse contains the response from method GremlinResourcesClient.NewListGremlinGraphsPager. type GremlinResourcesClientListGremlinGraphsResponse struct { + // The List operation response, that contains the graphs and their properties. GremlinGraphListResult } // GremlinResourcesClientMigrateGremlinDatabaseToAutoscaleResponse contains the response from method GremlinResourcesClient.BeginMigrateGremlinDatabaseToAutoscale. type GremlinResourcesClientMigrateGremlinDatabaseToAutoscaleResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // GremlinResourcesClientMigrateGremlinDatabaseToManualThroughputResponse contains the response from method GremlinResourcesClient.BeginMigrateGremlinDatabaseToManualThroughput. type GremlinResourcesClientMigrateGremlinDatabaseToManualThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // GremlinResourcesClientMigrateGremlinGraphToAutoscaleResponse contains the response from method GremlinResourcesClient.BeginMigrateGremlinGraphToAutoscale. type GremlinResourcesClientMigrateGremlinGraphToAutoscaleResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // GremlinResourcesClientMigrateGremlinGraphToManualThroughputResponse contains the response from method GremlinResourcesClient.BeginMigrateGremlinGraphToManualThroughput. type GremlinResourcesClientMigrateGremlinGraphToManualThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // GremlinResourcesClientRetrieveContinuousBackupInformationResponse contains the response from method GremlinResourcesClient.BeginRetrieveContinuousBackupInformation. type GremlinResourcesClientRetrieveContinuousBackupInformationResponse struct { + // Backup information of a resource. BackupInformation } // GremlinResourcesClientUpdateGremlinDatabaseThroughputResponse contains the response from method GremlinResourcesClient.BeginUpdateGremlinDatabaseThroughput. type GremlinResourcesClientUpdateGremlinDatabaseThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // GremlinResourcesClientUpdateGremlinGraphThroughputResponse contains the response from method GremlinResourcesClient.BeginUpdateGremlinGraphThroughput. type GremlinResourcesClientUpdateGremlinGraphThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // LocationsClientGetResponse contains the response from method LocationsClient.Get. type LocationsClientGetResponse struct { + // Cosmos DB location get result LocationGetResult } // LocationsClientListResponse contains the response from method LocationsClient.NewListPager. type LocationsClientListResponse struct { + // The List operation response, that contains Cosmos DB locations and their properties. LocationListResult } // MongoClustersClientCheckNameAvailabilityResponse contains the response from method MongoClustersClient.CheckNameAvailability. type MongoClustersClientCheckNameAvailabilityResponse struct { + // The check availability result. CheckNameAvailabilityResponse } // MongoClustersClientCreateOrUpdateFirewallRuleResponse contains the response from method MongoClustersClient.BeginCreateOrUpdateFirewallRule. type MongoClustersClientCreateOrUpdateFirewallRuleResponse struct { + // Represents a mongo cluster firewall rule. FirewallRule } // MongoClustersClientCreateOrUpdateResponse contains the response from method MongoClustersClient.BeginCreateOrUpdate. type MongoClustersClientCreateOrUpdateResponse struct { + // Represents a mongo cluster resource. MongoCluster } @@ -532,56 +617,67 @@ type MongoClustersClientDeleteResponse struct { // MongoClustersClientGetFirewallRuleResponse contains the response from method MongoClustersClient.GetFirewallRule. type MongoClustersClientGetFirewallRuleResponse struct { + // Represents a mongo cluster firewall rule. FirewallRule } // MongoClustersClientGetResponse contains the response from method MongoClustersClient.Get. type MongoClustersClientGetResponse struct { + // Represents a mongo cluster resource. MongoCluster } // MongoClustersClientListByResourceGroupResponse contains the response from method MongoClustersClient.NewListByResourceGroupPager. type MongoClustersClientListByResourceGroupResponse struct { + // A list of mongo clusters. MongoClusterListResult } // MongoClustersClientListConnectionStringsResponse contains the response from method MongoClustersClient.ListConnectionStrings. type MongoClustersClientListConnectionStringsResponse struct { + // The connection strings for the given mongo cluster. ListConnectionStringsResult } // MongoClustersClientListFirewallRulesResponse contains the response from method MongoClustersClient.NewListFirewallRulesPager. type MongoClustersClientListFirewallRulesResponse struct { + // A list of firewall rules. FirewallRuleListResult } // MongoClustersClientListResponse contains the response from method MongoClustersClient.NewListPager. type MongoClustersClientListResponse struct { + // A list of mongo clusters. MongoClusterListResult } // MongoClustersClientUpdateResponse contains the response from method MongoClustersClient.BeginUpdate. type MongoClustersClientUpdateResponse struct { + // Represents a mongo cluster resource. MongoCluster } // MongoDBResourcesClientCreateUpdateMongoDBCollectionResponse contains the response from method MongoDBResourcesClient.BeginCreateUpdateMongoDBCollection. type MongoDBResourcesClientCreateUpdateMongoDBCollectionResponse struct { + // An Azure Cosmos DB MongoDB collection. MongoDBCollectionGetResults } // MongoDBResourcesClientCreateUpdateMongoDBDatabaseResponse contains the response from method MongoDBResourcesClient.BeginCreateUpdateMongoDBDatabase. type MongoDBResourcesClientCreateUpdateMongoDBDatabaseResponse struct { + // An Azure Cosmos DB MongoDB database. MongoDBDatabaseGetResults } // MongoDBResourcesClientCreateUpdateMongoRoleDefinitionResponse contains the response from method MongoDBResourcesClient.BeginCreateUpdateMongoRoleDefinition. type MongoDBResourcesClientCreateUpdateMongoRoleDefinitionResponse struct { + // An Azure Cosmos DB Mongo Role Definition. MongoRoleDefinitionGetResults } // MongoDBResourcesClientCreateUpdateMongoUserDefinitionResponse contains the response from method MongoDBResourcesClient.BeginCreateUpdateMongoUserDefinition. type MongoDBResourcesClientCreateUpdateMongoUserDefinitionResponse struct { + // An Azure Cosmos DB User Definition MongoUserDefinitionGetResults } @@ -607,121 +703,145 @@ type MongoDBResourcesClientDeleteMongoUserDefinitionResponse struct { // MongoDBResourcesClientGetMongoDBCollectionResponse contains the response from method MongoDBResourcesClient.GetMongoDBCollection. type MongoDBResourcesClientGetMongoDBCollectionResponse struct { + // An Azure Cosmos DB MongoDB collection. MongoDBCollectionGetResults } // MongoDBResourcesClientGetMongoDBCollectionThroughputResponse contains the response from method MongoDBResourcesClient.GetMongoDBCollectionThroughput. type MongoDBResourcesClientGetMongoDBCollectionThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // MongoDBResourcesClientGetMongoDBDatabaseResponse contains the response from method MongoDBResourcesClient.GetMongoDBDatabase. type MongoDBResourcesClientGetMongoDBDatabaseResponse struct { + // An Azure Cosmos DB MongoDB database. MongoDBDatabaseGetResults } // MongoDBResourcesClientGetMongoDBDatabaseThroughputResponse contains the response from method MongoDBResourcesClient.GetMongoDBDatabaseThroughput. type MongoDBResourcesClientGetMongoDBDatabaseThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // MongoDBResourcesClientGetMongoRoleDefinitionResponse contains the response from method MongoDBResourcesClient.GetMongoRoleDefinition. type MongoDBResourcesClientGetMongoRoleDefinitionResponse struct { + // An Azure Cosmos DB Mongo Role Definition. MongoRoleDefinitionGetResults } // MongoDBResourcesClientGetMongoUserDefinitionResponse contains the response from method MongoDBResourcesClient.GetMongoUserDefinition. type MongoDBResourcesClientGetMongoUserDefinitionResponse struct { + // An Azure Cosmos DB User Definition 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. MongoDBCollectionListResult } // MongoDBResourcesClientListMongoDBDatabasesResponse contains the response from method MongoDBResourcesClient.NewListMongoDBDatabasesPager. type MongoDBResourcesClientListMongoDBDatabasesResponse struct { + // The List operation response, that contains the MongoDB databases and their properties. MongoDBDatabaseListResult } // MongoDBResourcesClientListMongoRoleDefinitionsResponse contains the response from method MongoDBResourcesClient.NewListMongoRoleDefinitionsPager. type MongoDBResourcesClientListMongoRoleDefinitionsResponse struct { + // The relevant Mongo Role Definitions. MongoRoleDefinitionListResult } // MongoDBResourcesClientListMongoUserDefinitionsResponse contains the response from method MongoDBResourcesClient.NewListMongoUserDefinitionsPager. type MongoDBResourcesClientListMongoUserDefinitionsResponse struct { + // The relevant User Definition. MongoUserDefinitionListResult } // MongoDBResourcesClientMigrateMongoDBCollectionToAutoscaleResponse contains the response from method MongoDBResourcesClient.BeginMigrateMongoDBCollectionToAutoscale. type MongoDBResourcesClientMigrateMongoDBCollectionToAutoscaleResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // MongoDBResourcesClientMigrateMongoDBCollectionToManualThroughputResponse contains the response from method MongoDBResourcesClient.BeginMigrateMongoDBCollectionToManualThroughput. type MongoDBResourcesClientMigrateMongoDBCollectionToManualThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // MongoDBResourcesClientMigrateMongoDBDatabaseToAutoscaleResponse contains the response from method MongoDBResourcesClient.BeginMigrateMongoDBDatabaseToAutoscale. type MongoDBResourcesClientMigrateMongoDBDatabaseToAutoscaleResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // MongoDBResourcesClientMigrateMongoDBDatabaseToManualThroughputResponse contains the response from method MongoDBResourcesClient.BeginMigrateMongoDBDatabaseToManualThroughput. type MongoDBResourcesClientMigrateMongoDBDatabaseToManualThroughputResponse struct { + // An Azure Cosmos DB resource throughput. 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. BackupInformation } // MongoDBResourcesClientUpdateMongoDBCollectionThroughputResponse contains the response from method MongoDBResourcesClient.BeginUpdateMongoDBCollectionThroughput. type MongoDBResourcesClientUpdateMongoDBCollectionThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // MongoDBResourcesClientUpdateMongoDBDatabaseThroughputResponse contains the response from method MongoDBResourcesClient.BeginUpdateMongoDBDatabaseThroughput. type MongoDBResourcesClientUpdateMongoDBDatabaseThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // NotebookWorkspacesClientCreateOrUpdateResponse contains the response from method NotebookWorkspacesClient.BeginCreateOrUpdate. type NotebookWorkspacesClientCreateOrUpdateResponse struct { + // A notebook workspace resource NotebookWorkspace } @@ -732,16 +852,19 @@ type NotebookWorkspacesClientDeleteResponse struct { // NotebookWorkspacesClientGetResponse contains the response from method NotebookWorkspacesClient.Get. type NotebookWorkspacesClientGetResponse struct { + // A notebook workspace resource NotebookWorkspace } // NotebookWorkspacesClientListByDatabaseAccountResponse contains the response from method NotebookWorkspacesClient.NewListByDatabaseAccountPager. type NotebookWorkspacesClientListByDatabaseAccountResponse struct { + // A list of notebook workspace resources NotebookWorkspaceListResult } // NotebookWorkspacesClientListConnectionInfoResponse contains the response from method NotebookWorkspacesClient.ListConnectionInfo. type NotebookWorkspacesClientListConnectionInfoResponse struct { + // The connection info for the given notebook workspace NotebookWorkspaceConnectionInfoResult } @@ -757,36 +880,44 @@ type NotebookWorkspacesClientStartResponse struct { // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the + // next set of results. OperationListResult } // PartitionKeyRangeIDClientListMetricsResponse contains the response from method PartitionKeyRangeIDClient.NewListMetricsPager. type PartitionKeyRangeIDClientListMetricsResponse struct { + // The response to a list partition metrics request. PartitionMetricListResult } // PartitionKeyRangeIDRegionClientListMetricsResponse contains the response from method PartitionKeyRangeIDRegionClient.NewListMetricsPager. type PartitionKeyRangeIDRegionClientListMetricsResponse struct { + // The response to a list partition metrics request. PartitionMetricListResult } // PercentileClientListMetricsResponse contains the response from method PercentileClient.NewListMetricsPager. type PercentileClientListMetricsResponse struct { + // The response to a list percentile metrics request. PercentileMetricListResult } // PercentileSourceTargetClientListMetricsResponse contains the response from method PercentileSourceTargetClient.NewListMetricsPager. type PercentileSourceTargetClientListMetricsResponse struct { + // The response to a list percentile metrics request. PercentileMetricListResult } // PercentileTargetClientListMetricsResponse contains the response from method PercentileTargetClient.NewListMetricsPager. type PercentileTargetClientListMetricsResponse struct { + // The response to a list percentile metrics request. PercentileMetricListResult } // PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreateOrUpdate. type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { + // A private endpoint connection PrivateEndpointConnection } @@ -797,131 +928,157 @@ type PrivateEndpointConnectionsClientDeleteResponse struct { // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { + // A private endpoint connection PrivateEndpointConnection } // PrivateEndpointConnectionsClientListByDatabaseAccountResponse contains the response from method PrivateEndpointConnectionsClient.NewListByDatabaseAccountPager. type PrivateEndpointConnectionsClientListByDatabaseAccountResponse struct { + // A list of private endpoint connections PrivateEndpointConnectionListResult } // PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. type PrivateLinkResourcesClientGetResponse struct { + // A private link resource PrivateLinkResource } // PrivateLinkResourcesClientListByDatabaseAccountResponse contains the response from method PrivateLinkResourcesClient.NewListByDatabaseAccountPager. type PrivateLinkResourcesClientListByDatabaseAccountResponse struct { + // A list of private link resources PrivateLinkResourceListResult } // RestorableDatabaseAccountsClientGetByLocationResponse contains the response from method RestorableDatabaseAccountsClient.GetByLocation. type RestorableDatabaseAccountsClientGetByLocationResponse struct { + // A Azure Cosmos DB restorable database account. RestorableDatabaseAccountGetResult } // RestorableDatabaseAccountsClientListByLocationResponse contains the response from method RestorableDatabaseAccountsClient.NewListByLocationPager. type RestorableDatabaseAccountsClientListByLocationResponse struct { + // The List operation response, that contains the restorable database accounts and their properties. RestorableDatabaseAccountsListResult } // RestorableDatabaseAccountsClientListResponse contains the response from method RestorableDatabaseAccountsClient.NewListPager. type RestorableDatabaseAccountsClientListResponse struct { + // The List operation response, that contains the restorable database accounts and their properties. RestorableDatabaseAccountsListResult } // RestorableGremlinDatabasesClientListResponse contains the response from method RestorableGremlinDatabasesClient.NewListPager. type RestorableGremlinDatabasesClientListResponse struct { + // The List operation response, that contains the Gremlin database events and their properties. RestorableGremlinDatabasesListResult } // RestorableGremlinGraphsClientListResponse contains the response from method RestorableGremlinGraphsClient.NewListPager. type RestorableGremlinGraphsClientListResponse struct { + // The List operation response, that contains the Gremlin graph events and their properties. RestorableGremlinGraphsListResult } // RestorableGremlinResourcesClientListResponse contains the response from method RestorableGremlinResourcesClient.NewListPager. type RestorableGremlinResourcesClientListResponse struct { + // The List operation response, that contains the restorable Gremlin resources. RestorableGremlinResourcesListResult } // RestorableMongodbCollectionsClientListResponse contains the response from method RestorableMongodbCollectionsClient.NewListPager. type RestorableMongodbCollectionsClientListResponse struct { + // The List operation response, that contains the MongoDB collection events and their properties. RestorableMongodbCollectionsListResult } // RestorableMongodbDatabasesClientListResponse contains the response from method RestorableMongodbDatabasesClient.NewListPager. type RestorableMongodbDatabasesClientListResponse struct { + // The List operation response, that contains the MongoDB database events and their properties. RestorableMongodbDatabasesListResult } // RestorableMongodbResourcesClientListResponse contains the response from method RestorableMongodbResourcesClient.NewListPager. type RestorableMongodbResourcesClientListResponse struct { + // The List operation response, that contains the restorable MongoDB resources. RestorableMongodbResourcesListResult } // RestorableSQLContainersClientListResponse contains the response from method RestorableSQLContainersClient.NewListPager. type RestorableSQLContainersClientListResponse struct { + // The List operation response, that contains the SQL container events and their properties. RestorableSQLContainersListResult } // RestorableSQLDatabasesClientListResponse contains the response from method RestorableSQLDatabasesClient.NewListPager. type RestorableSQLDatabasesClientListResponse struct { + // The List operation response, that contains the SQL database events and their properties. RestorableSQLDatabasesListResult } // RestorableSQLResourcesClientListResponse contains the response from method RestorableSQLResourcesClient.NewListPager. type RestorableSQLResourcesClientListResponse struct { + // The List operation response, that contains the restorable SQL resources. RestorableSQLResourcesListResult } // RestorableTableResourcesClientListResponse contains the response from method RestorableTableResourcesClient.NewListPager. type RestorableTableResourcesClientListResponse struct { + // List of restorable table names. RestorableTableResourcesListResult } // RestorableTablesClientListResponse contains the response from method RestorableTablesClient.NewListPager. type RestorableTablesClientListResponse struct { + // The List operation response, that contains the Table events and their properties. RestorableTablesListResult } // SQLResourcesClientCreateUpdateClientEncryptionKeyResponse contains the response from method SQLResourcesClient.BeginCreateUpdateClientEncryptionKey. type SQLResourcesClientCreateUpdateClientEncryptionKeyResponse struct { + // Client Encryption Key. ClientEncryptionKeyGetResults } // SQLResourcesClientCreateUpdateSQLContainerResponse contains the response from method SQLResourcesClient.BeginCreateUpdateSQLContainer. type SQLResourcesClientCreateUpdateSQLContainerResponse struct { + // An Azure Cosmos DB container. SQLContainerGetResults } // SQLResourcesClientCreateUpdateSQLDatabaseResponse contains the response from method SQLResourcesClient.BeginCreateUpdateSQLDatabase. type SQLResourcesClientCreateUpdateSQLDatabaseResponse struct { + // An Azure Cosmos DB SQL database. SQLDatabaseGetResults } // SQLResourcesClientCreateUpdateSQLRoleAssignmentResponse contains the response from method SQLResourcesClient.BeginCreateUpdateSQLRoleAssignment. type SQLResourcesClientCreateUpdateSQLRoleAssignmentResponse struct { + // An Azure Cosmos DB Role Assignment SQLRoleAssignmentGetResults } // SQLResourcesClientCreateUpdateSQLRoleDefinitionResponse contains the response from method SQLResourcesClient.BeginCreateUpdateSQLRoleDefinition. type SQLResourcesClientCreateUpdateSQLRoleDefinitionResponse struct { + // An Azure Cosmos DB SQL Role Definition. SQLRoleDefinitionGetResults } // SQLResourcesClientCreateUpdateSQLStoredProcedureResponse contains the response from method SQLResourcesClient.BeginCreateUpdateSQLStoredProcedure. type SQLResourcesClientCreateUpdateSQLStoredProcedureResponse struct { + // An Azure Cosmos DB storedProcedure. SQLStoredProcedureGetResults } // SQLResourcesClientCreateUpdateSQLTriggerResponse contains the response from method SQLResourcesClient.BeginCreateUpdateSQLTrigger. type SQLResourcesClientCreateUpdateSQLTriggerResponse struct { + // An Azure Cosmos DB trigger. SQLTriggerGetResults } // SQLResourcesClientCreateUpdateSQLUserDefinedFunctionResponse contains the response from method SQLResourcesClient.BeginCreateUpdateSQLUserDefinedFunction. type SQLResourcesClientCreateUpdateSQLUserDefinedFunctionResponse struct { + // An Azure Cosmos DB userDefinedFunction. SQLUserDefinedFunctionGetResults } @@ -962,161 +1119,193 @@ type SQLResourcesClientDeleteSQLUserDefinedFunctionResponse struct { // SQLResourcesClientGetClientEncryptionKeyResponse contains the response from method SQLResourcesClient.GetClientEncryptionKey. type SQLResourcesClientGetClientEncryptionKeyResponse struct { + // Client Encryption Key. ClientEncryptionKeyGetResults } // SQLResourcesClientGetSQLContainerResponse contains the response from method SQLResourcesClient.GetSQLContainer. type SQLResourcesClientGetSQLContainerResponse struct { + // An Azure Cosmos DB container. SQLContainerGetResults } // SQLResourcesClientGetSQLContainerThroughputResponse contains the response from method SQLResourcesClient.GetSQLContainerThroughput. type SQLResourcesClientGetSQLContainerThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // SQLResourcesClientGetSQLDatabaseResponse contains the response from method SQLResourcesClient.GetSQLDatabase. type SQLResourcesClientGetSQLDatabaseResponse struct { + // An Azure Cosmos DB SQL database. SQLDatabaseGetResults } // SQLResourcesClientGetSQLDatabaseThroughputResponse contains the response from method SQLResourcesClient.GetSQLDatabaseThroughput. type SQLResourcesClientGetSQLDatabaseThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // SQLResourcesClientGetSQLRoleAssignmentResponse contains the response from method SQLResourcesClient.GetSQLRoleAssignment. type SQLResourcesClientGetSQLRoleAssignmentResponse struct { + // An Azure Cosmos DB Role Assignment SQLRoleAssignmentGetResults } // SQLResourcesClientGetSQLRoleDefinitionResponse contains the response from method SQLResourcesClient.GetSQLRoleDefinition. type SQLResourcesClientGetSQLRoleDefinitionResponse struct { + // An Azure Cosmos DB SQL Role Definition. SQLRoleDefinitionGetResults } // SQLResourcesClientGetSQLStoredProcedureResponse contains the response from method SQLResourcesClient.GetSQLStoredProcedure. type SQLResourcesClientGetSQLStoredProcedureResponse struct { + // An Azure Cosmos DB storedProcedure. SQLStoredProcedureGetResults } // SQLResourcesClientGetSQLTriggerResponse contains the response from method SQLResourcesClient.GetSQLTrigger. type SQLResourcesClientGetSQLTriggerResponse struct { + // An Azure Cosmos DB trigger. SQLTriggerGetResults } // SQLResourcesClientGetSQLUserDefinedFunctionResponse contains the response from method SQLResourcesClient.GetSQLUserDefinedFunction. type SQLResourcesClientGetSQLUserDefinedFunctionResponse struct { + // An Azure Cosmos DB userDefinedFunction. SQLUserDefinedFunctionGetResults } // SQLResourcesClientListClientEncryptionKeysResponse contains the response from method SQLResourcesClient.NewListClientEncryptionKeysPager. type SQLResourcesClientListClientEncryptionKeysResponse struct { + // The List operation response, that contains the client encryption keys and their properties. 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. SQLContainerListResult } // SQLResourcesClientListSQLDatabasesResponse contains the response from method SQLResourcesClient.NewListSQLDatabasesPager. type SQLResourcesClientListSQLDatabasesResponse struct { + // The List operation response, that contains the SQL databases and their properties. SQLDatabaseListResult } // SQLResourcesClientListSQLRoleAssignmentsResponse contains the response from method SQLResourcesClient.NewListSQLRoleAssignmentsPager. type SQLResourcesClientListSQLRoleAssignmentsResponse struct { + // The relevant Role Assignments. SQLRoleAssignmentListResult } // SQLResourcesClientListSQLRoleDefinitionsResponse contains the response from method SQLResourcesClient.NewListSQLRoleDefinitionsPager. type SQLResourcesClientListSQLRoleDefinitionsResponse struct { + // The relevant Role Definitions. SQLRoleDefinitionListResult } // SQLResourcesClientListSQLStoredProceduresResponse contains the response from method SQLResourcesClient.NewListSQLStoredProceduresPager. type SQLResourcesClientListSQLStoredProceduresResponse struct { + // The List operation response, that contains the storedProcedures and their properties. SQLStoredProcedureListResult } // SQLResourcesClientListSQLTriggersResponse contains the response from method SQLResourcesClient.NewListSQLTriggersPager. type SQLResourcesClientListSQLTriggersResponse struct { + // The List operation response, that contains the triggers and their properties. SQLTriggerListResult } // SQLResourcesClientListSQLUserDefinedFunctionsResponse contains the response from method SQLResourcesClient.NewListSQLUserDefinedFunctionsPager. type SQLResourcesClientListSQLUserDefinedFunctionsResponse struct { + // The List operation response, that contains the userDefinedFunctions and their properties. SQLUserDefinedFunctionListResult } // SQLResourcesClientMigrateSQLContainerToAutoscaleResponse contains the response from method SQLResourcesClient.BeginMigrateSQLContainerToAutoscale. type SQLResourcesClientMigrateSQLContainerToAutoscaleResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // SQLResourcesClientMigrateSQLContainerToManualThroughputResponse contains the response from method SQLResourcesClient.BeginMigrateSQLContainerToManualThroughput. type SQLResourcesClientMigrateSQLContainerToManualThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // SQLResourcesClientMigrateSQLDatabaseToAutoscaleResponse contains the response from method SQLResourcesClient.BeginMigrateSQLDatabaseToAutoscale. type SQLResourcesClientMigrateSQLDatabaseToAutoscaleResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // SQLResourcesClientMigrateSQLDatabaseToManualThroughputResponse contains the response from method SQLResourcesClient.BeginMigrateSQLDatabaseToManualThroughput. type SQLResourcesClientMigrateSQLDatabaseToManualThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // SQLResourcesClientRetrieveContinuousBackupInformationResponse contains the response from method SQLResourcesClient.BeginRetrieveContinuousBackupInformation. type SQLResourcesClientRetrieveContinuousBackupInformationResponse struct { + // Backup information of a resource. 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. ThroughputSettingsGetResults } // SQLResourcesClientUpdateSQLDatabaseThroughputResponse contains the response from method SQLResourcesClient.BeginUpdateSQLDatabaseThroughput. type SQLResourcesClientUpdateSQLDatabaseThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // ServiceClientCreateResponse contains the response from method ServiceClient.BeginCreate. type ServiceClientCreateResponse struct { + // Properties for the database account. ServiceResource } @@ -1127,16 +1316,19 @@ type ServiceClientDeleteResponse struct { // ServiceClientGetResponse contains the response from method ServiceClient.Get. type ServiceClientGetResponse struct { + // Properties for the database account. ServiceResource } // ServiceClientListResponse contains the response from method ServiceClient.NewListPager. type ServiceClientListResponse struct { + // The List operation response, that contains the Service Resource and their properties. ServiceResourceListResult } // TableResourcesClientCreateUpdateTableResponse contains the response from method TableResourcesClient.BeginCreateUpdateTable. type TableResourcesClientCreateUpdateTableResponse struct { + // An Azure Cosmos DB Table. TableGetResults } @@ -1147,35 +1339,42 @@ type TableResourcesClientDeleteTableResponse struct { // TableResourcesClientGetTableResponse contains the response from method TableResourcesClient.GetTable. type TableResourcesClientGetTableResponse struct { + // An Azure Cosmos DB Table. TableGetResults } // TableResourcesClientGetTableThroughputResponse contains the response from method TableResourcesClient.GetTableThroughput. type TableResourcesClientGetTableThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // TableResourcesClientListTablesResponse contains the response from method TableResourcesClient.NewListTablesPager. type TableResourcesClientListTablesResponse struct { + // The List operation response, that contains the Table and their properties. TableListResult } // TableResourcesClientMigrateTableToAutoscaleResponse contains the response from method TableResourcesClient.BeginMigrateTableToAutoscale. type TableResourcesClientMigrateTableToAutoscaleResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // TableResourcesClientMigrateTableToManualThroughputResponse contains the response from method TableResourcesClient.BeginMigrateTableToManualThroughput. type TableResourcesClientMigrateTableToManualThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } // TableResourcesClientRetrieveContinuousBackupInformationResponse contains the response from method TableResourcesClient.BeginRetrieveContinuousBackupInformation. type TableResourcesClientRetrieveContinuousBackupInformationResponse struct { + // Backup information of a resource. BackupInformation } // TableResourcesClientUpdateTableThroughputResponse contains the response from method TableResourcesClient.BeginUpdateTableThroughput. type TableResourcesClientUpdateTableThroughputResponse struct { + // An Azure Cosmos DB resource throughput. ThroughputSettingsGetResults } diff --git a/sdk/resourcemanager/cosmos/armcosmos/restorabledatabaseaccounts_client.go b/sdk/resourcemanager/cosmos/armcosmos/restorabledatabaseaccounts_client.go index 090f6b8551fb..17beb9e52b0b 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorabledatabaseaccounts_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorabledatabaseaccounts_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -48,24 +47,27 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 // method. func (client *RestorableDatabaseAccountsClient) GetByLocation(ctx context.Context, location string, instanceID string, options *RestorableDatabaseAccountsClientGetByLocationOptions) (RestorableDatabaseAccountsClientGetByLocationResponse, error) { + var err error req, err := client.getByLocationCreateRequest(ctx, location, instanceID, options) if err != nil { return RestorableDatabaseAccountsClientGetByLocationResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return RestorableDatabaseAccountsClientGetByLocationResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RestorableDatabaseAccountsClientGetByLocationResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RestorableDatabaseAccountsClientGetByLocationResponse{}, err } - return client.getByLocationHandleResponse(resp) + resp, err := client.getByLocationHandleResponse(httpResp) + return resp, err } // getByLocationCreateRequest creates the GetByLocation request. @@ -88,7 +90,7 @@ func (client *RestorableDatabaseAccountsClient) getByLocationCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -106,7 +108,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - options - RestorableDatabaseAccountsClientListOptions contains the optional parameters for the RestorableDatabaseAccountsClient.NewListPager // method. func (client *RestorableDatabaseAccountsClient) NewListPager(options *RestorableDatabaseAccountsClientListOptions) *runtime.Pager[RestorableDatabaseAccountsClientListResponse] { @@ -143,7 +145,7 @@ func (client *RestorableDatabaseAccountsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -162,7 +164,7 @@ func (client *RestorableDatabaseAccountsClient) listHandleResponse(resp *http.Re // in a region. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' // permission. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - location - Cosmos DB region, with spaces between words and each word capitalized. // - options - RestorableDatabaseAccountsClientListByLocationOptions contains the optional parameters for the RestorableDatabaseAccountsClient.NewListByLocationPager // method. @@ -204,7 +206,7 @@ func (client *RestorableDatabaseAccountsClient) listByLocationCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-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 ebaedc9950c2..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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:15Z"); return t}()), - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09Z"); return t}()), - // OldestRestorableTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-01T22:05:09Z"); return t}()), - // RestorableLocations: []*armcosmos.RestorableLocationResource{ - // { - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:10Z"); return t}()), - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:35Z"); 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:10Z"); 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:18Z"); return t}()), - // OldestRestorableTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-01T22:05:09Z"); return t}()), - // RestorableLocations: []*armcosmos.RestorableLocationResource{ - // { - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:10Z"); return t}()), - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:35Z"); 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:10Z"); 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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:15Z"); return t}()), - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09Z"); return t}()), - // OldestRestorableTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-01T22:05:09Z"); return t}()), - // RestorableLocations: []*armcosmos.RestorableLocationResource{ - // { - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:10Z"); return t}()), - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:35Z"); 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:10Z"); 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:18Z"); return t}()), - // OldestRestorableTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-01T22:05:09Z"); return t}()), - // RestorableLocations: []*armcosmos.RestorableLocationResource{ - // { - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:10Z"); return t}()), - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:35Z"); 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:10Z"); 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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:15Z"); return t}()), - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-12T22:05:09Z"); return t}()), - // OldestRestorableTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-01T22:05:09Z"); return t}()), - // RestorableLocations: []*armcosmos.RestorableLocationResource{ - // { - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:10Z"); return t}()), - // DeletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-30T21:13:35Z"); 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:10Z"); 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 02c01d112d2d..309a92df2fea 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablegremlindatabases_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorablegremlindatabases_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -48,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 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -95,7 +94,7 @@ func (client *RestorableGremlinDatabasesClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-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 615a1c02df8f..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablegremlindatabases_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/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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=="), - // 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=="), - // 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 fbe2688c324b..8f6f8e75d727 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablegremlingraphs_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorablegremlingraphs_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -48,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 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -95,7 +94,7 @@ func (client *RestorableGremlinGraphsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") if options != nil && options.RestorableGremlinDatabaseRid != nil { reqQP.Set("restorableGremlinDatabaseRid", *options.RestorableGremlinDatabaseRid) } 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 67bc24019103..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablegremlingraphs_client_example_test.go +++ /dev/null @@ -1,64 +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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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=="), - // EventTimestamp: to.Ptr("2020-10-13T04:56:42Z"), - // OperationType: to.Ptr(armcosmos.OperationTypeCreate), - // 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 dced2e14043b..d9e8ac0fe86c 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablegremlinresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorablegremlinresources_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -48,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 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -95,7 +94,7 @@ func (client *RestorableGremlinResourcesClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-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 7c444cd1b60e..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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 50d27916f7cd..e53e26bfa956 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbcollections_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbcollections_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -48,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 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -95,7 +94,7 @@ func (client *RestorableMongodbCollectionsClient) listCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") if options != nil && options.RestorableMongodbDatabaseRid != nil { reqQP.Set("restorableMongodbDatabaseRid", *options.RestorableMongodbDatabaseRid) } 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 310d530f4c90..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbcollections_client_example_test.go +++ /dev/null @@ -1,64 +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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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=="), - // EventTimestamp: to.Ptr("2020-10-13T04:56:42Z"), - // OperationType: to.Ptr(armcosmos.OperationTypeCreate), - // 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 bce501c4999a..fe0caeca3eb7 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbdatabases_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbdatabases_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -48,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 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -95,7 +94,7 @@ func (client *RestorableMongodbDatabasesClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-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 3f7d446a1d89..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbdatabases_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/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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=="), - // 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=="), - // 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 bde25a76919c..f2239de6a8a4 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorablemongodbresources_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -48,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 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -95,7 +94,7 @@ func (client *RestorableMongodbResourcesClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-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 0164f595ae54..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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 da2644b20766..67909920e35e 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablesqlcontainers_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorablesqlcontainers_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -48,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 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -95,7 +94,7 @@ func (client *RestorableSQLContainersClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") if options != nil && options.RestorableSQLDatabaseRid != nil { reqQP.Set("restorableSqlDatabaseRid", *options.RestorableSQLDatabaseRid) } 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 26002f888102..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablesqlcontainers_client_example_test.go +++ /dev/null @@ -1,131 +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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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=="), - // 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=="), - // 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 96677bd87b28..c108d5a000b9 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablesqldatabases_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorablesqldatabases_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -48,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 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -95,7 +94,7 @@ func (client *RestorableSQLDatabasesClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-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 3d70aa3bdb32..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablesqldatabases_client_example_test.go +++ /dev/null @@ -1,113 +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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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=="), - // 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=="), - // 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=="), - // 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 de3127525c1a..c38b4de7cc78 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorablesqlresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorablesqlresources_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -48,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 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -95,7 +94,7 @@ func (client *RestorableSQLResourcesClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-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 cabe7c52957e..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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 c227d8f10cd2..e23f5d3483eb 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorabletableresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorabletableresources_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -48,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 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -95,7 +94,7 @@ func (client *RestorableTableResourcesClient) listCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-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 31b1b3913869..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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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 0fbbe68974d7..e7ca3aebfe2a 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/restorabletables_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/restorabletables_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -48,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 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -95,7 +94,7 @@ func (client *RestorableTablesClient) listCreateRequest(ctx context.Context, loc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") if options != nil && options.StartTime != nil { reqQP.Set("startTime", *options.StartTime) } 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 6df5b317758a..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/restorabletables_client_example_test.go +++ /dev/null @@ -1,62 +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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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=="), - // EventTimestamp: to.Ptr("2020-10-13T04:56:42Z"), - // OperationType: to.Ptr(armcosmos.OperationTypeCreate), - // 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 7db85a1675c9..5857cd65d7b4 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/service_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/service_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -47,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - serviceName - Cosmos DB service name. @@ -59,7 +58,8 @@ func (client *ServiceClient) BeginCreate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ServiceClientCreateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServiceClientCreateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServiceClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -68,20 +68,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *ServiceClient) create(ctx context.Context, resourceGroupName string, accountName string, serviceName string, createUpdateParameters ServiceResourceCreateUpdateParameters, options *ServiceClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, serviceName, createUpdateParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -108,16 +110,19 @@ func (client *ServiceClient) createCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateParameters) + if err := runtime.MarshalAsJSON(req, createUpdateParameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes service with the given serviceName. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - serviceName - Cosmos DB service name. @@ -128,7 +133,8 @@ func (client *ServiceClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ServiceClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServiceClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServiceClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -137,20 +143,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *ServiceClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, serviceName string, options *ServiceClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, serviceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -177,7 +185,7 @@ func (client *ServiceClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -186,24 +194,27 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - serviceName - Cosmos DB service name. // - options - ServiceClientGetOptions contains the optional parameters for the ServiceClient.Get method. func (client *ServiceClient) Get(ctx context.Context, resourceGroupName string, accountName string, serviceName string, options *ServiceClientGetOptions) (ServiceClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, serviceName, options) if err != nil { return ServiceClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServiceClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServiceClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServiceClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -230,7 +241,7 @@ func (client *ServiceClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -247,7 +258,7 @@ func (client *ServiceClient) getHandleResponse(resp *http.Response) (ServiceClie // NewListPager - Gets the status of service. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -293,7 +304,7 @@ func (client *ServiceClient) listCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-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 9dbcc129038b..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/service_client_example_test.go +++ /dev/null @@ -1,503 +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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.4622517Z"); 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.ServiceResourceCreateUpdateProperties{ - 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.4622517Z"); 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.ServiceResourceCreateUpdateProperties{ - 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.4622517Z"); 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.ServiceResourceCreateUpdateProperties{ - 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.4622517Z"); 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/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.ServiceResourceCreateUpdateProperties{ - InstanceCount: to.Ptr[int32](1), - InstanceSize: to.Ptr(armcosmos.ServiceSizeCosmosD4S), - ServiceType: to.Ptr(armcosmos.ServiceTypeSQLDedicatedGateway), - }, - }, 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.4622517Z"); 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.4622517Z"); 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.4622517Z"); 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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.4622517Z"); 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/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.4622517Z"); 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/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/sqlresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/sqlresources_client.go index d9d23dab710e..10efd4813081 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/sqlresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/sqlresources_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -48,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -62,7 +61,8 @@ func (client *SQLResourcesClient) BeginCreateUpdateClientEncryptionKey(ctx conte if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientCreateUpdateClientEncryptionKeyResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientCreateUpdateClientEncryptionKeyResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientCreateUpdateClientEncryptionKeyResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -72,20 +72,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.createUpdateClientEncryptionKeyCreateRequest(ctx, resourceGroupName, accountName, databaseName, clientEncryptionKeyName, createUpdateClientEncryptionKeyParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateClientEncryptionKeyCreateRequest creates the CreateUpdateClientEncryptionKey request. @@ -116,16 +118,19 @@ func (client *SQLResourcesClient) createUpdateClientEncryptionKeyCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateClientEncryptionKeyParameters) + if err := runtime.MarshalAsJSON(req, createUpdateClientEncryptionKeyParameters); err != nil { + return nil, err + } + return req, nil } // BeginCreateUpdateSQLContainer - Create or update an Azure Cosmos DB SQL container // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -139,7 +144,8 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLContainer(ctx context.Cont if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientCreateUpdateSQLContainerResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientCreateUpdateSQLContainerResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientCreateUpdateSQLContainerResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -148,20 +154,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.createUpdateSQLContainerCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, createUpdateSQLContainerParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateSQLContainerCreateRequest creates the CreateUpdateSQLContainer request. @@ -192,16 +200,19 @@ func (client *SQLResourcesClient) createUpdateSQLContainerCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateSQLContainerParameters) + if err := runtime.MarshalAsJSON(req, createUpdateSQLContainerParameters); err != nil { + return nil, err + } + return req, nil } // BeginCreateUpdateSQLDatabase - Create or update an Azure Cosmos DB SQL database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -214,7 +225,8 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLDatabase(ctx context.Conte if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientCreateUpdateSQLDatabaseResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientCreateUpdateSQLDatabaseResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientCreateUpdateSQLDatabaseResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -223,20 +235,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *SQLResourcesClient) createUpdateSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, createUpdateSQLDatabaseParameters SQLDatabaseCreateUpdateParameters, options *SQLResourcesClientBeginCreateUpdateSQLDatabaseOptions) (*http.Response, error) { + var err error req, err := client.createUpdateSQLDatabaseCreateRequest(ctx, resourceGroupName, accountName, databaseName, createUpdateSQLDatabaseParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateSQLDatabaseCreateRequest creates the CreateUpdateSQLDatabase request. @@ -263,16 +277,19 @@ func (client *SQLResourcesClient) createUpdateSQLDatabaseCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateSQLDatabaseParameters) + if err := runtime.MarshalAsJSON(req, createUpdateSQLDatabaseParameters); err != nil { + return nil, err + } + return req, nil } // 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -285,7 +302,8 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLRoleAssignment(ctx context if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientCreateUpdateSQLRoleAssignmentResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientCreateUpdateSQLRoleAssignmentResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientCreateUpdateSQLRoleAssignmentResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -294,20 +312,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *SQLResourcesClient) createUpdateSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string, createUpdateSQLRoleAssignmentParameters SQLRoleAssignmentCreateUpdateParameters, options *SQLResourcesClientBeginCreateUpdateSQLRoleAssignmentOptions) (*http.Response, error) { + var err error req, err := client.createUpdateSQLRoleAssignmentCreateRequest(ctx, roleAssignmentID, resourceGroupName, accountName, createUpdateSQLRoleAssignmentParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateSQLRoleAssignmentCreateRequest creates the CreateUpdateSQLRoleAssignment request. @@ -334,16 +354,19 @@ func (client *SQLResourcesClient) createUpdateSQLRoleAssignmentCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateSQLRoleAssignmentParameters) + if err := runtime.MarshalAsJSON(req, createUpdateSQLRoleAssignmentParameters); err != nil { + return nil, err + } + return req, nil } // 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -356,7 +379,8 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLRoleDefinition(ctx context if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientCreateUpdateSQLRoleDefinitionResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientCreateUpdateSQLRoleDefinitionResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientCreateUpdateSQLRoleDefinitionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -365,20 +389,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *SQLResourcesClient) createUpdateSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string, createUpdateSQLRoleDefinitionParameters SQLRoleDefinitionCreateUpdateParameters, options *SQLResourcesClientBeginCreateUpdateSQLRoleDefinitionOptions) (*http.Response, error) { + var err error req, err := client.createUpdateSQLRoleDefinitionCreateRequest(ctx, roleDefinitionID, resourceGroupName, accountName, createUpdateSQLRoleDefinitionParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateSQLRoleDefinitionCreateRequest creates the CreateUpdateSQLRoleDefinition request. @@ -405,16 +431,19 @@ func (client *SQLResourcesClient) createUpdateSQLRoleDefinitionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateSQLRoleDefinitionParameters) + if err := runtime.MarshalAsJSON(req, createUpdateSQLRoleDefinitionParameters); err != nil { + return nil, err + } + return req, nil } // BeginCreateUpdateSQLStoredProcedure - Create or update an Azure Cosmos DB SQL storedProcedure // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -429,7 +458,8 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLStoredProcedure(ctx contex if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientCreateUpdateSQLStoredProcedureResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientCreateUpdateSQLStoredProcedureResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientCreateUpdateSQLStoredProcedureResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -438,20 +468,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.createUpdateSQLStoredProcedureCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSQLStoredProcedureParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateSQLStoredProcedureCreateRequest creates the CreateUpdateSQLStoredProcedure request. @@ -486,16 +518,19 @@ func (client *SQLResourcesClient) createUpdateSQLStoredProcedureCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateSQLStoredProcedureParameters) + if err := runtime.MarshalAsJSON(req, createUpdateSQLStoredProcedureParameters); err != nil { + return nil, err + } + return req, nil } // BeginCreateUpdateSQLTrigger - Create or update an Azure Cosmos DB SQL trigger // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -510,7 +545,8 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLTrigger(ctx context.Contex if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientCreateUpdateSQLTriggerResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientCreateUpdateSQLTriggerResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientCreateUpdateSQLTriggerResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -519,20 +555,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.createUpdateSQLTriggerCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSQLTriggerParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateSQLTriggerCreateRequest creates the CreateUpdateSQLTrigger request. @@ -567,16 +605,19 @@ func (client *SQLResourcesClient) createUpdateSQLTriggerCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateSQLTriggerParameters) + if err := runtime.MarshalAsJSON(req, createUpdateSQLTriggerParameters); err != nil { + return nil, err + } + return req, nil } // BeginCreateUpdateSQLUserDefinedFunction - Create or update an Azure Cosmos DB SQL userDefinedFunction // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -591,7 +632,8 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLUserDefinedFunction(ctx co if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientCreateUpdateSQLUserDefinedFunctionResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientCreateUpdateSQLUserDefinedFunctionResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientCreateUpdateSQLUserDefinedFunctionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -600,20 +642,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.createUpdateSQLUserDefinedFunctionCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSQLUserDefinedFunctionParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateSQLUserDefinedFunctionCreateRequest creates the CreateUpdateSQLUserDefinedFunction request. @@ -648,16 +692,19 @@ func (client *SQLResourcesClient) createUpdateSQLUserDefinedFunctionCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateSQLUserDefinedFunctionParameters) + if err := runtime.MarshalAsJSON(req, createUpdateSQLUserDefinedFunctionParameters); err != nil { + return nil, err + } + return req, nil } // BeginDeleteSQLContainer - Deletes an existing Azure Cosmos DB SQL container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -670,7 +717,8 @@ func (client *SQLResourcesClient) BeginDeleteSQLContainer(ctx context.Context, r if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientDeleteSQLContainerResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientDeleteSQLContainerResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientDeleteSQLContainerResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -679,20 +727,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *SQLResourcesClient) deleteSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, options *SQLResourcesClientBeginDeleteSQLContainerOptions) (*http.Response, error) { + var err error req, err := client.deleteSQLContainerCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteSQLContainerCreateRequest creates the DeleteSQLContainer request. @@ -723,7 +773,7 @@ func (client *SQLResourcesClient) deleteSQLContainerCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -731,7 +781,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -743,7 +793,8 @@ func (client *SQLResourcesClient) BeginDeleteSQLDatabase(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientDeleteSQLDatabaseResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientDeleteSQLDatabaseResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientDeleteSQLDatabaseResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -752,20 +803,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *SQLResourcesClient) deleteSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *SQLResourcesClientBeginDeleteSQLDatabaseOptions) (*http.Response, error) { + var err error req, err := client.deleteSQLDatabaseCreateRequest(ctx, resourceGroupName, accountName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteSQLDatabaseCreateRequest creates the DeleteSQLDatabase request. @@ -792,7 +845,7 @@ func (client *SQLResourcesClient) deleteSQLDatabaseCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -800,7 +853,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -812,7 +865,8 @@ func (client *SQLResourcesClient) BeginDeleteSQLRoleAssignment(ctx context.Conte if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientDeleteSQLRoleAssignmentResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientDeleteSQLRoleAssignmentResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientDeleteSQLRoleAssignmentResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -821,20 +875,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *SQLResourcesClient) deleteSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string, options *SQLResourcesClientBeginDeleteSQLRoleAssignmentOptions) (*http.Response, error) { + var err error req, err := client.deleteSQLRoleAssignmentCreateRequest(ctx, roleAssignmentID, resourceGroupName, accountName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteSQLRoleAssignmentCreateRequest creates the DeleteSQLRoleAssignment request. @@ -861,7 +917,7 @@ func (client *SQLResourcesClient) deleteSQLRoleAssignmentCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -870,7 +926,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 2023-03-15-preview +// Generated from API version 2023-09-15-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. @@ -882,7 +938,8 @@ func (client *SQLResourcesClient) BeginDeleteSQLRoleDefinition(ctx context.Conte if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientDeleteSQLRoleDefinitionResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientDeleteSQLRoleDefinitionResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientDeleteSQLRoleDefinitionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -891,20 +948,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *SQLResourcesClient) deleteSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string, options *SQLResourcesClientBeginDeleteSQLRoleDefinitionOptions) (*http.Response, error) { + var err error req, err := client.deleteSQLRoleDefinitionCreateRequest(ctx, roleDefinitionID, resourceGroupName, accountName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteSQLRoleDefinitionCreateRequest creates the DeleteSQLRoleDefinition request. @@ -931,7 +990,7 @@ func (client *SQLResourcesClient) deleteSQLRoleDefinitionCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -940,7 +999,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -954,7 +1013,8 @@ func (client *SQLResourcesClient) BeginDeleteSQLStoredProcedure(ctx context.Cont if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientDeleteSQLStoredProcedureResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientDeleteSQLStoredProcedureResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientDeleteSQLStoredProcedureResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -963,20 +1023,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.deleteSQLStoredProcedureCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteSQLStoredProcedureCreateRequest creates the DeleteSQLStoredProcedure request. @@ -1011,7 +1073,7 @@ func (client *SQLResourcesClient) deleteSQLStoredProcedureCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -1019,7 +1081,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1033,7 +1095,8 @@ func (client *SQLResourcesClient) BeginDeleteSQLTrigger(ctx context.Context, res if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientDeleteSQLTriggerResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientDeleteSQLTriggerResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientDeleteSQLTriggerResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1042,20 +1105,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.deleteSQLTriggerCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteSQLTriggerCreateRequest creates the DeleteSQLTrigger request. @@ -1090,7 +1155,7 @@ func (client *SQLResourcesClient) deleteSQLTriggerCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -1098,7 +1163,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1112,7 +1177,8 @@ func (client *SQLResourcesClient) BeginDeleteSQLUserDefinedFunction(ctx context. if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientDeleteSQLUserDefinedFunctionResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientDeleteSQLUserDefinedFunctionResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientDeleteSQLUserDefinedFunctionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1121,20 +1187,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.deleteSQLUserDefinedFunctionCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteSQLUserDefinedFunctionCreateRequest creates the DeleteSQLUserDefinedFunction request. @@ -1169,7 +1237,7 @@ func (client *SQLResourcesClient) deleteSQLUserDefinedFunctionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -1177,7 +1245,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1185,18 +1253,21 @@ func (client *SQLResourcesClient) deleteSQLUserDefinedFunctionCreateRequest(ctx // - options - SQLResourcesClientGetClientEncryptionKeyOptions contains the optional parameters for the SQLResourcesClient.GetClientEncryptionKey // method. func (client *SQLResourcesClient) GetClientEncryptionKey(ctx context.Context, resourceGroupName string, accountName string, databaseName string, clientEncryptionKeyName string, options *SQLResourcesClientGetClientEncryptionKeyOptions) (SQLResourcesClientGetClientEncryptionKeyResponse, error) { + var err error req, err := client.getClientEncryptionKeyCreateRequest(ctx, resourceGroupName, accountName, databaseName, clientEncryptionKeyName, options) if err != nil { return SQLResourcesClientGetClientEncryptionKeyResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SQLResourcesClientGetClientEncryptionKeyResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SQLResourcesClientGetClientEncryptionKeyResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLResourcesClientGetClientEncryptionKeyResponse{}, err } - return client.getClientEncryptionKeyHandleResponse(resp) + resp, err := client.getClientEncryptionKeyHandleResponse(httpResp) + return resp, err } // getClientEncryptionKeyCreateRequest creates the GetClientEncryptionKey request. @@ -1227,7 +1298,7 @@ func (client *SQLResourcesClient) getClientEncryptionKeyCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1245,7 +1316,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1253,18 +1324,21 @@ func (client *SQLResourcesClient) getClientEncryptionKeyHandleResponse(resp *htt // - options - SQLResourcesClientGetSQLContainerOptions contains the optional parameters for the SQLResourcesClient.GetSQLContainer // method. func (client *SQLResourcesClient) GetSQLContainer(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, options *SQLResourcesClientGetSQLContainerOptions) (SQLResourcesClientGetSQLContainerResponse, error) { + var err error req, err := client.getSQLContainerCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, options) if err != nil { return SQLResourcesClientGetSQLContainerResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SQLResourcesClientGetSQLContainerResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SQLResourcesClientGetSQLContainerResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLResourcesClientGetSQLContainerResponse{}, err } - return client.getSQLContainerHandleResponse(resp) + resp, err := client.getSQLContainerHandleResponse(httpResp) + return resp, err } // getSQLContainerCreateRequest creates the GetSQLContainer request. @@ -1295,7 +1369,7 @@ func (client *SQLResourcesClient) getSQLContainerCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1313,7 +1387,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1321,18 +1395,21 @@ func (client *SQLResourcesClient) getSQLContainerHandleResponse(resp *http.Respo // - options - SQLResourcesClientGetSQLContainerThroughputOptions contains the optional parameters for the SQLResourcesClient.GetSQLContainerThroughput // method. func (client *SQLResourcesClient) GetSQLContainerThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, options *SQLResourcesClientGetSQLContainerThroughputOptions) (SQLResourcesClientGetSQLContainerThroughputResponse, error) { + var err error req, err := client.getSQLContainerThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, options) if err != nil { return SQLResourcesClientGetSQLContainerThroughputResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SQLResourcesClientGetSQLContainerThroughputResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SQLResourcesClientGetSQLContainerThroughputResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLResourcesClientGetSQLContainerThroughputResponse{}, err } - return client.getSQLContainerThroughputHandleResponse(resp) + resp, err := client.getSQLContainerThroughputHandleResponse(httpResp) + return resp, err } // getSQLContainerThroughputCreateRequest creates the GetSQLContainerThroughput request. @@ -1363,7 +1440,7 @@ func (client *SQLResourcesClient) getSQLContainerThroughputCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1381,25 +1458,28 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. // - options - SQLResourcesClientGetSQLDatabaseOptions contains the optional parameters for the SQLResourcesClient.GetSQLDatabase // method. func (client *SQLResourcesClient) GetSQLDatabase(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *SQLResourcesClientGetSQLDatabaseOptions) (SQLResourcesClientGetSQLDatabaseResponse, error) { + var err error req, err := client.getSQLDatabaseCreateRequest(ctx, resourceGroupName, accountName, databaseName, options) if err != nil { return SQLResourcesClientGetSQLDatabaseResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SQLResourcesClientGetSQLDatabaseResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SQLResourcesClientGetSQLDatabaseResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLResourcesClientGetSQLDatabaseResponse{}, err } - return client.getSQLDatabaseHandleResponse(resp) + resp, err := client.getSQLDatabaseHandleResponse(httpResp) + return resp, err } // getSQLDatabaseCreateRequest creates the GetSQLDatabase request. @@ -1426,7 +1506,7 @@ func (client *SQLResourcesClient) getSQLDatabaseCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1445,25 +1525,28 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. // - options - SQLResourcesClientGetSQLDatabaseThroughputOptions contains the optional parameters for the SQLResourcesClient.GetSQLDatabaseThroughput // method. func (client *SQLResourcesClient) GetSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *SQLResourcesClientGetSQLDatabaseThroughputOptions) (SQLResourcesClientGetSQLDatabaseThroughputResponse, error) { + var err error req, err := client.getSQLDatabaseThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, options) if err != nil { return SQLResourcesClientGetSQLDatabaseThroughputResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SQLResourcesClientGetSQLDatabaseThroughputResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SQLResourcesClientGetSQLDatabaseThroughputResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLResourcesClientGetSQLDatabaseThroughputResponse{}, err } - return client.getSQLDatabaseThroughputHandleResponse(resp) + resp, err := client.getSQLDatabaseThroughputHandleResponse(httpResp) + return resp, err } // getSQLDatabaseThroughputCreateRequest creates the GetSQLDatabaseThroughput request. @@ -1490,7 +1573,7 @@ func (client *SQLResourcesClient) getSQLDatabaseThroughputCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1508,25 +1591,28 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. // - options - SQLResourcesClientGetSQLRoleAssignmentOptions contains the optional parameters for the SQLResourcesClient.GetSQLRoleAssignment // method. func (client *SQLResourcesClient) GetSQLRoleAssignment(ctx context.Context, roleAssignmentID string, resourceGroupName string, accountName string, options *SQLResourcesClientGetSQLRoleAssignmentOptions) (SQLResourcesClientGetSQLRoleAssignmentResponse, error) { + var err error req, err := client.getSQLRoleAssignmentCreateRequest(ctx, roleAssignmentID, resourceGroupName, accountName, options) if err != nil { return SQLResourcesClientGetSQLRoleAssignmentResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SQLResourcesClientGetSQLRoleAssignmentResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SQLResourcesClientGetSQLRoleAssignmentResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLResourcesClientGetSQLRoleAssignmentResponse{}, err } - return client.getSQLRoleAssignmentHandleResponse(resp) + resp, err := client.getSQLRoleAssignmentHandleResponse(httpResp) + return resp, err } // getSQLRoleAssignmentCreateRequest creates the GetSQLRoleAssignment request. @@ -1553,7 +1639,7 @@ func (client *SQLResourcesClient) getSQLRoleAssignmentCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1571,25 +1657,28 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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. // - options - SQLResourcesClientGetSQLRoleDefinitionOptions contains the optional parameters for the SQLResourcesClient.GetSQLRoleDefinition // method. func (client *SQLResourcesClient) GetSQLRoleDefinition(ctx context.Context, roleDefinitionID string, resourceGroupName string, accountName string, options *SQLResourcesClientGetSQLRoleDefinitionOptions) (SQLResourcesClientGetSQLRoleDefinitionResponse, error) { + var err error req, err := client.getSQLRoleDefinitionCreateRequest(ctx, roleDefinitionID, resourceGroupName, accountName, options) if err != nil { return SQLResourcesClientGetSQLRoleDefinitionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SQLResourcesClientGetSQLRoleDefinitionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SQLResourcesClientGetSQLRoleDefinitionResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLResourcesClientGetSQLRoleDefinitionResponse{}, err } - return client.getSQLRoleDefinitionHandleResponse(resp) + resp, err := client.getSQLRoleDefinitionHandleResponse(httpResp) + return resp, err } // getSQLRoleDefinitionCreateRequest creates the GetSQLRoleDefinition request. @@ -1616,7 +1705,7 @@ func (client *SQLResourcesClient) getSQLRoleDefinitionCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1634,7 +1723,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1643,18 +1732,21 @@ func (client *SQLResourcesClient) getSQLRoleDefinitionHandleResponse(resp *http. // - options - SQLResourcesClientGetSQLStoredProcedureOptions contains the optional parameters for the SQLResourcesClient.GetSQLStoredProcedure // method. func (client *SQLResourcesClient) GetSQLStoredProcedure(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, storedProcedureName string, options *SQLResourcesClientGetSQLStoredProcedureOptions) (SQLResourcesClientGetSQLStoredProcedureResponse, error) { + var err error req, err := client.getSQLStoredProcedureCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, storedProcedureName, options) if err != nil { return SQLResourcesClientGetSQLStoredProcedureResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SQLResourcesClientGetSQLStoredProcedureResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SQLResourcesClientGetSQLStoredProcedureResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLResourcesClientGetSQLStoredProcedureResponse{}, err } - return client.getSQLStoredProcedureHandleResponse(resp) + resp, err := client.getSQLStoredProcedureHandleResponse(httpResp) + return resp, err } // getSQLStoredProcedureCreateRequest creates the GetSQLStoredProcedure request. @@ -1689,7 +1781,7 @@ func (client *SQLResourcesClient) getSQLStoredProcedureCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1707,7 +1799,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1716,18 +1808,21 @@ func (client *SQLResourcesClient) getSQLStoredProcedureHandleResponse(resp *http // - options - SQLResourcesClientGetSQLTriggerOptions contains the optional parameters for the SQLResourcesClient.GetSQLTrigger // method. func (client *SQLResourcesClient) GetSQLTrigger(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, triggerName string, options *SQLResourcesClientGetSQLTriggerOptions) (SQLResourcesClientGetSQLTriggerResponse, error) { + var err error req, err := client.getSQLTriggerCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, triggerName, options) if err != nil { return SQLResourcesClientGetSQLTriggerResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SQLResourcesClientGetSQLTriggerResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SQLResourcesClientGetSQLTriggerResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLResourcesClientGetSQLTriggerResponse{}, err } - return client.getSQLTriggerHandleResponse(resp) + resp, err := client.getSQLTriggerHandleResponse(httpResp) + return resp, err } // getSQLTriggerCreateRequest creates the GetSQLTrigger request. @@ -1762,7 +1857,7 @@ func (client *SQLResourcesClient) getSQLTriggerCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1780,7 +1875,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1789,18 +1884,21 @@ func (client *SQLResourcesClient) getSQLTriggerHandleResponse(resp *http.Respons // - options - SQLResourcesClientGetSQLUserDefinedFunctionOptions contains the optional parameters for the SQLResourcesClient.GetSQLUserDefinedFunction // method. func (client *SQLResourcesClient) GetSQLUserDefinedFunction(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, userDefinedFunctionName string, options *SQLResourcesClientGetSQLUserDefinedFunctionOptions) (SQLResourcesClientGetSQLUserDefinedFunctionResponse, error) { + var err error req, err := client.getSQLUserDefinedFunctionCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, options) if err != nil { return SQLResourcesClientGetSQLUserDefinedFunctionResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SQLResourcesClientGetSQLUserDefinedFunctionResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SQLResourcesClientGetSQLUserDefinedFunctionResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLResourcesClientGetSQLUserDefinedFunctionResponse{}, err } - return client.getSQLUserDefinedFunctionHandleResponse(resp) + resp, err := client.getSQLUserDefinedFunctionHandleResponse(httpResp) + return resp, err } // getSQLUserDefinedFunctionCreateRequest creates the GetSQLUserDefinedFunction request. @@ -1835,7 +1933,7 @@ func (client *SQLResourcesClient) getSQLUserDefinedFunctionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1852,7 +1950,7 @@ func (client *SQLResourcesClient) getSQLUserDefinedFunctionHandleResponse(resp * // NewListClientEncryptionKeysPager - Lists the ClientEncryptionKeys under an existing Azure Cosmos DB SQL database. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1904,7 +2002,7 @@ func (client *SQLResourcesClient) listClientEncryptionKeysCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1922,7 +2020,7 @@ func (client *SQLResourcesClient) listClientEncryptionKeysHandleResponse(resp *h // BeginListSQLContainerPartitionMerge - Merges the partitions of a SQL Container // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -1936,9 +2034,10 @@ func (client *SQLResourcesClient) BeginListSQLContainerPartitionMerge(ctx contex if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientListSQLContainerPartitionMergeResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientListSQLContainerPartitionMergeResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientListSQLContainerPartitionMergeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1947,20 +2046,22 @@ func (client *SQLResourcesClient) BeginListSQLContainerPartitionMerge(ctx contex // ListSQLContainerPartitionMerge - Merges the partitions of a SQL Container // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.listSQLContainerPartitionMergeCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, mergeParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // listSQLContainerPartitionMergeCreateRequest creates the ListSQLContainerPartitionMerge request. @@ -1991,15 +2092,18 @@ func (client *SQLResourcesClient) listSQLContainerPartitionMergeCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, mergeParameters) + 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2051,7 +2155,7 @@ func (client *SQLResourcesClient) listSQLContainersCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2068,7 +2172,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 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -2115,7 +2219,7 @@ func (client *SQLResourcesClient) listSQLDatabasesCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2132,7 +2236,7 @@ func (client *SQLResourcesClient) listSQLDatabasesHandleResponse(resp *http.Resp // NewListSQLRoleAssignmentsPager - Retrieves the list of all Azure Cosmos DB SQL Role Assignments. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -2179,7 +2283,7 @@ func (client *SQLResourcesClient) listSQLRoleAssignmentsCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2196,7 +2300,7 @@ func (client *SQLResourcesClient) listSQLRoleAssignmentsHandleResponse(resp *htt // NewListSQLRoleDefinitionsPager - Retrieves the list of all Azure Cosmos DB SQL Role Definitions. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -2243,7 +2347,7 @@ func (client *SQLResourcesClient) listSQLRoleDefinitionsCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2260,7 +2364,7 @@ func (client *SQLResourcesClient) listSQLRoleDefinitionsHandleResponse(resp *htt // NewListSQLStoredProceduresPager - Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2317,7 +2421,7 @@ func (client *SQLResourcesClient) listSQLStoredProceduresCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2334,7 +2438,7 @@ func (client *SQLResourcesClient) listSQLStoredProceduresHandleResponse(resp *ht // NewListSQLTriggersPager - Lists the SQL trigger under an existing Azure Cosmos DB database account. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2391,7 +2495,7 @@ func (client *SQLResourcesClient) listSQLTriggersCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2408,7 +2512,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2465,7 +2569,7 @@ func (client *SQLResourcesClient) listSQLUserDefinedFunctionsCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2483,7 +2587,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2496,7 +2600,8 @@ func (client *SQLResourcesClient) BeginMigrateSQLContainerToAutoscale(ctx contex if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientMigrateSQLContainerToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientMigrateSQLContainerToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientMigrateSQLContainerToAutoscaleResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -2505,20 +2610,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *SQLResourcesClient) migrateSQLContainerToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, options *SQLResourcesClientBeginMigrateSQLContainerToAutoscaleOptions) (*http.Response, error) { + var err error req, err := client.migrateSQLContainerToAutoscaleCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateSQLContainerToAutoscaleCreateRequest creates the MigrateSQLContainerToAutoscale request. @@ -2549,7 +2656,7 @@ func (client *SQLResourcesClient) migrateSQLContainerToAutoscaleCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2558,7 +2665,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2571,7 +2678,8 @@ func (client *SQLResourcesClient) BeginMigrateSQLContainerToManualThroughput(ctx if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientMigrateSQLContainerToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientMigrateSQLContainerToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientMigrateSQLContainerToManualThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -2580,20 +2688,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *SQLResourcesClient) migrateSQLContainerToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, containerName string, options *SQLResourcesClientBeginMigrateSQLContainerToManualThroughputOptions) (*http.Response, error) { + var err error req, err := client.migrateSQLContainerToManualThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateSQLContainerToManualThroughputCreateRequest creates the MigrateSQLContainerToManualThroughput request. @@ -2624,7 +2734,7 @@ func (client *SQLResourcesClient) migrateSQLContainerToManualThroughputCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2633,7 +2743,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2645,7 +2755,8 @@ func (client *SQLResourcesClient) BeginMigrateSQLDatabaseToAutoscale(ctx context if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientMigrateSQLDatabaseToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientMigrateSQLDatabaseToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientMigrateSQLDatabaseToAutoscaleResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -2654,20 +2765,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *SQLResourcesClient) migrateSQLDatabaseToAutoscale(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *SQLResourcesClientBeginMigrateSQLDatabaseToAutoscaleOptions) (*http.Response, error) { + var err error req, err := client.migrateSQLDatabaseToAutoscaleCreateRequest(ctx, resourceGroupName, accountName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateSQLDatabaseToAutoscaleCreateRequest creates the MigrateSQLDatabaseToAutoscale request. @@ -2694,7 +2807,7 @@ func (client *SQLResourcesClient) migrateSQLDatabaseToAutoscaleCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2703,7 +2816,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2715,7 +2828,8 @@ func (client *SQLResourcesClient) BeginMigrateSQLDatabaseToManualThroughput(ctx if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientMigrateSQLDatabaseToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientMigrateSQLDatabaseToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientMigrateSQLDatabaseToManualThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -2724,20 +2838,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *SQLResourcesClient) migrateSQLDatabaseToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, options *SQLResourcesClientBeginMigrateSQLDatabaseToManualThroughputOptions) (*http.Response, error) { + var err error req, err := client.migrateSQLDatabaseToManualThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateSQLDatabaseToManualThroughputCreateRequest creates the MigrateSQLDatabaseToManualThroughput request. @@ -2764,7 +2880,7 @@ func (client *SQLResourcesClient) migrateSQLDatabaseToManualThroughputCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -2773,7 +2889,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2787,9 +2903,10 @@ func (client *SQLResourcesClient) BeginRetrieveContinuousBackupInformation(ctx c if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientRetrieveContinuousBackupInformationResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientRetrieveContinuousBackupInformationResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientRetrieveContinuousBackupInformationResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -2798,20 +2915,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.retrieveContinuousBackupInformationCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, location, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // retrieveContinuousBackupInformationCreateRequest creates the RetrieveContinuousBackupInformation request. @@ -2842,16 +2961,19 @@ func (client *SQLResourcesClient) retrieveContinuousBackupInformationCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, location) + if err := runtime.MarshalAsJSON(req, location); err != nil { + return nil, err + } + 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2865,9 +2987,10 @@ func (client *SQLResourcesClient) BeginSQLContainerRedistributeThroughput(ctx co if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientSQLContainerRedistributeThroughputResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientSQLContainerRedistributeThroughputResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientSQLContainerRedistributeThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -2876,20 +2999,22 @@ func (client *SQLResourcesClient) BeginSQLContainerRedistributeThroughput(ctx co // SQLContainerRedistributeThroughput - Redistribute throughput for an Azure Cosmos DB SQL container // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.sqlContainerRedistributeThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, redistributeThroughputParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // sqlContainerRedistributeThroughputCreateRequest creates the SQLContainerRedistributeThroughput request. @@ -2920,16 +3045,19 @@ func (client *SQLResourcesClient) sqlContainerRedistributeThroughputCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, redistributeThroughputParameters) + 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -2943,9 +3071,10 @@ func (client *SQLResourcesClient) BeginSQLContainerRetrieveThroughputDistributio if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientSQLContainerRetrieveThroughputDistributionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -2954,20 +3083,22 @@ func (client *SQLResourcesClient) BeginSQLContainerRetrieveThroughputDistributio // 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.sqlContainerRetrieveThroughputDistributionCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, retrieveThroughputParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // sqlContainerRetrieveThroughputDistributionCreateRequest creates the SQLContainerRetrieveThroughputDistribution request. @@ -2998,16 +3129,19 @@ func (client *SQLResourcesClient) sqlContainerRetrieveThroughputDistributionCrea return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, retrieveThroughputParameters) + 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -3020,9 +3154,10 @@ func (client *SQLResourcesClient) BeginSQLDatabasePartitionMerge(ctx context.Con if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientSQLDatabasePartitionMergeResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientSQLDatabasePartitionMergeResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientSQLDatabasePartitionMergeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -3031,20 +3166,22 @@ func (client *SQLResourcesClient) BeginSQLDatabasePartitionMerge(ctx context.Con // SQLDatabasePartitionMerge - Merges the partitions of a SQL database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *SQLResourcesClient) sQLDatabasePartitionMerge(ctx context.Context, resourceGroupName string, accountName string, databaseName string, mergeParameters MergeParameters, options *SQLResourcesClientBeginSQLDatabasePartitionMergeOptions) (*http.Response, error) { + var err error req, err := client.sqlDatabasePartitionMergeCreateRequest(ctx, resourceGroupName, accountName, databaseName, mergeParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // sqlDatabasePartitionMergeCreateRequest creates the SQLDatabasePartitionMerge request. @@ -3071,16 +3208,19 @@ func (client *SQLResourcesClient) sqlDatabasePartitionMergeCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, mergeParameters) + 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -3093,9 +3233,10 @@ func (client *SQLResourcesClient) BeginSQLDatabaseRedistributeThroughput(ctx con if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientSQLDatabaseRedistributeThroughputResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientSQLDatabaseRedistributeThroughputResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientSQLDatabaseRedistributeThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -3104,20 +3245,22 @@ func (client *SQLResourcesClient) BeginSQLDatabaseRedistributeThroughput(ctx con // SQLDatabaseRedistributeThroughput - Redistribute throughput for an Azure Cosmos DB SQL database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *SQLResourcesClient) sQLDatabaseRedistributeThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, redistributeThroughputParameters RedistributeThroughputParameters, options *SQLResourcesClientBeginSQLDatabaseRedistributeThroughputOptions) (*http.Response, error) { + var err error req, err := client.sqlDatabaseRedistributeThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, redistributeThroughputParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // sqlDatabaseRedistributeThroughputCreateRequest creates the SQLDatabaseRedistributeThroughput request. @@ -3144,16 +3287,19 @@ func (client *SQLResourcesClient) sqlDatabaseRedistributeThroughputCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, redistributeThroughputParameters) + 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -3166,9 +3312,10 @@ func (client *SQLResourcesClient) BeginSQLDatabaseRetrieveThroughputDistribution if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientSQLDatabaseRetrieveThroughputDistributionResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLResourcesClientSQLDatabaseRetrieveThroughputDistributionResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientSQLDatabaseRetrieveThroughputDistributionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -3177,20 +3324,22 @@ func (client *SQLResourcesClient) BeginSQLDatabaseRetrieveThroughputDistribution // 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *SQLResourcesClient) sQLDatabaseRetrieveThroughputDistribution(ctx context.Context, resourceGroupName string, accountName string, databaseName string, retrieveThroughputParameters RetrieveThroughputParameters, options *SQLResourcesClientBeginSQLDatabaseRetrieveThroughputDistributionOptions) (*http.Response, error) { + var err error req, err := client.sqlDatabaseRetrieveThroughputDistributionCreateRequest(ctx, resourceGroupName, accountName, databaseName, retrieveThroughputParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // sqlDatabaseRetrieveThroughputDistributionCreateRequest creates the SQLDatabaseRetrieveThroughputDistribution request. @@ -3217,16 +3366,19 @@ func (client *SQLResourcesClient) sqlDatabaseRetrieveThroughputDistributionCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, retrieveThroughputParameters) + 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -3240,7 +3392,8 @@ func (client *SQLResourcesClient) BeginUpdateSQLContainerThroughput(ctx context. if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientUpdateSQLContainerThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientUpdateSQLContainerThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientUpdateSQLContainerThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -3249,20 +3402,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-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 req, err := client.updateSQLContainerThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateSQLContainerThroughputCreateRequest creates the UpdateSQLContainerThroughput request. @@ -3293,16 +3448,19 @@ func (client *SQLResourcesClient) updateSQLContainerThroughputCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, updateThroughputParameters) + if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { + return nil, err + } + return req, nil } // 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - databaseName - Cosmos DB database name. @@ -3315,7 +3473,8 @@ func (client *SQLResourcesClient) BeginUpdateSQLDatabaseThroughput(ctx context.C if err != nil { return nil, err } - return runtime.NewPoller[SQLResourcesClientUpdateSQLDatabaseThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[SQLResourcesClientUpdateSQLDatabaseThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[SQLResourcesClientUpdateSQLDatabaseThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -3324,20 +3483,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *SQLResourcesClient) updateSQLDatabaseThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *SQLResourcesClientBeginUpdateSQLDatabaseThroughputOptions) (*http.Response, error) { + var err error req, err := client.updateSQLDatabaseThroughputCreateRequest(ctx, resourceGroupName, accountName, databaseName, updateThroughputParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateSQLDatabaseThroughputCreateRequest creates the UpdateSQLDatabaseThroughput request. @@ -3364,8 +3525,11 @@ func (client *SQLResourcesClient) updateSQLDatabaseThroughputCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, updateThroughputParameters) + if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { + return nil, err + } + return req, 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 ac75932618b2..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/sqlresources_client_example_test.go +++ /dev/null @@ -1,2524 +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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBSqlDatabaseCreateUpdate.json -func ExampleSQLResourcesClient_BeginCreateUpdateSQLDatabase_cosmosDbSqlDatabaseCreateUpdate() { - 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBSqlDatabaseRestore.json -func ExampleSQLResourcesClient_BeginCreateUpdateSQLDatabase_cosmosDbSqlDatabaseRestore() { - 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{ - CreateMode: to.Ptr(armcosmos.CreateModeRestore), - ID: to.Ptr("databaseName"), - RestoreParameters: &armcosmos.ResourceRestoreParameters{ - RestoreSource: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId"), - RestoreTimestampInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-20T18:28:00Z"); return t }()), - }, - }, - }, - }, 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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), - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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("VGhpcyBpcyBhY3R1YWxseSBhbiBhcnJheSBvZiBieXRlcy4gVGhpcyByZXF1ZXN0L3Jlc3BvbnNlIGlzIGJlaW5nIHByZXNlbnRlZCBhcyBhIHN0cmluZyBmb3IgcmVhZGFiaWxpdHkgaW4gdGhlIGV4YW1wbGU="), - // 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("VGhpcyBpcyBhY3R1YWxseSBhbiBhcnJheSBvZiBieXRlcy4gVGhpcyByZXF1ZXN0L3Jlc3BvbnNlIGlzIGJlaW5nIHByZXNlbnRlZCBhcyBhIHN0cmluZyBmb3IgcmVhZGFiaWxpdHkgaW4gdGhlIGV4YW1wbGU="), - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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("VGhpcyBpcyBhY3R1YWxseSBhbiBhcnJheSBvZiBieXRlcy4gVGhpcyByZXF1ZXN0L3Jlc3BvbnNlIGlzIGJlaW5nIHByZXNlbnRlZCBhcyBhIHN0cmluZyBmb3IgcmVhZGFiaWxpdHkgaW4gdGhlIGV4YW1wbGU="), - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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("VGhpcyBpcyBhY3R1YWxseSBhbiBhcnJheSBvZiBieXRlcy4gVGhpcyByZXF1ZXN0L3Jlc3BvbnNlIGlzIGJlaW5nIHByZXNlbnRlZCBhcyBhIHN0cmluZyBmb3IgcmVhZGFiaWxpdHkgaW4gdGhlIGV4YW1wbGU="), - }, - }, - }, 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("VGhpcyBpcyBhY3R1YWxseSBhbiBhcnJheSBvZiBieXRlcy4gVGhpcyByZXF1ZXN0L3Jlc3BvbnNlIGlzIGJlaW5nIHByZXNlbnRlZCBhcyBhIHN0cmluZyBmb3IgcmVhZGFiaWxpdHkgaW4gdGhlIGV4YW1wbGU="), - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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), - // }, - // 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), - // }, - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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), - // }, - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBSqlContainerCreateUpdate.json -func ExampleSQLResourcesClient_BeginCreateUpdateSQLContainer_cosmosDbSqlContainerCreateUpdate() { - 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), - }, - 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), - // }, - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBSqlContainerRestore.json -func ExampleSQLResourcesClient_BeginCreateUpdateSQLContainer_cosmosDbSqlContainerRestore() { - 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{ - CreateMode: to.Ptr(armcosmos.CreateModeRestore), - ID: to.Ptr("containerName"), - RestoreParameters: &armcosmos.ResourceRestoreParameters{ - RestoreSource: to.Ptr("/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId"), - RestoreTimestampInUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-20T18:28:00Z"); return t }()), - }, - }, - }, - }, 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), - // }, - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBSqlMaterializedViewCreateUpdate.json -func ExampleSQLResourcesClient_BeginCreateUpdateSQLContainer_cosmosDbSqlMaterializedViewCreateUpdate() { - 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", "mvContainerName", armcosmos.SQLContainerCreateUpdateParameters{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armcosmos.SQLContainerCreateUpdateProperties{ - Options: &armcosmos.CreateUpdateOptions{}, - Resource: &armcosmos.SQLContainerResource{ - ID: to.Ptr("mvContainerName"), - 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), - }, - MaterializedViewDefinition: &armcosmos.MaterializedViewDefinition{ - Definition: to.Ptr("select * from ROOT"), - SourceCollectionID: to.Ptr("sourceContainerName"), - }, - PartitionKey: &armcosmos.ContainerPartitionKey{ - Kind: to.Ptr(armcosmos.PartitionKindHash), - Paths: []*string{ - to.Ptr("/mvpk")}, - }, - }, - }, - }, 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("mvContainerName"), - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/sqlContainers"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/sqlDatabases/databaseName/containers/mvContainerName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armcosmos.SQLContainerGetProperties{ - // Resource: &armcosmos.SQLContainerGetPropertiesResource{ - // Etag: to.Ptr("\"00000800-0000-0200-0000-639ff6480000\""), - // Rid: to.Ptr("vb0sn8MDxLw="), - // Ts: to.Ptr[float32](1671427656), - // ConflictResolutionPolicy: &armcosmos.ConflictResolutionPolicy{ - // ConflictResolutionPath: to.Ptr("/_ts"), - // ConflictResolutionProcedure: to.Ptr(""), - // Mode: to.Ptr(armcosmos.ConflictResolutionModeLastWriterWins), - // }, - // DefaultTTL: to.Ptr[int32](-1), - // ID: to.Ptr("mvContainerName"), - // IndexingPolicy: &armcosmos.IndexingPolicy{ - // Automatic: to.Ptr(true), - // ExcludedPaths: []*armcosmos.ExcludedPath{ - // { - // Path: to.Ptr("/\"_etag\"/?"), - // }}, - // IncludedPaths: []*armcosmos.IncludedPath{ - // { - // Path: to.Ptr("/*"), - // }}, - // IndexingMode: to.Ptr(armcosmos.IndexingModeConsistent), - // }, - // MaterializedViewDefinition: &armcosmos.MaterializedViewDefinition{ - // Definition: to.Ptr("select * from ROOT"), - // SourceCollectionID: to.Ptr("sourceContainerName"), - // SourceCollectionRid: to.Ptr("vb0sn6nEu9A="), - // }, - // PartitionKey: &armcosmos.ContainerPartitionKey{ - // Kind: to.Ptr(armcosmos.PartitionKindHash), - // Paths: []*string{ - // to.Ptr("/mvpk")}, - // }, - // UniqueKeyPolicy: &armcosmos.UniqueKeyPolicy{ - // UniqueKeys: []*armcosmos.UniqueKey{ - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBSqlDatabasePartitionMerge.json -func ExampleSQLResourcesClient_BeginSQLDatabasePartitionMerge() { - 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().BeginSQLDatabasePartitionMerge(ctx, "rgName", "ddb1", "databaseName", armcosmos.MergeParameters{ - IsDryRun: 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.PhysicalPartitionStorageInfoCollection = armcosmos.PhysicalPartitionStorageInfoCollection{ - // PhysicalPartitionStorageInfoCollection: []*armcosmos.PhysicalPartitionStorageInfo{ - // { - // ID: to.Ptr("0"), - // StorageInKB: to.Ptr[float64](333), - // }, - // { - // ID: to.Ptr("1"), - // StorageInKB: to.Ptr[float64](305), - // }, - // { - // ID: to.Ptr("177"), - // StorageInKB: to.Ptr[float64](368), - // }, - // { - // ID: to.Ptr("178"), - // StorageInKB: to.Ptr[float64](96313), - // }, - // { - // ID: to.Ptr("5"), - // StorageInKB: to.Ptr[float64](194), - // }, - // { - // ID: to.Ptr("6"), - // StorageInKB: to.Ptr[float64](331), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBSqlContainerPartitionMerge.json -func ExampleSQLResourcesClient_BeginListSQLContainerPartitionMerge() { - 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().BeginListSQLContainerPartitionMerge(ctx, "rgName", "ddb1", "databaseName", "containerName", armcosmos.MergeParameters{ - IsDryRun: 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.PhysicalPartitionStorageInfoCollection = armcosmos.PhysicalPartitionStorageInfoCollection{ - // PhysicalPartitionStorageInfoCollection: []*armcosmos.PhysicalPartitionStorageInfo{ - // { - // ID: to.Ptr("0"), - // StorageInKB: to.Ptr[float64](333), - // }, - // { - // ID: to.Ptr("1"), - // StorageInKB: to.Ptr[float64](305), - // }, - // { - // ID: to.Ptr("177"), - // StorageInKB: to.Ptr[float64](368), - // }, - // { - // ID: to.Ptr("178"), - // StorageInKB: to.Ptr[float64](96313), - // }, - // { - // ID: to.Ptr("5"), - // StorageInKB: to.Ptr[float64](194), - // }, - // { - // ID: to.Ptr("6"), - // StorageInKB: to.Ptr[float64](331), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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), - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBSqlDatabaseRetrieveThroughputDistribution.json -func ExampleSQLResourcesClient_BeginSQLDatabaseRetrieveThroughputDistribution() { - 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().BeginSQLDatabaseRetrieveThroughputDistribution(ctx, "rg1", "ddb1", "databaseName", armcosmos.RetrieveThroughputParameters{ - Properties: &armcosmos.RetrieveThroughputProperties{ - Resource: &armcosmos.RetrieveThroughputPropertiesResource{ - PhysicalPartitionIDs: []*armcosmos.PhysicalPartitionID{ - { - ID: to.Ptr("0"), - }, - { - ID: to.Ptr("1"), - }}, - }, - }, - }, 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.PhysicalPartitionThroughputInfoResult = armcosmos.PhysicalPartitionThroughputInfoResult{ - // Properties: &armcosmos.PhysicalPartitionThroughputInfoResultProperties{ - // Resource: &armcosmos.PhysicalPartitionThroughputInfoResultPropertiesResource{ - // PhysicalPartitionThroughputInfo: []*armcosmos.PhysicalPartitionThroughputInfoResource{ - // { - // ID: to.Ptr("0"), - // Throughput: to.Ptr[float64](5000), - // }, - // { - // ID: to.Ptr("1"), - // Throughput: to.Ptr[float64](5000), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBSqlDatabaseRedistributeThroughput.json -func ExampleSQLResourcesClient_BeginSQLDatabaseRedistributeThroughput() { - 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().BeginSQLDatabaseRedistributeThroughput(ctx, "rg1", "ddb1", "databaseName", armcosmos.RedistributeThroughputParameters{ - Properties: &armcosmos.RedistributeThroughputProperties{ - Resource: &armcosmos.RedistributeThroughputPropertiesResource{ - SourcePhysicalPartitionThroughputInfo: []*armcosmos.PhysicalPartitionThroughputInfoResource{ - { - ID: to.Ptr("2"), - Throughput: to.Ptr[float64](5000), - }, - { - ID: to.Ptr("3"), - }}, - TargetPhysicalPartitionThroughputInfo: []*armcosmos.PhysicalPartitionThroughputInfoResource{ - { - ID: to.Ptr("0"), - Throughput: to.Ptr[float64](5000), - }, - { - ID: to.Ptr("1"), - Throughput: to.Ptr[float64](5000), - }}, - ThroughputPolicy: to.Ptr(armcosmos.ThroughputPolicyTypeCustom), - }, - }, - }, 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.PhysicalPartitionThroughputInfoResult = armcosmos.PhysicalPartitionThroughputInfoResult{ - // Properties: &armcosmos.PhysicalPartitionThroughputInfoResultProperties{ - // Resource: &armcosmos.PhysicalPartitionThroughputInfoResultPropertiesResource{ - // PhysicalPartitionThroughputInfo: []*armcosmos.PhysicalPartitionThroughputInfoResource{ - // { - // ID: to.Ptr("0"), - // Throughput: to.Ptr[float64](5000), - // }, - // { - // ID: to.Ptr("1"), - // Throughput: to.Ptr[float64](5000), - // }, - // { - // ID: to.Ptr("2"), - // Throughput: to.Ptr[float64](5000), - // }, - // { - // ID: to.Ptr("3"), - // Throughput: to.Ptr[float64](3000), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBSqlContainerRetrieveThroughputDistribution.json -func ExampleSQLResourcesClient_BeginSQLContainerRetrieveThroughputDistribution() { - 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().BeginSQLContainerRetrieveThroughputDistribution(ctx, "rg1", "ddb1", "databaseName", "containerName", armcosmos.RetrieveThroughputParameters{ - Properties: &armcosmos.RetrieveThroughputProperties{ - Resource: &armcosmos.RetrieveThroughputPropertiesResource{ - PhysicalPartitionIDs: []*armcosmos.PhysicalPartitionID{ - { - ID: to.Ptr("0"), - }, - { - ID: to.Ptr("1"), - }}, - }, - }, - }, 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.PhysicalPartitionThroughputInfoResult = armcosmos.PhysicalPartitionThroughputInfoResult{ - // Properties: &armcosmos.PhysicalPartitionThroughputInfoResultProperties{ - // Resource: &armcosmos.PhysicalPartitionThroughputInfoResultPropertiesResource{ - // PhysicalPartitionThroughputInfo: []*armcosmos.PhysicalPartitionThroughputInfoResource{ - // { - // ID: to.Ptr("0"), - // Throughput: to.Ptr[float64](5000), - // }, - // { - // ID: to.Ptr("1"), - // Throughput: to.Ptr[float64](5000), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/examples/CosmosDBSqlContainerRedistributeThroughput.json -func ExampleSQLResourcesClient_BeginSQLContainerRedistributeThroughput() { - 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().BeginSQLContainerRedistributeThroughput(ctx, "rg1", "ddb1", "databaseName", "containerName", armcosmos.RedistributeThroughputParameters{ - Properties: &armcosmos.RedistributeThroughputProperties{ - Resource: &armcosmos.RedistributeThroughputPropertiesResource{ - SourcePhysicalPartitionThroughputInfo: []*armcosmos.PhysicalPartitionThroughputInfoResource{ - { - ID: to.Ptr("2"), - Throughput: to.Ptr[float64](5000), - }, - { - ID: to.Ptr("3"), - }}, - TargetPhysicalPartitionThroughputInfo: []*armcosmos.PhysicalPartitionThroughputInfoResource{ - { - ID: to.Ptr("0"), - Throughput: to.Ptr[float64](5000), - }, - { - ID: to.Ptr("1"), - Throughput: to.Ptr[float64](5000), - }}, - ThroughputPolicy: to.Ptr(armcosmos.ThroughputPolicyTypeCustom), - }, - }, - }, 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.PhysicalPartitionThroughputInfoResult = armcosmos.PhysicalPartitionThroughputInfoResult{ - // Properties: &armcosmos.PhysicalPartitionThroughputInfoResultProperties{ - // Resource: &armcosmos.PhysicalPartitionThroughputInfoResultPropertiesResource{ - // PhysicalPartitionThroughputInfo: []*armcosmos.PhysicalPartitionThroughputInfoResource{ - // { - // ID: to.Ptr("0"), - // Throughput: to.Ptr[float64](5000), - // }, - // { - // ID: to.Ptr("1"), - // Throughput: to.Ptr[float64](5000), - // }, - // { - // ID: to.Ptr("2"), - // Throughput: to.Ptr[float64](5000), - // }, - // { - // ID: to.Ptr("3"), - // Throughput: to.Ptr[float64](3000), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/tableresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/tableresources_client.go index 8af3e30594c1..8bff555759fc 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/tableresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/tableresources_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos @@ -47,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - tableName - Cosmos DB table name. @@ -60,7 +59,8 @@ func (client *TableResourcesClient) BeginCreateUpdateTable(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[TableResourcesClientCreateUpdateTableResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[TableResourcesClientCreateUpdateTableResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[TableResourcesClientCreateUpdateTableResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,20 +69,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *TableResourcesClient) createUpdateTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, createUpdateTableParameters TableCreateUpdateParameters, options *TableResourcesClientBeginCreateUpdateTableOptions) (*http.Response, error) { + var err error req, err := client.createUpdateTableCreateRequest(ctx, resourceGroupName, accountName, tableName, createUpdateTableParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createUpdateTableCreateRequest creates the CreateUpdateTable request. @@ -109,16 +111,19 @@ func (client *TableResourcesClient) createUpdateTableCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, createUpdateTableParameters) + if err := runtime.MarshalAsJSON(req, createUpdateTableParameters); err != nil { + return nil, err + } + return req, nil } // BeginDeleteTable - Deletes an existing Azure Cosmos DB Table. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - tableName - Cosmos DB table name. @@ -130,7 +135,8 @@ func (client *TableResourcesClient) BeginDeleteTable(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller[TableResourcesClientDeleteTableResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[TableResourcesClientDeleteTableResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[TableResourcesClientDeleteTableResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -139,20 +145,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *TableResourcesClient) deleteTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableResourcesClientBeginDeleteTableOptions) (*http.Response, error) { + var err error req, err := client.deleteTableCreateRequest(ctx, resourceGroupName, accountName, tableName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteTableCreateRequest creates the DeleteTable request. @@ -179,7 +187,7 @@ func (client *TableResourcesClient) deleteTableCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -187,24 +195,27 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - tableName - Cosmos DB table name. // - options - TableResourcesClientGetTableOptions contains the optional parameters for the TableResourcesClient.GetTable method. func (client *TableResourcesClient) GetTable(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableResourcesClientGetTableOptions) (TableResourcesClientGetTableResponse, error) { + var err error req, err := client.getTableCreateRequest(ctx, resourceGroupName, accountName, tableName, options) if err != nil { return TableResourcesClientGetTableResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TableResourcesClientGetTableResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TableResourcesClientGetTableResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TableResourcesClientGetTableResponse{}, err } - return client.getTableHandleResponse(resp) + resp, err := client.getTableHandleResponse(httpResp) + return resp, err } // getTableCreateRequest creates the GetTable request. @@ -231,7 +242,7 @@ func (client *TableResourcesClient) getTableCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -250,25 +261,28 @@ func (client *TableResourcesClient) getTableHandleResponse(resp *http.Response) // name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - tableName - Cosmos DB table name. // - options - TableResourcesClientGetTableThroughputOptions contains the optional parameters for the TableResourcesClient.GetTableThroughput // method. func (client *TableResourcesClient) GetTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableResourcesClientGetTableThroughputOptions) (TableResourcesClientGetTableThroughputResponse, error) { + var err error req, err := client.getTableThroughputCreateRequest(ctx, resourceGroupName, accountName, tableName, options) if err != nil { return TableResourcesClientGetTableThroughputResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TableResourcesClientGetTableThroughputResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TableResourcesClientGetTableThroughputResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TableResourcesClientGetTableThroughputResponse{}, err } - return client.getTableThroughputHandleResponse(resp) + resp, err := client.getTableThroughputHandleResponse(httpResp) + return resp, err } // getTableThroughputCreateRequest creates the GetTableThroughput request. @@ -295,7 +309,7 @@ func (client *TableResourcesClient) getTableThroughputCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -312,7 +326,7 @@ func (client *TableResourcesClient) getTableThroughputHandleResponse(resp *http. // NewListTablesPager - Lists the Tables under an existing Azure Cosmos DB database account. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-09-15-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 @@ -359,7 +373,7 @@ func (client *TableResourcesClient) listTablesCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -377,7 +391,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - tableName - Cosmos DB table name. @@ -389,7 +403,8 @@ func (client *TableResourcesClient) BeginMigrateTableToAutoscale(ctx context.Con if err != nil { return nil, err } - return runtime.NewPoller[TableResourcesClientMigrateTableToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[TableResourcesClientMigrateTableToAutoscaleResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[TableResourcesClientMigrateTableToAutoscaleResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -398,20 +413,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *TableResourcesClient) migrateTableToAutoscale(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableResourcesClientBeginMigrateTableToAutoscaleOptions) (*http.Response, error) { + var err error req, err := client.migrateTableToAutoscaleCreateRequest(ctx, resourceGroupName, accountName, tableName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateTableToAutoscaleCreateRequest creates the MigrateTableToAutoscale request. @@ -438,7 +455,7 @@ func (client *TableResourcesClient) migrateTableToAutoscaleCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -447,7 +464,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - tableName - Cosmos DB table name. @@ -459,7 +476,8 @@ func (client *TableResourcesClient) BeginMigrateTableToManualThroughput(ctx cont if err != nil { return nil, err } - return runtime.NewPoller[TableResourcesClientMigrateTableToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[TableResourcesClientMigrateTableToManualThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[TableResourcesClientMigrateTableToManualThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -468,20 +486,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *TableResourcesClient) migrateTableToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableResourcesClientBeginMigrateTableToManualThroughputOptions) (*http.Response, error) { + var err error req, err := client.migrateTableToManualThroughputCreateRequest(ctx, resourceGroupName, accountName, tableName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateTableToManualThroughputCreateRequest creates the MigrateTableToManualThroughput request. @@ -508,7 +528,7 @@ func (client *TableResourcesClient) migrateTableToManualThroughputCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -517,7 +537,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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - tableName - Cosmos DB table name. @@ -530,9 +550,10 @@ func (client *TableResourcesClient) BeginRetrieveContinuousBackupInformation(ctx if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TableResourcesClientRetrieveContinuousBackupInformationResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[TableResourcesClientRetrieveContinuousBackupInformationResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[TableResourcesClientRetrieveContinuousBackupInformationResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -541,20 +562,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *TableResourcesClient) retrieveContinuousBackupInformation(ctx context.Context, resourceGroupName string, accountName string, tableName string, location ContinuousBackupRestoreLocation, options *TableResourcesClientBeginRetrieveContinuousBackupInformationOptions) (*http.Response, error) { + var err error req, err := client.retrieveContinuousBackupInformationCreateRequest(ctx, resourceGroupName, accountName, tableName, location, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // retrieveContinuousBackupInformationCreateRequest creates the RetrieveContinuousBackupInformation request. @@ -581,16 +604,19 @@ func (client *TableResourcesClient) retrieveContinuousBackupInformationCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, location) + if err := runtime.MarshalAsJSON(req, location); err != nil { + return nil, err + } + return req, nil } // 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - Cosmos DB database account name. // - tableName - Cosmos DB table name. @@ -603,7 +629,8 @@ func (client *TableResourcesClient) BeginUpdateTableThroughput(ctx context.Conte if err != nil { return nil, err } - return runtime.NewPoller[TableResourcesClientUpdateTableThroughputResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[TableResourcesClientUpdateTableThroughputResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[TableResourcesClientUpdateTableThroughputResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -612,20 +639,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-09-15-preview func (client *TableResourcesClient) updateTableThroughput(ctx context.Context, resourceGroupName string, accountName string, tableName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *TableResourcesClientBeginUpdateTableThroughputOptions) (*http.Response, error) { + var err error req, err := client.updateTableThroughputCreateRequest(ctx, resourceGroupName, accountName, tableName, updateThroughputParameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateTableThroughputCreateRequest creates the UpdateTableThroughput request. @@ -652,8 +681,11 @@ func (client *TableResourcesClient) updateTableThroughputCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-09-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, updateThroughputParameters) + if err := runtime.MarshalAsJSON(req, updateThroughputParameters); err != nil { + return nil, err + } + return req, 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 03e6043673a9..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/tableresources_client_example_test.go +++ /dev/null @@ -1,355 +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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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), - // 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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/1b33e81bbdc28fcd6644a1315b8d7b1b6d030590/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2023-03-15-preview/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/time_rfc3339.go b/sdk/resourcemanager/cosmos/armcosmos/time_rfc3339.go index 8aba08e64030..e1d548f6fc19 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/time_rfc3339.go +++ b/sdk/resourcemanager/cosmos/armcosmos/time_rfc3339.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcosmos