diff --git a/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md b/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md index d9e1222e8d83..83fa021f2e6e 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md +++ b/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 3.0.0-beta.2 (2023-09-13) +### Other Changes + + ## 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..cdf40c3fabdc 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/Microsoft.DocumentDB/core/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/core/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..5deb84b5a97a 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 @@ -60,7 +59,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) } @@ -72,18 +72,20 @@ func (client *CassandraClustersClient) BeginCreateUpdate(ctx context.Context, re // // Generated from API version 2023-03-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. @@ -109,7 +111,10 @@ func (client *CassandraClustersClient) createUpdateCreateRequest(ctx context.Con reqQP.Set("api-version", "2023-03-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 @@ -128,7 +133,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) } @@ -141,18 +147,20 @@ func (client *CassandraClustersClient) BeginDeallocate(ctx context.Context, reso // // Generated from API version 2023-03-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. @@ -195,7 +203,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) } @@ -206,18 +215,20 @@ func (client *CassandraClustersClient) BeginDelete(ctx context.Context, resource // // Generated from API version 2023-03-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. @@ -254,18 +265,21 @@ func (client *CassandraClustersClient) deleteCreateRequest(ctx context.Context, // - 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. @@ -313,18 +327,21 @@ func (client *CassandraClustersClient) getHandleResponse(resp *http.Response) (C // - 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. @@ -381,7 +398,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) } @@ -392,18 +410,20 @@ func (client *CassandraClustersClient) BeginInvokeCommand(ctx context.Context, r // // Generated from API version 2023-03-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. @@ -429,7 +449,10 @@ func (client *CassandraClustersClient) invokeCommandCreateRequest(ctx context.Co reqQP.Set("api-version", "2023-03-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. @@ -625,7 +648,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) } @@ -638,18 +662,20 @@ func (client *CassandraClustersClient) BeginStart(ctx context.Context, resourceG // // Generated from API version 2023-03-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. @@ -687,18 +713,21 @@ func (client *CassandraClustersClient) startCreateRequest(ctx context.Context, r // - 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. @@ -751,7 +780,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) } @@ -762,18 +792,20 @@ func (client *CassandraClustersClient) BeginUpdate(ctx context.Context, resource // // Generated from API version 2023-03-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. @@ -799,5 +831,8 @@ func (client *CassandraClustersClient) updateCreateRequest(ctx context.Context, reqQP.Set("api-version", "2023-03-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..2b013c6cb5df 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 @@ -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) } @@ -73,18 +73,20 @@ func (client *CassandraDataCentersClient) BeginCreateUpdate(ctx context.Context, // // Generated from API version 2023-03-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. @@ -114,7 +116,10 @@ func (client *CassandraDataCentersClient) createUpdateCreateRequest(ctx context. reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -143,18 +149,20 @@ func (client *CassandraDataCentersClient) BeginDelete(ctx context.Context, resou // // Generated from API version 2023-03-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. @@ -197,18 +205,21 @@ func (client *CassandraDataCentersClient) deleteCreateRequest(ctx context.Contex // - 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. @@ -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) } @@ -341,18 +353,20 @@ func (client *CassandraDataCentersClient) BeginUpdate(ctx context.Context, resou // // Generated from API version 2023-03-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. @@ -382,5 +396,8 @@ func (client *CassandraDataCentersClient) updateCreateRequest(ctx context.Contex reqQP.Set("api-version", "2023-03-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..dfdf814e02c1 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 @@ -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) } @@ -71,18 +71,20 @@ func (client *CassandraResourcesClient) BeginCreateUpdateCassandraKeyspace(ctx c // // Generated from API version 2023-03-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. @@ -112,7 +114,10 @@ func (client *CassandraResourcesClient) createUpdateCassandraKeyspaceCreateReque reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -143,18 +149,20 @@ func (client *CassandraResourcesClient) BeginCreateUpdateCassandraTable(ctx cont // // Generated from API version 2023-03-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. @@ -188,7 +196,10 @@ func (client *CassandraResourcesClient) createUpdateCassandraTableCreateRequest( reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -219,18 +231,20 @@ func (client *CassandraResourcesClient) BeginCreateUpdateCassandraView(ctx conte // // Generated from API version 2023-03-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. @@ -264,7 +278,10 @@ func (client *CassandraResourcesClient) createUpdateCassandraViewCreateRequest(c reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -293,18 +311,20 @@ func (client *CassandraResourcesClient) BeginDeleteCassandraKeyspace(ctx context // // Generated from API version 2023-03-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. @@ -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) } @@ -363,18 +384,20 @@ func (client *CassandraResourcesClient) BeginDeleteCassandraTable(ctx context.Co // // Generated from API version 2023-03-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. @@ -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) } @@ -437,18 +461,20 @@ func (client *CassandraResourcesClient) BeginDeleteCassandraView(ctx context.Con // // Generated from API version 2023-03-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. @@ -495,18 +521,21 @@ func (client *CassandraResourcesClient) deleteCassandraViewCreateRequest(ctx con // - 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. @@ -559,18 +588,21 @@ func (client *CassandraResourcesClient) getCassandraKeyspaceHandleResponse(resp // - 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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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) } @@ -1114,18 +1159,20 @@ func (client *CassandraResourcesClient) BeginMigrateCassandraKeyspaceToAutoscale // // Generated from API version 2023-03-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. @@ -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) } @@ -1185,18 +1233,20 @@ func (client *CassandraResourcesClient) BeginMigrateCassandraKeyspaceToManualThr // // Generated from API version 2023-03-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. @@ -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) } @@ -1256,18 +1307,20 @@ func (client *CassandraResourcesClient) BeginMigrateCassandraTableToAutoscale(ct // // Generated from API version 2023-03-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. @@ -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) } @@ -1331,18 +1385,20 @@ func (client *CassandraResourcesClient) BeginMigrateCassandraTableToManualThroug // // Generated from API version 2023-03-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. @@ -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) } @@ -1406,18 +1463,20 @@ func (client *CassandraResourcesClient) BeginMigrateCassandraViewToAutoscale(ctx // // Generated from API version 2023-03-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. @@ -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) } @@ -1481,18 +1541,20 @@ func (client *CassandraResourcesClient) BeginMigrateCassandraViewToManualThrough // // Generated from API version 2023-03-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. @@ -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) } @@ -1556,18 +1619,20 @@ func (client *CassandraResourcesClient) BeginUpdateCassandraKeyspaceThroughput(c // // Generated from API version 2023-03-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. @@ -1597,7 +1662,10 @@ func (client *CassandraResourcesClient) updateCassandraKeyspaceThroughputCreateR reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -1628,18 +1697,20 @@ func (client *CassandraResourcesClient) BeginUpdateCassandraTableThroughput(ctx // // Generated from API version 2023-03-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. @@ -1673,7 +1744,10 @@ func (client *CassandraResourcesClient) updateCassandraTableThroughputCreateRequ reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -1704,18 +1779,20 @@ func (client *CassandraResourcesClient) BeginUpdateCassandraViewThroughput(ctx c // // Generated from API version 2023-03-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. @@ -1749,5 +1826,8 @@ func (client *CassandraResourcesClient) updateCassandraViewThroughputCreateReque reqQP.Set("api-version", "2023-03-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..cf06d3fcf10e 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 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..73bd1a3a2383 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 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..6402ad4ee9b6 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 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..f8045132476d 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 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..9b73af61ab46 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. @@ -333,21 +332,21 @@ 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, } } @@ -355,17 +354,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 +549,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, } } @@ -738,19 +737,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..202cb668bf16 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 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..87453fbe0a3c 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 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..88c43366c787 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 @@ -52,18 +51,20 @@ func NewDatabaseAccountsClient(subscriptionID string, credential azcore.TokenCre // - 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. @@ -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) } @@ -111,18 +113,20 @@ func (client *DatabaseAccountsClient) BeginCreateOrUpdate(ctx context.Context, r // // Generated from API version 2023-03-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. @@ -148,7 +152,10 @@ func (client *DatabaseAccountsClient) createOrUpdateCreateRequest(ctx context.Co reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -176,18 +184,20 @@ func (client *DatabaseAccountsClient) BeginDelete(ctx context.Context, resourceG // // Generated from API version 2023-03-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. @@ -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) } @@ -245,18 +256,20 @@ func (client *DatabaseAccountsClient) BeginFailoverPriorityChange(ctx context.Co // // Generated from API version 2023-03-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. @@ -281,7 +294,10 @@ func (client *DatabaseAccountsClient) failoverPriorityChangeCreateRequest(ctx co reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2023-03-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. @@ -292,18 +308,21 @@ func (client *DatabaseAccountsClient) failoverPriorityChangeCreateRequest(ctx co // - 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. @@ -350,18 +369,21 @@ func (client *DatabaseAccountsClient) getHandleResponse(resp *http.Response) (Da // - 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. @@ -521,18 +543,21 @@ func (client *DatabaseAccountsClient) listByResourceGroupHandleResponse(resp *ht // - 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. @@ -579,18 +604,21 @@ func (client *DatabaseAccountsClient) listConnectionStringsHandleResponse(resp * // - 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. @@ -769,18 +797,21 @@ func (client *DatabaseAccountsClient) listMetricsHandleResponse(resp *http.Respo // - 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. @@ -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) } @@ -911,18 +943,20 @@ func (client *DatabaseAccountsClient) BeginOfflineRegion(ctx context.Context, re // // Generated from API version 2023-03-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. @@ -948,7 +982,10 @@ func (client *DatabaseAccountsClient) offlineRegionCreateRequest(ctx context.Con reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -977,18 +1015,20 @@ func (client *DatabaseAccountsClient) BeginOnlineRegion(ctx context.Context, res // // Generated from API version 2023-03-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. @@ -1014,7 +1054,10 @@ func (client *DatabaseAccountsClient) onlineRegionCreateRequest(ctx context.Cont reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -1043,18 +1087,20 @@ func (client *DatabaseAccountsClient) BeginRegenerateKey(ctx context.Context, re // // Generated from API version 2023-03-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. @@ -1079,7 +1125,10 @@ func (client *DatabaseAccountsClient) regenerateKeyCreateRequest(ctx context.Con reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -1108,18 +1158,20 @@ func (client *DatabaseAccountsClient) BeginUpdate(ctx context.Context, resourceG // // Generated from API version 2023-03-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. @@ -1145,5 +1197,8 @@ func (client *DatabaseAccountsClient) updateCreateRequest(ctx context.Context, r reqQP.Set("api-version", "2023-03-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..447b18b3269f 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 @@ -53,18 +52,21 @@ func NewDataTransferJobsClient(subscriptionID string, credential azcore.TokenCre // - 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. @@ -115,18 +117,21 @@ func (client *DataTransferJobsClient) cancelHandleResponse(resp *http.Response) // - 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. @@ -156,7 +161,10 @@ func (client *DataTransferJobsClient) createCreateRequest(ctx context.Context, r reqQP.Set("api-version", "2023-03-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. @@ -177,18 +185,21 @@ func (client *DataTransferJobsClient) createHandleResponse(resp *http.Response) // - 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. @@ -309,18 +320,21 @@ func (client *DataTransferJobsClient) listByDatabaseAccountHandleResponse(resp * // - 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. @@ -371,18 +385,21 @@ func (client *DataTransferJobsClient) pauseHandleResponse(resp *http.Response) ( // - 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. 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..7a968ac65220 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 @@ -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) } @@ -71,18 +71,20 @@ func (client *GraphResourcesClient) BeginCreateUpdateGraph(ctx context.Context, // // Generated from API version 2023-03-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. @@ -112,7 +114,10 @@ func (client *GraphResourcesClient) createUpdateGraphCreateRequest(ctx context.C reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -141,18 +147,20 @@ func (client *GraphResourcesClient) BeginDeleteGraphResource(ctx context.Context // // Generated from API version 2023-03-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. @@ -193,18 +201,21 @@ func (client *GraphResourcesClient) deleteGraphResourceCreateRequest(ctx context // - 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. 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..3d9ccf67af13 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 @@ -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) } @@ -71,18 +71,20 @@ func (client *GremlinResourcesClient) BeginCreateUpdateGremlinDatabase(ctx conte // // Generated from API version 2023-03-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. @@ -112,7 +114,10 @@ func (client *GremlinResourcesClient) createUpdateGremlinDatabaseCreateRequest(c reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -143,18 +149,20 @@ func (client *GremlinResourcesClient) BeginCreateUpdateGremlinGraph(ctx context. // // Generated from API version 2023-03-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. @@ -188,7 +196,10 @@ func (client *GremlinResourcesClient) createUpdateGremlinGraphCreateRequest(ctx reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -217,18 +229,20 @@ func (client *GremlinResourcesClient) BeginDeleteGremlinDatabase(ctx context.Con // // Generated from API version 2023-03-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. @@ -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) } @@ -287,18 +302,20 @@ func (client *GremlinResourcesClient) BeginDeleteGremlinGraph(ctx context.Contex // // Generated from API version 2023-03-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. @@ -344,18 +361,21 @@ func (client *GremlinResourcesClient) deleteGremlinGraphCreateRequest(ctx contex // - 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. @@ -408,18 +428,21 @@ func (client *GremlinResourcesClient) getGremlinDatabaseHandleResponse(resp *htt // - 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. @@ -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. @@ -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. @@ -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) } @@ -757,18 +787,20 @@ func (client *GremlinResourcesClient) BeginMigrateGremlinDatabaseToAutoscale(ctx // // Generated from API version 2023-03-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. @@ -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) } @@ -827,18 +860,20 @@ func (client *GremlinResourcesClient) BeginMigrateGremlinDatabaseToManualThrough // // Generated from API version 2023-03-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. @@ -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) } @@ -898,18 +934,20 @@ func (client *GremlinResourcesClient) BeginMigrateGremlinGraphToAutoscale(ctx co // // Generated from API version 2023-03-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. @@ -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) } @@ -973,18 +1012,20 @@ func (client *GremlinResourcesClient) BeginMigrateGremlinGraphToManualThroughput // // Generated from API version 2023-03-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. @@ -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) } @@ -1051,18 +1093,20 @@ func (client *GremlinResourcesClient) BeginRetrieveContinuousBackupInformation(c // // Generated from API version 2023-03-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. @@ -1096,7 +1140,10 @@ func (client *GremlinResourcesClient) retrieveContinuousBackupInformationCreateR reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -1126,18 +1174,20 @@ func (client *GremlinResourcesClient) BeginUpdateGremlinDatabaseThroughput(ctx c // // Generated from API version 2023-03-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. @@ -1167,7 +1217,10 @@ func (client *GremlinResourcesClient) updateGremlinDatabaseThroughputCreateReque reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -1198,18 +1252,20 @@ func (client *GremlinResourcesClient) BeginUpdateGremlinGraphThroughput(ctx cont // // Generated from API version 2023-03-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. @@ -1243,5 +1299,8 @@ func (client *GremlinResourcesClient) updateGremlinGraphThroughputCreateRequest( reqQP.Set("api-version", "2023-03-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..d4da066bde92 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 @@ -51,18 +50,21 @@ func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential // - 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. 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..5e8d19054697 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. @@ -228,112 +218,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 @@ -479,165 +363,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. @@ -1126,50 +851,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 @@ -1368,8 +1049,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, } } @@ -1496,16 +1177,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 +1242,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 +1287,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, } } @@ -2029,12 +1669,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. @@ -2153,142 +1787,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 +1979,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 +2079,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 +2368,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 +2529,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 +2654,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,79 +2843,6 @@ 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 -} - -// 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 -} - // MongoDBCollectionCreateUpdateParameters - Parameters to create and update Cosmos DB MongoDB collection. type MongoDBCollectionCreateUpdateParameters struct { // REQUIRED; Properties to create and update Azure Cosmos DB MongoDB collection. @@ -3814,213 +3097,6 @@ 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 type MongoDataTransferDataSourceSink struct { // REQUIRED @@ -4242,51 +3318,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 +3352,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 +3362,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 +3425,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 +3494,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 +3509,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 +3649,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 +3688,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 +3887,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 +3933,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 +3979,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 +4063,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 +4109,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 +4116,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 +4231,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 +4309,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 +4378,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 +4396,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. @@ -6001,316 +4848,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 +5267,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 +5306,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 +5479,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. diff --git a/sdk/resourcemanager/cosmos/armcosmos/models_serde.go b/sdk/resourcemanager/cosmos/armcosmos/models_serde.go index 3e922ee5468b..7786af6cd663 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 diff --git a/sdk/resourcemanager/cosmos/armcosmos/mongoclusters_client.go b/sdk/resourcemanager/cosmos/armcosmos/mongoclusters_client.go index 3c3323bebc9c..7fdc53e9fe76 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 @@ -53,18 +52,21 @@ func NewMongoClustersClient(subscriptionID string, credential azcore.TokenCreden // - 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. @@ -86,7 +88,10 @@ func (client *MongoClustersClient) checkNameAvailabilityCreateRequest(ctx contex reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -128,18 +134,20 @@ func (client *MongoClustersClient) BeginCreateOrUpdate(ctx context.Context, reso // // Generated from API version 2023-03-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. @@ -165,7 +173,10 @@ func (client *MongoClustersClient) createOrUpdateCreateRequest(ctx context.Conte reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -197,18 +209,20 @@ func (client *MongoClustersClient) BeginCreateOrUpdateFirewallRule(ctx context.C // // Generated from API version 2023-03-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. @@ -238,7 +252,10 @@ func (client *MongoClustersClient) createOrUpdateFirewallRuleCreateRequest(ctx c reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -268,18 +286,20 @@ func (client *MongoClustersClient) BeginDelete(ctx context.Context, resourceGrou // // Generated from API version 2023-03-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. @@ -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) } @@ -336,18 +357,20 @@ func (client *MongoClustersClient) BeginDeleteFirewallRule(ctx context.Context, // // Generated from API version 2023-03-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. @@ -388,18 +411,21 @@ func (client *MongoClustersClient) deleteFirewallRuleCreateRequest(ctx context.C // - 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. @@ -447,18 +473,21 @@ func (client *MongoClustersClient) getHandleResponse(resp *http.Response) (Mongo // - 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. @@ -634,18 +663,21 @@ func (client *MongoClustersClient) listByResourceGroupHandleResponse(resp *http. // - 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. @@ -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) } @@ -783,18 +816,20 @@ func (client *MongoClustersClient) BeginUpdate(ctx context.Context, resourceGrou // // Generated from API version 2023-03-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. @@ -820,5 +855,8 @@ func (client *MongoClustersClient) updateCreateRequest(ctx context.Context, reso reqQP.Set("api-version", "2023-03-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..97974e681b05 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 @@ -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) } @@ -72,18 +72,20 @@ func (client *MongoDBResourcesClient) BeginCreateUpdateMongoDBCollection(ctx con // // Generated from API version 2023-03-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. @@ -117,7 +119,10 @@ func (client *MongoDBResourcesClient) createUpdateMongoDBCollectionCreateRequest reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -147,18 +153,20 @@ func (client *MongoDBResourcesClient) BeginCreateUpdateMongoDBDatabase(ctx conte // // Generated from API version 2023-03-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. @@ -188,7 +196,10 @@ func (client *MongoDBResourcesClient) createUpdateMongoDBDatabaseCreateRequest(c reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -218,18 +230,20 @@ func (client *MongoDBResourcesClient) BeginCreateUpdateMongoRoleDefinition(ctx c // // Generated from API version 2023-03-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. @@ -259,7 +273,10 @@ func (client *MongoDBResourcesClient) createUpdateMongoRoleDefinitionCreateReque reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -289,18 +307,20 @@ func (client *MongoDBResourcesClient) BeginCreateUpdateMongoUserDefinition(ctx c // // Generated from API version 2023-03-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. @@ -330,7 +350,10 @@ func (client *MongoDBResourcesClient) createUpdateMongoUserDefinitionCreateReque reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -360,18 +384,20 @@ func (client *MongoDBResourcesClient) BeginDeleteMongoDBCollection(ctx context.C // // Generated from API version 2023-03-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. @@ -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) } @@ -433,18 +460,20 @@ func (client *MongoDBResourcesClient) BeginDeleteMongoDBDatabase(ctx context.Con // // Generated from API version 2023-03-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. @@ -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) } @@ -502,18 +532,20 @@ func (client *MongoDBResourcesClient) BeginDeleteMongoRoleDefinition(ctx context // // Generated from API version 2023-03-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. @@ -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) } @@ -572,18 +605,20 @@ func (client *MongoDBResourcesClient) BeginDeleteMongoUserDefinition(ctx context // // Generated from API version 2023-03-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. @@ -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. @@ -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. @@ -763,18 +804,21 @@ func (client *MongoDBResourcesClient) getMongoDBCollectionThroughputHandleRespon // - 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. @@ -827,18 +871,21 @@ func (client *MongoDBResourcesClient) getMongoDBDatabaseHandleResponse(resp *htt // - 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. @@ -890,18 +937,21 @@ func (client *MongoDBResourcesClient) getMongoDBDatabaseThroughputHandleResponse // - 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. @@ -953,18 +1003,21 @@ func (client *MongoDBResourcesClient) getMongoRoleDefinitionHandleResponse(resp // - 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. @@ -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) } @@ -1036,18 +1090,20 @@ func (client *MongoDBResourcesClient) BeginListMongoDBCollectionPartitionMerge(c // // Generated from API version 2023-03-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. @@ -1081,7 +1137,10 @@ func (client *MongoDBResourcesClient) listMongoDBCollectionPartitionMergeCreateR reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -1372,18 +1432,20 @@ func (client *MongoDBResourcesClient) BeginMigrateMongoDBCollectionToAutoscale(c // // Generated from API version 2023-03-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. @@ -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) } @@ -1448,18 +1511,20 @@ func (client *MongoDBResourcesClient) BeginMigrateMongoDBCollectionToManualThrou // // Generated from API version 2023-03-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. @@ -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) } @@ -1522,18 +1588,20 @@ func (client *MongoDBResourcesClient) BeginMigrateMongoDBDatabaseToAutoscale(ctx // // Generated from API version 2023-03-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. @@ -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) } @@ -1592,18 +1661,20 @@ func (client *MongoDBResourcesClient) BeginMigrateMongoDBDatabaseToManualThrough // // Generated from API version 2023-03-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. @@ -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) } @@ -1666,18 +1738,20 @@ func (client *MongoDBResourcesClient) BeginMongoDBContainerRedistributeThroughpu // // Generated from API version 2023-03-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. @@ -1711,7 +1785,10 @@ func (client *MongoDBResourcesClient) mongoDBContainerRedistributeThroughputCrea reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -1745,18 +1823,20 @@ func (client *MongoDBResourcesClient) BeginMongoDBContainerRetrieveThroughputDis // // Generated from API version 2023-03-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. @@ -1790,7 +1870,10 @@ func (client *MongoDBResourcesClient) mongoDBContainerRetrieveThroughputDistribu reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -1822,18 +1906,20 @@ func (client *MongoDBResourcesClient) BeginMongoDBDatabasePartitionMerge(ctx con // // Generated from API version 2023-03-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. @@ -1863,7 +1949,10 @@ func (client *MongoDBResourcesClient) mongoDBDatabasePartitionMergeCreateRequest reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -1895,18 +1985,20 @@ func (client *MongoDBResourcesClient) BeginMongoDBDatabaseRedistributeThroughput // // Generated from API version 2023-03-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. @@ -1936,7 +2028,10 @@ func (client *MongoDBResourcesClient) mongoDBDatabaseRedistributeThroughputCreat reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -1969,18 +2065,20 @@ func (client *MongoDBResourcesClient) BeginMongoDBDatabaseRetrieveThroughputDist // // Generated from API version 2023-03-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. @@ -2010,7 +2108,10 @@ func (client *MongoDBResourcesClient) mongoDBDatabaseRetrieveThroughputDistribut reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -2043,18 +2145,20 @@ func (client *MongoDBResourcesClient) BeginRetrieveContinuousBackupInformation(c // // Generated from API version 2023-03-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. @@ -2088,7 +2192,10 @@ func (client *MongoDBResourcesClient) retrieveContinuousBackupInformationCreateR reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -2119,18 +2227,20 @@ func (client *MongoDBResourcesClient) BeginUpdateMongoDBCollectionThroughput(ctx // // Generated from API version 2023-03-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. @@ -2164,7 +2274,10 @@ func (client *MongoDBResourcesClient) updateMongoDBCollectionThroughputCreateReq reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -2194,18 +2308,20 @@ func (client *MongoDBResourcesClient) BeginUpdateMongoDBDatabaseThroughput(ctx c // // Generated from API version 2023-03-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. @@ -2235,5 +2351,8 @@ func (client *MongoDBResourcesClient) updateMongoDBDatabaseThroughputCreateReque reqQP.Set("api-version", "2023-03-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..89ec46146661 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 @@ -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) } @@ -71,18 +71,20 @@ func (client *NotebookWorkspacesClient) BeginCreateOrUpdate(ctx context.Context, // // Generated from API version 2023-03-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. @@ -112,7 +114,10 @@ func (client *NotebookWorkspacesClient) createOrUpdateCreateRequest(ctx context. reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -141,18 +147,20 @@ func (client *NotebookWorkspacesClient) BeginDelete(ctx context.Context, resourc // // Generated from API version 2023-03-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. @@ -194,18 +202,21 @@ func (client *NotebookWorkspacesClient) deleteCreateRequest(ctx context.Context, // - 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. @@ -321,18 +332,21 @@ func (client *NotebookWorkspacesClient) listByDatabaseAccountHandleResponse(resp // - 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. @@ -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) } @@ -400,18 +415,20 @@ func (client *NotebookWorkspacesClient) BeginRegenerateAuthToken(ctx context.Con // // Generated from API version 2023-03-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. @@ -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) } @@ -470,18 +488,20 @@ func (client *NotebookWorkspacesClient) BeginStart(ctx context.Context, resource // // Generated from API version 2023-03-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. 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..03f1fef7fe43 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 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..206b0031593e --- /dev/null +++ b/sdk/resourcemanager/cosmos/armcosmos/options.go @@ -0,0 +1,1535 @@ +//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 +} + +// 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..90036b019503 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 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..acb655146155 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 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..e74adf1a0db0 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 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..6bd92e2a0839 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 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..3a3771d146ba 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 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..55490e7610ec 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 @@ -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) } @@ -70,18 +70,20 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // // Generated from API version 2023-03-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. @@ -111,7 +113,10 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -140,18 +146,20 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // // Generated from API version 2023-03-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. @@ -194,18 +202,21 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // - 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. 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..89163853de00 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 @@ -54,18 +53,21 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // - 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. 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..2ad692e92b14 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 @@ -54,18 +53,21 @@ func NewRestorableDatabaseAccountsClient(subscriptionID string, credential azcor // - 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. 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..8e3ad5639538 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 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..97942efc5235 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 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..6cc6ab575e61 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 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..c0b649cca65e 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 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..027ac07c734d 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 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..61fa5bc06470 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 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..aab75ec8f335 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 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..fe5576c67d9b 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 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..7d481646c3a5 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 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..3230f0ced809 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 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..748c4961c757 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 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..fac17b5f64fd 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 @@ -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) } @@ -70,18 +70,20 @@ func (client *ServiceClient) BeginCreate(ctx context.Context, resourceGroupName // // Generated from API version 2023-03-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. @@ -111,7 +113,10 @@ func (client *ServiceClient) createCreateRequest(ctx context.Context, resourceGr reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -139,18 +145,20 @@ func (client *ServiceClient) BeginDelete(ctx context.Context, resourceGroupName // // Generated from API version 2023-03-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. @@ -192,18 +200,21 @@ func (client *ServiceClient) deleteCreateRequest(ctx context.Context, resourceGr // - 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. 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..d0e789f5355f 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 @@ -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) } @@ -74,18 +74,20 @@ func (client *SQLResourcesClient) BeginCreateUpdateClientEncryptionKey(ctx conte // // Generated from API version 2023-03-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. @@ -119,7 +121,10 @@ func (client *SQLResourcesClient) createUpdateClientEncryptionKeyCreateRequest(c reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -150,18 +156,20 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLContainer(ctx context.Cont // // Generated from API version 2023-03-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. @@ -195,7 +203,10 @@ func (client *SQLResourcesClient) createUpdateSQLContainerCreateRequest(ctx cont reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -225,18 +237,20 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLDatabase(ctx context.Conte // // Generated from API version 2023-03-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. @@ -266,7 +280,10 @@ func (client *SQLResourcesClient) createUpdateSQLDatabaseCreateRequest(ctx conte reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -296,18 +314,20 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLRoleAssignment(ctx context // // Generated from API version 2023-03-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. @@ -337,7 +357,10 @@ func (client *SQLResourcesClient) createUpdateSQLRoleAssignmentCreateRequest(ctx reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -367,18 +391,20 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLRoleDefinition(ctx context // // Generated from API version 2023-03-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. @@ -408,7 +434,10 @@ func (client *SQLResourcesClient) createUpdateSQLRoleDefinitionCreateRequest(ctx reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -440,18 +470,20 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLStoredProcedure(ctx contex // // Generated from API version 2023-03-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. @@ -489,7 +521,10 @@ func (client *SQLResourcesClient) createUpdateSQLStoredProcedureCreateRequest(ct reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -521,18 +557,20 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLTrigger(ctx context.Contex // // Generated from API version 2023-03-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. @@ -570,7 +608,10 @@ func (client *SQLResourcesClient) createUpdateSQLTriggerCreateRequest(ctx contex reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -602,18 +644,20 @@ func (client *SQLResourcesClient) BeginCreateUpdateSQLUserDefinedFunction(ctx co // // Generated from API version 2023-03-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. @@ -651,7 +695,10 @@ func (client *SQLResourcesClient) createUpdateSQLUserDefinedFunctionCreateReques reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -681,18 +729,20 @@ func (client *SQLResourcesClient) BeginDeleteSQLContainer(ctx context.Context, r // // Generated from API version 2023-03-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. @@ -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) } @@ -754,18 +805,20 @@ func (client *SQLResourcesClient) BeginDeleteSQLDatabase(ctx context.Context, re // // Generated from API version 2023-03-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. @@ -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) } @@ -823,18 +877,20 @@ func (client *SQLResourcesClient) BeginDeleteSQLRoleAssignment(ctx context.Conte // // Generated from API version 2023-03-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. @@ -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) } @@ -893,18 +950,20 @@ func (client *SQLResourcesClient) BeginDeleteSQLRoleDefinition(ctx context.Conte // // Generated from API version 2023-03-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. @@ -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) } @@ -965,18 +1025,20 @@ func (client *SQLResourcesClient) BeginDeleteSQLStoredProcedure(ctx context.Cont // // Generated from API version 2023-03-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. @@ -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) } @@ -1044,18 +1107,20 @@ func (client *SQLResourcesClient) BeginDeleteSQLTrigger(ctx context.Context, res // // Generated from API version 2023-03-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. @@ -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) } @@ -1123,18 +1189,20 @@ func (client *SQLResourcesClient) BeginDeleteSQLUserDefinedFunction(ctx context. // // Generated from API version 2023-03-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. @@ -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. @@ -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. @@ -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. @@ -1388,18 +1465,21 @@ func (client *SQLResourcesClient) getSQLContainerThroughputHandleResponse(resp * // - 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. @@ -1452,18 +1532,21 @@ func (client *SQLResourcesClient) getSQLDatabaseHandleResponse(resp *http.Respon // - 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. @@ -1515,18 +1598,21 @@ func (client *SQLResourcesClient) getSQLDatabaseThroughputHandleResponse(resp *h // - 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. @@ -1578,18 +1664,21 @@ func (client *SQLResourcesClient) getSQLRoleAssignmentHandleResponse(resp *http. // - 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. @@ -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. @@ -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. @@ -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. @@ -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) } @@ -1949,18 +2048,20 @@ func (client *SQLResourcesClient) BeginListSQLContainerPartitionMerge(ctx contex // // Generated from API version 2023-03-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. @@ -1994,7 +2095,10 @@ func (client *SQLResourcesClient) listSQLContainerPartitionMergeCreateRequest(ct reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -2507,18 +2612,20 @@ func (client *SQLResourcesClient) BeginMigrateSQLContainerToAutoscale(ctx contex // // Generated from API version 2023-03-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. @@ -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) } @@ -2582,18 +2690,20 @@ func (client *SQLResourcesClient) BeginMigrateSQLContainerToManualThroughput(ctx // // Generated from API version 2023-03-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. @@ -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) } @@ -2656,18 +2767,20 @@ func (client *SQLResourcesClient) BeginMigrateSQLDatabaseToAutoscale(ctx context // // Generated from API version 2023-03-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. @@ -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) } @@ -2726,18 +2840,20 @@ func (client *SQLResourcesClient) BeginMigrateSQLDatabaseToManualThroughput(ctx // // Generated from API version 2023-03-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. @@ -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) } @@ -2800,18 +2917,20 @@ func (client *SQLResourcesClient) BeginRetrieveContinuousBackupInformation(ctx c // // Generated from API version 2023-03-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. @@ -2845,7 +2964,10 @@ func (client *SQLResourcesClient) retrieveContinuousBackupInformationCreateReque reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -2878,18 +3001,20 @@ func (client *SQLResourcesClient) BeginSQLContainerRedistributeThroughput(ctx co // // Generated from API version 2023-03-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. @@ -2923,7 +3048,10 @@ func (client *SQLResourcesClient) sqlContainerRedistributeThroughputCreateReques reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -2956,18 +3085,20 @@ func (client *SQLResourcesClient) BeginSQLContainerRetrieveThroughputDistributio // // Generated from API version 2023-03-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. @@ -3001,7 +3132,10 @@ func (client *SQLResourcesClient) sqlContainerRetrieveThroughputDistributionCrea reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -3033,18 +3168,20 @@ func (client *SQLResourcesClient) BeginSQLDatabasePartitionMerge(ctx context.Con // // Generated from API version 2023-03-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. @@ -3074,7 +3211,10 @@ func (client *SQLResourcesClient) sqlDatabasePartitionMergeCreateRequest(ctx con reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -3106,18 +3247,20 @@ func (client *SQLResourcesClient) BeginSQLDatabaseRedistributeThroughput(ctx con // // Generated from API version 2023-03-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. @@ -3147,7 +3290,10 @@ func (client *SQLResourcesClient) sqlDatabaseRedistributeThroughputCreateRequest reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -3179,18 +3326,20 @@ func (client *SQLResourcesClient) BeginSQLDatabaseRetrieveThroughputDistribution // // Generated from API version 2023-03-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. @@ -3220,7 +3369,10 @@ func (client *SQLResourcesClient) sqlDatabaseRetrieveThroughputDistributionCreat reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -3251,18 +3404,20 @@ func (client *SQLResourcesClient) BeginUpdateSQLContainerThroughput(ctx context. // // Generated from API version 2023-03-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. @@ -3296,7 +3451,10 @@ func (client *SQLResourcesClient) updateSQLContainerThroughputCreateRequest(ctx reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -3326,18 +3485,20 @@ func (client *SQLResourcesClient) BeginUpdateSQLDatabaseThroughput(ctx context.C // // Generated from API version 2023-03-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. @@ -3367,5 +3528,8 @@ func (client *SQLResourcesClient) updateSQLDatabaseThroughputCreateRequest(ctx c reqQP.Set("api-version", "2023-03-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..f60706ec178b 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 @@ -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) } @@ -71,18 +71,20 @@ func (client *TableResourcesClient) BeginCreateUpdateTable(ctx context.Context, // // Generated from API version 2023-03-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. @@ -112,7 +114,10 @@ func (client *TableResourcesClient) createUpdateTableCreateRequest(ctx context.C reqQP.Set("api-version", "2023-03-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. @@ -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) } @@ -141,18 +147,20 @@ func (client *TableResourcesClient) BeginDeleteTable(ctx context.Context, resour // // Generated from API version 2023-03-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. @@ -193,18 +201,21 @@ func (client *TableResourcesClient) deleteTableCreateRequest(ctx context.Context // - 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. @@ -257,18 +268,21 @@ func (client *TableResourcesClient) getTableHandleResponse(resp *http.Response) // - 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. @@ -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) } @@ -400,18 +415,20 @@ func (client *TableResourcesClient) BeginMigrateTableToAutoscale(ctx context.Con // // Generated from API version 2023-03-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. @@ -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) } @@ -470,18 +488,20 @@ func (client *TableResourcesClient) BeginMigrateTableToManualThroughput(ctx cont // // Generated from API version 2023-03-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. @@ -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) } @@ -543,18 +564,20 @@ func (client *TableResourcesClient) BeginRetrieveContinuousBackupInformation(ctx // // Generated from API version 2023-03-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. @@ -584,7 +607,10 @@ func (client *TableResourcesClient) retrieveContinuousBackupInformationCreateReq reqQP.Set("api-version", "2023-03-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 @@ -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) } @@ -614,18 +641,20 @@ func (client *TableResourcesClient) BeginUpdateTableThroughput(ctx context.Conte // // Generated from API version 2023-03-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. @@ -655,5 +684,8 @@ func (client *TableResourcesClient) updateTableThroughputCreateRequest(ctx conte reqQP.Set("api-version", "2023-03-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